aboutsummaryrefslogtreecommitdiffstats
path: root/main/busybox/0009-libbb-allow_blank-argument-for-ask_and_check_passwor.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/busybox/0009-libbb-allow_blank-argument-for-ask_and_check_passwor.patch')
-rw-r--r--main/busybox/0009-libbb-allow_blank-argument-for-ask_and_check_passwor.patch70
1 files changed, 70 insertions, 0 deletions
diff --git a/main/busybox/0009-libbb-allow_blank-argument-for-ask_and_check_passwor.patch b/main/busybox/0009-libbb-allow_blank-argument-for-ask_and_check_passwor.patch
new file mode 100644
index 00000000000..504a1bcc440
--- /dev/null
+++ b/main/busybox/0009-libbb-allow_blank-argument-for-ask_and_check_passwor.patch
@@ -0,0 +1,70 @@
+From 7161cc4e35dff5a21aff1f7b5d3edd7d7dcbacbd Mon Sep 17 00:00:00 2001
+From: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
+Date: Thu, 5 Nov 2015 16:27:35 +0200
+Subject: [PATCH 09/15] libbb: allow_blank argument for
+ ask_and_check_password_extended()
+
+---
+ include/libbb.h | 2 +-
+ libbb/correct_password.c | 6 +++---
+ loginutils/sulogin.c | 2 +-
+ 3 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/include/libbb.h b/include/libbb.h
+index 25c5868..1348a46 100644
+--- a/include/libbb.h
++++ b/include/libbb.h
+@@ -1376,7 +1376,7 @@ void setup_environment(const char *shell, int flags, const struct passwd *pw) FA
+ void nuke_str(char *str) FAST_FUNC;
+ int check_securetty(const char *short_tty);
+ int check_password(const struct passwd *pw, const char *plaintext) FAST_FUNC;
+-int ask_and_check_password_extended(const struct passwd *pw, int timeout, const char *prompt) FAST_FUNC;
++int ask_and_check_password_extended(const struct passwd *pw, int timeout, int allow_blank, const char *prompt) FAST_FUNC;
+ int ask_and_check_password(const struct passwd *pw) FAST_FUNC;
+ /* Returns a malloced string */
+ #if !ENABLE_USE_BB_CRYPT
+diff --git a/libbb/correct_password.c b/libbb/correct_password.c
+index 513c930..57cd2b8 100644
+--- a/libbb/correct_password.c
++++ b/libbb/correct_password.c
+@@ -96,7 +96,7 @@ int FAST_FUNC check_password(const struct passwd *pw, const char *plaintext)
+ * NULL pw means "just fake it for login with bad username"
+ */
+ int FAST_FUNC ask_and_check_password_extended(const struct passwd *pw,
+- int timeout, const char *prompt)
++ int timeout, int allow_blank, const char *prompt)
+ {
+ IF_FEATURE_SHADOWPASSWDS(char buffer[SHADOW_BUFSIZE];)
+ char *plaintext;
+@@ -105,7 +105,7 @@ int FAST_FUNC ask_and_check_password_extended(const struct passwd *pw,
+
+ pw_pass = get_passwd(pw, buffer);
+ if (!pw_pass[0]) /* empty password field? */
+- return 1;
++ return allow_blank;
+
+ plaintext = bb_ask(STDIN_FILENO, timeout, prompt);
+ if (!plaintext) {
+@@ -120,5 +120,5 @@ int FAST_FUNC ask_and_check_password_extended(const struct passwd *pw,
+
+ int FAST_FUNC ask_and_check_password(const struct passwd *pw)
+ {
+- return ask_and_check_password_extended(pw, 0, "Password: ");
++ return ask_and_check_password_extended(pw, 0, 1, "Password: ");
+ }
+diff --git a/loginutils/sulogin.c b/loginutils/sulogin.c
+index f324695..b26db96 100644
+--- a/loginutils/sulogin.c
++++ b/loginutils/sulogin.c
+@@ -63,7 +63,7 @@ int sulogin_main(int argc UNUSED_PARAM, char **argv)
+ while (1) {
+ int r;
+
+- r = ask_and_check_password_extended(pwd, timeout,
++ r = ask_and_check_password_extended(pwd, timeout, 1,
+ "Give root password for system maintenance\n"
+ "(or type Control-D for normal startup):"
+ );
+--
+2.9.1
+