]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
daemon: Preface polkit error output with 'polkit:'
authorCole Robinson <crobinso@redhat.com>
Sun, 16 Dec 2012 22:59:08 +0000 (17:59 -0500)
committerCole Robinson <crobinso@redhat.com>
Mon, 28 Jan 2013 19:45:26 +0000 (14:45 -0500)
There's been a few bugs about an expected error from polkit:

https://bugzilla.redhat.com/show_bug.cgi?id=873799
https://bugzilla.redhat.com/show_bug.cgi?id=872166

The error is:

Authorization requires authentication but no agent is available.

The error means that polkit needs a password, but there is no polkit
agent registered in your session. Polkit agents are the bit of UI that
pop up and actually ask for your password.

Preface the error with the string 'polkit:' so folks can hopefully
make more sense of it.
(cherry picked from commit 96a108c99398f56970a29c8bfb7da9df90d206ed)

daemon/remote.c

index e7fe128a6f8a0c2b1a9e7c7a9cc4dc932434852e..35411f150fca0afacd0553df83e946861e02c127 100644 (file)
@@ -2862,9 +2862,10 @@ error:
     if (authdismissed) {
         virReportError(VIR_ERR_AUTH_CANCELLED, "%s",
                        _("authentication cancelled by user"));
+    } else if (pkout && *pkout) {
+        virReportError(VIR_ERR_AUTH_FAILED, _("polkit: %s"), pkout);
     } else {
-        virReportError(VIR_ERR_AUTH_FAILED, "%s",
-                       pkout && *pkout ? pkout : _("authentication failed"));
+        virReportError(VIR_ERR_AUTH_FAILED, "%s", _("authentication failed"));
     }
 
     VIR_FREE(pkout);