]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
login: Clean up PAM resources on error path
authorTobias Stoeckmann <tobias@stoeckmann.org>
Fri, 3 Apr 2026 07:38:43 +0000 (09:38 +0200)
committerTobias Stoeckmann <tobias@stoeckmann.org>
Wed, 8 Apr 2026 10:10:02 +0000 (12:10 +0200)
If PAM_REINITIALIZEE_CRED fails at this point, PAM_ESTABLISH_CRED
succeeded before. Clean up credentials with PAM_DELETE_CRED in this case
just to be sure.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
login-utils/login.c

index 8459a013a42de6129a33ca58a7a5493a2bb349b1..b6d8aaf2ae24a5778adfba56e71961a02b1c0706 100644 (file)
@@ -1094,6 +1094,7 @@ static void loginpam_session(struct login_context *cxt)
 
        rc = pam_setcred(pamh, PAM_REINITIALIZE_CRED);
        if (is_pam_failure(rc)) {
+               pam_setcred(cxt->pamh, PAM_DELETE_CRED);
                pam_close_session(pamh, 0);
                loginpam_err(pamh, rc);
        }