mirror of
https://github.com/boltgolt/howdy.git
synced 2024-09-12 09:41:18 +02:00
fix: print message when retries limit is reached
This commit is contained in:
parent
ab79c5b674
commit
b383164e06
1 changed files with 13 additions and 1 deletions
|
@ -368,12 +368,24 @@ auto identify(pam_handle_t *pamh, int flags, int argc, const char **argv,
|
|||
} else {
|
||||
try {
|
||||
EnterDevice enter_device;
|
||||
for (int retries = 0;
|
||||
int retries;
|
||||
|
||||
// We try to send it
|
||||
enter_device.send_enter_press();
|
||||
|
||||
for (retries = 0;
|
||||
retries < MAX_RETRIES &&
|
||||
pass_task.wait(DEFAULT_TIMEOUT) == std::future_status::timeout;
|
||||
retries++) {
|
||||
enter_device.send_enter_press();
|
||||
}
|
||||
|
||||
if (retries == MAX_RETRIES) {
|
||||
syslog(LOG_WARNING,
|
||||
"Failed to send enter input before the retries limit");
|
||||
conv_function(PAM_ERROR_MSG, S("Failed to send Enter press, waiting "
|
||||
"for user to press it instead"));
|
||||
}
|
||||
} catch (std::runtime_error &err) {
|
||||
syslog(LOG_WARNING, "Failed to send enter input: %s", err.what());
|
||||
conv_function(PAM_ERROR_MSG, S("Failed to send Enter press, waiting "
|
||||
|
|
Loading…
Reference in a new issue