From 90e766a78fe8ebf8acdc19713e9194266c78c093 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Thu, 27 Aug 2015 15:29:58 +0200 Subject: login: rework login mechanism We used to have the login functionality in the /env/bin/init script. This is hard to review and it's too easy to break the login functionality with changes to this script. Move the places to ask for a password to C code where we have only a few places where we have to ask for a password. Mainly these are run_shell() and the menutree command. This patch introduces a login() function which will only return if the correct password has been entered. Following calls will return immediately without asking for a password again. Signed-off-by: Sascha Hauer --- common/startup.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'common/startup.c') diff --git a/common/startup.c b/common/startup.c index 802b90e0e8..4a303b297a 100644 --- a/common/startup.c +++ b/common/startup.c @@ -108,13 +108,10 @@ void __noreturn start_barebox(void) if (IS_ENABLED(CONFIG_COMMAND_SUPPORT)) { pr_info("running /env/bin/init...\n"); - if (!stat("/env/bin/init", &s)) { + if (!stat("/env/bin/init", &s)) run_command("source /env/bin/init"); - } else { + else pr_err("/env/bin/init not found\n"); - if (IS_ENABLED(CONFIG_CMD_LOGIN)) - while(run_command("login -t 0")); - } } if (!barebox_main) { -- cgit v1.2.3