[Asterisk-cvs] asterisk ChangeLog,1.51,1.52 asterisk.c,1.190,1.191
kpfleming
kpfleming
Mon Nov 7 19:39:23 CST 2005
Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv14071
Modified Files:
ChangeLog asterisk.c
Log Message:
issue #5621
Index: ChangeLog
===================================================================
RCS file: /usr/cvsroot/asterisk/ChangeLog,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- ChangeLog 8 Nov 2005 00:12:21 -0000 1.51
+++ ChangeLog 8 Nov 2005 00:30:29 -0000 1.52
@@ -1,5 +1,7 @@
2005-11-07 Kevin P. Fleming <kpfleming at digium.com>
+ * asterisk.c: support 'runuser' and 'rungroup' options in asterisk.conf (issue #5621)
+
* res/Makefile, apps/Makefile, channels/Makefile, Makefile: support WITHOUT_ZAPTEL define to forcibly avoid building Zaptel support (issue #5634)
* Makefile: various fixes (issue #5633)
Index: asterisk.c
===================================================================
RCS file: /usr/cvsroot/asterisk/asterisk.c,v
retrieving revision 1.190
retrieving revision 1.191
diff -u -d -r1.190 -r1.191
--- asterisk.c 5 Nov 2005 18:58:27 -0000 1.190
+++ asterisk.c 8 Nov 2005 00:30:29 -0000 1.191
@@ -194,6 +194,8 @@
char ast_config_AST_PID[AST_CONFIG_MAX_PATH];
char ast_config_AST_SOCKET[AST_CONFIG_MAX_PATH];
char ast_config_AST_RUN_DIR[AST_CONFIG_MAX_PATH];
+char ast_config_AST_RUN_USER[AST_CONFIG_MAX_PATH];
+char ast_config_AST_RUN_GROUP[AST_CONFIG_MAX_PATH];
char ast_config_AST_CTL_PERMISSIONS[AST_CONFIG_MAX_PATH];
char ast_config_AST_CTL_OWNER[AST_CONFIG_MAX_PATH] = "\0";
char ast_config_AST_CTL_GROUP[AST_CONFIG_MAX_PATH] = "\0";
@@ -1885,6 +1887,12 @@
} else if ((sscanf(v->value, "%lf", &option_maxload) != 1) || (option_maxload < 0.0)) {
option_maxload = 0.0;
}
+ /* What user to run as */
+ } else if (!strcasecmp(v->name, "runuser")) {
+ ast_copy_string(ast_config_AST_RUN_USER, v->value, sizeof(ast_config_AST_RUN_USER));
+ /* What group to run as */
+ } else if (!strcasecmp(v->name, "rungroup")) {
+ ast_copy_string(ast_config_AST_RUN_GROUP, v->value, sizeof(ast_config_AST_RUN_GROUP));
}
v = v->next;
}
@@ -2047,6 +2055,10 @@
ast_verbose("[ Reading Master Configuration ]");
ast_readconfig();
+ if ((!rungroup) && !ast_strlen_zero(ast_config_AST_RUN_GROUP))
+ rungroup = ast_config_AST_RUN_GROUP;
+ if ((!runuser) && !ast_strlen_zero(ast_config_AST_RUN_USER))
+ runuser = ast_config_AST_RUN_USER;
#ifndef __CYGWIN__
if (!is_child_of_nonroot && ast_set_priority(option_highpriority)) {
@@ -2064,6 +2076,10 @@
ast_log(LOG_WARNING, "Unable to setgid to %d (%s)\n", gr->gr_gid, rungroup);
exit(1);
}
+ if (setgroups(0, NULL)) {
+ ast_log(LOG_WARNING, "Unable to drop unneeded groups\n");
+ exit(1);
+ }
if (option_verbose)
ast_verbose("Running as group '%s'\n", rungroup);
}
More information about the svn-commits
mailing list