]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
ask-password: default to a different prompt than "Password:" if the echo is on
authorLennart Poettering <lennart@poettering.net>
Thu, 3 Jun 2021 08:42:55 +0000 (10:42 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 3 Jun 2021 09:16:48 +0000 (11:16 +0200)
src/ask-password/ask-password.c

index fb4b7be4fcbeb6e5196a331d4980f8a33b8033a1..db6f2f59c0aabb2af089fa5159793c585c5c2fa0 100644 (file)
@@ -200,6 +200,14 @@ static int parse_argv(int argc, char *argv[]) {
                 arg_message = strv_join(argv + optind, " ");
                 if (!arg_message)
                         return log_oom();
+        } else if (FLAGS_SET(arg_flags, ASK_PASSWORD_ECHO)) {
+                /* By default ask_password_auto() will query with the string "Password: ", which is not right
+                 * when full echo is on, since then it's unlikely a password. Let's hence default to a less
+                 * confusing string in that case. */
+
+                arg_message = strdup("Input:");
+                if (!arg_message)
+                        return log_oom();
         }
 
         return 1;