summaryrefslogtreecommitdiff
path: root/ssh-agent.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2005-05-25 11:01:01 +0000
committerColin Watson <cjwatson@debian.org>2005-05-25 11:01:01 +0000
commite88de75a1a236779a10e8ccbcc51d25308be8840 (patch)
tree7495477a2a7d0cac17a9fcded020b6ea816182ef /ssh-agent.c
parent30a0f9443782cd9d7308acd09430bf586186aa55 (diff)
parent5d05471f6657646d1d6500c7c43134462c407ee6 (diff)
Merge 4.0p1 to the trunk.
Diffstat (limited to 'ssh-agent.c')
-rw-r--r--ssh-agent.c30
1 files changed, 8 insertions, 22 deletions
diff --git a/ssh-agent.c b/ssh-agent.c
index bc4d8d33a..dd7e22ad5 100644
--- a/ssh-agent.c
+++ b/ssh-agent.c
@@ -35,7 +35,7 @@
35 35
36#include "includes.h" 36#include "includes.h"
37#include "openbsd-compat/sys-queue.h" 37#include "openbsd-compat/sys-queue.h"
38RCSID("$OpenBSD: ssh-agent.c,v 1.120 2004/08/11 21:43:05 avsm Exp $"); 38RCSID("$OpenBSD: ssh-agent.c,v 1.122 2004/10/29 22:53:56 djm Exp $");
39 39
40#include <openssl/evp.h> 40#include <openssl/evp.h>
41#include <openssl/md5.h> 41#include <openssl/md5.h>
@@ -168,23 +168,15 @@ lookup_identity(Key *key, int version)
168static int 168static int
169confirm_key(Identity *id) 169confirm_key(Identity *id)
170{ 170{
171 char *p, prompt[1024]; 171 char *p;
172 int ret = -1; 172 int ret = -1;
173 173
174 p = key_fingerprint(id->key, SSH_FP_MD5, SSH_FP_HEX); 174 p = key_fingerprint(id->key, SSH_FP_MD5, SSH_FP_HEX);
175 snprintf(prompt, sizeof(prompt), "Allow use of key %s?\n" 175 if (ask_permission("Allow use of key %s?\nKey fingerprint %s.",
176 "Key fingerprint %s.", id->comment, p); 176 id->comment, p))
177 ret = 0;
177 xfree(p); 178 xfree(p);
178 p = read_passphrase(prompt, RP_ALLOW_EOF); 179
179 if (p != NULL) {
180 /*
181 * Accept empty responses and responses consisting
182 * of the word "yes" as affirmative.
183 */
184 if (*p == '\0' || *p == '\n' || strcasecmp(p, "yes") == 0)
185 ret = 0;
186 xfree(p);
187 }
188 return (ret); 180 return (ret);
189} 181}
190 182
@@ -1010,9 +1002,7 @@ main(int ac, char **av)
1010#ifdef HAVE_SETRLIMIT 1002#ifdef HAVE_SETRLIMIT
1011 struct rlimit rlim; 1003 struct rlimit rlim;
1012#endif 1004#endif
1013#ifdef HAVE_CYGWIN
1014 int prev_mask; 1005 int prev_mask;
1015#endif
1016 extern int optind; 1006 extern int optind;
1017 extern char *optarg; 1007 extern char *optarg;
1018 pid_t pid; 1008 pid_t pid;
@@ -1124,24 +1114,20 @@ main(int ac, char **av)
1124 sock = socket(AF_UNIX, SOCK_STREAM, 0); 1114 sock = socket(AF_UNIX, SOCK_STREAM, 0);
1125 if (sock < 0) { 1115 if (sock < 0) {
1126 perror("socket"); 1116 perror("socket");
1117 *socket_name = '\0'; /* Don't unlink any existing file */
1127 cleanup_exit(1); 1118 cleanup_exit(1);
1128 } 1119 }
1129 memset(&sunaddr, 0, sizeof(sunaddr)); 1120 memset(&sunaddr, 0, sizeof(sunaddr));
1130 sunaddr.sun_family = AF_UNIX; 1121 sunaddr.sun_family = AF_UNIX;
1131 strlcpy(sunaddr.sun_path, socket_name, sizeof(sunaddr.sun_path)); 1122 strlcpy(sunaddr.sun_path, socket_name, sizeof(sunaddr.sun_path));
1132#ifdef HAVE_CYGWIN
1133 prev_mask = umask(0177); 1123 prev_mask = umask(0177);
1134#endif
1135 if (bind(sock, (struct sockaddr *) & sunaddr, sizeof(sunaddr)) < 0) { 1124 if (bind(sock, (struct sockaddr *) & sunaddr, sizeof(sunaddr)) < 0) {
1136 perror("bind"); 1125 perror("bind");
1137#ifdef HAVE_CYGWIN 1126 *socket_name = '\0'; /* Don't unlink any existing file */
1138 umask(prev_mask); 1127 umask(prev_mask);
1139#endif
1140 cleanup_exit(1); 1128 cleanup_exit(1);
1141 } 1129 }
1142#ifdef HAVE_CYGWIN
1143 umask(prev_mask); 1130 umask(prev_mask);
1144#endif
1145 if (listen(sock, SSH_LISTEN_BACKLOG) < 0) { 1131 if (listen(sock, SSH_LISTEN_BACKLOG) < 0) {
1146 perror("listen"); 1132 perror("listen");
1147 cleanup_exit(1); 1133 cleanup_exit(1);