From f2c7ae1ddd5973c578d73ec929f29205e84aa47a Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 6 Mar 2007 15:08:58 +0100 Subject: [PATCH] login: close PAM session after failed pam_setcred 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 Signed-off-by: Karel Zak --- login-utils/login.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/login-utils/login.c b/login-utils/login.c index fb3847d0..a9a06b1e 100644 --- a/login-utils/login.c +++ b/login-utils/login.c @@ -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 */ -- 2.39.5