From faf2f6483a344a3f7d73181dd5f154a9c7fa0c7c Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Fri, 21 Dec 2001 10:28:07 +1100 Subject: - (djm) Add option to gnome-ssh-askpass to stop it from grabbing the X server. I have found this necessary to avoid server hangs with X input extensions (e.g. kinput2). Enable by setting the environment variable "GNOME_SSH_ASKPASS_NOGRAB" --- contrib/gnome-ssh-askpass.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'contrib/gnome-ssh-askpass.c') 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 @@ /* - * Copyright (c) 2000 Damien Miller. All rights reserved. + * Copyright (c) 2000-2001 Damien Miller. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -22,6 +22,17 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* + * This is a simple GNOME SSH passphrase grabber. To use it, set the + * environment variable SSH_ASKPASS to point to the location of + * gnome-ssh-askpass before calling "ssh-add < /dev/null". + * + * There is only one run-time option: if you set the environment variable + * "GNOME_SSH_ASKPASS_NOGRAB=true" then gnome-ssh-askpass will not grab + * the X server. I have found this necessary to avoid server hangs with + * X input extensions (e.g. kinput2) enabled. - djm + */ + /* * Compile with: * @@ -57,10 +68,11 @@ passphrase_dialog(char *message) { char *passphrase; char **messages; - int result, i; - + int result, i, grab_server; GtkWidget *dialog, *entry, *label; + grab_server = (getenv("GNOME_SSH_ASKPASS_NOGRAB") == NULL); + dialog = gnome_dialog_new("OpenSSH", GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, NULL); @@ -89,7 +101,8 @@ passphrase_dialog(char *message) gtk_widget_show_all(dialog); /* Grab focus */ - XGrabServer(GDK_DISPLAY()); + if (grab_server) + XGrabServer(GDK_DISPLAY()); if (gdk_pointer_grab(dialog->window, TRUE, 0, NULL, NULL, GDK_CURRENT_TIME)) goto nograb; @@ -103,7 +116,8 @@ passphrase_dialog(char *message) result = gnome_dialog_run(GNOME_DIALOG(dialog)); /* Ungrab */ - XUngrabServer(GDK_DISPLAY()); + if (grab_server) + XUngrabServer(GDK_DISPLAY()); gdk_pointer_ungrab(GDK_CURRENT_TIME); gdk_keyboard_ungrab(GDK_CURRENT_TIME); gdk_flush(); @@ -126,7 +140,8 @@ passphrase_dialog(char *message) nograbkb: gdk_pointer_ungrab(GDK_CURRENT_TIME); nograb: - XUngrabServer(GDK_DISPLAY()); + if (grab_server) + XUngrabServer(GDK_DISPLAY()); gnome_dialog_close(GNOME_DIALOG(dialog)); report_failed_grab(); -- cgit v1.2.3