Skip to content

Commit a505f10

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

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
@@ -2987,6 +2987,7 @@ int dissected_image_decrypt_interactively(
29872987
if (r < 0)
29882988
return log_error_errno(r, "Failed to query for passphrase: %m");
29892989

2990+
assert(!strv_isempty(z));
29902991
passphrase = z[0];
29912992
}
29922993
}

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)