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

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