Browse Source

Do not setgroups() on FreeBSD

pull/257/head
Andrey Kiryanov 2 years ago
parent
commit
4925c3cc1b
  1. 3
      tpws/sec.c

3
tpws/sec.c

@ -1,5 +1,6 @@
#define _GNU_SOURCE
#include <sys/param.h>
#include <stdio.h>
#include <stdlib.h>
#include "sec.h"
@ -277,12 +278,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))
{
perror("setgroups");
return false;
}
#endif
if (setgid(gid))
{
perror("setgid");

Loading…
Cancel
Save