[asterisk-commits] branch 1.2 - r7900 /branches/1.2/asterisk.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Jan 9 12:11:24 CST 2006


Author: kpfleming
Date: Mon Jan  9 12:11:23 2006
New Revision: 7900

URL: http://svn.digium.com/view/asterisk?rev=7900&view=rev
Log:
commit user/group-related changes from trunk

Modified:
    branches/1.2/asterisk.c

Modified: branches/1.2/asterisk.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/asterisk.c?rev=7900&r1=7899&r2=7900&view=diff
==============================================================================
--- branches/1.2/asterisk.c (original)
+++ branches/1.2/asterisk.c Mon Jan  9 12:11:23 2006
@@ -2187,6 +2187,16 @@
 			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);



More information about the asterisk-commits mailing list