From: Karel Zak Date: Tue, 6 Mar 2007 14:08:58 +0000 (+0100) Subject: login: close PAM session after failed pam_setcred X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f2c7ae1ddd5973c578d73ec929f29205e84aa47a;p=util-linux 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 --- 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 */