Call setgroups() before setgid/setuid

fixes #6659
This commit is contained in:
Gunnar Beutner 2014-07-11 14:26:21 +02:00
parent b80c3b2df4
commit 4cc51f990f
1 changed files with 7 additions and 0 deletions

View File

@ -403,6 +403,13 @@ int Main(void)
}
}
if (setgroups(0, NULL) < 0) {
std::ostringstream msgbuf;
msgbuf << "setgroups() failed with error code " << errno << ", \"" << Utility::FormatErrorNumber(errno) << "\"";
Log(LogCritical, "icinga-app", msgbuf.str());
return EXIT_FAILURE;
}
if (setgid(gr->gr_gid) < 0) {
std::ostringstream msgbuf;
msgbuf << "setgid() failed with error code " << errno << ", \"" << Utility::FormatErrorNumber(errno) << "\"";