diff options
author | 2018-06-01 03:33:53 +0000 | |
---|---|---|
committer | 2018-06-01 03:33:53 +0000 | |
commit | ef0a268e213e50fbb9924f5366593dd8eced7607 (patch) | |
tree | 48c973bd18fb5254cbd1f3879b6fd2e6553a5564 /usr.bin/ssh/readconf.c | |
parent | Bump ELF_RANDOMIZE_LIMIT to 1MB. (diff) | |
download | wireguard-openbsd-ef0a268e213e50fbb9924f5366593dd8eced7607.tar.xz wireguard-openbsd-ef0a268e213e50fbb9924f5366593dd8eced7607.zip |
make UID available as a %-expansion everywhere that the username is
available currently. In the client this is via %i, in the server %U
(since %i was already used in the client in some places for this, but
used for something different in the server);
bz#2870, ok dtucker@
Diffstat (limited to 'usr.bin/ssh/readconf.c')
-rw-r--r-- | usr.bin/ssh/readconf.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.bin/ssh/readconf.c b/usr.bin/ssh/readconf.c index 9cb40e1f432..e580a910de9 100644 --- a/usr.bin/ssh/readconf.c +++ b/usr.bin/ssh/readconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: readconf.c,v 1.287 2018/05/22 00:13:26 djm Exp $ */ +/* $OpenBSD: readconf.c,v 1.288 2018/06/01 03:33:53 djm Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -536,6 +536,7 @@ match_cfg_line(Options *options, char **condition, struct passwd *pw, const char *ruser; int r, port, this_result, result = 1, attributes = 0, negate; char thishost[NI_MAXHOST], shorthost[NI_MAXHOST], portstr[NI_MAXSERV]; + char uidstr[32]; /* * Configuration is likely to be incomplete at this point so we @@ -616,6 +617,8 @@ match_cfg_line(Options *options, char **condition, struct passwd *pw, strlcpy(shorthost, thishost, sizeof(shorthost)); shorthost[strcspn(thishost, ".")] = '\0'; snprintf(portstr, sizeof(portstr), "%d", port); + snprintf(uidstr, sizeof(uidstr), "%llu", + (unsigned long long)pw->pw_uid); cmd = percent_expand(arg, "L", shorthost, @@ -626,6 +629,7 @@ match_cfg_line(Options *options, char **condition, struct passwd *pw, "p", portstr, "r", ruser, "u", pw->pw_name, + "i", uidstr, (char *)NULL); if (result != 1) { /* skip execution if prior predicate failed */ |