Pino Toscano
2020-Aug-17 07:19 UTC
[Libguestfs] [v2v PATCH] libvirt: read password file outside libvirt auth callback
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
Richard W.M. Jones
2020-Aug-17 09:44 UTC
Re: [Libguestfs] [v2v PATCH] libvirt: read password file outside libvirt auth callback
On Mon, Aug 17, 2020 at 09:19:52AM +0200, Pino Toscano wrote:> 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 > --ACK, thanks Pino. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org