mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-10-14 02:22:03 +08:00
call setgroups() after setgid() to avoid staying with an unexpected group set.
This commit is contained in:
+9
-1
@@ -49,6 +49,7 @@
|
||||
#include <worker.h>
|
||||
#include <cookies.h>
|
||||
#include <tun.h>
|
||||
#include <grp.h>
|
||||
#include <ip-lease.h>
|
||||
#include <ccan/list/list.h>
|
||||
|
||||
@@ -362,7 +363,14 @@ static void drop_privileges(main_server_st* s)
|
||||
mslog(s, NULL, LOG_ERR, "cannot set gid to %d: %s\n",
|
||||
(int) s->config->gid, strerror(e));
|
||||
exit(1);
|
||||
|
||||
}
|
||||
|
||||
ret = setgroups(1, &s->config->gid);
|
||||
if (ret < 0) {
|
||||
e = errno;
|
||||
mslog(s, NULL, LOG_ERR, "cannot set groups to %d: %s\n",
|
||||
(int) s->config->gid, strerror(e));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user