After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 664640 - CUPS authentication does not work
CUPS authentication does not work
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Printing
3.2.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2011-11-23 12:58 UTC by Jan Rękorajski
Modified: 2013-01-18 13:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix broken auth connection logic (2.87 KB, patch)
2011-11-23 12:58 UTC, Jan Rękorajski
none Details | Review
Printserver's config (4.98 KB, text/plain)
2011-12-02 09:56 UTC, Jan Rękorajski
  Details

Description Jan Rękorajski 2011-11-23 12:58: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.
Comment 1 Matthias Clasen 2011-11-29 23:17:19 UTC
Marek, can you take a look at this ?
Comment 2 Marek Kašík 2011-12-01 14:58:55 UTC
(In reply to comment #1)
> Marek, can you take a look at this ?
Sure.

Hi Jan,

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?

Regards

Marek
Comment 3 Jan Rękorajski 2011-12-02 09:55:01 UTC
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).
Comment 4 Jan Rękorajski 2011-12-02 09:56:03 UTC
Created attachment 202579 [details]
Printserver's config
Comment 5 Marek Kašík 2011-12-14 12:18:51 UTC
Hi Jan,

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.

Regards

Marek

P.S.: btw, it worked in Gtk+ 2.18 - I'll have to find when it broke
Comment 6 Jan Rękorajski 2011-12-14 12:23:02 UTC
I don't have commit access, feel free to change the style and commit it.
Comment 7 Marek Kašík 2011-12-14 13:14:21 UTC
I've just committed the patch to master and gtk-3-2 branches.

Thank you

Marek
Comment 8 Jan Rękorajski 2012-05-25 11:06:35 UTC
I just realized that gtk 2.24 suffers the same problem.
Please apply the patch also to the gtk-2-24 branch.
Comment 9 Richard Fuller 2012-09-07 13:28:47 UTC
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...)
Comment 10 Matthias Schiffer 2012-10-09 01:08:19 UTC
This still needs to be applied to the gtk-2-24 branch...
Comment 11 Matthias Schiffer 2013-01-15 12:35:59 UTC
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...
Comment 12 Marek Kašík 2013-01-15 12:39:12 UTC
Hi. I will look at this this week.
Comment 13 Marek Kašík 2013-01-18 13:32:35 UTC
Hi,

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.

Regards

Marek