mirror of
https://github.com/norohind/hans.git
synced 2025-04-13 13:17:23 +03:00
Remove supplementary groups when dropping privileges
Suggested by xambroz.
This commit is contained in:
parent
5e1004038f
commit
ed3d7de6cc
@ -27,6 +27,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/select.h>
|
||||
#include <grp.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
@ -203,6 +204,9 @@ void Worker::dropPrivileges()
|
||||
#else
|
||||
syslog(LOG_INFO, "dropping privileges");
|
||||
|
||||
if (setgroups(0, NULL) == -1)
|
||||
throw Exception("setgroups", true);
|
||||
|
||||
if (setgid(gid) == -1)
|
||||
throw Exception("setgid", true);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user