summaryrefslogtreecommitdiff
path: root/ssh-add.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssh-add.c')
-rw-r--r--ssh-add.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/ssh-add.c b/ssh-add.c
index fb237ce2e..9ec34180f 100644
--- a/ssh-add.c
+++ b/ssh-add.c
@@ -14,7 +14,7 @@ Adds an identity to the authentication server, or removes an identity.
14*/ 14*/
15 15
16#include "includes.h" 16#include "includes.h"
17RCSID("$Id: ssh-add.c,v 1.5 1999/11/08 23:28:04 damien Exp $"); 17RCSID("$Id: ssh-add.c,v 1.6 1999/11/12 04:46:08 damien Exp $");
18 18
19#include "rsa.h" 19#include "rsa.h"
20#include "ssh.h" 20#include "ssh.h"
@@ -60,12 +60,14 @@ add_file(AuthenticationConnection *ac, const char *filename)
60 RSA *public_key; 60 RSA *public_key;
61 char *saved_comment, *comment, *pass; 61 char *saved_comment, *comment, *pass;
62 int first; 62 int first;
63#ifndef DISABLE_EXTERNAL_ASKPASS
63 int pipes[2]; 64 int pipes[2];
64 char buf[BUFSIZE]; 65 char buf[BUFSIZE];
65 int tmp; 66 int tmp;
66 pid_t child; 67 pid_t child;
67 FILE *pipef; 68 FILE *pipef;
68 69#endif /* !DISABLE_EXTERNAL_ASKPASS */
70
69 key = RSA_new(); 71 key = RSA_new();
70 public_key = RSA_new(); 72 public_key = RSA_new();
71 if (!load_public_key(filename, public_key, &saved_comment)) 73 if (!load_public_key(filename, public_key, &saved_comment))
@@ -86,6 +88,7 @@ add_file(AuthenticationConnection *ac, const char *filename)
86 /* Ask for a passphrase. */ 88 /* Ask for a passphrase. */
87 if (getenv("DISPLAY") && !isatty(fileno(stdin))) 89 if (getenv("DISPLAY") && !isatty(fileno(stdin)))
88 { 90 {
91#ifndef DISABLE_EXTERNAL_ASKPASS
89 if (pipe(pipes) ==-1) 92 if (pipe(pipes) ==-1)
90 { 93 {
91 fprintf(stderr, "Creating pipes failed: %s\n", strerror(errno)); 94 fprintf(stderr, "Creating pipes failed: %s\n", strerror(errno));
@@ -152,6 +155,10 @@ add_file(AuthenticationConnection *ac, const char *filename)
152 return; 155 return;
153 } 156 }
154 } 157 }
158#else /* !DISABLE_EXTERNAL_ASKPASS */
159 xfree(saved_comment);
160 return;
161#endif /* !DISABLE_EXTERNAL_ASKPASS */
155 } 162 }
156 else 163 else
157 { 164 {