diff --git a/ChangeLog b/ChangeLog index 2d84af023..d7ca09dbb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,6 @@ 20020912 + - (djm) Made GNOME askpass programs return non-zero if cancel button is + pressed. - (djm) Added getpeereid() replacement. Properly implemented for systems with SO_PEERCRED support. Faked for systems which lack it. - (djm) Sync sys/tree.h with OpenBSD -current. Rename tree.h and @@ -645,4 +647,4 @@ save auth method before monitor_reset_key_state(); bugzilla bug #284; ok provos@ -$Id: ChangeLog,v 1.2462 2002/09/12 00:45:32 djm Exp $ +$Id: ChangeLog,v 1.2463 2002/09/12 04:49:00 djm Exp $ diff --git a/contrib/gnome-ssh-askpass1.c b/contrib/gnome-ssh-askpass1.c index 7cece5620..b6b342b84 100644 --- a/contrib/gnome-ssh-askpass1.c +++ b/contrib/gnome-ssh-askpass1.c @@ -38,7 +38,7 @@ * Compile with: * * cc `gnome-config --cflags gnome gnomeui` \ - * gnome-ssh-askpass.c -o gnome-ssh-askpass \ + * gnome-ssh-askpass1.c -o gnome-ssh-askpass \ * `gnome-config --libs gnome gnomeui` * */ @@ -64,7 +64,7 @@ report_failed_grab (void) gnome_dialog_run_and_close(GNOME_DIALOG(err)); } -void +int passphrase_dialog(char *message) { char *passphrase; @@ -135,7 +135,7 @@ passphrase_dialog(char *message) gtk_entry_set_text(GTK_ENTRY(entry), passphrase); gnome_dialog_close(GNOME_DIALOG(dialog)); - return; + return (result == 0 ? 0 : -1); /* At least one grab failed - ungrab what we got, and report the failure to the user. Note that XGrabServer() cannot @@ -148,13 +148,15 @@ passphrase_dialog(char *message) gnome_dialog_close(GNOME_DIALOG(dialog)); report_failed_grab(); + return (-1); } int main(int argc, char **argv) { char *message; - + int result; + gnome_init("GNOME ssh-askpass", "0.1", argc, argv); if (argc == 2) @@ -163,6 +165,7 @@ main(int argc, char **argv) message = "Enter your OpenSSH passphrase:"; setvbuf(stdout, 0, _IONBF, 0); - passphrase_dialog(message); - return 0; + result = passphrase_dialog(message); + + return (result); } diff --git a/contrib/gnome-ssh-askpass2.c b/contrib/gnome-ssh-askpass2.c index 8cccf9e60..89a412aa8 100644 --- a/contrib/gnome-ssh-askpass2.c +++ b/contrib/gnome-ssh-askpass2.c @@ -40,7 +40,7 @@ * Compile with: * * cc `pkg-config --cflags gtk+-2.0` \ - * gnome-ssh-askpass.c -o gnome-ssh-askpass \ + * gnome-ssh-askpass2.c -o gnome-ssh-askpass \ * `pkg-config --libs gtk+-2.0` * */ @@ -79,7 +79,7 @@ ok_dialog(GtkWidget *entry, gpointer dialog) gtk_dialog_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK); } -static void +static int passphrase_dialog(char *message) { const char *failed; @@ -165,7 +165,7 @@ passphrase_dialog(char *message) g_free(passphrase); gtk_widget_destroy(dialog); - return; + return (result == GTK_RESPONSE_OK ? 0 : -1); /* At least one grab failed - ungrab what we got, and report the failure to the user. Note that XGrabServer() cannot @@ -178,13 +178,16 @@ passphrase_dialog(char *message) gtk_widget_destroy(dialog); report_failed_grab(failed); + + return (-1); } int main(int argc, char **argv) { char *message; - + int result; + gtk_init(&argc, &argv); if (argc > 1) { @@ -194,8 +197,8 @@ main(int argc, char **argv) } setvbuf(stdout, 0, _IONBF, 0); - passphrase_dialog(message); + result = passphrase_dialog(message); g_free(message); - return 0; + return (result); }