tftpd: allow initgroups() to rescue setgroups() failure

If setgroups() fails, but initgroups() succeeds (somehow) then allow
the process to continue, as initgroups() ought to have set the group
list properly.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
H. Peter Anvin 2024-05-29 17:52:42 -07:00
parent 416046e2ad
commit 99112f0206

View file

@ -990,7 +990,9 @@ int main(int argc, char **argv)
#endif
#ifdef HAVE_INITGROUPS
setrv = initgroups(user, pw->pw_gid);
if (setrv && errno != EPERM) {
if (!setrv) {
die = 0;
} else if (errno != EPERM) {
syslog(LOG_ERR, "cannot set groups for user %s", user);
die = EX_OSERR;
}