]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Merge pull request #16111 from poettering/bitlck-fix
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 10 Jun 2020 08:25:36 +0000 (10:25 +0200)
committerGitHub <noreply@github.com>
Wed, 10 Jun 2020 08:25:36 +0000 (10:25 +0200)
bitlocker cryptsetup fix

src/cryptsetup/cryptsetup.c

index c05e2d1351aefeaf3abcde8a35cfb707a49bb2fb..6d3f842dbe1ec5fb5f6bf7d70ec3ff0b574f67ac 100644 (file)
@@ -932,8 +932,8 @@ static int run(int argc, char *argv[]) {
                                 log_warning("Key file %s is world-readable. This is not a good idea!", key_file);
                 }
 
-                if (!arg_type || STR_IN_SET(arg_type, ANY_LUKS, CRYPT_LUKS1)) {
-                        r = crypt_load(cd, CRYPT_LUKS, NULL);
+                if (!arg_type || STR_IN_SET(arg_type, ANY_LUKS, CRYPT_LUKS1, CRYPT_LUKS2)) {
+                        r = crypt_load(cd, !arg_type || streq(arg_type, ANY_LUKS) ? CRYPT_LUKS : arg_type, NULL);
                         if (r < 0)
                                 return log_error_errno(r, "Failed to load LUKS superblock on device %s: %m", crypt_get_device_name(cd));
 
@@ -957,7 +957,7 @@ static int run(int argc, char *argv[]) {
 
 /* since cryptsetup 2.3.0 (Feb 2020) */
 #ifdef CRYPT_BITLK
-                if (!arg_type || STR_IN_SET(arg_type, ANY_LUKS, CRYPT_BITLK)) {
+                if (streq_ptr(arg_type, CRYPT_BITLK)) {
                         r = crypt_load(cd, CRYPT_BITLK, NULL);
                         if (r < 0)
                                 return log_error_errno(r, "Failed to load Bitlocker superblock on device %s: %m", crypt_get_device_name(cd));