use setgroups()

git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@42 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
Joshua Kwan 2004-01-02 20:39:02 +00:00
parent c9ed0149c6
commit ad799b2374
1 changed files with 17 additions and 2 deletions

View File

@ -1072,8 +1072,23 @@ main (void)
}
/* shed privs. this is done immediately after chroot. */
setgid (newgid);
setuid (newuid);
if (setgroups(1, &newgid) == -1)
{
perror("setgroups");
exit(1);
}
if (setgid (1, newgid) == -1)
{
perror("setgid");
exit(1);
}
if (setuid (1, newuid) == -1)
{
perror("setuid");
exit(1);
}
/* simple login routine, uses ncurses */
if (readfile (0))