← Commit list

b6dc13c2d

Jonathan Liu
Jonathan Liu
2013-05-21
SUCCESS Duration: 192s

Subject

sulogin: allow system maintenance login if root password is empty

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

libbb/bb_askpass.c+3 -1
@@ -65,7 +65,9 @@ char* FAST_FUNC bb_ask(const int fd, int timeout, const char *prompt)
i = 0;
while (1) {
int r = read(fd, &ret[i], 1);
- if (r < 0) {
+ if ((i == 0 && r == 0) /* EOF (^D) with no password */
+ || r < 0
+ ) {
/* read is interrupted by timeout or ^C */
ret = NULL;
break;
loginutils/sulogin.c+2 -2
@@ -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;
}