diff options
Diffstat (limited to 'ssh-add.c')
-rw-r--r-- | ssh-add.c | 19 |
1 files changed, 10 insertions, 9 deletions
@@ -35,18 +35,19 @@ | |||
35 | */ | 35 | */ |
36 | 36 | ||
37 | #include "includes.h" | 37 | #include "includes.h" |
38 | RCSID("$OpenBSD: ssh-add.c,v 1.24 2001/01/13 18:14:13 markus Exp $"); | 38 | RCSID("$OpenBSD: ssh-add.c,v 1.27 2001/01/21 19:05:56 markus Exp $"); |
39 | 39 | ||
40 | #include <openssl/evp.h> | 40 | #include <openssl/evp.h> |
41 | #include <openssl/rsa.h> | ||
42 | #include <openssl/dsa.h> | ||
43 | 41 | ||
44 | #include "rsa.h" | ||
45 | #include "ssh.h" | 42 | #include "ssh.h" |
43 | #include "rsa.h" | ||
44 | #include "log.h" | ||
46 | #include "xmalloc.h" | 45 | #include "xmalloc.h" |
47 | #include "key.h" | 46 | #include "key.h" |
48 | #include "authfd.h" | 47 | #include "authfd.h" |
49 | #include "authfile.h" | 48 | #include "authfile.h" |
49 | #include "pathnames.h" | ||
50 | #include "readpass.h" | ||
50 | 51 | ||
51 | #ifdef HAVE___PROGNAME | 52 | #ifdef HAVE___PROGNAME |
52 | extern char *__progname; | 53 | extern char *__progname; |
@@ -103,6 +104,8 @@ ssh_askpass(char *askpass, char *msg) | |||
103 | int p[2], status; | 104 | int p[2], status; |
104 | char buf[1024]; | 105 | char buf[1024]; |
105 | 106 | ||
107 | if (fflush(stdout) != 0) | ||
108 | error("ssh_askpass: fflush: %s", strerror(errno)); | ||
106 | if (askpass == NULL) | 109 | if (askpass == NULL) |
107 | fatal("internal error: askpass undefined"); | 110 | fatal("internal error: askpass undefined"); |
108 | if (pipe(p) < 0) | 111 | if (pipe(p) < 0) |
@@ -117,9 +120,7 @@ ssh_askpass(char *askpass, char *msg) | |||
117 | fatal("ssh_askpass: exec(%s): %s", askpass, strerror(errno)); | 120 | fatal("ssh_askpass: exec(%s): %s", askpass, strerror(errno)); |
118 | } | 121 | } |
119 | close(p[1]); | 122 | close(p[1]); |
120 | buf[0] = '\0'; | 123 | len = read(p[0], buf, sizeof buf); |
121 | atomicio(read, p[0], buf, sizeof buf); | ||
122 | len = strlen(buf); | ||
123 | close(p[0]); | 124 | close(p[0]); |
124 | while (waitpid(pid, &status, 0) < 0) | 125 | while (waitpid(pid, &status, 0) < 0) |
125 | if (errno != EINTR) | 126 | if (errno != EINTR) |
@@ -166,7 +167,7 @@ add_file(AuthenticationConnection *ac, const char *filename) | |||
166 | if (getenv(SSH_ASKPASS_ENV)) | 167 | if (getenv(SSH_ASKPASS_ENV)) |
167 | askpass = getenv(SSH_ASKPASS_ENV); | 168 | askpass = getenv(SSH_ASKPASS_ENV); |
168 | else | 169 | else |
169 | askpass = SSH_ASKPASS_DEFAULT; | 170 | askpass = _PATH_SSH_ASKPASS_DEFAULT; |
170 | } | 171 | } |
171 | 172 | ||
172 | /* At first, try empty passphrase */ | 173 | /* At first, try empty passphrase */ |
@@ -291,7 +292,7 @@ main(int argc, char **argv) | |||
291 | ssh_close_authentication_connection(ac); | 292 | ssh_close_authentication_connection(ac); |
292 | exit(1); | 293 | exit(1); |
293 | } | 294 | } |
294 | snprintf(buf, sizeof buf, "%s/%s", pw->pw_dir, SSH_CLIENT_IDENTITY); | 295 | snprintf(buf, sizeof buf, "%s/%s", pw->pw_dir, _PATH_SSH_CLIENT_IDENTITY); |
295 | if (deleting) | 296 | if (deleting) |
296 | delete_file(ac, buf); | 297 | delete_file(ac, buf); |
297 | else | 298 | else |