chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
unit-name: fix escaping logic in unit_name_mangle_with_suffix()
[elogind.git]
/
src
/
shared
/
ask-password-api.c
diff --git
a/src/shared/ask-password-api.c
b/src/shared/ask-password-api.c
index c3c78b69fbc0ba42a2ba1801146c96269f16b992..94a27f9010cca4924761187a92d43513e1deee8c 100644
(file)
--- 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,
int ask_password_tty(
const char *message,
usec_t until,
+ bool echo,
const char *flag_file,
char **_passphrase) {
const char *flag_file,
char **_passphrase) {
@@
-218,7
+219,7
@@
int ask_password_tty(
passphrase[p++] = c;
if (!silent_mode && ttyfd >= 0)
passphrase[p++] = c;
if (!silent_mode && ttyfd >= 0)
- loop_write(ttyfd, "*", 1, false);
+ loop_write(ttyfd,
echo ? &c :
"*", 1, false);
dirty = true;
}
dirty = true;
}
@@
-270,7
+271,7
@@
static int create_socket(char **name) {
if (r < 0) {
r = -errno;
if (r < 0) {
r = -errno;
- log_error("bind(
) failed: %m"
);
+ log_error("bind(
%s) failed: %m", sa.un.sun_path
);
goto fail;
}
goto fail;
}
@@
-300,6
+301,7
@@
int ask_password_agent(
const char *icon,
const char *id,
usec_t until,
const char *icon,
const char *id,
usec_t until,
+ bool echo,
bool accept_cached,
char ***_passphrases) {
bool accept_cached,
char ***_passphrases) {
@@
-359,14
+361,16
@@
int ask_password_agent(
fprintf(f,
"[Ask]\n"
fprintf(f,
"[Ask]\n"
- "PID=
%lu
\n"
+ "PID=
"PID_FMT"
\n"
"Socket=%s\n"
"AcceptCached=%i\n"
"Socket=%s\n"
"AcceptCached=%i\n"
- "NotAfter=%llu\n",
- (unsigned long) getpid(),
+ "Echo=%i\n"
+ "NotAfter="USEC_FMT"\n",
+ getpid(),
socket_name,
accept_cached ? 1 : 0,
socket_name,
accept_cached ? 1 : 0,
- (unsigned long long) until);
+ echo ? 1 : 0,
+ until);
if (message)
fprintf(f, "Message=%s\n", message);
if (message)
fprintf(f, "Message=%s\n", 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;
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;
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
*_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);
}
}