From: Karel Zak Date: Thu, 17 Feb 2011 10:16:43 +0000 (+0100) Subject: login: does not ignore setgid() return code for non-roots X-Git-Tag: v2.19.1-rc1~69 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a5300bb024edb55ed7b26d0e070d8c89f54a63c8;p=thirdparty%2Futil-linux.git login: does not ignore setgid() return code for non-roots Reported-by: Steve Grubb Signed-off-by: Karel Zak --- diff --git a/login-utils/login.c b/login-utils/login.c index 5584c32026..bb4d91c9bb 100644 --- a/login-utils/login.c +++ b/login-utils/login.c @@ -1037,7 +1037,11 @@ Michael Riepe } #endif - setgid(pwd->pw_gid); + if (setgid(pwd->pw_gid) < 0 && pwd->pw_gid) { + syslog(LOG_ALERT, _("setgid() failed")); + exit(EXIT_FAILURE); + } + if (*pwd->pw_shell == '\0') pwd->pw_shell = _PATH_BSHELL;