From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 2/5] login: add globalvar timeout support
Date: Mon, 16 Sep 2013 19:49:57 +0200 [thread overview]
Message-ID: <1379353800-28237-2-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <1379353800-28237-1-git-send-email-plagnioj@jcrosoft.com>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
commands/login.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/commands/login.c b/commands/login.c
index fb6bb35..485def2 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");
--
1.8.4.rc1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2013-09-16 17:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-16 17:48 [PATCH 0/5 v3] defaultenv-2: add login support Jean-Christophe PLAGNIOL-VILLARD
2013-09-16 17:49 ` [PATCH 1/5] globalvar: add globalvar_add_simple_int/bool/enum/ip support Jean-Christophe PLAGNIOL-VILLARD
2013-09-16 17:49 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2013-09-16 17:49 ` [PATCH 3/5] login: disable input console if password wrong Jean-Christophe PLAGNIOL-VILLARD
2013-09-16 17:49 ` [PATCH 4/5] login/passwd: add default password support Jean-Christophe PLAGNIOL-VILLARD
2013-09-16 17:50 ` [PATCH 5/5] defaultenv-2: add login support Jean-Christophe PLAGNIOL-VILLARD
2013-09-18 7:25 ` [PATCH 0/5 v3] " Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1379353800-28237-2-git-send-email-plagnioj@jcrosoft.com \
--to=plagnioj@jcrosoft.com \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox