From: Yu Watanabe Date: Fri, 6 Sep 2024 06:00:32 +0000 (+0900) Subject: tree-wide: check if non-empty password is acquired X-Git-Tag: v257-rc1~536^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F34279%2Fhead;p=thirdparty%2Fsystemd.git tree-wide: check if non-empty password is acquired --- diff --git a/src/home/homectl.c b/src/home/homectl.c index a71548439e2..cbb1c79f408 100644 --- a/src/home/homectl.c +++ b/src/home/homectl.c @@ -1244,6 +1244,8 @@ static int acquire_new_password( if (r < 0) return log_error_errno(r, "Failed to acquire password: %m"); + assert(!strv_isempty(first)); + question = mfree(question); if (asprintf(&question, "Please enter new password for user %s (repeat):", user_name) < 0) return log_oom(); diff --git a/src/shared/dissect-image.c b/src/shared/dissect-image.c index b84924ad8d9..a538425c1f9 100644 --- a/src/shared/dissect-image.c +++ b/src/shared/dissect-image.c @@ -3079,6 +3079,7 @@ int dissected_image_decrypt_interactively( if (r < 0) return log_error_errno(r, "Failed to query for passphrase: %m"); + assert(!strv_isempty(z)); passphrase = z[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 4b1e8487490..df21f3d28fb 100644 --- a/src/tty-ask-password-agent/tty-ask-password-agent.c +++ b/src/tty-ask-password-agent/tty-ask-password-agent.c @@ -263,9 +263,7 @@ static int process_one_password_file(const char *filename) { return log_error_errno(r, "Failed to query password: %m"); } - if (strv_isempty(passwords)) - return -ECANCELED; - + assert(!strv_isempty(passwords)); r = send_passwords(socket_name, passwords); if (r < 0) return log_error_errno(r, "Failed to send: %m");