On Mon, Sep 21, 2020 at 10:02 PM Matt Coleman <mcoleman(a)datto.com> wrote:
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(a)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
Reviewed-by: Neal Gompa <ngompa13(a)gmail.com>
--
真実はいつも一つ!/ Always, there's only one truth!