aboutsummaryrefslogtreecommitdiffstats
path: root/src/auth/crypt.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-10-29 14:31:45 +0100
committerMattias Andrée <maandree@operamail.com>2014-10-29 14:31:45 +0100
commit94839658c359ccc24aa31969204474ba507c1cb5 (patch)
tree80de5b1952ef7a1fa9059031267cca0a46761712 /src/auth/crypt.c
parentbump year (diff)
downloadcerberus-94839658c359ccc24aa31969204474ba507c1cb5.tar.gz
cerberus-94839658c359ccc24aa31969204474ba507c1cb5.tar.bz2
cerberus-94839658c359ccc24aa31969204474ba507c1cb5.tar.xz
add HOOK_DENIED
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/auth/crypt.c')
-rw-r--r--src/auth/crypt.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/auth/crypt.c b/src/auth/crypt.c
index cbd082b..ec65fc8 100644
--- a/src/auth/crypt.c
+++ b/src/auth/crypt.c
@@ -74,7 +74,7 @@ void initialise_crypt(char* remote, char* username, char* (*reader)(void))
/**
* Perform token authentication
*
- * @return Whether the user got automatically authenticated
+ * @return 0: failed, 1: success, 2: auto-authenticated
*/
char authenticate_crypt(void)
{
@@ -111,11 +111,11 @@ char authenticate_crypt(void)
#endif
if (!(crypted && *crypted)) /* empty means that no passphrase is required (not even Enter) */
- return 1;
+ return 2;
entered = crypt(passphrase_reader(), crypted /* salt argument stops parsing when encrypted begins */);
if (entered && !strcmp(entered, crypted))
- return 0;
+ return 1;
/* Clear ISIG (and everything else) to prevent the user
* from skipping the brute force protection sleep. */
@@ -124,7 +124,6 @@ char authenticate_crypt(void)
tcsetattr(STDIN_FILENO, TCSAFLUSH, &stty);
printf("Incorrect passphrase\n");
- sleep(FAILURE_SLEEP);
- _exit(1);
+ return 0;
}