File tree Expand file tree Collapse file tree 7 files changed +11
-7
lines changed Expand file tree Collapse file tree 7 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -2375,7 +2375,7 @@ let sysprep =
23752375 ~params:
23762376 [
23772377 (Ref _vm, " self" , " The VM" )
2378- ; (String , " unattend" , " XML content passed to sysprep" )
2378+ ; (SecretString , " unattend" , " XML content passed to sysprep" )
23792379 ; (Float , " timeout" , " timeout in seconds for expected reboot" )
23802380 ]
23812381 ~doc:
Original file line number Diff line number Diff line change @@ -3602,7 +3602,7 @@ let vm_sysprep fd printer rpc session_id params =
36023602 let unattend =
36033603 match get_client_file fd filename with
36043604 | Some xml ->
3605- xml
3605+ xml |> SecretString. of_string
36063606 | None ->
36073607 marshal fd (Command (PrintStderr " Failed to read file.\n " )) ;
36083608 raise (ExitWithError 1 )
Original file line number Diff line number Diff line change @@ -24,6 +24,8 @@ let write_to_channel c s = output_string c s
2424
2525let equal = String. equal
2626
27+ let length = String. length
28+
2729let pool_secret = " pool_secret"
2830
2931let with_cookie t cookies = (pool_secret, t) :: cookies
Original file line number Diff line number Diff line change @@ -25,6 +25,8 @@ val of_string : string -> t
2525
2626val equal : t -> t -> bool
2727
28+ val length : t -> int
29+
2830val json_rpc_of_t : t -> Rpc .t
2931
3032val t_of_rpc : Rpc .t -> t
Original file line number Diff line number Diff line change @@ -140,7 +140,7 @@ let make_iso ~vm_uuid ~unattend =
140140 Xapi_stdext_unix.Unixext. mkdir_rec SR. dir 0o755 ;
141141 with_temp_dir ~dir: " /var/tmp/xapi" " sysprep-" " -iso" (fun temp_dir ->
142142 let path = temp_dir // " unattend.xml" in
143- Unixext. write_string_to_file path unattend ;
143+ SecretString. write_to_file path unattend ;
144144 debug " %s: written to %s" __FUNCTION__ path ;
145145 let args = [" -r" ; " -J" ; " -o" ; iso; temp_dir] in
146146 Forkhelpers. execute_command_get_output genisoimage args |> ignore ;
@@ -262,7 +262,7 @@ let sysprep ~__context ~vm ~unattend ~timeout =
262262 let control = Printf. sprintf " /local/domain/%Ld/control" domid in
263263 if domid < = 0L then
264264 fail VM_not_running ;
265- if String . length unattend > 32 * 1024 then
265+ if SecretString . length unattend > 32 * 1024 then
266266 fail XML_too_large ;
267267 Ezxenstore_core.Xenstore. with_xs (fun xs ->
268268 let open Ezxenstore_core.Xenstore in
Original file line number Diff line number Diff line change @@ -32,9 +32,9 @@ val on_startup : __context:Context.t -> unit
3232val sysprep :
3333 __context :Context .t
3434 -> vm :API .ref_VM
35- -> unattend :string
35+ -> unattend :SecretString . t
3636 -> timeout :float
3737 -> unit
3838(* * Execute sysprep on [vm] using script [unattend]. This requires
39- driver support from the VM and is checked. [unattend:string ] must
39+ driver support from the VM and is checked. [unattend] must
4040 not exceed 32kb. Raised [Failure] that must be handled, *)
Original file line number Diff line number Diff line change @@ -454,6 +454,6 @@ val remove_from_blocked_operations :
454454val sysprep :
455455 __context :Context .t
456456 -> self :API .ref_VM
457- -> unattend :string
457+ -> unattend :SecretString . t
458458 -> timeout :float
459459 -> unit
You can’t perform that action at this time.
0 commit comments