]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
login-utils/auth: Drop pam_setcred
authorTobias Stoeckmann <tobias@stoeckmann.org>
Tue, 7 Apr 2026 17:53:09 +0000 (19:53 +0200)
committerTobias Stoeckmann <tobias@stoeckmann.org>
Wed, 8 Apr 2026 10:14:08 +0000 (12:14 +0200)
The credentials are not needed right before pam_end. Drop the call,
which avoids the requirement of cleaning them up again.

While at it, supply the last retcode into pam_end, even though it's
always 0 anyway.

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

index fdeb12bbcee0c1b3f0fb054f9213e270abfe0d79..8b93624a49735cabf829d317f3650b0b322e6508 100644 (file)
@@ -53,11 +53,7 @@ int auth_pam(const char *service_name, uid_t uid, const char *username)
                if (pam_fail_check(pamh, retcode))
                        return FALSE;
 
-               retcode = pam_setcred(pamh, 0);
-               if (pam_fail_check(pamh, retcode))
-                       return FALSE;
-
-               pam_end(pamh, 0);
+               pam_end(pamh, retcode);
                /* no need to establish a session; this isn't a
                 * session-oriented activity...  */
        }