]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
cryptsetup: fix flags check 19562/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 10 May 2021 13:04:10 +0000 (15:04 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 10 May 2021 17:53:52 +0000 (19:53 +0200)
FLAGS_SET() checks if *all* the bits are set. In this case we want to check
if *any* are. FLAGS_SET() was added in cde2f8605e0c3842f9a87785dd758f955f2d04ba,
but not a bug then yet, because with just one bit, both options are equivalent.
But when more bits were added later, this stopped being correct.

src/cryptsetup/cryptsetup.c

index 5ae2aaa06036356090b03d614383e4edce23c408..ca6bdecb8632913adc01fc488a05d986672c207b 100644 (file)
@@ -772,7 +772,7 @@ static int attach_luks_or_plain_or_bitlk_by_fido2(
                 if (r < 0)
                         return r;
 
-                if (FLAGS_SET(required, FIDO2ENROLL_PIN | FIDO2ENROLL_UP | FIDO2ENROLL_UV) && arg_headless)
+                if ((required & (FIDO2ENROLL_PIN | FIDO2ENROLL_UP | FIDO2ENROLL_UV)) && arg_headless)
                         return log_error_errno(SYNTHETIC_ERRNO(ENOPKG),
                                                "Local verification is required to unlock this volume, but the 'headless' parameter was set.");