[PATCH 1/1] uid for expansion in ControlPath

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

 



From: Christian Hesse <mail@xxxxxxxx>

Modern Linux systems create a private directory in /run/user/ for each
user, named by user id. This adds a new character sequence '%i' for
expansion in ControlPath to match thisi directory.

Signed-off-by: Christian Hesse <mail@xxxxxxxx>
---
 ssh.c        | 5 ++++-
 ssh_config.5 | 4 +++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/ssh.c b/ssh.c
index 59c1f93..c4de144 100644
--- a/ssh.c
+++ b/ssh.c
@@ -505,7 +505,8 @@ main(int ac, char **av)
 {
 	int i, r, opt, exit_status, use_syslog, config_test = 0;
 	char *p, *cp, *line, *argv0, buf[PATH_MAX], *host_arg, *logfile;
-	char thishost[NI_MAXHOST], shorthost[NI_MAXHOST], portstr[NI_MAXSERV];
+	char thishost[NI_MAXHOST], shorthost[NI_MAXHOST], portstr[NI_MAXSERV],
+	    uidstr[11];
 	char cname[NI_MAXHOST];
 	struct stat st;
 	struct passwd *pw;
@@ -1122,6 +1123,7 @@ main(int ac, char **av)
 	strlcpy(shorthost, thishost, sizeof(shorthost));
 	shorthost[strcspn(thishost, ".")] = '\0';
 	snprintf(portstr, sizeof(portstr), "%d", options.port);
+	snprintf(uidstr, sizeof(uidstr), "%d", pw->pw_uid);
 
 	if ((md = ssh_digest_start(SSH_DIGEST_SHA1)) == NULL ||
 	    ssh_digest_update(md, thishost, strlen(thishost)) < 0 ||
@@ -1164,6 +1166,7 @@ main(int ac, char **av)
 		    "p", portstr,
 		    "r", options.user,
 		    "u", pw->pw_name,
+		    "i", uidstr,
 		    (char *)NULL);
 		free(cp);
 	}
diff --git a/ssh_config.5 b/ssh_config.5
index 5b0975f..852f79d 100644
--- a/ssh_config.5
+++ b/ssh_config.5
@@ -538,7 +538,9 @@ the destination port,
 .Ql %r
 by the remote login username,
 .Ql %u
-by the username of the user running
+by the username and
+.Ql %i
+by the userid of the user running
 .Xr ssh 1 , and
 .Ql \&%C
 by a hash of the concatenation: %l%h%p%r.
-- 
2.5.0

_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@xxxxxxxxxxx
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev



[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux