[libvirt] [PATCH] daemon: Preface polkit error output with 'polkit:'

Cole Robinson crobinso at redhat.com
Mon Dec 17 18:38:45 UTC 2012


On 12/16/2012 06:31 PM, Peter Krempa wrote:
> On 12/17/12 00:15, Cole Robinson wrote:
>> 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.
>> ---
>>   daemon/remote.c | 5 +++--
>>   1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/daemon/remote.c b/daemon/remote.c
>> index 41b8ea8..f85dae0 100644
>> --- a/daemon/remote.c
>> +++ b/daemon/remote.c
>> @@ -2887,9 +2887,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);
> 
> This line fails syntax-check:
> 
> libvirt_unmarked_diagnostics
> daemon/remote.c:2891:        virReportError(VIR_ERR_AUTH_FAILED, "polkit: %s",
> pkout);
> 
> It seems a bit unreasonable here, but you need to put the translation macro
> there.
> 
>>       } else {
>> -        virReportError(VIR_ERR_AUTH_FAILED, "%s",
>> -                       pkout && *pkout ? pkout : _("authentication failed"));
>> +        virReportError(VIR_ERR_AUTH_FAILED, "%s", _("authentication failed"));
>>       }
>>
>>       VIR_FREE(pkout);
>>
> 
> The change makes sense to me and I've also hit the error and had to look where
> it comes from.
> 
> ACK once you make it pass syntax-check.
> 
> Peter

Thanks Peter, pushed with that tweak.

- Cole




More information about the libvir-list mailing list