multiuser: login process should call setuid() and setgid().
The login process didn't call setuid() or setgid() so all users were logged in as the super user. Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com> Fixes #13533.
This commit is contained in:
parent
d7b12f71ea
commit
5d5be299d1
@ -156,6 +156,12 @@ setup_environment(struct passwd* passwd, bool preserveEnvironment)
|
|||||||
if (ioctl(STDIN_FILENO, TIOCSPGRP, &pid) != 0)
|
if (ioctl(STDIN_FILENO, TIOCSPGRP, &pid) != 0)
|
||||||
return errno;
|
return errno;
|
||||||
|
|
||||||
|
if (passwd->pw_gid && setgid(passwd->pw_gid) != 0)
|
||||||
|
return errno;
|
||||||
|
|
||||||
|
if (passwd->pw_uid && setuid(passwd->pw_uid) != 0)
|
||||||
|
return errno;
|
||||||
|
|
||||||
const char* home = getenv("HOME");
|
const char* home = getenv("HOME");
|
||||||
if (home == NULL)
|
if (home == NULL)
|
||||||
return B_ENTRY_NOT_FOUND;
|
return B_ENTRY_NOT_FOUND;
|
||||||
|
Loading…
Reference in New Issue
Block a user