]> err.no Git - util-linux/commitdiff
login: close PAM session after failed pam_setcred
authorKarel Zak <kzak@redhat.com>
Tue, 6 Mar 2007 14:08:58 +0000 (15:08 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 7 Mar 2007 09:14:13 +0000 (10:14 +0100)
If for some reason the pam set credential call fails, it does not close the pam
session. pam open can mount drives, so calling pam close is important.

From: Steve Grubb <sgrubb@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
login-utils/login.c

index fb3847d083df985440c3d0626206608543bfddb6..a9a06b1e1ef3db0cb4d9f9f682153d0f05021efa 100644 (file)
@@ -624,6 +624,8 @@ main(int argc, char **argv)
     PAM_FAIL_CHECK;
 
     retcode = pam_setcred(pamh, PAM_ESTABLISH_CRED);
+    if (retcode != PAM_SUCCESS)
+           pam_close_session(pamh, 0);
     PAM_FAIL_CHECK;
 
 #else /* ! HAVE_SECURITY_PAM_MISC_H */