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

Eric Blake eblake at redhat.com
Fri Jan 27 21:06:13 UTC 2012


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 at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120127/51bb0742/attachment-0001.sig>


More information about the libvir-list mailing list