RHEL: Reject use of libguestfs-winsupport features except for virt-* tools (RHBZ#1240276).

Fix the tests: it doesn't let us use guestfish for arbitrary Windows
edits.
This commit is contained in:
Richard W.M. Jones
2015-07-07 09:28:03 -04:00
parent c508b33902
commit b8c1579194
3 changed files with 19 additions and 0 deletions

View File

@@ -1836,6 +1836,22 @@ and generate_client_actions actions () =
check_args_validity c_name style;
trace_call name c_name style;
(* RHEL *)
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.
*)

View File

@@ -37,6 +37,7 @@ fi
# Create a disk image.
guestfish <<EOF
set-program virt-testing
sparse windows.img-t 512M
run

View File

@@ -96,6 +96,8 @@ main (int argc, char *argv[])
if (g == NULL)
error (EXIT_FAILURE, 0, "failed to create handle");
guestfs_set_program (g, "virt-testing");
if (guestfs_add_drive_scratch (g, 1024*1024*1024, -1) == -1)
exit (EXIT_FAILURE);