mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone
Blob Blame History Raw
From 0c01f7c2c9acb1336d996df65acddb33c2dc0181 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 7 Jul 2015 09:28:03 -0400
Subject: [PATCH] RHEL 7: Reject use of libguestfs-winsupport features except
 for virt-* tools (RHBZ#1240276).

---
 generator/c.ml | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/generator/c.ml b/generator/c.ml
index 606c898..bba57c5 100644
--- a/generator/c.ml
+++ b/generator/c.ml
@@ -1856,12 +1856,29 @@ and generate_client_actions actions () =
       pr "  const uint64_t progress_hint = 0;\n";
 
     pr "\n";
+
     enter_event name;
     check_null_strings c_name style;
     reject_unknown_optargs c_name style;
     check_args_validity c_name style;
     trace_call name c_name style;
 
+    (* RHEL 7 *)
+    if name = "mount" || name = "mount_ro" || name = "mount_options" ||
+       name = "mount_vfs" then (
+      pr "  if (g->program && !STRPREFIX (g->program, \"virt-\")) {\n";
+      pr "    CLEANUP_FREE char *vfs_type = guestfs_vfs_type (g, mountable);\n";
+      pr "    if (vfs_type && STREQ (vfs_type, \"ntfs\")) {\n";
+      pr "      error (g, \"mount: unsupported filesystem type\");\n";
+      pr "      if (trace_flag)\n";
+      pr "        guestfs_int_trace (g, \"%%s = %%s (error)\",\n";
+      pr "                              \"%s\", \"-1\");\n" name;
+      pr "      return %s;\n" (string_of_errcode errcode);
+      pr "    }\n";
+      pr "  }\n";
+      pr "\n";
+    );
+
     (* Calculate the total size of all FileIn arguments to pass
      * as a progress bar hint.
      *)
-- 
2.9.4