Userspace: init now sets user and group ids before running their shell

This commit is contained in:
Bananymous 2023-06-11 22:32:51 +03:00
parent e9217b3484
commit f67f8ccbe0
1 changed files with 5 additions and 0 deletions

View File

@ -131,6 +131,11 @@ int main()
{
printf("Welcome back %s!\n", user.name.data());
if (setgid(user.gid) == -1)
perror("setgid");
if (setuid(user.uid) == -1)
perror("setuid");
execl(user.shell.data(), user.shell.data(), nullptr);
perror("execl");