aboutsummaryrefslogtreecommitdiff
path: root/loginutils
diff options
context:
space:
mode:
authorJonathan Liu <net147@gmail.com>2013-05-21 17:01:55 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2013-05-21 17:01:55 +0200
commitb6dc13c2d3754704b1bf5af4e6b957b48585102f (patch)
treefd04dfd6847a6e194fa92676fd2fec8574567dba /loginutils
parent9cb1e2f86b08da469bb4680cf68e927534b5a2ab (diff)
downloadbusybox-b6dc13c2d3754704b1bf5af4e6b957b48585102f.tar.gz
sulogin: allow system maintenance login if root password is empty
The current password checking is unable to distinguish between the user entering an empty password or pressing Control-D. As a result, an empty password always results in normal startup. We modify bb_ask to return NULL if Control-D is pressed without entering a password. The sulogin applet is then modified to only proceed to normal startup if bb_ask returns NULL. This covers EOF with no password, interrupt by timeout and ^C. Signed-off-by: Jonathan Liu <net147@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'loginutils')
-rw-r--r--loginutils/sulogin.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/loginutils/sulogin.c b/loginutils/sulogin.c
index f79802a4d..65e638489 100644
--- a/loginutils/sulogin.c
+++ b/loginutils/sulogin.c
@@ -83,8 +83,8 @@ int sulogin_main(int argc UNUSED_PARAM, char **argv)
cp = bb_ask(STDIN_FILENO, timeout,
"Give root password for system maintenance\n"
"(or type Control-D for normal startup):");
-
- if (!cp || !*cp) {
+ if (!cp) {
+ /* ^D, ^C, timeout, or read error */
bb_info_msg("Normal startup");
return 0;
}