When creating a passwd struct from a uid that is not in the passwd

database, set pw_gid to the user's gid instead of whatever the user
specified via the -g flag (or 0 if no -g).
This commit is contained in:
Todd C. Miller
2015-04-16 13:19:04 -06:00
parent 3de14196c8
commit e98778b2a2
2 changed files with 2 additions and 2 deletions

View File

@@ -950,7 +950,7 @@ set_runaspw(const char *user, bool quiet)
uid_t uid = sudo_strtoid(user + 1, NULL, NULL, &errstr);
if (errstr == NULL) {
if ((pw = sudo_getpwuid(uid)) == NULL)
pw = sudo_fakepwnam(user, runas_gr ? runas_gr->gr_gid : 0);
pw = sudo_fakepwnam(user, user_gid);
}
}
if (pw == NULL) {