Skip to content

Commit bf4bc35

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) (cherry picked from commit 1a62817)
1 parent 339e0b4 commit bf4bc35

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
@@ -1204,6 +1204,8 @@ static int acquire_new_password(
12041204
if (r < 0)
12051205
return log_error_errno(r, "Failed to acquire password: %m");
12061206

1207+
assert(!strv_isempty(first));
1208+
12071209
question = mfree(question);
12081210
if (asprintf(&question, "Please enter new password for user %s (repeat):", user_name) < 0)
12091211
return log_oom();

src/shared/dissect-image.c

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

2547+
assert(!strv_isempty(z));
25472548
passphrase = z[0];
25482549
}
25492550
}

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)