View | Details | Raw Unified | Return to bug 2220 | Differences between
and this patch

Collapse All | Expand All

(-)file_not_specified_in_diff (-6 / +26 lines)
Line  Link Here
 ControlPath ~/.ssh/control-master/%m
 ControlPath ~/.ssh/control-master/%m
1
--
2
ssh.c        |   19 +++++++++++++++++++
1
ssh.c        |   19 +++++++++++++++++++
3
ssh_config.5 |    8 +++++---
2
ssh_config.5 |    8 +++++---
4
2 files changed, 24 insertions(+), 3 deletions(-)
3
2 files changed, 24 insertions(+), 3 deletions(-)
5
-- a/ssh.c
4
++ b/ssh.c
Lines 83-88 Link Here
83
#include "canohost.h"
83
#include "canohost.h"
84
#include "compat.h"
84
#include "compat.h"
85
#include "cipher.h"
85
#include "cipher.h"
86
#include "digest.h"
86
#include "packet.h"
87
#include "packet.h"
87
#include "buffer.h"
88
#include "buffer.h"
88
#include "channels.h"
89
#include "channels.h"
Lines 190-195 static int remote_forward_confirms_recei Link Here
190
extern int muxserver_sock;
191
extern int muxserver_sock;
191
extern u_int muxclient_command;
192
extern u_int muxclient_command;
192
193
194
/* Length of mux hash value (using sha1) */
195
#define MUX_DIGEST_LENGTH 20
196
193
/* Prints a help message to the user.  This function never returns. */
197
/* Prints a help message to the user.  This function never returns. */
194
198
195
static void
199
static void
Lines 422-427 main(int ac, char **av) Link Here
422
	extern char *optarg;
426
	extern char *optarg;
423
	Forward fwd;
427
	Forward fwd;
424
	struct addrinfo *addrs = NULL;
428
	struct addrinfo *addrs = NULL;
429
	struct ssh_digest_ctx *md;
430
	unsigned char digest[MUX_DIGEST_LENGTH];
431
	char mux_hash[MUX_DIGEST_LENGTH*2+1];
425
432
426
	/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
433
	/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
427
	sanitise_stdfd();
434
	sanitise_stdfd();
Lines 982-987 main(int ac, char **av) Link Here
982
	shorthost[strcspn(thishost, ".")] = '\0';
989
	shorthost[strcspn(thishost, ".")] = '\0';
983
	snprintf(portstr, sizeof(portstr), "%d", options.port);
990
	snprintf(portstr, sizeof(portstr), "%d", options.port);
984
991
992
	if ((md = ssh_digest_start(SSH_DIGEST_SHA1)) == NULL ||
993
	    ssh_digest_update(md, thishost, strlen(thishost)) < 0 ||
994
	    ssh_digest_update(md, host, strlen(host)) < 0 ||
995
	    ssh_digest_update(md, portstr, strlen(portstr)) < 0 ||
996
	    ssh_digest_update(md, options.user, strlen(options.user)) < 0 ||
997
	    ssh_digest_final(md, digest, sizeof(digest)) < 0)
998
		fatal("%s: mux digest failed", __func__);
999
	for(i = 0; i < MUX_DIGEST_LENGTH; i++)
1000
		sprintf(&mux_hash[i*2], "%02x", (unsigned int)digest[i]);
1001
	ssh_digest_free(md);
1002
985
	if (options.local_command != NULL) {
1003
	if (options.local_command != NULL) {
986
		debug3("expanding LocalCommand: %s", options.local_command);
1004
		debug3("expanding LocalCommand: %s", options.local_command);
987
		cp = options.local_command;
1005
		cp = options.local_command;
Lines 1000-1005 main(int ac, char **av) Link Here
1000
		options.control_path = percent_expand(cp, "h", host,
1018
		options.control_path = percent_expand(cp, "h", host,
1001
		    "l", thishost, "n", host_arg, "r", options.user,
1019
		    "l", thishost, "n", host_arg, "r", options.user,
1002
		    "p", portstr, "u", pw->pw_name, "L", shorthost,
1020
		    "p", portstr, "u", pw->pw_name, "L", shorthost,
1021
		    "m", mux_hash,
1003
		    (char *)NULL);
1022
		    (char *)NULL);
1004
		free(cp);
1023
		free(cp);
1005
	}
1024
	}
1006
-- a/ssh_config.5
1025
++ b/ssh_config.5
Lines 482-495 Link Here
482
.Ql %p
482
.Ql %p
483
the destination port,
483
the destination port,
484
.Ql %r
484
.Ql %r
485
by the remote login username, and
485
by the remote login username,
486
.Ql %u
486
.Ql %u
487
by the username of the user running
487
by the username of the user running
488
.Xr ssh 1 .
488
.Xr ssh 1 , and
489
.Ql %m
490
by the SHA1 digest of the concatenation: %l%h%p%r.
489
It is recommended that any
491
It is recommended that any
490
.Cm ControlPath
492
.Cm ControlPath
491
used for opportunistic connection sharing include
493
used for opportunistic connection sharing include
492
at least %h, %p, and %r.
494
at least %h, %p, and %r (or alternatively %m).
493
This ensures that shared connections are uniquely identified.
495
This ensures that shared connections are uniquely identified.
494
.It Cm ControlPersist
496
.It Cm ControlPersist
495
When used in conjunction with
497
When used in conjunction with

Return to bug 2220