Skip to content

Commit 1a62817

Browse files
yuwatabluca
authored andcommitted
tree-wide: check if non-empty password is acquired
(cherry picked from commit 204529d) (cherry picked from commit e80e9dc) (cherry picked from commit a505f10)
1 parent abaef1a commit 1a62817

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

src/home/homectl.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,6 +1208,8 @@ static int acquire_new_password(
12081208
if (r < 0)
12091209
return log_error_errno(r, "Failed to acquire password: %m");
12101210

1211+
assert(!strv_isempty(first));
1212+
12111213
question = mfree(question);
12121214
if (asprintf(&question, "Please enter new password for user %s (repeat):", user_name) < 0)
12131215
return log_oom();

src/shared/dissect-image.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2906,6 +2906,7 @@ int dissected_image_decrypt_interactively(
29062906
if (r < 0)
29072907
return log_error_errno(r, "Failed to query for passphrase: %m");
29082908

2909+
assert(!strv_isempty(z));
29092910
passphrase = z[0];
29102911
}
29112912
}

src/tty-ask-password-agent/tty-ask-password-agent.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,7 @@ static int process_one_password_file(const char *filename) {
257257
return log_error_errno(r, "Failed to query password: %m");
258258
}
259259

260-
if (strv_isempty(passwords))
261-
return -ECANCELED;
262-
260+
assert(!strv_isempty(passwords));
263261
r = send_passwords(socket_name, passwords);
264262
if (r < 0)
265263
return log_error_errno(r, "Failed to send: %m");

0 commit comments

Comments
 (0)