summaryrefslogtreecommitdiffstats
path: root/src/ask-password/ask-password.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-06-03 10:42:55 +0200
committerLennart Poettering <lennart@poettering.net>2021-06-03 11:16:48 +0200
commita51168481f2e3bcda2c18c2f2edae311caee495b (patch)
treefabbf5be3dd11640c21d52b84997d44f76d7c510 /src/ask-password/ask-password.c
parentask-password: make password echo fully configurable (diff)
downloadsystemd-a51168481f2e3bcda2c18c2f2edae311caee495b.tar.xz
systemd-a51168481f2e3bcda2c18c2f2edae311caee495b.zip
ask-password: default to a different prompt than "Password:" if the echo is on
Diffstat (limited to 'src/ask-password/ask-password.c')
-rw-r--r--src/ask-password/ask-password.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/ask-password/ask-password.c b/src/ask-password/ask-password.c
index fb4b7be4fc..db6f2f59c0 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;