summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2013-09-16 19:49:57 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2013-09-18 09:24:39 +0200
commit54385ace4b98f8131d53757d18858d0729960dc2 (patch)
tree15357f82e1936dfa777293bc069a0975ad50725f /commands
parent50355554dc17182f80ff582daf9a680200830dcb (diff)
downloadbarebox-54385ace4b98f8131d53757d18858d0729960dc2.tar.gz
barebox-54385ace4b98f8131d53757d18858d0729960dc2.tar.xz
login: add globalvar timeout support
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands')
-rw-r--r--commands/login.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/commands/login.c b/commands/login.c
index fb6bb35cfc..485def2bcd 100644
--- a/commands/login.c
+++ b/commands/login.c
@@ -20,6 +20,10 @@
#include <complete.h>
#include <password.h>
#include <getopt.h>
+#include <environment.h>
+#include <globalvar.h>
+#include <magicvar.h>
+#include <init.h>
#define PASSWD_MAX_LENGTH (128 + 1)
@@ -31,11 +35,13 @@
#define LOGIN_MODE HIDE
#endif
+static int login_timeout = 0;
+
static int do_login(int argc, char *argv[])
{
unsigned char passwd[PASSWD_MAX_LENGTH];
int passwd_len, opt;
- int timeout = 0;
+ int timeout = login_timeout;
char *timeout_cmd = "boot";
if (!is_passwd_enable()) {
@@ -80,3 +86,13 @@ BAREBOX_CMD_START(login)
BAREBOX_CMD_HELP(cmd_login_help)
BAREBOX_CMD_COMPLETE(empty_complete)
BAREBOX_CMD_END
+
+static int login_global_init(void)
+{
+ globalvar_add_simple_int("login.timeout", &login_timeout, "%d");
+
+ return 0;
+}
+late_initcall(login_global_init);
+
+BAREBOX_MAGICVAR_NAMED(global_login_timeout, global.login.timeout, "timeout to type the password");