summaryrefslogtreecommitdiff
path: root/ssh.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssh.c')
-rw-r--r--ssh.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/ssh.c b/ssh.c
index 0871d06de..a27c45725 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.241 2005/06/06 11:20:36 djm Exp $"); 43RCSID("$OpenBSD: ssh.c,v 1.242 2005/06/08 11:25:09 djm Exp $");
44 44
45#include <openssl/evp.h> 45#include <openssl/evp.h>
46#include <openssl/err.h> 46#include <openssl/err.h>
@@ -386,8 +386,10 @@ again:
386 } 386 }
387 break; 387 break;
388 case 'M': 388 case 'M':
389 options.control_master = 389 if (options.control_master == SSHCTL_MASTER_YES)
390 (options.control_master >= 1) ? 2 : 1; 390 options.control_master = SSHCTL_MASTER_ASK;
391 else
392 options.control_master = SSHCTL_MASTER_YES;
391 break; 393 break;
392 case 'p': 394 case 'p':
393 options.port = a2port(optarg); 395 options.port = a2port(optarg);
@@ -618,11 +620,8 @@ again:
618 } 620 }
619 if (mux_command != 0 && options.control_path == NULL) 621 if (mux_command != 0 && options.control_path == NULL)
620 fatal("No ControlPath specified for \"-O\" command"); 622 fatal("No ControlPath specified for \"-O\" command");
621 if (options.control_path != NULL && options.control_master == 0) { 623 if (options.control_path != NULL)
622 if (mux_command == 0)
623 mux_command = SSHMUX_COMMAND_OPEN;
624 control_client(options.control_path); 624 control_client(options.control_path);
625 }
626 625
627 /* Open a connection to the remote host. */ 626 /* Open a connection to the remote host. */
628 if (ssh_connect(host, &hostaddr, options.port, 627 if (ssh_connect(host, &hostaddr, options.port,
@@ -1086,9 +1085,12 @@ ssh_control_listener(void)
1086 mode_t old_umask; 1085 mode_t old_umask;
1087 int addr_len; 1086 int addr_len;
1088 1087
1089 if (options.control_path == NULL || options.control_master <= 0) 1088 if (options.control_path == NULL ||
1089 options.control_master == SSHCTL_MASTER_NO)
1090 return; 1090 return;
1091 1091
1092 debug("setting up multiplex master socket");
1093
1092 memset(&addr, '\0', sizeof(addr)); 1094 memset(&addr, '\0', sizeof(addr));
1093 addr.sun_family = AF_UNIX; 1095 addr.sun_family = AF_UNIX;
1094 addr_len = offsetof(struct sockaddr_un, sun_path) + 1096 addr_len = offsetof(struct sockaddr_un, sun_path) +
@@ -1299,6 +1301,20 @@ control_client(const char *path)
1299 extern char **environ; 1301 extern char **environ;
1300 u_int flags; 1302 u_int flags;
1301 1303
1304 if (mux_command == 0)
1305 mux_command = SSHMUX_COMMAND_OPEN;
1306
1307 switch (options.control_master) {
1308 case SSHCTL_MASTER_AUTO:
1309 case SSHCTL_MASTER_AUTO_ASK:
1310 debug("auto-mux: Trying existing master");
1311 /* FALLTHROUGH */
1312 case SSHCTL_MASTER_NO:
1313 break;
1314 default:
1315 return;
1316 }
1317
1302 memset(&addr, '\0', sizeof(addr)); 1318 memset(&addr, '\0', sizeof(addr));
1303 addr.sun_family = AF_UNIX; 1319 addr.sun_family = AF_UNIX;
1304 addr_len = offsetof(struct sockaddr_un, sun_path) + 1320 addr_len = offsetof(struct sockaddr_un, sun_path) +