From 1a0b84e0f346822d930ce2e0b4ffec44a3813bb9 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 25 Nov 2013 05:05:25 +0100 Subject: prevent the user from skipping the failure sleep MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/auth/pam.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/auth/pam.c') diff --git a/src/auth/pam.c b/src/auth/pam.c index e02aed1..c4f38e9 100644 --- a/src/auth/pam.c +++ b/src/auth/pam.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -214,6 +215,13 @@ char authenticate_pam(void) if (__failed(rc = pam_authenticate(handle, 0))) { + /* Clear ISIG (and everything else) to prevent the user + * from skipping the brute force protection sleep. */ + struct termios stty; + tcgetattr(STDIN_FILENO, &stty); + stty.c_lflag = 0; + tcsetattr(STDIN_FILENO, TCSAFLUSH, &stty); + printf("Incorrect passphrase\n"); pam_end(handle, rc); sleep(FAILURE_SLEEP); -- cgit v1.2.3-70-g09d2