summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.in21
-rw-r--r--gnome-ssh-askpass.c102
2 files changed, 115 insertions, 8 deletions
diff --git a/Makefile.in b/Makefile.in
index f182af3b3..03200eb9d 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -12,11 +12,13 @@ CC=@CC@
12PATHS=-DETCDIR=\"@sysconfdir@\" -DSSH_PROGRAM=\"$(SSH_PROGRAM)\" -DASKPASS_PROGRAM=\"$(ASKPASS_PROGRAM)\" 12PATHS=-DETCDIR=\"@sysconfdir@\" -DSSH_PROGRAM=\"$(SSH_PROGRAM)\" -DASKPASS_PROGRAM=\"$(ASKPASS_PROGRAM)\"
13CFLAGS=@CFLAGS@ $(PATHS) @DEFS@ 13CFLAGS=@CFLAGS@ $(PATHS) @DEFS@
14TARGETS=libssh.a ssh sshd ssh-add ssh-keygen ssh-agent scp 14TARGETS=libssh.a ssh sshd ssh-add ssh-keygen ssh-agent scp
15LFLAGS=-L. 15LIBS=@LIBS@
16LIBS=-lssh @LIBS@
17AR=@AR@ 16AR=@AR@
18RANLIB=@RANLIB@ 17RANLIB=@RANLIB@
19 18
19GNOME_CFLAGS=`gnome-config --cflags gnome gnomeui`
20GNOME_LIBS=`gnome-config --libs gnome gnomeui`
21
20OBJS= authfd.o authfile.o auth-passwd.o auth-rhosts.o auth-rh-rsa.o \ 22OBJS= authfd.o authfile.o auth-passwd.o auth-rhosts.o auth-rh-rsa.o \
21 auth-rsa.o bufaux.o buffer.o canohost.o channels.o cipher.o \ 23 auth-rsa.o bufaux.o buffer.o canohost.o channels.o cipher.o \
22 clientloop.o compress.o crc32.o deattack.o helper.o hostfile.o \ 24 clientloop.o compress.o crc32.o deattack.o helper.o hostfile.o \
@@ -31,24 +33,27 @@ libssh.a: authfd.o authfile.o bufaux.o buffer.o canohost.o channels.o cipher.o c
31 $(AR) rv $@ $^ 33 $(AR) rv $@ $^
32 $(RANLIB) $@ 34 $(RANLIB) $@
33 35
34ssh: ssh.o sshconnect.o log-client.o readconf.o clientloop.o 36ssh: ssh.o sshconnect.o log-client.o readconf.o clientloop.o libssh.a
35 $(CC) -o $@ $^ $(LFLAGS) $(LIBS) 37 $(CC) -o $@ $^ $(LFLAGS) $(LIBS)
36 38
37sshd: sshd.o auth-rhosts.o auth-passwd.o auth-rsa.o auth-rh-rsa.o pty.o log-server.o login.o servconf.o serverloop.o 39sshd: sshd.o auth-rhosts.o auth-passwd.o auth-rsa.o auth-rh-rsa.o pty.o log-server.o login.o servconf.o serverloop.o libssh.a
38 $(CC) -o $@ $^ $(LFLAGS) $(LIBS) 40 $(CC) -o $@ $^ $(LFLAGS) $(LIBS)
39 41
40scp: scp.o 42scp: scp.o libssh.a
41 $(CC) -o $@ $^ $(LFLAGS) $(LIBS) 43 $(CC) -o $@ $^ $(LFLAGS) $(LIBS)
42 44
43ssh-add: ssh-add.o log-client.o 45ssh-add: ssh-add.o log-client.o libssh.a
44 $(CC) -o $@ $^ $(LFLAGS) $(LIBS) 46 $(CC) -o $@ $^ $(LFLAGS) $(LIBS)
45 47
46ssh-agent: ssh-agent.o log-client.o 48ssh-agent: ssh-agent.o log-client.o libssh.a
47 $(CC) -o $@ $^ $(LFLAGS) $(LIBS) 49 $(CC) -o $@ $^ $(LFLAGS) $(LIBS)
48 50
49ssh-keygen: ssh-keygen.o log-client.o 51ssh-keygen: ssh-keygen.o log-client.o libssh.a
50 $(CC) -o $@ $^ $(LFLAGS) $(LIBS) 52 $(CC) -o $@ $^ $(LFLAGS) $(LIBS)
51 53
54gnome-ssh-askpass: gnome-ssh-askpass.c
55 $(CC) $(CFLAGS) $(GNOME_CFLAGS) -o $@ gnome-ssh-askpass.c $(GNOME_LIBS)
56
52clean: 57clean:
53 rm -f *.o core $(TARGETS) config.status config.cache config.log 58 rm -f *.o core $(TARGETS) config.status config.cache config.log
54 59
diff --git a/gnome-ssh-askpass.c b/gnome-ssh-askpass.c
new file mode 100644
index 000000000..6610478c9
--- /dev/null
+++ b/gnome-ssh-askpass.c
@@ -0,0 +1,102 @@
1/*
2**
3** GNOME ssh passphrase requestor
4**
5** Damien Miller <djm@ibs.com.au>
6**
7** Copyright 1999 Internet Business Solutions
8**
9** Permission is hereby granted, free of charge, to any person
10** obtaining a copy of this software and associated documentation
11** files (the "Software"), to deal in the Software without
12** restriction, including without limitation the rights to use, copy,
13** modify, merge, publish, distribute, sublicense, and/or sell copies
14** of the Software, and to permit persons to whom the Software is
15** furnished to do so, subject to the following conditions:
16**
17** The above copyright notice and this permission notice shall be
18** included in all copies or substantial portions of the Software.
19**
20** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
21** KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
22** WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
23** AND NONINFRINGEMENT. IN NO EVENT SHALL DAMIEN MILLER OR INTERNET
24** BUSINESS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
27** OR OTHER DEALINGS IN THE SOFTWARE.
28**
29** Except as contained in this notice, the name of Internet Business
30** Solutions shall not be used in advertising or otherwise to promote
31** the sale, use or other dealings in this Software without prior
32** written authorization from Internet Business Solutions.
33**
34*/
35
36#include <stdlib.h>
37#include <stdio.h>
38#include <string.h>
39#include <gnome.h>
40
41int passphrase_dialog(char **passphrase_p, char *message)
42{
43 char *passphrase;
44 int result;
45
46 GtkWidget *dialog, *entry, *label;
47
48 dialog = gnome_dialog_new("OpenSSH", GNOME_STOCK_BUTTON_OK,
49 GNOME_STOCK_BUTTON_CANCEL, NULL);
50
51 label = gtk_label_new(message);
52 gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox), label, FALSE,
53 FALSE, 0);
54 gtk_widget_show(label);
55
56 entry = gtk_entry_new();
57 gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox), entry, FALSE,
58 FALSE, 0);
59 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE);
60 gtk_widget_grab_focus(entry);
61 gtk_widget_show(entry);
62
63 /* Run dialog */
64 result = gnome_dialog_run(GNOME_DIALOG(dialog));
65
66 passphrase = gtk_entry_get_text(GTK_ENTRY(entry));
67
68 /* Take copy of passphrase if user selected OK */
69 if (result == 0)
70 *passphrase_p = strdup(passphrase);
71 else
72 *passphrase_p = NULL;
73
74 /* Zero existing passphrase */
75 memset(passphrase, '\0', strlen(passphrase));
76 gtk_entry_set_text(GTK_ENTRY(entry), passphrase);
77
78 gnome_dialog_close(GNOME_DIALOG(dialog));
79
80 return (result == 0);
81}
82
83int main(int argc, char **argv)
84{
85 char *passphrase;
86 char *message;
87
88 gnome_init("GNOME ssh-askpass", "0.1", argc, argv);
89
90 if (argc == 2)
91 message = argv[1];
92 else
93 message = "Enter your OpenSSH passphrase:";
94
95 if (passphrase_dialog(&passphrase, message))
96 {
97 printf("%s\n", passphrase);
98 memset(passphrase, '\0', strlen(passphrase));
99 }
100
101 return 0;
102}