summaryrefslogtreecommitdiff
path: root/src/tty-ask-password-agent/tty-ask-password-agent.c
diff options
context:
space:
mode:
authorDavid Sommerseth <davids@redhat.com>2014-10-03 15:53:45 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-10-05 15:29:41 -0400
commit64845bdc829d6a6179d0762b7e97ef23828562a3 (patch)
tree639cc68e573d665a61a45836d1793ac2eb96932c /src/tty-ask-password-agent/tty-ask-password-agent.c
parent75a0da952f603006d6b3535ecaf8ebe2bded30e7 (diff)
ask-password: Add --echo to enable echoing the user input
Programs such as OpenVPN may use ask-password for not only retrieving passwords, but also usernames. Masking usernames with * seems just silly. v2 - Don't mess with termios flags, instead print the input instead of an asterix. Resolves issues with backspace and TAB input. v3 - Renamed 'do_echo' variables and argument to 'echo'. Also modified the ask_password_{tty,agent,auto} API instead of additional wrapper functions. [zj: undo changes to ask_password_auto, since no callers were using the new argument.]
Diffstat (limited to 'src/tty-ask-password-agent/tty-ask-password-agent.c')
-rw-r--r--src/tty-ask-password-agent/tty-ask-password-agent.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/tty-ask-password-agent/tty-ask-password-agent.c b/src/tty-ask-password-agent/tty-ask-password-agent.c
index e7cbde285c..e6dc84b440 100644
--- a/src/tty-ask-password-agent/tty-ask-password-agent.c
+++ b/src/tty-ask-password-agent/tty-ask-password-agent.c
@@ -214,7 +214,7 @@ static int parse_password(const char *filename, char **wall) {
_cleanup_free_ char *socket_name = NULL, *message = NULL, *packet = NULL;
uint64_t not_after = 0;
unsigned pid = 0;
- bool accept_cached = false;
+ bool accept_cached = false, echo = false;
const ConfigTableItem items[] = {
{ "Ask", "Socket", config_parse_string, 0, &socket_name },
@@ -222,6 +222,7 @@ static int parse_password(const char *filename, char **wall) {
{ "Ask", "Message", config_parse_string, 0, &message },
{ "Ask", "PID", config_parse_unsigned, 0, &pid },
{ "Ask", "AcceptCached", config_parse_bool, 0, &accept_cached },
+ { "Ask", "Echo", config_parse_bool, 0, &echo },
{}
};
@@ -314,7 +315,7 @@ static int parse_password(const char *filename, char **wall) {
return tty_fd;
}
- r = ask_password_tty(message, not_after, filename, &password);
+ r = ask_password_tty(message, not_after, echo, filename, &password);
if (arg_console) {
safe_close(tty_fd);