1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

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

This commit is contained in:
Yu Watanabe 2024-09-06 15:00:32 +09:00
parent 623a8b1922
commit 204529d0fc
3 changed files with 4 additions and 3 deletions

View File

@ -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();

View File

@ -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];
}
}

View File

@ -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");