Commit 9a11a1f4 authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Fix authentication

According to the CUPS code ( cupsDoAuthentication returns 0 on success and -1 on error. The code was assuming the opposite

Now the CUPS password dialog is shown when needed. This is quite often, e.g directly at startup due to getServerSettings() so it might be worth checking if that's really necessary.

BUG: 408512

Test Plan: Open print-manager with a user that is not in a CUPS system group. Privileged operations work after entering a password

Reviewers: dantti, broulik

Reviewed By: dantti

Subscribers: ognarb, rdieter, kde-utils-devel

Differential Revision:
parent faea0b12
......@@ -845,11 +845,11 @@ bool KCupsConnection::retry(const char *resource, int operation) const
// force authentication
qCDebug(LIBKCUPS) << "Calling cupsDoAuthentication() password_retries:" << password_retries;
int ret = cupsDoAuthentication(CUPS_HTTP_DEFAULT, "POST", resource);
qCDebug(LIBKCUPS) << "Called cupsDoAuthentication(), success:" << (ret == -1 ? true : false);
qCDebug(LIBKCUPS) << "Called cupsDoAuthentication(), success:" << (ret == 0);
// If the authentication was successful
// sometimes just trying to be root works
return ret == -1 ? true : false;
return ret == 0;
// the action was not forbidden
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment