mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
generator: Don't permit certain String/stringt combinations.
After the previous commit it become possible to construct various "impossible" argument types, such as lists of FileIn strings. This commit prevents these from happening.
This commit is contained in:
@@ -154,6 +154,29 @@ let () =
|
||||
List.iter check_arg_type args;
|
||||
) (actions |> daemon_functions);
|
||||
|
||||
(* Some String/stringt and StringList/stringt combinations are
|
||||
* not permitted.
|
||||
*)
|
||||
List.iter (
|
||||
fun { name = name; style = _, args, _ } ->
|
||||
let check_arg_type = function
|
||||
(* Previously only DeviceList and FilenameList were special list
|
||||
* types. We could permit more here in future.
|
||||
*)
|
||||
| StringList (FileIn, _)
|
||||
| StringList (FileOut, _)
|
||||
| StringList (Mountable, _)
|
||||
| StringList (Pathname, _)
|
||||
| StringList (Dev_or_Path, _)
|
||||
| StringList (Mountable_or_Path, _)
|
||||
| StringList (Key, _)
|
||||
| StringList (GUID, _) ->
|
||||
failwithf "StringList (t, _) is not permitted for %s." name
|
||||
| _ -> ()
|
||||
in
|
||||
List.iter check_arg_type args
|
||||
) actions;
|
||||
|
||||
(* Check short descriptions. *)
|
||||
List.iter (
|
||||
fun { name = name; shortdesc = shortdesc } ->
|
||||
|
||||
Reference in New Issue
Block a user