[Libguestfs] [v2v PATCH] libvirt: read password file outside libvirt auth callback

Pino Toscano ptoscano at redhat.com
Mon Aug 17 07:19:52 UTC 2020


This way errors that occur while reading the password file are properly
propagated, instead of being reported as errors of the libvirt
authentication callback.

Reported by: Ming Xie.
---
 v2v/libvirt_utils.ml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/v2v/libvirt_utils.ml b/v2v/libvirt_utils.ml
index 4d0b8639..1a24b049 100644
--- a/v2v/libvirt_utils.ml
+++ b/v2v/libvirt_utils.ml
@@ -24,8 +24,8 @@ open Common_gettext.Gettext
     module. *)
 
 let auth_for_password_file ?password_file () =
+  let password = Option.map read_first_line_from_file password_file in
   let auth_fn creds =
-    let password = Option.map read_first_line_from_file password_file in
     List.map (
       function
       | { Libvirt.Connect.typ = Libvirt.Connect.CredentialPassphrase } -> password
-- 
2.26.2




More information about the Libguestfs mailing list