From 4925c3cc1b8691bbbcaccb9d3ada709588974281 Mon Sep 17 00:00:00 2001 From: Andrey Kiryanov Date: Sun, 11 Aug 2024 21:47:56 +0300 Subject: [PATCH] Do not setgroups() on FreeBSD --- tpws/sec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tpws/sec.c b/tpws/sec.c index b5fba25..20948d8 100644 --- a/tpws/sec.c +++ b/tpws/sec.c @@ -1,5 +1,6 @@ #define _GNU_SOURCE +#include #include #include #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");