- (djm) Made GNOME askpass programs return non-zero if cancel button is

pressed.
This commit is contained in:
Damien Miller 2002-09-12 14:49:00 +10:00
Родитель 1d87176749
Коммит 10f3085137
3 изменённых файлов: 21 добавлений и 13 удалений

Просмотреть файл

@ -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 $

Просмотреть файл

@ -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,12 +148,14 @@ 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);
@ -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);
}

Просмотреть файл

@ -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,12 +178,15 @@ 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);
@ -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);
}