[Libguestfs] [PATCH v4 1/2] v2v: -o openstack: Restrict passthrough auth params to ‘os-*’.

Richard W.M. Jones rjones at redhat.com
Tue Nov 20 12:22:35 UTC 2018


This was already documented, but the implementation allowed you to
pass through anything to the openstack command.
---
 v2v/output_openstack.ml | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/v2v/output_openstack.ml b/v2v/output_openstack.ml
index 22fac69bd..b35a1f72a 100644
--- a/v2v/output_openstack.ml
+++ b/v2v/output_openstack.ml
@@ -110,13 +110,15 @@ let parse_output_options options =
        dev_disk_by_id := Some v
     | "guest-id", v ->
        guest_id := Some v
-    | k, v ->
-       (* Accumulate any remaining/unknown -oo parameters
+    | k, v when String.is_prefix k "os-" ->
+       (* Accumulate any remaining/unknown -oo os-* parameters
         * into the authentication list, where they will be
         * pass unmodified through to the openstack command.
         *)
        let opt = sprintf "--%s=%s" k v in
        authentication := opt :: !authentication
+    | k, _ ->
+       error (f_"-o openstack: unknown output option ‘-oo %s’") k
   ) options;
   let server_id = !server_id in
   let authentication = List.rev !authentication in
-- 
2.19.0.rc0




More information about the Libguestfs mailing list