- djm@cvs.openbsd.org 2011/05/05 05:12:08
[mux.c] gracefully fall back when ControlPath is too large for a sockaddr_un. ok markus@ as part of a larger diff
This commit is contained in:
parent
d6548fe4cf
commit
60432d8cf2
|
@ -1,3 +1,10 @@
|
||||||
|
20110515
|
||||||
|
- (djm) OpenBSD CVS Sync
|
||||||
|
- djm@cvs.openbsd.org 2011/05/05 05:12:08
|
||||||
|
[mux.c]
|
||||||
|
gracefully fall back when ControlPath is too large for a
|
||||||
|
sockaddr_un. ok markus@ as part of a larger diff
|
||||||
|
|
||||||
20110510
|
20110510
|
||||||
- (dtucker) [openbsd-compat/openssl-compat.{c,h}] Bug #1882: fix
|
- (dtucker) [openbsd-compat/openssl-compat.{c,h}] Bug #1882: fix
|
||||||
--with-ssl-engine which was broken with the change from deprecated
|
--with-ssl-engine which was broken with the change from deprecated
|
||||||
|
|
16
mux.c
16
mux.c
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: mux.c,v 1.25 2011/04/17 22:42:41 djm Exp $ */
|
/* $OpenBSD: mux.c,v 1.26 2011/05/05 05:12:08 djm Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org>
|
* Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org>
|
||||||
*
|
*
|
||||||
|
@ -1095,21 +1095,25 @@ muxserver_listen(void)
|
||||||
strlen(options.control_path) + 1;
|
strlen(options.control_path) + 1;
|
||||||
|
|
||||||
if (strlcpy(addr.sun_path, options.control_path,
|
if (strlcpy(addr.sun_path, options.control_path,
|
||||||
sizeof(addr.sun_path)) >= sizeof(addr.sun_path))
|
sizeof(addr.sun_path)) >= sizeof(addr.sun_path)) {
|
||||||
fatal("ControlPath too long");
|
error("ControlPath \"%s\" too long for Unix domain socket",
|
||||||
|
options.control_path);
|
||||||
|
goto disable_mux_master;
|
||||||
|
}
|
||||||
|
|
||||||
if ((muxserver_sock = socket(PF_UNIX, SOCK_STREAM, 0)) < 0)
|
if ((muxserver_sock = socket(PF_UNIX, SOCK_STREAM, 0)) < 0)
|
||||||
fatal("%s socket(): %s", __func__, strerror(errno));
|
fatal("%s socket(): %s", __func__, strerror(errno));
|
||||||
|
|
||||||
old_umask = umask(0177);
|
old_umask = umask(0177);
|
||||||
if (bind(muxserver_sock, (struct sockaddr *)&addr, sun_len) == -1) {
|
if (bind(muxserver_sock, (struct sockaddr *)&addr, sun_len) == -1) {
|
||||||
muxserver_sock = -1;
|
|
||||||
if (errno == EINVAL || errno == EADDRINUSE) {
|
if (errno == EINVAL || errno == EADDRINUSE) {
|
||||||
error("ControlSocket %s already exists, "
|
error("ControlSocket %s already exists, "
|
||||||
"disabling multiplexing", options.control_path);
|
"disabling multiplexing", options.control_path);
|
||||||
disable_mux_master:
|
disable_mux_master:
|
||||||
close(muxserver_sock);
|
if (muxserver_sock != -1) {
|
||||||
muxserver_sock = -1;
|
close(muxserver_sock);
|
||||||
|
muxserver_sock = -1;
|
||||||
|
}
|
||||||
xfree(options.control_path);
|
xfree(options.control_path);
|
||||||
options.control_path = NULL;
|
options.control_path = NULL;
|
||||||
options.control_master = SSHCTL_MASTER_NO;
|
options.control_master = SSHCTL_MASTER_NO;
|
||||||
|
|
Loading…
Reference in New Issue