diff options
Diffstat (limited to 'contrib/gnome-ssh-askpass.c')
-rw-r--r-- | contrib/gnome-ssh-askpass.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/contrib/gnome-ssh-askpass.c b/contrib/gnome-ssh-askpass.c index 949b80781..7cece5620 100644 --- a/contrib/gnome-ssh-askpass.c +++ b/contrib/gnome-ssh-askpass.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2001 Damien Miller. All rights reserved. | 2 | * Copyright (c) 2000-2002 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 |
@@ -27,10 +27,11 @@ | |||
27 | * environment variable SSH_ASKPASS to point to the location of | 27 | * environment variable SSH_ASKPASS to point to the location of |
28 | * gnome-ssh-askpass before calling "ssh-add < /dev/null". | 28 | * gnome-ssh-askpass before calling "ssh-add < /dev/null". |
29 | * | 29 | * |
30 | * There is only one run-time option: if you set the environment variable | 30 | * There is only two run-time options: if you set the environment variable |
31 | * "GNOME_SSH_ASKPASS_GRAB_SERVER=true" then gnome-ssh-askpass will grab | 31 | * "GNOME_SSH_ASKPASS_GRAB_SERVER=true" then gnome-ssh-askpass will grab |
32 | * the X server. This may have some benefit to security if you don't trust | 32 | * the X server. If you set "GNOME_SSH_ASKPASS_GRAB_POINTER=true", then the |
33 | * your X server. We grab the keyboard and pointer anyway. | 33 | * pointer will be grabbed too. These may have some benefit to security if |
34 | * you don't trust your X server. We grab the keyboard always. | ||
34 | */ | 35 | */ |
35 | 36 | ||
36 | /* | 37 | /* |
@@ -68,10 +69,11 @@ passphrase_dialog(char *message) | |||
68 | { | 69 | { |
69 | char *passphrase; | 70 | char *passphrase; |
70 | char **messages; | 71 | char **messages; |
71 | int result, i, grab_server; | 72 | int result, i, grab_server, grab_pointer; |
72 | GtkWidget *dialog, *entry, *label; | 73 | GtkWidget *dialog, *entry, *label; |
73 | 74 | ||
74 | grab_server = (getenv("GNOME_SSH_ASKPASS_GRAB_SERVER") != NULL); | 75 | grab_server = (getenv("GNOME_SSH_ASKPASS_GRAB_SERVER") != NULL); |
76 | grab_pointer = (getenv("GNOME_SSH_ASKPASS_GRAB_POINTER") != NULL); | ||
75 | 77 | ||
76 | dialog = gnome_dialog_new("OpenSSH", GNOME_STOCK_BUTTON_OK, | 78 | dialog = gnome_dialog_new("OpenSSH", GNOME_STOCK_BUTTON_OK, |
77 | GNOME_STOCK_BUTTON_CANCEL, NULL); | 79 | GNOME_STOCK_BUTTON_CANCEL, NULL); |
@@ -103,8 +105,8 @@ passphrase_dialog(char *message) | |||
103 | /* Grab focus */ | 105 | /* Grab focus */ |
104 | if (grab_server) | 106 | if (grab_server) |
105 | XGrabServer(GDK_DISPLAY()); | 107 | XGrabServer(GDK_DISPLAY()); |
106 | if (gdk_pointer_grab(dialog->window, TRUE, 0, NULL, NULL, | 108 | if (grab_pointer && gdk_pointer_grab(dialog->window, TRUE, 0, |
107 | GDK_CURRENT_TIME)) | 109 | NULL, NULL, GDK_CURRENT_TIME)) |
108 | goto nograb; | 110 | goto nograb; |
109 | if (gdk_keyboard_grab(dialog->window, FALSE, GDK_CURRENT_TIME)) | 111 | if (gdk_keyboard_grab(dialog->window, FALSE, GDK_CURRENT_TIME)) |
110 | goto nograbkb; | 112 | goto nograbkb; |
@@ -118,7 +120,8 @@ passphrase_dialog(char *message) | |||
118 | /* Ungrab */ | 120 | /* Ungrab */ |
119 | if (grab_server) | 121 | if (grab_server) |
120 | XUngrabServer(GDK_DISPLAY()); | 122 | XUngrabServer(GDK_DISPLAY()); |
121 | gdk_pointer_ungrab(GDK_CURRENT_TIME); | 123 | if (grab_pointer) |
124 | gdk_pointer_ungrab(GDK_CURRENT_TIME); | ||
122 | gdk_keyboard_ungrab(GDK_CURRENT_TIME); | 125 | gdk_keyboard_ungrab(GDK_CURRENT_TIME); |
123 | gdk_flush(); | 126 | gdk_flush(); |
124 | 127 | ||