Skip to content

Ensure we are only initializing logging once#70

Merged
nresare merged 1 commit intomainfrom
only_initialize_logging_once
Aug 31, 2025
Merged

Ensure we are only initializing logging once#70
nresare merged 1 commit intomainfrom
only_initialize_logging_once

Conversation

@nresare
Copy link
Owner

@nresare nresare commented Aug 31, 2025

Previously, when sm_authenticate() is called mulitple times, there would be a warning stating that logging initalizaion could only happen once. Now, we hold a Mutex that ensures that it only gets called once and in the unlikely event that tehre are concurrent calls to init_logging() that only one thread wins and gets to attempt initialization

Previously, when sm_authenticate() is called mulitple times,
there would be a warning stating that logging initalizaion could only
happen once. Now, we hold a Mutex<bool> that ensures that it only
gets called once and in the unlikely event that tehre are concurrent
calls to init_logging() that only one thread wins and gets to
attempt initialization
@nresare
Copy link
Owner Author

nresare commented Aug 31, 2025

This problem would be visible for anyone that used pam-ssh-agent with sudo with the default configuration but where for example none of the keys available from ssh-agent would be present in /etc/security/authorized_keys, as sudo then would try to authenticate three times in rapid succession. I have tested this manually on a linux box and it does indeed resolve that problem.

@nresare nresare merged commit d5b9b5a into main Aug 31, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant