]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared/ask-password-api: do not show hint on echo
authorChristian Hesse <mail@eworm.de>
Wed, 11 Mar 2020 19:39:07 +0000 (20:39 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 12 Mar 2020 16:55:23 +0000 (17:55 +0100)
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.

src/shared/ask-password-api.c

index 6abcbfca9d00fc6a09832dbe18d56275ff63c259..0fc5501e621d271b1b99ddba4d6c6e4bd67ee2ed 100644 (file)
@@ -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);