1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-19 22:50:17 +03:00

tree-wide: check if non-empty password is acquired

(cherry picked from commit 204529d0fcde9a95119b489225620f36649c2f5b)
This commit is contained in:
Yu Watanabe 2024-09-06 15:00:32 +09:00 committed by Daan De Meyer
parent 34881c9d5a
commit e80e9dce63
3 changed files with 4 additions and 3 deletions

View File

@ -1243,6 +1243,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();

View File

@ -3077,6 +3077,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];
}
}

View File

@ -265,9 +265,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");