diff options
author | Jonathan Liu <net147@gmail.com> | 2013-05-23 08:18:21 +1000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-05-24 14:14:46 +0100 |
commit | 43808760847f7b80ed70f1cef09d89cef28b28ec (patch) | |
tree | 7947bcd449b96865dddd15ac01aa0fe6a5ccb8ef /meta/recipes-core | |
parent | 8f5abd28128bcb3612f397d7baadc16bc76ce7c7 (diff) | |
download | poky-43808760847f7b80ed70f1cef09d89cef28b28ec.tar.gz |
busybox: backport sulogin empty root password fix
This allows system maintenance login if the root password is empty.
(From OE-Core rev: 28bb8fe5c144e02c28bff54b5b81c8da33b9f58b)
Signed-off-by: Jonathan Liu <net147@gmail.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core')
-rw-r--r-- | meta/recipes-core/busybox/busybox-1.20.2/busybox-sulogin-empty-root-password.patch | 58 | ||||
-rw-r--r-- | meta/recipes-core/busybox/busybox_1.20.2.bb | 1 |
2 files changed, 59 insertions, 0 deletions
diff --git a/meta/recipes-core/busybox/busybox-1.20.2/busybox-sulogin-empty-root-password.patch b/meta/recipes-core/busybox/busybox-1.20.2/busybox-sulogin-empty-root-password.patch new file mode 100644 index 0000000000..baad298a3f --- /dev/null +++ b/meta/recipes-core/busybox/busybox-1.20.2/busybox-sulogin-empty-root-password.patch | |||
@@ -0,0 +1,58 @@ | |||
1 | Upstream-Status: Backport | ||
2 | Signed-off-by: Jonathan Liu <net147@gmail.com> | ||
3 | |||
4 | From b6dc13c2d3754704b1bf5af4e6b957b48585102f Mon Sep 17 00:00:00 2001 | ||
5 | From: Jonathan Liu <net147@gmail.com> | ||
6 | Date: Tue, 21 May 2013 17:01:55 +0200 | ||
7 | Subject: [PATCH] sulogin: allow system maintenance login if root password is | ||
8 | empty | ||
9 | |||
10 | The current password checking is unable to distinguish between the user | ||
11 | entering an empty password or pressing Control-D. As a result, an empty | ||
12 | password always results in normal startup. | ||
13 | |||
14 | We modify bb_ask to return NULL if Control-D is pressed without entering | ||
15 | a password. The sulogin applet is then modified to only proceed to | ||
16 | normal startup if bb_ask returns NULL. This covers EOF with no password, | ||
17 | interrupt by timeout and ^C. | ||
18 | |||
19 | Signed-off-by: Jonathan Liu <net147@gmail.com> | ||
20 | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com> | ||
21 | --- | ||
22 | libbb/bb_askpass.c | 4 +++- | ||
23 | loginutils/sulogin.c | 4 ++-- | ||
24 | 2 files changed, 5 insertions(+), 3 deletions(-) | ||
25 | |||
26 | diff --git a/libbb/bb_askpass.c b/libbb/bb_askpass.c | ||
27 | index fe2b506..77c1bcd 100644 | ||
28 | --- a/libbb/bb_askpass.c | ||
29 | +++ b/libbb/bb_askpass.c | ||
30 | @@ -65,7 +65,9 @@ char* FAST_FUNC bb_ask(const int fd, int timeout, const char *prompt) | ||
31 | i = 0; | ||
32 | while (1) { | ||
33 | int r = read(fd, &ret[i], 1); | ||
34 | - if (r < 0) { | ||
35 | + if ((i == 0 && r == 0) /* EOF (^D) with no password */ | ||
36 | + || r < 0 | ||
37 | + ) { | ||
38 | /* read is interrupted by timeout or ^C */ | ||
39 | ret = NULL; | ||
40 | break; | ||
41 | diff --git a/loginutils/sulogin.c b/loginutils/sulogin.c | ||
42 | index f79802a..65e6384 100644 | ||
43 | --- a/loginutils/sulogin.c | ||
44 | +++ b/loginutils/sulogin.c | ||
45 | @@ -83,8 +83,8 @@ int sulogin_main(int argc UNUSED_PARAM, char **argv) | ||
46 | cp = bb_ask(STDIN_FILENO, timeout, | ||
47 | "Give root password for system maintenance\n" | ||
48 | "(or type Control-D for normal startup):"); | ||
49 | - | ||
50 | - if (!cp || !*cp) { | ||
51 | + if (!cp) { | ||
52 | + /* ^D, ^C, timeout, or read error */ | ||
53 | bb_info_msg("Normal startup"); | ||
54 | return 0; | ||
55 | } | ||
56 | -- | ||
57 | 1.8.2.3 | ||
58 | |||
diff --git a/meta/recipes-core/busybox/busybox_1.20.2.bb b/meta/recipes-core/busybox/busybox_1.20.2.bb index 1445a5e46c..07d722d722 100644 --- a/meta/recipes-core/busybox/busybox_1.20.2.bb +++ b/meta/recipes-core/busybox/busybox_1.20.2.bb | |||
@@ -33,6 +33,7 @@ SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \ | |||
33 | file://testsuite-du-du-k-works-fix-false-positive.patch \ | 33 | file://testsuite-du-du-k-works-fix-false-positive.patch \ |
34 | file://strict-atime.patch \ | 34 | file://strict-atime.patch \ |
35 | file://fail_on_no_media.patch \ | 35 | file://fail_on_no_media.patch \ |
36 | file://busybox-sulogin-empty-root-password.patch \ | ||
36 | file://inetd.conf \ | 37 | file://inetd.conf \ |
37 | file://inetd" | 38 | file://inetd" |
38 | 39 | ||