mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

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

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