From a51168481f2e3bcda2c18c2f2edae311caee495b Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 3 Jun 2021 10:42:55 +0200 Subject: [PATCH] ask-password: default to a different prompt than "Password:" if the echo is on --- src/ask-password/ask-password.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ask-password/ask-password.c b/src/ask-password/ask-password.c index fb4b7be4fcb..db6f2f59c0a 100644 --- a/src/ask-password/ask-password.c +++ b/src/ask-password/ask-password.c @@ -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; -- 2.47.3