multiuser: Change all groups in setup_environment.
We need to change all groups, not just the primary group. Otherwise, other groups will be left intact, which may include groups the new user doesn't have permissions for.
This commit is contained in:
@@ -202,6 +202,9 @@ setup_environment(struct passwd* passwd, bool preserveEnvironment, bool chngdir)
|
||||
if (passwd->pw_gid && setgid(passwd->pw_gid) != 0)
|
||||
return errno;
|
||||
|
||||
if (initgroups(passwd->pw_name, passwd->pw_gid) != 0)
|
||||
return errno;
|
||||
|
||||
if (passwd->pw_uid && setuid(passwd->pw_uid) != 0)
|
||||
return errno;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user