From 69c516a36ddeac5fd41d4ef8879f16fd5db88266 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Eivind=20N=C3=A6ss?= Date: Mon, 20 Sep 2021 09:52:22 -0700 Subject: [PATCH] Fixing GCC warning -Wunused-result with setgid in winbind.c MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Eivind Næss --- pppd/plugins/winbind.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pppd/plugins/winbind.c b/pppd/plugins/winbind.c index 8c98e2a..86b5198 100644 --- a/pppd/plugins/winbind.c +++ b/pppd/plugins/winbind.c @@ -299,15 +299,20 @@ unsigned int run_ntlm_auth(const char *username, if (forkret == 0) { /* child process */ uid_t uid; + gid_t gid; close(child_out[0]); close(child_in[1]); /* run winbind as the user that invoked pppd */ - setgid(getgid()); + gid = getgid(); + if (setgid(gid) == -1 || getgid() != gid) { + fatal("pppd/winbind: could not setgid to %d: %m", gid); + } uid = getuid(); - if (setuid(uid) == -1 || getuid() != uid) + if (setuid(uid) == -1 || getuid() != uid) { fatal("pppd/winbind: could not setuid to %d: %m", uid); + } execl("/bin/sh", "sh", "-c", ntlm_auth, NULL); fatal("pppd/winbind: could not exec /bin/sh: %m"); } -- 2.39.2