]> git.ipfire.org Git - thirdparty/libvirt.git/commit
polkit: Adjust message when authentication agent isn't found
authorJohn Ferlan <jferlan@redhat.com>
Thu, 14 Jan 2016 19:34:28 +0000 (14:34 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Tue, 1 Mar 2016 11:50:16 +0000 (06:50 -0500)
commit1d35f6ffe15f860914294f6a97de428d357a1fc9
tree056ac23ead20d5d49c7cb2fc4bbf36ab9124b842
parent35b20c1f7c638f4675edfe8b99767e26e13bec70
polkit: Adjust message when authentication agent isn't found

When there isn't a ssh -X type session running and a user has not
been added to the libvirt group, attempts to run 'virsh -c qemu:///system'
commands from an otherwise unprivileged user will fail with rather
generic or opaque error message:

    "error: authentication failed: no agent is available to authenticate"

This patch will adjust the error code and message to help reflect the
situation that the problem is the requested mechanism is UNAVAILABLE and
a slightly more descriptive error. The result on a failure then becomes:

    "error: authentication unavailable: no polkit agent available to
            authenticate action 'org.libvirt.unix.manage'"

A bit more history on this - at one time a failure generated the
following type message when running the 'pkcheck' as a subprocess:

"error: authentication failed: polkit\56retains_authorization_after_challenge=1
Authorization requires authentication but no agent is available."

but, a patch was generated to adjust the error message to help provide
more details about what failed. This was pushed as commit id '96a108c99'.
That patch prepended a "polkit: " to the output. It really didn't solve
the problem, but gave a hint.

After some time it was deemed using DBus API calls directly was a
better way to go (since pkcheck calls them anyway). So, commit id
'1b854c76' (more or less) copied the code from remoteDispatchAuthPolkit
and adjusted it. Then commit id 'c7542573' adjusted the remote.c
code to call the new API (virPolkitCheckAuth). Finally, commit id
'308c0c5a' altered the code to call DBus APIs directly. In doing
so, it reverted the failing error message to the generic message
that would have been received from DBus anyway.
include/libvirt/virterror.h
src/util/virerror.c
src/util/virpolkit.c
tests/virpolkittest.c