]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: check if non-empty password is acquired 34279/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 6 Sep 2024 06:00:32 +0000 (15:00 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 6 Sep 2024 06:00:32 +0000 (15:00 +0900)
src/home/homectl.c
src/shared/dissect-image.c
src/tty-ask-password-agent/tty-ask-password-agent.c

index a71548439e2fc2f4bc71c0e5263a71fb31718213..cbb1c79f40886ebf3c31beb572ee7a6aba9a2cd7 100644 (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();
index b84924ad8d95d04124ee7eeebf1c35e3b7d485d5..a538425c1f968ea6bff74aeac4750d2023f68cd4 100644 (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];
         }
 }
index 4b1e848749045f03a7639b1eec358177e6f56065..df21f3d28fb3f57622d06e47d046e39c32f3ba4e 100644 (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");