Initialize groups properly
authorMark Spencer <markster@digium.com>
Sat, 7 Jan 2006 19:42:05 +0000 (19:42 +0000)
committerMark Spencer <markster@digium.com>
Sat, 7 Jan 2006 19:42:05 +0000 (19:42 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7857 65c4cc65-6c06-0410-ace0-fbb531ad65f3

asterisk.c

index 2e47563..c81a1b1 100644 (file)
@@ -2171,6 +2171,10 @@ int main(int argc, char *argv[])
                        ast_log(LOG_WARNING, "No such user '%s'!\n", runuser);
                        exit(1);
                }
+               if (initgroups(pw->pw_name, pw->pw_gid)) {
+                       ast_log(LOG_WARNING, "Unable to init groups for '%s'\n", runuser);
+                       exit(1);
+               }
                if (setuid(pw->pw_uid)) {
                        ast_log(LOG_WARNING, "Unable to setuid to %d (%s)\n", pw->pw_uid, runuser);
                        exit(1);