summaryrefslogtreecommitdiffstats
path: root/login-utils/login.c
diff options
context:
space:
mode:
authorKarel Zak2011-02-17 11:16:43 +0100
committerKarel Zak2011-02-17 11:16:43 +0100
commit81e9987bf0f79c430154b3ef31f79ed7b6a5ba2e (patch)
treeb64ae91e90596649a2097081a5e785da3c6017fd /login-utils/login.c
parentfdisk: more robust whole-disk detection (diff)
downloadkernel-qcow2-util-linux-81e9987bf0f79c430154b3ef31f79ed7b6a5ba2e.tar.gz
kernel-qcow2-util-linux-81e9987bf0f79c430154b3ef31f79ed7b6a5ba2e.tar.xz
kernel-qcow2-util-linux-81e9987bf0f79c430154b3ef31f79ed7b6a5ba2e.zip
login: does not ignore setgid() return code for non-roots
Reported-by: Steve Grubb <sgrubb@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'login-utils/login.c')
-rw-r--r--login-utils/login.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/login-utils/login.c b/login-utils/login.c
index 5486ad918..40f23ad3a 100644
--- a/login-utils/login.c
+++ b/login-utils/login.c
@@ -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;