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:
James Woodcock 2017-05-26 17:14:02 +01:00 committed by Augustin Cavalier
parent d7b12f71ea
commit 5d5be299d1

View File

@ -156,6 +156,12 @@ setup_environment(struct passwd* passwd, bool preserveEnvironment)
if (ioctl(STDIN_FILENO, TIOCSPGRP, &pid) != 0)
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");
if (home == NULL)
return B_ENTRY_NOT_FOUND;