summaryrefslogtreecommitdiffstats
path: root/usr.bin/ssh/auth.c
diff options
context:
space:
mode:
authordjm <djm@openbsd.org>2018-06-01 03:33:53 +0000
committerdjm <djm@openbsd.org>2018-06-01 03:33:53 +0000
commitef0a268e213e50fbb9924f5366593dd8eced7607 (patch)
tree48c973bd18fb5254cbd1f3879b6fd2e6553a5564 /usr.bin/ssh/auth.c
parentBump ELF_RANDOMIZE_LIMIT to 1MB. (diff)
downloadwireguard-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/auth.c')
-rw-r--r--usr.bin/ssh/auth.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/ssh/auth.c b/usr.bin/ssh/auth.c
index 999677bc746..d393d138ca8 100644
--- a/usr.bin/ssh/auth.c
+++ b/usr.bin/ssh/auth.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: auth.c,v 1.128 2018/05/25 07:11:01 djm Exp $ */
+/* $OpenBSD: auth.c,v 1.129 2018/06/01 03:33:53 djm Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
*
@@ -332,11 +332,13 @@ auth_root_allowed(struct ssh *ssh, const char *method)
char *
expand_authorized_keys(const char *filename, struct passwd *pw)
{
- char *file, ret[PATH_MAX];
+ char *file, uidstr[32], ret[PATH_MAX];
int i;
+ snprintf(uidstr, sizeof(uidstr), "%llu",
+ (unsigned long long)pw->pw_uid);
file = percent_expand(filename, "h", pw->pw_dir,
- "u", pw->pw_name, (char *)NULL);
+ "u", pw->pw_name, "U", uidstr, (char *)NULL);
/*
* Ensure that filename starts anchored. If not, be backward