]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
login: does not ignore setgid() return code for non-roots
authorKarel Zak <kzak@redhat.com>
Thu, 17 Feb 2011 10:16:43 +0000 (11:16 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 18 Apr 2011 12:28:53 +0000 (14:28 +0200)
Reported-by: Steve Grubb <sgrubb@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
login-utils/login.c

index 5584c320267c87c8743029c81356771ba5bcb30d..bb4d91c9bbcd919f3ea1af6dd7f8a2c2da5bfff2 100644 (file)
@@ -1037,7 +1037,11 @@ Michael Riepe <michael@stud.uni-hannover.de>
     }
 #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;