summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--contrib/gnome-ssh-askpass.c95
2 files changed, 50 insertions, 51 deletions
diff --git a/ChangeLog b/ChangeLog
index 512c6ecf3..55ec667d1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,10 @@
4 - (bal) Added DG/UX case and set that they have a broken IPTOS. 4 - (bal) Added DG/UX case and set that they have a broken IPTOS.
5 - (djm) Mini-configure reorder patch from Tim Rice <tim@multitalents.net> 5 - (djm) Mini-configure reorder patch from Tim Rice <tim@multitalents.net>
6 Fixes linking on SCO. 6 Fixes linking on SCO.
7 - (djm) Make gnome-ssh-askpass handle multi-line prompts. Patch from
8 Nalin Dahyabhai <nalin@redhat.com>
9 - (djm) BSD license for gnome-ssh-askpass (was X11)
10 - (djm) KNF on gnome-ssh-askpass
7 11
820010215 1220010215
9 - (djm) Move PAM session setup back to before setuid to user. Fixes 13 - (djm) Move PAM session setup back to before setuid to user. Fixes
@@ -3977,4 +3981,4 @@
3977 - Wrote replacements for strlcpy and mkdtemp 3981 - Wrote replacements for strlcpy and mkdtemp
3978 - Released 1.0pre1 3982 - Released 1.0pre1
3979 3983
3980$Id: ChangeLog,v 1.775 2001/02/15 23:18:12 djm Exp $ 3984$Id: ChangeLog,v 1.776 2001/02/16 00:18:58 djm Exp $
diff --git a/contrib/gnome-ssh-askpass.c b/contrib/gnome-ssh-askpass.c
index 5b6f65e88..27e5ccaa1 100644
--- a/contrib/gnome-ssh-askpass.c
+++ b/contrib/gnome-ssh-askpass.c
@@ -1,46 +1,35 @@
1/* 1/*
2 Compile with: 2 * Copyright (c) 2000 Damien Miller. All rights reserved.
3 3 *
4 cc `gnome-config --cflags gnome gnomeui` \ 4 * Redistribution and use in source and binary forms, with or without
5 gnome-ssh-askpass.c -o gnome-ssh-askpass \ 5 * modification, are permitted provided that the following conditions
6 `gnome-config --libs gnome gnomeui` 6 * are met:
7 7 * 1. Redistributions of source code must retain the above copyright
8*/ 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
15 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */
9 24
10/* 25/*
11** 26 * Compile with:
12** GNOME ssh passphrase requestor 27 *
13** 28 * cc `gnome-config --cflags gnome gnomeui` \
14** Damien Miller <djm@ibs.com.au> 29 * gnome-ssh-askpass.c -o gnome-ssh-askpass \
15** 30 * `gnome-config --libs gnome gnomeui`
16** Copyright 1999 Internet Business Solutions 31 *
17** 32 */
18** Permission is hereby granted, free of charge, to any person
19** obtaining a copy of this software and associated documentation
20** files (the "Software"), to deal in the Software without
21** restriction, including without limitation the rights to use, copy,
22** modify, merge, publish, distribute, sublicense, and/or sell copies
23** of the Software, and to permit persons to whom the Software is
24** furnished to do so, subject to the following conditions:
25**
26** The above copyright notice and this permission notice shall be
27** included in all copies or substantial portions of the Software.
28**
29** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
30** KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
31** WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
32** AND NONINFRINGEMENT. IN NO EVENT SHALL DAMIEN MILLER OR INTERNET
33** BUSINESS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
34** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
35** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
36** OR OTHER DEALINGS IN THE SOFTWARE.
37**
38** Except as contained in this notice, the name of Internet Business
39** Solutions shall not be used in advertising or otherwise to promote
40** the sale, use or other dealings in this Software without prior
41** written authorization from Internet Business Solutions.
42**
43*/
44 33
45#include <stdlib.h> 34#include <stdlib.h>
46#include <stdio.h> 35#include <stdio.h>
@@ -67,20 +56,25 @@ void
67passphrase_dialog(char *message) 56passphrase_dialog(char *message)
68{ 57{
69 char *passphrase; 58 char *passphrase;
70 int result; 59 char **messages;
60 int result, i;
71 61
72 GtkWidget *dialog, *entry, *label; 62 GtkWidget *dialog, *entry, *label;
73 63
74 dialog = gnome_dialog_new("OpenSSH", GNOME_STOCK_BUTTON_OK, 64 dialog = gnome_dialog_new("OpenSSH", GNOME_STOCK_BUTTON_OK,
75 GNOME_STOCK_BUTTON_CANCEL, NULL); 65 GNOME_STOCK_BUTTON_CANCEL, NULL);
76 66
77 label = gtk_label_new(message); 67 messages = g_strsplit(message, "\\n", 0);
78 gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox), label, FALSE, 68 if (messages)
79 FALSE, 0); 69 for(i = 0; messages[i]; i++) {
70 label = gtk_label_new(messages[i]);
71 gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox),
72 label, FALSE, FALSE, 0);
73 }
80 74
81 entry = gtk_entry_new(); 75 entry = gtk_entry_new();
82 gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox), entry, FALSE, 76 gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox), entry, FALSE,
83 FALSE, 0); 77 FALSE, 0);
84 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); 78 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE);
85 gtk_widget_grab_focus(entry); 79 gtk_widget_grab_focus(entry);
86 80
@@ -90,13 +84,14 @@ passphrase_dialog(char *message)
90 gtk_window_set_position (GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); 84 gtk_window_set_position (GTK_WINDOW(dialog), GTK_WIN_POS_CENTER);
91 gtk_window_set_policy(GTK_WINDOW(dialog), FALSE, FALSE, TRUE); 85 gtk_window_set_policy(GTK_WINDOW(dialog), FALSE, FALSE, TRUE);
92 gnome_dialog_close_hides(GNOME_DIALOG(dialog), TRUE); 86 gnome_dialog_close_hides(GNOME_DIALOG(dialog), TRUE);
93 gtk_container_set_border_width(GTK_CONTAINER(GNOME_DIALOG(dialog)->vbox), GNOME_PAD); 87 gtk_container_set_border_width(GTK_CONTAINER(GNOME_DIALOG(dialog)->vbox),
88 GNOME_PAD);
94 gtk_widget_show_all(dialog); 89 gtk_widget_show_all(dialog);
95 90
96 /* Grab focus */ 91 /* Grab focus */
97 XGrabServer(GDK_DISPLAY()); 92 XGrabServer(GDK_DISPLAY());
98 if (gdk_pointer_grab(dialog->window, TRUE, 0, 93 if (gdk_pointer_grab(dialog->window, TRUE, 0, NULL, NULL,
99 NULL, NULL, GDK_CURRENT_TIME)) 94 GDK_CURRENT_TIME))
100 goto nograb; 95 goto nograb;
101 if (gdk_keyboard_grab(dialog->window, FALSE, GDK_CURRENT_TIME)) 96 if (gdk_keyboard_grab(dialog->window, FALSE, GDK_CURRENT_TIME))
102 goto nograbkb; 97 goto nograbkb;