virt-v2v/SOURCES/0013-libvirt-read-password-...

31 lines
1.1 KiB
Diff

From 207552533f0b4ed2e2d570a827a85a44d4248b78 Mon Sep 17 00:00:00 2001
From: Pino Toscano <ptoscano@redhat.com>
Date: Mon, 17 Aug 2020 09:17:51 +0200
Subject: [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.
(cherry picked from commit 76f9f3a0603f33c85d681fe13e24516331c6aea7)
---
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