mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

Blame SOURCES/0026-RHEL-7-Reject-use-of-libguestfs-winsupport-features-.patch

491457
From bde317aebdf229935880ab33e222eea325e7fe8c Mon Sep 17 00:00:00 2001
4ebc84
From: "Richard W.M. Jones" <rjones@redhat.com>
4ebc84
Date: Tue, 7 Jul 2015 09:28:03 -0400
4ebc84
Subject: [PATCH] RHEL 7: Reject use of libguestfs-winsupport features except
4ebc84
 for virt-* tools (RHBZ#1240276).
4ebc84
4ebc84
---
4ebc84
 generator/c.ml | 17 +++++++++++++++++
4ebc84
 1 file changed, 17 insertions(+)
4ebc84
4ebc84
diff --git a/generator/c.ml b/generator/c.ml
4ebc84
index 86f7d89a3..9d7c491c2 100644
4ebc84
--- a/generator/c.ml
4ebc84
+++ b/generator/c.ml
4ebc84
@@ -1826,12 +1826,29 @@ and generate_client_actions actions () =
4ebc84
       pr "  const uint64_t progress_hint = 0;\n";
4ebc84
 
4ebc84
     pr "\n";
4ebc84
+
4ebc84
     enter_event name;
4ebc84
     check_null_strings c_name style;
4ebc84
     reject_unknown_optargs c_name style;
4ebc84
     check_args_validity c_name style;
4ebc84
     trace_call name c_name style;
4ebc84
 
4ebc84
+    (* RHEL 7 *)
4ebc84
+    if name = "mount" || name = "mount_ro" || name = "mount_options" ||
4ebc84
+       name = "mount_vfs" then (
4ebc84
+      pr "  if (g->program && !STRPREFIX (g->program, \"virt-\")) {\n";
4ebc84
+      pr "    CLEANUP_FREE char *vfs_type = guestfs_vfs_type (g, mountable);\n";
4ebc84
+      pr "    if (vfs_type && STREQ (vfs_type, \"ntfs\")) {\n";
4ebc84
+      pr "      error (g, \"mount: unsupported filesystem type\");\n";
4ebc84
+      pr "      if (trace_flag)\n";
4ebc84
+      pr "        guestfs_int_trace (g, \"%%s = %%s (error)\",\n";
4ebc84
+      pr "                              \"%s\", \"-1\");\n" name;
4ebc84
+      pr "      return %s;\n" (string_of_errcode errcode);
4ebc84
+      pr "    }\n";
4ebc84
+      pr "  }\n";
4ebc84
+      pr "\n";
4ebc84
+    );
4ebc84
+
4ebc84
     (* Calculate the total size of all FileIn arguments to pass
4ebc84
      * as a progress bar hint.
4ebc84
      *)
4ebc84
-- 
4ebc84
2.21.0
4ebc84