Bugzilla – Attachment 2451 Details for
Bug 2220
Add uuid-style identifier for use with ControlPath
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
tweaked patch
connection-hash.diff (text/plain), 3.75 KB, created by
Damien Miller
on 2014-07-03 14:47:02 AEST
(
hide
)
Description:
tweaked patch
Filename:
MIME Type:
Creator:
Damien Miller
Created:
2014-07-03 14:47:02 AEST
Size:
3.75 KB
patch
obsolete
>diff --git ssh.c ssh.c >index 17f6363..1435e14 100644 >--- ssh.c >+++ ssh.c >@@ -76,6 +76,7 @@ > #include "canohost.h" > #include "compat.h" > #include "cipher.h" >+#include "digest.h" > #include "packet.h" > #include "buffer.h" > #include "channels.h" >@@ -178,7 +179,6 @@ static int remote_forward_confirms_received = 0; > extern int muxserver_sock; > extern u_int muxclient_command; > >- > /* Prints a help message to the user. This function never returns. */ > > static void >@@ -411,6 +411,9 @@ main(int ac, char **av) > extern char *optarg; > Forward fwd; > struct addrinfo *addrs = NULL; >+ struct ssh_digest_ctx *md; >+ u_char conn_hash[SSH_DIGEST_MAX_LENGTH]; >+ char *conn_hash_hex; > > /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ > sanitise_stdfd(); >@@ -970,12 +973,29 @@ main(int ac, char **av) > shorthost[strcspn(thishost, ".")] = '\0'; > snprintf(portstr, sizeof(portstr), "%d", options.port); > >+ if ((md = ssh_digest_start(SSH_DIGEST_SHA1)) == NULL || >+ ssh_digest_update(md, thishost, strlen(thishost)) < 0 || >+ ssh_digest_update(md, host, strlen(host)) < 0 || >+ ssh_digest_update(md, portstr, strlen(portstr)) < 0 || >+ ssh_digest_update(md, options.user, strlen(options.user)) < 0 || >+ ssh_digest_final(md, conn_hash, sizeof(conn_hash)) < 0) >+ fatal("%s: mux digest failed", __func__); >+ ssh_digest_free(md); >+ conn_hash_hex = tohex(conn_hash, ssh_digest_bytes(SSH_DIGEST_SHA1)); >+ > if (options.local_command != NULL) { > debug3("expanding LocalCommand: %s", options.local_command); > cp = options.local_command; >- options.local_command = percent_expand(cp, "d", pw->pw_dir, >- "h", host, "l", thishost, "n", host_arg, "r", options.user, >- "p", portstr, "u", pw->pw_name, "L", shorthost, >+ options.local_command = percent_expand(cp, >+ "C", conn_hash_hex, >+ "L", shorthost, >+ "d", pw->pw_dir, >+ "h", host, >+ "l", thishost, >+ "n", host_arg, >+ "p", portstr, >+ "r", options.user, >+ "u", pw->pw_name, > (char *)NULL); > debug3("expanded LocalCommand: %s", options.local_command); > free(cp); >@@ -985,12 +1005,20 @@ main(int ac, char **av) > cp = tilde_expand_filename(options.control_path, > original_real_uid); > free(options.control_path); >- options.control_path = percent_expand(cp, "h", host, >- "l", thishost, "n", host_arg, "r", options.user, >- "p", portstr, "u", pw->pw_name, "L", shorthost, >+ options.control_path = percent_expand(cp, >+ "C", conn_hash_hex, >+ "L", shorthost, >+ "h", host, >+ "l", thishost, >+ "n", host_arg, >+ "p", portstr, >+ "r", options.user, >+ "u", pw->pw_name, > (char *)NULL); > free(cp); > } >+ free(conn_hash_hex); >+ > if (muxclient_command != 0 && options.control_path == NULL) > fatal("No ControlPath specified for \"-O\" command"); > if (options.control_path != NULL) >diff --git ssh_config.5 ssh_config.5 >index f96f37b..9624bf3 100644 >--- ssh_config.5 >+++ ssh_config.5 >@@ -499,14 +499,16 @@ specified on the command line, > .Ql %p > the destination port, > .Ql %r >-by the remote login username, and >+by the remote login username, > .Ql %u > by the username of the user running >-.Xr ssh 1 . >+.Xr ssh 1 , and >+.Ql %C >+by a hash of the concatenation: %l%h%p%r. > It is recommended that any > .Cm ControlPath > used for opportunistic connection sharing include >-at least %h, %p, and %r. >+at least %h, %p, and %r (or alternatively %C). > This ensures that shared connections are uniquely identified. > .It Cm ControlPersist > When used in conjunction with >@@ -933,7 +935,9 @@ The following escape character substitutions will be performed: > .Ql %r > (remote user name) or > .Ql %u >-(local user name). >+(local user name) or >+.Ql %C >+by a hash of the concatenation: %l%h%p%r. > .Pp > The command is run synchronously and does not have access to the > session of the
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 2220
:
2418
| 2451