[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH] libvirt: ensure defresult is used in virConnectAuthCallbackDefault



A previous change to this function's password handling broke the use of
default values for credential types other than VIR_CRED_PASSPHRASE and
VIR_CRED_NOECHOPROMPT.

Signed-off-by: Matt Coleman <matt datto com>
---
 src/libvirt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/libvirt.c b/src/libvirt.c
index 0748eb2352..63c8bdea9f 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -146,7 +146,9 @@ virConnectAuthCallbackDefault(virConnectCredentialPtr cred,
             len = strlen(buf);
             if (len != 0 && buf[len-1] == '\n')
                 buf[len-1] = '\0';
-            bufptr = g_strdup(buf);
+
+            if (strlen(buf) > 0)
+                bufptr = g_strdup(buf);
             break;
 
         case VIR_CRED_PASSPHRASE:
-- 
2.27.0



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]