Skip to content

[autobackport: sssd-2-12] krb5: check for PIN locked in error message#8411

Merged
alexey-tikhonov merged 2 commits intoSSSD:sssd-2-12from
sssd-bot:SSSD-sssd-backport-pr8398-to-sssd-2-12
Jan 29, 2026
Merged

[autobackport: sssd-2-12] krb5: check for PIN locked in error message#8411
alexey-tikhonov merged 2 commits intoSSSD:sssd-2-12from
sssd-bot:SSSD-sssd-backport-pr8398-to-sssd-2-12

Conversation

@sssd-bot
Copy link
Contributor

This is an automatic backport of PR#8398 krb5: check for PIN locked in error message to branch sssd-2-12, created by @sumit-bose.

Please make sure this backport is correct.

Note

The commits were cherry-picked without conflicts.

You can push changes to this pull request

git remote add sssd-bot git@github.com:sssd-bot/sssd.git
git fetch sssd-bot refs/heads/SSSD-sssd-backport-pr8398-to-sssd-2-12
git checkout SSSD-sssd-backport-pr8398-to-sssd-2-12
git push sssd-bot SSSD-sssd-backport-pr8398-to-sssd-2-12 --force

Original commits
4ca8bb6 - pam_sss: change PAM message type for PIN locked
bc3ad16 - krb5: check for PIN locked in error message

Backported commits

  • 8678fac - pam_sss: change PAM message type for PIN locked
  • 13306dd - krb5: check for PIN locked in error message

Original Pull Request Body

Currently the PIN locked message is only displays if the Smartcard
authentication is done locally, e.g. if the system is offline. During
pkinit libkrb5 does not send a dedicated error code but the error message
generated by the library contains a hint.

This patch checks the libkrb5 error message in case the authentication
fails with the pre-authentication failed error code. This is a bit tricky
because 'krb5_get_error_message()' currently only returns a defined result
at the first call after a failed library call.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a mechanism to detect and report a 'PIN locked' error during Kerberos authentication with a smart card. The changes in src/providers/krb5/krb5_child.c add logic to parse the error message from libkrb5 when a pre-authentication failure occurs during a smartcard-based authentication attempt. If the error message indicates a locked PIN, a specific PAM message is sent to the client. The change in src/sss_client/pam_sss.c adjusts the PAM message type to PAM_ERROR_MSG for better integration with display managers like GDM. The implementation is careful about when to retrieve the error message, as it might only be available on the first call. The changes are well-commented and appear to correctly address the issue described. I have no major concerns.

@alexey-tikhonov alexey-tikhonov added the no-backport This should go to target branch only. label Jan 29, 2026
@alexey-tikhonov alexey-tikhonov removed the request for review from ikerexxe January 29, 2026 15:42
To make sure GDM can display this message together with an
authentication failed error message the PAM message type has to be the
same.

Reviewed-by: Alexey Tikhonov <atikhono@redhat.com>
Reviewed-by: Iker Pedrosa <ipedrosa@redhat.com>
(cherry picked from commit 4ca8bb6)
Currently the PIN locked message is only displays if the Smartcard
authentication is done locally, e.g. if the system is offline. During
pkinit libkrb5 does not send a dedicated error code but the error
message generated by the library contains a hint.

This patch checks the libkrb5 error message in case the authentication
fails with the pre-authentication failed error code. This is a bit
tricky because 'krb5_get_error_message()' currently only returns a
defined result at the first call after a failed library call.

Reviewed-by: Alexey Tikhonov <atikhono@redhat.com>
Reviewed-by: Iker Pedrosa <ipedrosa@redhat.com>
(cherry picked from commit bc3ad16)
@sssd-bot
Copy link
Contributor Author

The pull request was accepted by @alexey-tikhonov with the following PR CI status:


🟢 rpm-build:centos-stream-10-x86_64:upstream (success)
🟢 rpm-build:fedora-42-x86_64:upstream (success)
🟢 rpm-build:fedora-43-x86_64:upstream (success)
🟢 rpm-build:fedora-rawhide-x86_64:upstream (success)
🟢 Build / freebsd (success)
🟢 Build / make-distcheck (success)


There are unsuccessful or unfinished checks. Make sure that the failures are not related to this pull request before merging.

@sssd-bot sssd-bot force-pushed the SSSD-sssd-backport-pr8398-to-sssd-2-12 branch from 13306dd to 37df45f Compare January 29, 2026 15:43
@alexey-tikhonov alexey-tikhonov merged commit ac2476d into SSSD:sssd-2-12 Jan 29, 2026
3 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Accepted no-backport This should go to target branch only.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants