AuthorizedKeysCommandUser: use the user being authenticated by default (#953534)

This commit is contained in:
Petr Lautrbach 2013-04-19 14:12:14 +02:00
parent 1e3cc96dcb
commit fb00871f19

View File

@ -119,20 +119,20 @@ diff -up openssh-6.1p1/auth2-pubkey.c.akc openssh-6.1p1/auth2-pubkey.c
+ return 0; + return 0;
+ +
+ if (options.authorized_keys_command_user == NULL) { + if (options.authorized_keys_command_user == NULL) {
+ error("No user for AuthorizedKeysCommand specified, skipping"); + pw = user_pw;
+ return 0;
+ } + }
+ + else {
+ username = percent_expand(options.authorized_keys_command_user, + username = percent_expand(options.authorized_keys_command_user,
+ "u", user_pw->pw_name, (char *)NULL); + "u", user_pw->pw_name, (char *)NULL);
+ pw = getpwnam(username); + pw = getpwnam(username);
+ if (pw == NULL) { + if (pw == NULL) {
+ error("AuthorizedKeyCommandUser \"%s\" not found: %s", + error("AuthorizedKeyCommandUser \"%s\" not found: %s",
+ username, strerror(errno)); + username, strerror(errno));
+ free(username);
+ return 0;
+ }
+ free(username); + free(username);
+ return 0;
+ } + }
+ free(username);
+ +
+ temporarily_use_uid(pw); + temporarily_use_uid(pw);
+ +