Only set group for "runuser" if "rungroup" is not specified.
authorMark Spencer <markster@digium.com>
Sat, 7 Jan 2006 20:08:51 +0000 (20:08 +0000)
committerMark Spencer <markster@digium.com>
Sat, 7 Jan 2006 20:08:51 +0000 (20:08 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7858 65c4cc65-6c06-0410-ace0-fbb531ad65f3

asterisk.c

index c81a1b1..da156ef 100644 (file)
@@ -2171,9 +2171,11 @@ 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 (!ast_strlen_zero(rungroup))
+                       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);