From: Todd C. Miller Date: Sat, 25 Jun 2005 18:29:17 +0000 (+0000) Subject: Fix call to pam_end() when pam_open_session() fails. X-Git-Tag: SUDO_1_7_0~632 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d281ff77e29c4b4dec3a5cc90c742f5c76fb4186;p=sudo Fix call to pam_end() when pam_open_session() fails. --- diff --git a/auth/pam.c b/auth/pam.c index 7f88bf3ec..bace4891a 100644 --- a/auth/pam.c +++ b/auth/pam.c @@ -175,6 +175,8 @@ int pam_prep_user(pw) struct passwd *pw; { + int eval; + if (pamh == NULL) pam_init(pw, NULL, NULL); @@ -201,8 +203,8 @@ pam_prep_user(pw) * can at least cause pam_limits to be run by opening and then * immediately closing the session. */ - if (pam_open_session(pamh, 0) != PAM_SUCCESS) { - (void) pam_end(pamh, error); + if ((eval = pam_open_session(pamh, 0)) != PAM_SUCCESS) { + (void) pam_end(pamh, eval | PAM_DATA_SILENT); return(AUTH_FAILURE); } (void) pam_close_session(pamh, 0);