]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
cryptenroll: fix an assertion with weak passwords
authorFrantisek Sumsal <frantisek@sumsal.cz>
Tue, 9 May 2023 20:17:15 +0000 (22:17 +0200)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Tue, 9 May 2023 20:17:15 +0000 (22:17 +0200)
Passing 0 to log_xxx_errno() leads to an assertion, so let's not do that:

$ NEWPASSWORD="" build-san/systemd-cryptenroll --unlock-key-file=/tmp/password --password "$img"
/tmp/password has 0644 mode that is too permissive, please adjust the ownership and access mode.
Assertion '(_error) != 0' failed at src/cryptenroll/cryptenroll-password.c:164, function enroll_password(). Aborting.
Aborted (core dumped)

src/cryptenroll/cryptenroll-password.c

index 25a90b5905304d7e80528c1456ca94078a55494d..72f2165d49cefc9f8f8e6bebd635d3c5f5fac6be 100644 (file)
@@ -161,7 +161,7 @@ int enroll_password(
         if (r < 0)
                 return log_error_errno(r, "Failed to check password for quality: %m");
         if (r == 0)
-                log_warning_errno(r, "Specified password does not pass quality checks (%s), proceeding anyway.", error);
+                log_warning("Specified password does not pass quality checks (%s), proceeding anyway.", error);
 
         keyslot = crypt_keyslot_add_by_volume_key(
                         cd,