From 9c935dd9bf05628826ad2495d3e8bdf3d3271c21 Mon Sep 17 00:00:00 2001 From: "djm@openbsd.org" Date: Fri, 1 Jun 2018 03:33:53 +0000 Subject: 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 --- auth.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'auth.c') diff --git a/auth.c b/auth.c index 0b7a335f..573cd03b 100644 --- a/auth.c +++ b/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. * @@ -422,11 +422,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 -- cgit v1.2.3