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:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user