diff options
author | Lennart Poettering <lennart@poettering.net> | 2020-08-26 23:05:46 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-09-20 12:38:25 +0200 |
commit | 7b6e0f74f27cc6800af04861c95344b588a8d56d (patch) | |
tree | e6a1a659cca913191d48db24788bfc45d1307337 | |
parent | 0bfe4bd39b3f48030c49489ab87eb799dba590da (diff) | |
download | systemd-7b6e0f74f27cc6800af04861c95344b588a8d56d.tar.gz |
tty-ask-pw-agent: the message string might not be set
(cherry picked from commit 66bff73b4f91f8d2fdd385f9f1e2b6339055c9e4)
(cherry picked from commit f7ce2e9839f2a7b3aa97b1f35e5b3f1f66459e93)
(cherry picked from commit e99154585cd955b550c938647bd5b9650a1aedfd)
-rw-r--r-- | src/shared/ask-password-api.c | 3 | ||||
-rw-r--r-- | src/tty-ask-password-agent/tty-ask-password-agent.c | 10 |
2 files changed, 7 insertions, 6 deletions
diff --git a/src/shared/ask-password-api.c b/src/shared/ask-password-api.c index 7f6775f4a1..a20384afab 100644 --- a/src/shared/ask-password-api.c +++ b/src/shared/ask-password-api.c @@ -236,6 +236,9 @@ int ask_password_plymouth( assert(ret); + if (!message) + message = "Password:"; + if (flag_file) { notify = inotify_init1(IN_CLOEXEC|IN_NONBLOCK); if (notify < 0) 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 a6e9aa5be2..568a91536b 100644 --- a/src/tty-ask-password-agent/tty-ask-password-agent.c +++ b/src/tty-ask-password-agent/tty-ask-password-agent.c @@ -206,7 +206,7 @@ static int process_one_password_file(const char *filename) { switch (arg_action) { case ACTION_LIST: - printf("'%s' (PID %u)\n", message, pid); + printf("'%s' (PID %u)\n", strna(message), pid); return 0; case ACTION_WALL: { @@ -215,7 +215,7 @@ static int process_one_password_file(const char *filename) { if (asprintf(&wall, "Password entry required for \'%s\' (PID %u).\r\n" "Please enter password with the systemd-tty-ask-password-agent tool.", - message, + strna(message), pid) < 0) return log_oom(); @@ -229,7 +229,7 @@ static int process_one_password_file(const char *filename) { if (access(socket_name, W_OK) < 0) { if (arg_action == ACTION_QUERY) - log_info("Not querying '%s' (PID %u), lacking privileges.", message, pid); + log_info("Not querying '%s' (PID %u), lacking privileges.", strna(message), pid); return 0; } @@ -242,7 +242,6 @@ static int process_one_password_file(const char *filename) { r = ask_password_plymouth(message, not_after, flags, filename, &passwords); else r = agent_ask_password_tty(message, not_after, flags, filename, &passwords); - if (r < 0) { /* If the query went away, that's OK */ if (IN_SET(r, -ETIME, -ENOENT)) @@ -258,8 +257,7 @@ static int process_one_password_file(const char *filename) { if (r < 0) return log_error_errno(r, "Failed to send: %m"); break; - } - } + }} return 0; } |