Skip to content

Commit

Permalink
tree-wide: check if non-empty password is acquired
Browse files Browse the repository at this point in the history
(cherry picked from commit 204529d0fcde9a95119b489225620f36649c2f5b)
(cherry picked from commit e80e9dce63787d1d4494ed65d7c27018344387d5)
(cherry picked from commit a505f10)
  • Loading branch information
yuwata authored and bluca committed Sep 11, 2024
1 parent abaef1a commit 1a62817
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/home/homectl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1208,6 +1208,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();
Expand Down
1 change: 1 addition & 0 deletions src/shared/dissect-image.c
Original file line number Diff line number Diff line change
Expand Up @@ -2906,6 +2906,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];
}
}
Expand Down
4 changes: 1 addition & 3 deletions src/tty-ask-password-agent/tty-ask-password-agent.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,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");
Expand Down

0 comments on commit 1a62817

Please sign in to comment.