summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--contrib/gnome-ssh-askpass.c27
2 files changed, 28 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 90026d9e3..dbdd62479 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
120011221
2 - (djm) Add option to gnome-ssh-askpass to stop it from grabbing the X
3 server. I have found this necessary to avoid server hangs with X input
4 extensions (e.g. kinput2). Enable by setting the environment variable
5 "GNOME_SSH_ASKPASS_NOGRAB"
6
120011219 720011219
2 - (stevesk) OpenBSD CVS sync X11 localhost display 8 - (stevesk) OpenBSD CVS sync X11 localhost display
3 - stevesk@cvs.openbsd.org 2001/11/29 14:10:51 9 - stevesk@cvs.openbsd.org 2001/11/29 14:10:51
@@ -7025,4 +7031,4 @@
7025 - Wrote replacements for strlcpy and mkdtemp 7031 - Wrote replacements for strlcpy and mkdtemp
7026 - Released 1.0pre1 7032 - Released 1.0pre1
7027 7033
7028$Id: ChangeLog,v 1.1692 2001/12/19 17:58:01 stevesk Exp $ 7034$Id: ChangeLog,v 1.1693 2001/12/20 23:28:07 djm Exp $
diff --git a/contrib/gnome-ssh-askpass.c b/contrib/gnome-ssh-askpass.c
index 27e5ccaa1..31aec46b7 100644
--- a/contrib/gnome-ssh-askpass.c
+++ b/contrib/gnome-ssh-askpass.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2000 Damien Miller. All rights reserved. 2 * Copyright (c) 2000-2001 Damien Miller. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
@@ -23,6 +23,17 @@
23 */ 23 */
24 24
25/* 25/*
26 * This is a simple GNOME SSH passphrase grabber. To use it, set the
27 * environment variable SSH_ASKPASS to point to the location of
28 * gnome-ssh-askpass before calling "ssh-add < /dev/null".
29 *
30 * There is only one run-time option: if you set the environment variable
31 * "GNOME_SSH_ASKPASS_NOGRAB=true" then gnome-ssh-askpass will not grab
32 * the X server. I have found this necessary to avoid server hangs with
33 * X input extensions (e.g. kinput2) enabled. - djm
34 */
35
36/*
26 * Compile with: 37 * Compile with:
27 * 38 *
28 * cc `gnome-config --cflags gnome gnomeui` \ 39 * cc `gnome-config --cflags gnome gnomeui` \
@@ -57,10 +68,11 @@ passphrase_dialog(char *message)
57{ 68{
58 char *passphrase; 69 char *passphrase;
59 char **messages; 70 char **messages;
60 int result, i; 71 int result, i, grab_server;
61
62 GtkWidget *dialog, *entry, *label; 72 GtkWidget *dialog, *entry, *label;
63 73
74 grab_server = (getenv("GNOME_SSH_ASKPASS_NOGRAB") == NULL);
75
64 dialog = gnome_dialog_new("OpenSSH", GNOME_STOCK_BUTTON_OK, 76 dialog = gnome_dialog_new("OpenSSH", GNOME_STOCK_BUTTON_OK,
65 GNOME_STOCK_BUTTON_CANCEL, NULL); 77 GNOME_STOCK_BUTTON_CANCEL, NULL);
66 78
@@ -89,7 +101,8 @@ passphrase_dialog(char *message)
89 gtk_widget_show_all(dialog); 101 gtk_widget_show_all(dialog);
90 102
91 /* Grab focus */ 103 /* Grab focus */
92 XGrabServer(GDK_DISPLAY()); 104 if (grab_server)
105 XGrabServer(GDK_DISPLAY());
93 if (gdk_pointer_grab(dialog->window, TRUE, 0, NULL, NULL, 106 if (gdk_pointer_grab(dialog->window, TRUE, 0, NULL, NULL,
94 GDK_CURRENT_TIME)) 107 GDK_CURRENT_TIME))
95 goto nograb; 108 goto nograb;
@@ -103,7 +116,8 @@ passphrase_dialog(char *message)
103 result = gnome_dialog_run(GNOME_DIALOG(dialog)); 116 result = gnome_dialog_run(GNOME_DIALOG(dialog));
104 117
105 /* Ungrab */ 118 /* Ungrab */
106 XUngrabServer(GDK_DISPLAY()); 119 if (grab_server)
120 XUngrabServer(GDK_DISPLAY());
107 gdk_pointer_ungrab(GDK_CURRENT_TIME); 121 gdk_pointer_ungrab(GDK_CURRENT_TIME);
108 gdk_keyboard_ungrab(GDK_CURRENT_TIME); 122 gdk_keyboard_ungrab(GDK_CURRENT_TIME);
109 gdk_flush(); 123 gdk_flush();
@@ -126,7 +140,8 @@ passphrase_dialog(char *message)
126 nograbkb: 140 nograbkb:
127 gdk_pointer_ungrab(GDK_CURRENT_TIME); 141 gdk_pointer_ungrab(GDK_CURRENT_TIME);
128 nograb: 142 nograb:
129 XUngrabServer(GDK_DISPLAY()); 143 if (grab_server)
144 XUngrabServer(GDK_DISPLAY());
130 gnome_dialog_close(GNOME_DIALOG(dialog)); 145 gnome_dialog_close(GNOME_DIALOG(dialog));
131 146
132 report_failed_grab(); 147 report_failed_grab();