diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2015-08-27 15:29:58 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-08-28 08:00:27 +0200 |
commit | 90e766a78fe8ebf8acdc19713e9194266c78c093 (patch) | |
tree | 58556b422db0819d335e60c4b5e573206d8c872d /include | |
parent | f38ba32965c5686c062884fab2e9f505015af82a (diff) | |
download | barebox-90e766a78fe8ebf8acdc19713e9194266c78c093.tar.gz barebox-90e766a78fe8ebf8acdc19713e9194266c78c093.tar.xz |
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 <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/console.h | 3 | ||||
-rw-r--r-- | include/password.h | 8 |
2 files changed, 8 insertions, 3 deletions
diff --git a/include/console.h b/include/console.h index a6737c8581..4b2f134a4c 100644 --- a/include/console.h +++ b/include/console.h @@ -71,9 +71,6 @@ extern struct list_head console_list; #define CFG_PBSIZE (CONFIG_CBSIZE+sizeof(CONFIG_PROMPT)+16) -bool console_is_input_allow(void); -void console_allow_input(bool val); - extern int barebox_loglevel; struct console_device *console_get_first_active(void); diff --git a/include/password.h b/include/password.h index 0dd1054054..fec831fde2 100644 --- a/include/password.h +++ b/include/password.h @@ -42,6 +42,14 @@ int passwd_env_disable(void); int check_env_passwd(unsigned char* passwd, size_t length); int set_env_passwd(unsigned char* passwd, size_t length); +#ifdef CONFIG_PASSWORD +void login(void); +#else +static inline void login(void) +{ +} +#endif + static inline int is_passwd_enable(void) { return is_passwd_default_enable() || is_passwd_env_enable(); |