summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/ask-password-api.c10
-rw-r--r--src/shared/ask-password-api.h4
2 files changed, 9 insertions, 5 deletions
diff --git a/src/shared/ask-password-api.c b/src/shared/ask-password-api.c
index 8d03f4ad09..94a27f9010 100644
--- a/src/shared/ask-password-api.c
+++ b/src/shared/ask-password-api.c
@@ -52,6 +52,7 @@ static void backspace_chars(int ttyfd, size_t p) {
int ask_password_tty(
const char *message,
usec_t until,
+ bool echo,
const char *flag_file,
char **_passphrase) {
@@ -218,7 +219,7 @@ int ask_password_tty(
passphrase[p++] = c;
if (!silent_mode && ttyfd >= 0)
- loop_write(ttyfd, "*", 1, false);
+ loop_write(ttyfd, echo ? &c : "*", 1, false);
dirty = true;
}
@@ -300,6 +301,7 @@ int ask_password_agent(
const char *icon,
const char *id,
usec_t until,
+ bool echo,
bool accept_cached,
char ***_passphrases) {
@@ -362,10 +364,12 @@ int ask_password_agent(
"PID="PID_FMT"\n"
"Socket=%s\n"
"AcceptCached=%i\n"
+ "Echo=%i\n"
"NotAfter="USEC_FMT"\n",
getpid(),
socket_name,
accept_cached ? 1 : 0,
+ echo ? 1 : 0,
until);
if (message)
@@ -550,7 +554,7 @@ int ask_password_auto(const char *message, const char *icon, const char *id,
int r;
char *s = NULL, **l = NULL;
- r = ask_password_tty(message, until, NULL, &s);
+ r = ask_password_tty(message, until, false, NULL, &s);
if (r < 0)
return r;
@@ -561,5 +565,5 @@ int ask_password_auto(const char *message, const char *icon, const char *id,
*_passphrases = l;
return r;
} else
- return ask_password_agent(message, icon, id, until, accept_cached, _passphrases);
+ return ask_password_agent(message, icon, id, until, false, accept_cached, _passphrases);
}
diff --git a/src/shared/ask-password-api.h b/src/shared/ask-password-api.h
index 3839a2df0f..704ee6e1b4 100644
--- a/src/shared/ask-password-api.h
+++ b/src/shared/ask-password-api.h
@@ -23,10 +23,10 @@
#include "util.h"
-int ask_password_tty(const char *message, usec_t until, const char *flag_file, char **_passphrase);
+int ask_password_tty(const char *message, usec_t until, bool echo, const char *flag_file, char **_passphrase);
int ask_password_agent(const char *message, const char *icon, const char *id,
- usec_t until, bool accept_cached, char ***_passphrases);
+ usec_t until, bool echo, bool accept_cached, char ***_passphrases);
int ask_password_auto(const char *message, const char *icon, const char *id,
usec_t until, bool accept_cached, char ***_passphrases);