summaryrefslogtreecommitdiffstats
path: root/commands/login.c
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2013-09-16 19:49:58 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2013-09-19 08:49:47 +0200
commitbb89ea62a0b7e5c6fcedfe1a28b6dd82236247ce (patch)
tree45448d5807a24e8bd1b42e27994334e590763f2f /commands/login.c
parent54385ace4b98f8131d53757d18858d0729960dc2 (diff)
downloadbarebox-bb89ea62a0b7e5c6fcedfe1a28b6dd82236247ce.tar.gz
barebox-bb89ea62a0b7e5c6fcedfe1a28b6dd82236247ce.tar.xz
login: disable input console if password wrong
so we guarantee that barebox is secured again user interaction Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands/login.c')
-rw-r--r--commands/login.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/commands/login.c b/commands/login.c
index 485def2bcd..b616bf15fc 100644
--- a/commands/login.c
+++ b/commands/login.c
@@ -24,6 +24,7 @@
#include <globalvar.h>
#include <magicvar.h>
#include <init.h>
+#include <console.h>
#define PASSWD_MAX_LENGTH (128 + 1)
@@ -44,6 +45,7 @@ static int do_login(int argc, char *argv[])
int timeout = login_timeout;
char *timeout_cmd = "boot";
+ console_allow_input(true);
if (!is_passwd_enable()) {
puts("login: password not set\n");
return 0;
@@ -64,8 +66,10 @@ static int do_login(int argc, char *argv[])
puts("Password: ");
passwd_len = password(passwd, PASSWD_MAX_LENGTH, LOGIN_MODE, timeout);
- if (passwd_len < 0)
+ if (passwd_len < 0) {
+ console_allow_input(false);
run_command(timeout_cmd, 0);
+ }
if (check_passwd(passwd, passwd_len))
return 0;