Blame SOURCES/0005-RHEL-8-Reject-use-of-libguestfs-winsupport-features-.patch

ff8314
From cb2ac63562447e2780bd7103ed060fd6013b9054 Mon Sep 17 00:00:00 2001
46b2f6
From: "Richard W.M. Jones" <rjones@redhat.com>
46b2f6
Date: Tue, 7 Jul 2015 09:28:03 -0400
46b2f6
Subject: [PATCH] RHEL 8: Reject use of libguestfs-winsupport features except
46b2f6
 for virt-* tools (RHBZ#1240276).
46b2f6
ff8314
Fix the tests: it doesn't let us use guestfish for arbitrary Windows
ff8314
edits.
46b2f6
---
ff8314
 generator/c.ml                             | 16 ++++++++++++++++
ff8314
 test-data/phony-guests/make-windows-img.sh |  1 +
ff8314
 tests/charsets/test-charset-fidelity.c     |  2 ++
ff8314
 3 files changed, 19 insertions(+)
46b2f6
46b2f6
diff --git a/generator/c.ml b/generator/c.ml
ff8314
index 86d3b26f8..a625361a9 100644
46b2f6
--- a/generator/c.ml
46b2f6
+++ b/generator/c.ml
ff8314
@@ -1846,6 +1846,22 @@ and generate_client_actions actions () =
46b2f6
     check_args_validity c_name style;
46b2f6
     trace_call name c_name style;
46b2f6
 
46b2f6
+    (* RHEL 8 *)
46b2f6
+    if name = "mount" || name = "mount_ro" || name = "mount_options" ||
46b2f6
+       name = "mount_vfs" then (
46b2f6
+      pr "  if (g->program && !STRPREFIX (g->program, \"virt-\")) {\n";
46b2f6
+      pr "    CLEANUP_FREE char *vfs_type = guestfs_vfs_type (g, mountable);\n";
46b2f6
+      pr "    if (vfs_type && STREQ (vfs_type, \"ntfs\")) {\n";
46b2f6
+      pr "      error (g, \"mount: unsupported filesystem type\");\n";
46b2f6
+      pr "      if (trace_flag)\n";
46b2f6
+      pr "        guestfs_int_trace (g, \"%%s = %%s (error)\",\n";
46b2f6
+      pr "                              \"%s\", \"-1\");\n" name;
46b2f6
+      pr "      return %s;\n" (string_of_errcode errcode);
46b2f6
+      pr "    }\n";
46b2f6
+      pr "  }\n";
46b2f6
+      pr "\n";
46b2f6
+    );
46b2f6
+
46b2f6
     (* Calculate the total size of all FileIn arguments to pass
46b2f6
      * as a progress bar hint.
46b2f6
      *)
ff8314
diff --git a/test-data/phony-guests/make-windows-img.sh b/test-data/phony-guests/make-windows-img.sh
ff8314
index 30908a918..73cf5144e 100755
ff8314
--- a/test-data/phony-guests/make-windows-img.sh
ff8314
+++ b/test-data/phony-guests/make-windows-img.sh
ff8314
@@ -37,6 +37,7 @@ fi
ff8314
 
ff8314
 # Create a disk image.
ff8314
 guestfish <
ff8314
+set-program virt-testing
ff8314
 sparse windows.img-t 512M
ff8314
 run
ff8314
 
ff8314
diff --git a/tests/charsets/test-charset-fidelity.c b/tests/charsets/test-charset-fidelity.c
ff8314
index 39ccc2068..2b2e2d8a9 100644
ff8314
--- a/tests/charsets/test-charset-fidelity.c
ff8314
+++ b/tests/charsets/test-charset-fidelity.c
ff8314
@@ -94,6 +94,8 @@ main (int argc, char *argv[])
ff8314
   if (g == NULL)
ff8314
     error (EXIT_FAILURE, 0, "failed to create handle");
ff8314
 
ff8314
+  guestfs_set_program (g, "virt-testing");
ff8314
+
ff8314
   if (guestfs_add_drive_scratch (g, 1024*1024*1024, -1) == -1)
ff8314
     exit (EXIT_FAILURE);
ff8314
 
46b2f6
-- 
5ce0c7
2.18.4
46b2f6