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

Re: [libvirt] [PATCH] Return more error output if policykit auth fails.



On 01/27/2012 01:44 PM, Cole Robinson wrote:
> @@ -2537,15 +2538,20 @@ remoteDispatchAuthPolkit(virNetServerPtr server ATTRIBUTE_UNUSED,
>  error:
>      virCommandFree(cmd);
>      VIR_FREE(ident);
> -    VIR_FREE(pkout);
>      virResetLastError();
> +
>      if (authdismissed) {
>          virNetError(VIR_ERR_AUTH_CANCELLED, "%s",
>                      _("authentication cancelled by user"));
> +    } else if (pkout || pkerr) {
> +        virNetError(VIR_ERR_AUTH_FAILED, "%s %s", pkerr, pkout);

This could dereference NULL (well, it won't on glibc, but "(null) error"
or "out (null)" don't look any nicer).

Change it to:

    virNetError(VIR_ERR_AUTH_FAILED, "%s", pkerr ? pkerr : pkout);

and I'll call it good enough for ACK (that is, even if the app wrote to
both stdout and stderr, I think that printing just stderr output in that
case is probably reasonable).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


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