|
@ -172,6 +172,19 @@ static void clear_pam_wrong(EV_P_ ev_timer *w, int revents) { |
|
|
clear_pam_wrong_timeout = NULL; |
|
|
clear_pam_wrong_timeout = NULL; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void clear_input(void) { |
|
|
|
|
|
input_position = 0; |
|
|
|
|
|
clear_password_memory(); |
|
|
|
|
|
password[input_position] = '\0'; |
|
|
|
|
|
|
|
|
|
|
|
/* Hide the unlock indicator after a bit if the password buffer is
|
|
|
|
|
|
* empty. */ |
|
|
|
|
|
start_clear_indicator_timeout(); |
|
|
|
|
|
unlock_state = STATE_BACKSPACE_ACTIVE; |
|
|
|
|
|
redraw_screen(); |
|
|
|
|
|
unlock_state = STATE_KEY_PRESSED; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
static void input_done(void) { |
|
|
static void input_done(void) { |
|
|
if (clear_pam_wrong_timeout) { |
|
|
if (clear_pam_wrong_timeout) { |
|
|
ev_timer_stop(main_loop, clear_pam_wrong_timeout); |
|
|
ev_timer_stop(main_loop, clear_pam_wrong_timeout); |
|
@ -192,6 +205,7 @@ static void input_done(void) { |
|
|
fprintf(stderr, "Authentication failure\n"); |
|
|
fprintf(stderr, "Authentication failure\n"); |
|
|
|
|
|
|
|
|
pam_state = STATE_PAM_WRONG; |
|
|
pam_state = STATE_PAM_WRONG; |
|
|
|
|
|
clear_input(); |
|
|
redraw_screen(); |
|
|
redraw_screen(); |
|
|
|
|
|
|
|
|
/* Clear this state after 2 seconds (unless the user enters another
|
|
|
/* Clear this state after 2 seconds (unless the user enters another
|
|
@ -257,20 +271,15 @@ static void handle_key_press(xcb_key_press_event_t *event) { |
|
|
unlock_state = STATE_KEY_PRESSED; |
|
|
unlock_state = STATE_KEY_PRESSED; |
|
|
redraw_screen(); |
|
|
redraw_screen(); |
|
|
input_done(); |
|
|
input_done(); |
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
case XKB_KEY_u: |
|
|
case XKB_KEY_u: |
|
|
if (!ctrl) |
|
|
if (ctrl) |
|
|
break; |
|
|
clear_input(); |
|
|
case XKB_KEY_Escape: |
|
|
return; |
|
|
input_position = 0; |
|
|
|
|
|
clear_password_memory(); |
|
|
|
|
|
password[input_position] = '\0'; |
|
|
|
|
|
|
|
|
|
|
|
/* Hide the unlock indicator after a bit if the password buffer is
|
|
|
case XKB_KEY_Escape: |
|
|
* empty. */ |
|
|
clear_input(); |
|
|
start_clear_indicator_timeout(); |
|
|
|
|
|
unlock_state = STATE_BACKSPACE_ACTIVE; |
|
|
|
|
|
redraw_screen(); |
|
|
|
|
|
unlock_state = STATE_KEY_PRESSED; |
|
|
|
|
|
return; |
|
|
return; |
|
|
|
|
|
|
|
|
case XKB_KEY_BackSpace: |
|
|
case XKB_KEY_BackSpace: |
|
|