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" --- ChangeLog | 8 +++++++- contrib/gnome-ssh-askpass.c | 27 +++++++++++++++++++++------ 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 @@ +20011221 + - (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" + 20011219 - (stevesk) OpenBSD CVS sync X11 localhost display - stevesk@cvs.openbsd.org 2001/11/29 14:10:51 @@ -7025,4 +7031,4 @@ - Wrote replacements for strlcpy and mkdtemp - Released 1.0pre1 -$Id: ChangeLog,v 1.1692 2001/12/19 17:58:01 stevesk Exp $ +$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 @@ /* - * 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