diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | mux.c | 16 |
2 files changed, 17 insertions, 6 deletions
@@ -1,3 +1,10 @@ | |||
1 | 20110515 | ||
2 | - (djm) OpenBSD CVS Sync | ||
3 | - djm@cvs.openbsd.org 2011/05/05 05:12:08 | ||
4 | [mux.c] | ||
5 | gracefully fall back when ControlPath is too large for a | ||
6 | sockaddr_un. ok markus@ as part of a larger diff | ||
7 | |||
1 | 20110510 | 8 | 20110510 |
2 | - (dtucker) [openbsd-compat/openssl-compat.{c,h}] Bug #1882: fix | 9 | - (dtucker) [openbsd-compat/openssl-compat.{c,h}] Bug #1882: fix |
3 | --with-ssl-engine which was broken with the change from deprecated | 10 | --with-ssl-engine which was broken with the change from deprecated |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: mux.c,v 1.25 2011/04/17 22:42:41 djm Exp $ */ | 1 | /* $OpenBSD: mux.c,v 1.26 2011/05/05 05:12:08 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org> | 3 | * Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org> |
4 | * | 4 | * |
@@ -1095,21 +1095,25 @@ muxserver_listen(void) | |||
1095 | strlen(options.control_path) + 1; | 1095 | strlen(options.control_path) + 1; |
1096 | 1096 | ||
1097 | if (strlcpy(addr.sun_path, options.control_path, | 1097 | if (strlcpy(addr.sun_path, options.control_path, |
1098 | sizeof(addr.sun_path)) >= sizeof(addr.sun_path)) | 1098 | sizeof(addr.sun_path)) >= sizeof(addr.sun_path)) { |
1099 | fatal("ControlPath too long"); | 1099 | error("ControlPath \"%s\" too long for Unix domain socket", |
1100 | options.control_path); | ||
1101 | goto disable_mux_master; | ||
1102 | } | ||
1100 | 1103 | ||
1101 | if ((muxserver_sock = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) | 1104 | if ((muxserver_sock = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) |
1102 | fatal("%s socket(): %s", __func__, strerror(errno)); | 1105 | fatal("%s socket(): %s", __func__, strerror(errno)); |
1103 | 1106 | ||
1104 | old_umask = umask(0177); | 1107 | old_umask = umask(0177); |
1105 | if (bind(muxserver_sock, (struct sockaddr *)&addr, sun_len) == -1) { | 1108 | if (bind(muxserver_sock, (struct sockaddr *)&addr, sun_len) == -1) { |
1106 | muxserver_sock = -1; | ||
1107 | if (errno == EINVAL || errno == EADDRINUSE) { | 1109 | if (errno == EINVAL || errno == EADDRINUSE) { |
1108 | error("ControlSocket %s already exists, " | 1110 | error("ControlSocket %s already exists, " |
1109 | "disabling multiplexing", options.control_path); | 1111 | "disabling multiplexing", options.control_path); |
1110 | disable_mux_master: | 1112 | disable_mux_master: |
1111 | close(muxserver_sock); | 1113 | if (muxserver_sock != -1) { |
1112 | muxserver_sock = -1; | 1114 | close(muxserver_sock); |
1115 | muxserver_sock = -1; | ||
1116 | } | ||
1113 | xfree(options.control_path); | 1117 | xfree(options.control_path); |
1114 | options.control_path = NULL; | 1118 | options.control_path = NULL; |
1115 | options.control_master = SSHCTL_MASTER_NO; | 1119 | options.control_master = SSHCTL_MASTER_NO; |