GNOME Bugzilla – Bug 664640
CUPS authentication does not work
Last modified: 2013-01-18 13:32:35 UTC
Created attachment 201994 [details] [review]
Fix broken auth connection logic
Trying to connect to a print server that requires authentication (BASIC) causes the entire print dialog to hang. It doesn't even ask for a password.
This is caused by the broken authentication logic in cups printing backend.
First problem is that cupsDoAuthentication() returns non-zero only in case of canceled auth (a.k.a. NULL password), and backend sets password to "" (empty string) for no reason. Second problem is that request and poll states are not reset for authentication requests and _get_send reconnects causing gtk_cups_request_read_write() to loop forever.
The last problem is that error conditions from request->state methods are never checked, again causing indefinite loops in gtk_cups_request_read_write().
Attached patch fixes all this, thus making basic auth working in cups printing backend.
Marek, can you take a look at this ?
(In reply to comment #1)
> Marek, can you take a look at this ?
do you connect to the print server remotely?
Could you post here server's /etc/cups/cupsd.conf config file?
Does the print dialog show you printers before it hangs?
Yes, I connect remotely, I have 'ServerName printserver.mydomain' in
/etc/cups/client.conf. Print dialog lists all printers, and then hangs trying to
get selected printer information (via GET /printers/printer.ppd).
I spent 3 days debugging this, so I know what's going on there.
I'm attaching my server's /etc/cups/cupsd.conf (IPs obfuscated, but fortunately they are not relevant here).
Created attachment 202579 [details]
thank you for the patch. It fixes the problem.
The only one thing I would change is just the style of brackets of the check for error. Move the brackets to their own lines as in the rest of Gtk+ code or just remove them.
Do you have commit access to Gtk+'s GIT? If not, I can commit it instead of you.
P.S.: btw, it worked in Gtk+ 2.18 - I'll have to find when it broke
I don't have commit access, feel free to change the style and commit it.
I've just committed the patch to master and gtk-3-2 branches.
I just realized that gtk 2.24 suffers the same problem.
Please apply the patch also to the gtk-2-24 branch.
Just to confirm this is still an issue with gtk 2.24 (2.24.6 and above, including 2.24.12) and that the patch resolves it.
(Unfortunately, discovered the issue and fixed it independently, which gave me enough information to find this bug...)
This still needs to be applied to the gtk-2-24 branch...
Hello? Is there any chance to get this patch applied to the gtk2 branch any time soon? It's been more than a year now since this got fixed in gtk3...
Hi. I will look at this this week.
I've tested the change with 2.24 and it fixes the problem there. It is now committed in gtk-2-24.
I'm sorry for the delay.