diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2005-05-27 08:30:38 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2005-05-27 08:30:38 +0000 |
commit | 92679069f4ad386d7cc137e81855898197b88f75 (patch) | |
tree | a0eee1e012180f87c774904e01ebc9f1123799d8 /usr.bin/ssh | |
parent | 5074e8db2f40e746b1e221cc7138206de0441360 (diff) |
fix -O for cases where no ControlPath has been specified or socket at
ControlPath is not contactable; spotted by and ok avsm@
Diffstat (limited to 'usr.bin/ssh')
-rw-r--r-- | usr.bin/ssh/ssh.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/usr.bin/ssh/ssh.c b/usr.bin/ssh/ssh.c index e20aa31a809..3ae12269318 100644 --- a/usr.bin/ssh/ssh.c +++ b/usr.bin/ssh/ssh.c @@ -40,7 +40,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: ssh.c,v 1.239 2005/05/10 10:30:43 djm Exp $"); +RCSID("$OpenBSD: ssh.c,v 1.240 2005/05/27 08:30:37 djm Exp $"); #include <openssl/evp.h> #include <openssl/err.h> @@ -145,7 +145,7 @@ pid_t proxy_command_pid = 0; int control_fd = -1; /* Multiplexing control command */ -static u_int mux_command = SSHMUX_COMMAND_OPEN; +static u_int mux_command = 0; /* Only used in control client mode */ volatile sig_atomic_t control_client_terminate = 0; @@ -605,8 +605,13 @@ again: options.control_path = tilde_expand_filename( options.control_path, original_real_uid); } - if (options.control_path != NULL && options.control_master == 0) + if (mux_command != 0 && options.control_path == NULL) + fatal("No ControlPath specified for \"-O\" command"); + if (options.control_path != NULL && options.control_master == 0) { + if (mux_command == 0) + mux_command = SSHMUX_COMMAND_OPEN; control_client(options.control_path); + } /* Open a connection to the remote host. */ if (ssh_connect(host, &hostaddr, options.port, @@ -1291,6 +1296,10 @@ control_client(const char *path) fatal("%s socket(): %s", __func__, strerror(errno)); if (connect(sock, (struct sockaddr*)&addr, addr.sun_len) == -1) { + if (mux_command != SSHMUX_COMMAND_OPEN) { + fatal("Control socket connect(%.100s): %s", path, + strerror(errno)); + } if (errno == ENOENT) debug("Control socket \"%.100s\" does not exist", path); else { |