Blame SOURCES/0004-options-Ignore-errors-from-guestfs_luks_uuid.patch

62f9b7
From 132c355d3ba10b6ec303cbc059d6732056474695 Mon Sep 17 00:00:00 2001
62f9b7
From: "Richard W.M. Jones" <rjones@redhat.com>
62f9b7
Date: Tue, 6 Oct 2020 15:04:27 +0100
62f9b7
Subject: [PATCH 4/4] options: Ignore errors from guestfs_luks_uuid.
62f9b7
62f9b7
For BitLocker disks cryptsetup does not (yet? ever?) support reading
62f9b7
UUIDs and this function will fail.  Skip reading the UUID in this
62f9b7
case.
62f9b7
62f9b7
Updates commit bb4a2dc17a78b53437896d4215ae82df8e11b788.
62f9b7
---
62f9b7
 options/decrypt.c | 11 ++++++++++-
62f9b7
 1 file changed, 10 insertions(+), 1 deletion(-)
62f9b7
62f9b7
diff --git a/options/decrypt.c b/options/decrypt.c
62f9b7
index 8eb24bc..434b7d5 100644
62f9b7
--- a/common/options/decrypt.c
62f9b7
+++ b/common/options/decrypt.c
62f9b7
@@ -25,6 +25,7 @@
62f9b7
 
62f9b7
 #include <stdio.h>
62f9b7
 #include <stdlib.h>
62f9b7
+#include <stdbool.h>
62f9b7
 #include <string.h>
62f9b7
 #include <libintl.h>
62f9b7
 #include <error.h>
62f9b7
@@ -82,11 +83,19 @@ inspect_do_decrypt (guestfs_h *g, struct key_store *ks)
62f9b7
     CLEANUP_FREE char *type = guestfs_vfs_type (g, partitions[i]);
62f9b7
     if (type &&
62f9b7
         (STREQ (type, "crypto_LUKS") || STREQ (type, "BitLocker"))) {
62f9b7
+      bool is_bitlocker = STREQ (type, "BitLocker");
62f9b7
       char mapname[32];
62f9b7
       make_mapname (partitions[i], mapname, sizeof mapname);
62f9b7
 
62f9b7
 #ifdef GUESTFS_HAVE_LUKS_UUID
62f9b7
-      CLEANUP_FREE char *uuid = guestfs_luks_uuid (g, partitions[i]);
62f9b7
+      CLEANUP_FREE char *uuid = NULL;
62f9b7
+
62f9b7
+      /* This fails for Windows BitLocker disks because cryptsetup
62f9b7
+       * luksUUID cannot read a UUID (unclear if this is a limitation
62f9b7
+       * of the format or cryptsetup).
62f9b7
+       */
62f9b7
+      if (!is_bitlocker)
62f9b7
+        uuid = guestfs_luks_uuid (g, partitions[i]);
62f9b7
 #else
62f9b7
       const char *uuid = NULL;
62f9b7
 #endif
62f9b7
-- 
62f9b7
2.18.4
62f9b7