mirror of
https://github.com/bol-van/zapret.git
synced 2024-11-26 12:10:53 +03:00
Do not setgroups() on FreeBSD
This commit is contained in:
parent
c369f11638
commit
4925c3cc1b
@ -1,5 +1,6 @@
|
|||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
|
|
||||||
|
#include <sys/param.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "sec.h"
|
#include "sec.h"
|
||||||
@ -277,12 +278,14 @@ bool droproot(uid_t uid, gid_t gid)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#if !(defined(BSD) && !defined(__OpenBSD__) && !defined(__APPLE__))
|
||||||
// drop all SGIDs
|
// drop all SGIDs
|
||||||
if (setgroups(0,NULL))
|
if (setgroups(0,NULL))
|
||||||
{
|
{
|
||||||
perror("setgroups");
|
perror("setgroups");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (setgid(gid))
|
if (setgid(gid))
|
||||||
{
|
{
|
||||||
perror("setgid");
|
perror("setgid");
|
||||||
|
Loading…
Reference in New Issue
Block a user