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

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