[PATCH] libvirt: ensure defresult is used in virConnectAuthCallbackDefault

Neal Gompa ngompa13 at gmail.com
Tue Sep 22 02:06:02 UTC 2020


On Mon, Sep 21, 2020 at 10:02 PM Matt Coleman <mcoleman at 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 at 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 at gmail.com>

-- 
真実はいつも一つ!/ Always, there's only one truth!





More information about the libvir-list mailing list