summaryrefslogtreecommitdiff
path: root/ssh.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssh.c')
-rw-r--r--ssh.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/ssh.c b/ssh.c
index 7754f581c..43ecbd924 100644
--- a/ssh.c
+++ b/ssh.c
@@ -40,7 +40,7 @@
40 */ 40 */
41 41
42#include "includes.h" 42#include "includes.h"
43RCSID("$OpenBSD: ssh.c,v 1.239 2005/05/10 10:30:43 djm Exp $"); 43RCSID("$OpenBSD: ssh.c,v 1.240 2005/05/27 08:30:37 djm Exp $");
44 44
45#include <openssl/evp.h> 45#include <openssl/evp.h>
46#include <openssl/err.h> 46#include <openssl/err.h>
@@ -145,7 +145,7 @@ pid_t proxy_command_pid = 0;
145int control_fd = -1; 145int control_fd = -1;
146 146
147/* Multiplexing control command */ 147/* Multiplexing control command */
148static u_int mux_command = SSHMUX_COMMAND_OPEN; 148static u_int mux_command = 0;
149 149
150/* Only used in control client mode */ 150/* Only used in control client mode */
151volatile sig_atomic_t control_client_terminate = 0; 151volatile sig_atomic_t control_client_terminate = 0;
@@ -612,8 +612,13 @@ again:
612 options.control_path = tilde_expand_filename( 612 options.control_path = tilde_expand_filename(
613 options.control_path, original_real_uid); 613 options.control_path, original_real_uid);
614 } 614 }
615 if (options.control_path != NULL && options.control_master == 0) 615 if (mux_command != 0 && options.control_path == NULL)
616 fatal("No ControlPath specified for \"-O\" command");
617 if (options.control_path != NULL && options.control_master == 0) {
618 if (mux_command == 0)
619 mux_command = SSHMUX_COMMAND_OPEN;
616 control_client(options.control_path); 620 control_client(options.control_path);
621 }
617 622
618 /* Open a connection to the remote host. */ 623 /* Open a connection to the remote host. */
619 if (ssh_connect(host, &hostaddr, options.port, 624 if (ssh_connect(host, &hostaddr, options.port,
@@ -1303,6 +1308,10 @@ control_client(const char *path)
1303 fatal("%s socket(): %s", __func__, strerror(errno)); 1308 fatal("%s socket(): %s", __func__, strerror(errno));
1304 1309
1305 if (connect(sock, (struct sockaddr*)&addr, addr_len) == -1) { 1310 if (connect(sock, (struct sockaddr*)&addr, addr_len) == -1) {
1311 if (mux_command != SSHMUX_COMMAND_OPEN) {
1312 fatal("Control socket connect(%.100s): %s", path,
1313 strerror(errno));
1314 }
1306 if (errno == ENOENT) 1315 if (errno == ENOENT)
1307 debug("Control socket \"%.100s\" does not exist", path); 1316 debug("Control socket \"%.100s\" does not exist", path);
1308 else { 1317 else {