]> granicus.if.org Git - sudo/commitdiff
Fix call to pam_end() when pam_open_session() fails.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Sat, 25 Jun 2005 18:29:17 +0000 (18:29 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Sat, 25 Jun 2005 18:29:17 +0000 (18:29 +0000)
auth/pam.c

index 7f88bf3ec7c7122d4e98f01b1d67559f0e083159..bace4891aded38ac1b7db4740873e5dcd0b09d06 100644 (file)
@@ -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);