Only set group for "runuser" if "rungroup" is not specified.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7858 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2006-01-07 20:08:51 +00:00
parent bb8882d7fc
commit e9afca36f9

View 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);