]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
commit user/group-related changes from trunk
authorKevin P. Fleming <kpfleming@digium.com>
Mon, 9 Jan 2006 18:11:23 +0000 (18:11 +0000)
committerKevin P. Fleming <kpfleming@digium.com>
Mon, 9 Jan 2006 18:11:23 +0000 (18:11 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@7900 65c4cc65-6c06-0410-ace0-fbb531ad65f3

asterisk.c

index a382b78e459de29fb4902960540839d0d4b62611..2bfbf452a9b060104fc164cff11c33f1facbe6c6 100644 (file)
@@ -2187,6 +2187,16 @@ int main(int argc, char *argv[])
                        ast_log(LOG_WARNING, "No such user '%s'!\n", runuser);
                        exit(1);
                }
+               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);
+                       }
+               }
                if (setuid(pw->pw_uid)) {
                        ast_log(LOG_WARNING, "Unable to setuid to %d (%s)\n", pw->pw_uid, runuser);
                        exit(1);