From 99112f02064359f5070c82298aa9a6f4dd58e535 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Wed, 29 May 2024 17:52:42 -0700 Subject: [PATCH] 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 --- tftpd/tftpd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tftpd/tftpd.c b/tftpd/tftpd.c index 2db7977..e410d42 100644 --- a/tftpd/tftpd.c +++ b/tftpd/tftpd.c @@ -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; }