From ad799b23740857e6210de2f1b67b62f6ce425bfa Mon Sep 17 00:00:00 2001 From: Joshua Kwan Date: Fri, 2 Jan 2004 20:39:02 +0000 Subject: [PATCH] use setgroups() git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@42 db0b04b0-f4d1-0310-9a6d-de3e77497b0e --- dgamelaunch.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/dgamelaunch.c b/dgamelaunch.c index 846e6fb..466d0ca 100644 --- a/dgamelaunch.c +++ b/dgamelaunch.c @@ -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))