0
0
Fork 0
mirror of https://github.com/boltgolt/howdy.git synced 2024-09-12 09:41:18 +02:00

Merge pull request #802 from musikid/fix_prompt

Ignore compare error if password is typed
This commit is contained in:
boltgolt 2023-06-24 16:09:01 +02:00 committed by GitHub
commit 2b3f38c2a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -310,9 +310,11 @@ auto identify(pam_handle_t *pamh, int flags, int argc, const char **argv,
return std::tuple<int, char *>(pam_res, auth_tok_ptr);
});
auto ask_pass = auth_tok && workaround != Workaround::Off;
// We ask for the password if the function requires it and if a workaround is
// set
if (auth_tok && workaround != Workaround::Off) {
if (ask_pass) {
pass_task.activate();
}
@ -350,8 +352,9 @@ auto identify(pam_handle_t *pamh, int flags, int argc, const char **argv,
int status = child_task.get();
// If python process ran into a timeout
// Do not send enter presses or terminate the PAM function, as the user might still be typing their password
if (WEXITSTATUS(status) == CompareError::TIMEOUT_REACHED && WIFEXITED(status)) {
// Do not send enter presses or terminate the PAM function, as the user might
// still be typing their password
if (WIFEXITED(status) && WEXITSTATUS(status) != EXIT_SUCCESS && ask_pass) {
// Wait for the password to be typed
pass_task.stop(false);
@ -359,14 +362,13 @@ auto identify(pam_handle_t *pamh, int flags, int argc, const char **argv,
std::tie(pam_res, password) = pass_task.get();
if (pam_res != PAM_SUCCESS) {
return pam_res;
return howdy_status(username, status, config, conv_function);
}
// The password has been entered, we are passing it to PAM stack
return PAM_IGNORE;
}
// We want to stop the password prompt, either by canceling the thread when
// workaround is set to "native", or by emulating "Enter" input with
// "input"