summaryrefslogtreecommitdiff
path: root/ssh-agent.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2014-07-18 14:11:24 +1000
committerDamien Miller <djm@mindrot.org>2014-07-18 14:11:24 +1000
commit7acefbbcbeab725420ea07397ae35992f505f702 (patch)
treebfb07917715d425438dab987a47ccd7a8d7f118b /ssh-agent.c
parent6262d760e00714523633bd989d62e273a3dca99a (diff)
- millert@cvs.openbsd.org 2014/07/15 15:54:14
[PROTOCOL auth-options.c auth-passwd.c auth-rh-rsa.c auth-rhosts.c] [auth-rsa.c auth.c auth1.c auth2-hostbased.c auth2-kbdint.c auth2-none.c] [auth2-passwd.c auth2-pubkey.c auth2.c canohost.c channels.c channels.h] [clientloop.c misc.c misc.h monitor.c mux.c packet.c readconf.c] [readconf.h servconf.c servconf.h serverloop.c session.c ssh-agent.c] [ssh.c ssh_config.5 sshconnect.c sshconnect1.c sshconnect2.c sshd.c] [sshd_config.5 sshlogin.c] Add support for Unix domain socket forwarding. A remote TCP port may be forwarded to a local Unix domain socket and vice versa or both ends may be a Unix domain socket. This is a reimplementation of the streamlocal patches by William Ahern from: http://www.25thandclement.com/~william/projects/streamlocal.html OK djm@ markus@
Diffstat (limited to 'ssh-agent.c')
-rw-r--r--ssh-agent.c23
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