you need to setgid in addition to initgroups...
authorMark Spencer <markster@digium.com>
Sun, 8 Jan 2006 20:27:22 +0000 (20:27 +0000)
committerMark Spencer <markster@digium.com>
Sun, 8 Jan 2006 20:27:22 +0000 (20:27 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7869 65c4cc65-6c06-0410-ace0-fbb531ad65f3

asterisk.c

index 21136dd..3563b41 100644 (file)
@@ -2171,7 +2171,11 @@ int main(int argc, char *argv[])
                        ast_log(LOG_WARNING, "No such user '%s'!\n", runuser);
                        exit(1);
                }
-               if (!ast_strlen_zero(rungroup)) {
+               if (!rungroup) {
+                       if (setgid(pw->pw_gid)) {
+                               ast_log(LOG_WARNING, "Unable to setgid to %d!\n", pw->pw_gid);
+                               exit(1);
+                       }
                        if (initgroups(pw->pw_name, pw->pw_gid)) {
                                ast_log(LOG_WARNING, "Unable to init groups for '%s'\n", runuser);
                                exit(1);