aboutsummaryrefslogtreecommitdiffstats
path: root/src/auth/pam.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2013-11-25 05:05:25 +0100
committerMattias Andrée <maandree@operamail.com>2013-11-25 05:05:25 +0100
commit1a0b84e0f346822d930ce2e0b4ffec44a3813bb9 (patch)
tree29c233471ae71ee76e45dbd356c84dad7001149e /src/auth/pam.c
parentderp (diff)
downloadcerberus-1a0b84e0f346822d930ce2e0b4ffec44a3813bb9.tar.gz
cerberus-1a0b84e0f346822d930ce2e0b4ffec44a3813bb9.tar.bz2
cerberus-1a0b84e0f346822d930ce2e0b4ffec44a3813bb9.tar.xz
prevent the user from skipping the failure sleep
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/auth/pam.c')
-rw-r--r--src/auth/pam.c8
1 files changed, 8 insertions, 0 deletions
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 <unistd.h>
#include <signal.h>
#include <string.h>
+#include <termios.h>
#include <security/pam_appl.h>
#include <security/pam_misc.h>
@@ -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);