diff options
Diffstat (limited to 'ssh-agent.c')
-rw-r--r-- | ssh-agent.c | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/ssh-agent.c b/ssh-agent.c index f7a021364..26c1bd37e 100644 --- a/ssh-agent.c +++ b/ssh-agent.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh-agent.c,v 1.187 2014/07/03 03:11:03 djm Exp $ */ | 1 | /* $OpenBSD: ssh-agent.c,v 1.188 2014/07/15 15:54:14 millert Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -1038,11 +1038,9 @@ main(int ac, char **av) | |||
1038 | u_int nalloc; | 1038 | u_int nalloc; |
1039 | char *shell, *format, *pidstr, *agentsocket = NULL; | 1039 | char *shell, *format, *pidstr, *agentsocket = NULL; |
1040 | fd_set *readsetp = NULL, *writesetp = NULL; | 1040 | fd_set *readsetp = NULL, *writesetp = NULL; |
1041 | struct sockaddr_un sunaddr; | ||
1042 | #ifdef HAVE_SETRLIMIT | 1041 | #ifdef HAVE_SETRLIMIT |
1043 | struct rlimit rlim; | 1042 | struct rlimit rlim; |
1044 | #endif | 1043 | #endif |
1045 | int prev_mask; | ||
1046 | extern int optind; | 1044 | extern int optind; |
1047 | extern char *optarg; | 1045 | extern char *optarg; |
1048 | pid_t pid; | 1046 | pid_t pid; |
@@ -1161,25 +1159,10 @@ main(int ac, char **av) | |||
1161 | * Create socket early so it will exist before command gets run from | 1159 | * Create socket early so it will exist before command gets run from |
1162 | * the parent. | 1160 | * the parent. |
1163 | */ | 1161 | */ |
1164 | sock = socket(AF_UNIX, SOCK_STREAM, 0); | 1162 | sock = unix_listener(socket_name, SSH_LISTEN_BACKLOG, 0); |
1165 | if (sock < 0) { | 1163 | if (sock < 0) { |
1166 | perror("socket"); | 1164 | /* XXX - unix_listener() calls error() not perror() */ |
1167 | *socket_name = '\0'; /* Don't unlink any existing file */ | ||
1168 | cleanup_exit(1); | ||
1169 | } | ||
1170 | memset(&sunaddr, 0, sizeof(sunaddr)); | ||
1171 | sunaddr.sun_family = AF_UNIX; | ||
1172 | strlcpy(sunaddr.sun_path, socket_name, sizeof(sunaddr.sun_path)); | ||
1173 | prev_mask = umask(0177); | ||
1174 | if (bind(sock, (struct sockaddr *) &sunaddr, sizeof(sunaddr)) < 0) { | ||
1175 | perror("bind"); | ||
1176 | *socket_name = '\0'; /* Don't unlink any existing file */ | 1165 | *socket_name = '\0'; /* Don't unlink any existing file */ |
1177 | umask(prev_mask); | ||
1178 | cleanup_exit(1); | ||
1179 | } | ||
1180 | umask(prev_mask); | ||
1181 | if (listen(sock, SSH_LISTEN_BACKLOG) < 0) { | ||
1182 | perror("listen"); | ||
1183 | cleanup_exit(1); | 1166 | cleanup_exit(1); |
1184 | } | 1167 | } |
1185 | 1168 | ||