Blame SOURCES/0011-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch

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