diff options
author | djm@openbsd.org <djm@openbsd.org> | 2018-06-01 03:33:53 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2018-06-01 13:35:59 +1000 |
commit | 9c935dd9bf05628826ad2495d3e8bdf3d3271c21 (patch) | |
tree | 35ccf63e51d3daf2fa927b843d813295e41e96e6 /readconf.c | |
parent | d8748b91d1d6c108c0c260ed41fa55f37b9ef34b (diff) |
upstream: 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@
OpenBSD-Commit-ID: c7e912b0213713316cb55db194b3a6415b3d4b95
Diffstat (limited to 'readconf.c')
-rw-r--r-- | readconf.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/readconf.c b/readconf.c index 7b7a0d7e0..9c4a234b5 100644 --- a/readconf.c +++ b/readconf.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: readconf.c,v 1.287 2018/05/22 00:13:26 djm Exp $ */ | 1 | /* $OpenBSD: readconf.c,v 1.288 2018/06/01 03:33:53 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -551,6 +551,7 @@ match_cfg_line(Options *options, char **condition, struct passwd *pw, | |||
551 | const char *ruser; | 551 | const char *ruser; |
552 | int r, port, this_result, result = 1, attributes = 0, negate; | 552 | int r, port, this_result, result = 1, attributes = 0, negate; |
553 | char thishost[NI_MAXHOST], shorthost[NI_MAXHOST], portstr[NI_MAXSERV]; | 553 | char thishost[NI_MAXHOST], shorthost[NI_MAXHOST], portstr[NI_MAXSERV]; |
554 | char uidstr[32]; | ||
554 | 555 | ||
555 | /* | 556 | /* |
556 | * Configuration is likely to be incomplete at this point so we | 557 | * Configuration is likely to be incomplete at this point so we |
@@ -631,6 +632,8 @@ match_cfg_line(Options *options, char **condition, struct passwd *pw, | |||
631 | strlcpy(shorthost, thishost, sizeof(shorthost)); | 632 | strlcpy(shorthost, thishost, sizeof(shorthost)); |
632 | shorthost[strcspn(thishost, ".")] = '\0'; | 633 | shorthost[strcspn(thishost, ".")] = '\0'; |
633 | snprintf(portstr, sizeof(portstr), "%d", port); | 634 | snprintf(portstr, sizeof(portstr), "%d", port); |
635 | snprintf(uidstr, sizeof(uidstr), "%llu", | ||
636 | (unsigned long long)pw->pw_uid); | ||
634 | 637 | ||
635 | cmd = percent_expand(arg, | 638 | cmd = percent_expand(arg, |
636 | "L", shorthost, | 639 | "L", shorthost, |
@@ -641,6 +644,7 @@ match_cfg_line(Options *options, char **condition, struct passwd *pw, | |||
641 | "p", portstr, | 644 | "p", portstr, |
642 | "r", ruser, | 645 | "r", ruser, |
643 | "u", pw->pw_name, | 646 | "u", pw->pw_name, |
647 | "i", uidstr, | ||
644 | (char *)NULL); | 648 | (char *)NULL); |
645 | if (result != 1) { | 649 | if (result != 1) { |
646 | /* skip execution if prior predicate failed */ | 650 | /* skip execution if prior predicate failed */ |