1
0
mirror of https://github.com/bol-van/zapret.git synced 2025-05-24 22:32:58 +03:00
This commit is contained in:
Andrey Kiryanov
2024-09-17 19:11:25 +03:00
committed by GitHub

@@ -1,5 +1,6 @@
#define _GNU_SOURCE
#include <sys/param.h>
#include <stdio.h>
#include <stdlib.h>
#include "sec.h"
@@ -279,12 +280,14 @@ bool droproot(uid_t uid, gid_t gid)
return false;
}
#endif
#if !(defined(BSD) && !defined(__OpenBSD__) && !defined(__APPLE__))
// drop all SGIDs
if (setgroups(0,NULL))
{
DLOG_PERROR("setgroups");
return false;
}
#endif
if (setgid(gid))
{
DLOG_PERROR("setgid");