From bb89ea62a0b7e5c6fcedfe1a28b6dd82236247ce Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Mon, 16 Sep 2013 19:49:58 +0200 Subject: login: disable input console if password wrong so we guarantee that barebox is secured again user interaction Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD Signed-off-by: Sascha Hauer --- commands/login.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'commands/login.c') 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 #include #include +#include #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; -- cgit v1.2.3