From 20a7592edf5feacc25ef6bb80f667883d6f557e7 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Wed, 11 Mar 2020 20:39:07 +0100 Subject: [PATCH] shared/ask-password-api: do not show hint on echo Giving --echo to systemd-ask-password allows to echo the user input instead of masking it. This is useful when querying for usernames or similar. Showing "(press TAB for no echo)" does not make sense there, so do not. Note that pressing TAB or ESC still disables echo. (cherry picked from commit ddee0e815ed5500722019bcb807957ea6846212d) --- src/shared/ask-password-api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/ask-password-api.c b/src/shared/ask-password-api.c index 6abcbfca9d..0fc5501e62 100644 --- a/src/shared/ask-password-api.c +++ b/src/shared/ask-password-api.c @@ -469,7 +469,7 @@ int ask_password_tty( (void) loop_write(ttyfd, message, strlen(message), false); (void) loop_write(ttyfd, " ", 1, false); - if (!(flags & ASK_PASSWORD_SILENT)) { + if (!(flags & ASK_PASSWORD_SILENT) && !(flags & ASK_PASSWORD_ECHO)) { if (use_color) (void) loop_write(ttyfd, ANSI_GREY, STRLEN(ANSI_GREY), false); (void) loop_write(ttyfd, PRESS_TAB, strlen(PRESS_TAB), false); -- 2.25.1