Blame SOURCES/0001-options-Use-new-cryptsetup-open-API-if-available.patch

62f9b7
From 96ea18db4a4f2e336145553c0fbbba59ede2221e Mon Sep 17 00:00:00 2001
62f9b7
From: "Richard W.M. Jones" <rjones@redhat.com>
62f9b7
Date: Mon, 30 Mar 2020 14:34:43 +0100
62f9b7
Subject: [PATCH 1/4] options: Use new cryptsetup-open API if available.
62f9b7
62f9b7
Fall back to luks-open if we're using libguestfs <= 1.43.1.
62f9b7
---
62f9b7
 options/decrypt.c | 6 +++++-
62f9b7
 1 file changed, 5 insertions(+), 1 deletion(-)
62f9b7
62f9b7
diff --git a/options/decrypt.c b/options/decrypt.c
62f9b7
index 683cf5e..d868f70 100644
62f9b7
--- a/common/options/decrypt.c
62f9b7
+++ b/common/options/decrypt.c
62f9b7
@@ -97,11 +97,15 @@ inspect_do_decrypt (guestfs_h *g, struct key_store *ks)
62f9b7
 
62f9b7
       /* Try each key in turn. */
62f9b7
       for (j = 0; keys[j] != NULL; ++j) {
62f9b7
-        /* XXX Should we call guestfs_luks_open_ro if readonly flag
62f9b7
+        /* XXX Should we set GUESTFS_CRYPTSETUP_OPEN_READONLY if readonly
62f9b7
          * is set?  This might break 'mount_ro'.
62f9b7
          */
62f9b7
         guestfs_push_error_handler (g, NULL, NULL);
62f9b7
+#ifdef GUESTFS_HAVE_CRYPTSETUP_OPEN
62f9b7
+        r = guestfs_cryptsetup_open (g, partitions[i], keys[j], mapname, -1);
62f9b7
+#else
62f9b7
         r = guestfs_luks_open (g, partitions[i], keys[j], mapname);
62f9b7
+#endif
62f9b7
         guestfs_pop_error_handler (g);
62f9b7
         if (r == 0)
62f9b7
           goto opened;
62f9b7
-- 
62f9b7
2.18.4
62f9b7