Blame SOURCES/0015-guestfish-guestmount-enable-networking-for-key-ID-cl.patch

65aaff
From 5ae97d7d83d8cdb6e8428774282167dd774aaf70 Mon Sep 17 00:00:00 2001
65aaff
From: Laszlo Ersek <lersek@redhat.com>
65aaff
Date: Thu, 30 Jun 2022 14:20:48 +0200
65aaff
Subject: [PATCH] guestfish, guestmount: enable networking for "--key
65aaff
 ID:clevis"
65aaff
65aaff
Call the C-language helper key_store_requires_network() in guestfish and
65aaff
guestmount.
65aaff
65aaff
(Short log for the "common" submodule, commit range
65aaff
35467027f657..af6cb55bc58a:
65aaff
65aaff
Laszlo Ersek (12):
65aaff
      options: fix UUID comparison logic bug in get_keys()
65aaff
      mltools/tools_utils: remove unused function "key_store_to_cli"
65aaff
      mltools/tools_utils: allow multiple "--key" options for OCaml tools too
65aaff
      options: replace NULL-termination with number-of-elements in get_keys()
65aaff
      options: wrap each passphrase from get_keys() into a struct
65aaff
      options: add back-end for LUKS decryption with Clevis+Tang
65aaff
      options: introduce selector type "key_clevis"
65aaff
      options: generalize "--key" selector parsing for C-language utilities
65aaff
      mltools/tools_utils-c: handle internal type error with abort()
65aaff
      mltools/tools_utils: generalize "--key" selector parsing for OCaml utils
65aaff
      options, mltools/tools_utils: parse "--key ID:clevis" options
65aaff
      options, mltools/tools_utils: add helper for network dependency
65aaff
).
65aaff
65aaff
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1809453
65aaff
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
65aaff
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
65aaff
Message-Id: <20220630122048.19335-4-lersek@redhat.com>
65aaff
(cherry picked from commit 6a5b44f538065a9f661510234a4235bf38348213)
65aaff
---
65aaff
 fish/fish.c       | 3 +++
65aaff
 fuse/guestmount.c | 4 ++++
65aaff
 2 files changed, 7 insertions(+)
65aaff
65aaff
diff --git a/fish/fish.c b/fish/fish.c
65aaff
index 23d9bb94f..19e3d2799 100644
65aaff
--- a/fish/fish.c
65aaff
+++ b/fish/fish.c
65aaff
@@ -476,6 +476,9 @@ main (int argc, char *argv[])
65aaff
   /* If we've got drives to add, add them now. */
65aaff
   add_drives (drvs);
65aaff
 
65aaff
+  if (key_store_requires_network (ks) && guestfs_set_network (g, 1) == -1)
65aaff
+    exit (EXIT_FAILURE);
65aaff
+
65aaff
   /* If we've got mountpoints or prepared drives or -i option, we must
65aaff
    * launch the guest and mount them.
65aaff
    */
65aaff
diff --git a/fuse/guestmount.c b/fuse/guestmount.c
65aaff
index 77c534828..3c6d57bde 100644
65aaff
--- a/fuse/guestmount.c
65aaff
+++ b/fuse/guestmount.c
65aaff
@@ -348,6 +348,10 @@ main (int argc, char *argv[])
65aaff
 
65aaff
   /* Do the guest drives and mountpoints. */
65aaff
   add_drives (drvs);
65aaff
+
65aaff
+  if (key_store_requires_network (ks) && guestfs_set_network (g, 1) == -1)
65aaff
+    exit (EXIT_FAILURE);
65aaff
+
65aaff
   if (guestfs_launch (g) == -1)
65aaff
     exit (EXIT_FAILURE);
65aaff
   if (inspector)
65aaff
-- 
65aaff
2.31.1
65aaff