Bug#274333: libgnomeprint 2.8.0 breaks gpdf

Loïc Minier Loïc Minier , 274333-quiet@bugs.debian.org
Wed, 6 Oct 2004 21:28:47 +0200


clone 274333 -1
reassign -1 libcupsys2-gnutls10
thanks

 I am cloning this until the OP confirms what is listening on his 631
 port.

 Short summary for Kenshi Muto: in libcups, the assumption is made that
 localhost is the default CUPS server when searching for the default
 printer.  This is bad because anything can be listening on port 631,
 for example a RPC service.  See the bug report for details.  :)

Loïc Minier <lool@dooz.org> - Wed, Oct 06, 2004:

>  if something is listening on TCP port 631 (a simple netcat for
>  example), and you use gpdf, some lib it uses will contact TCP port 631
>  and timeout.

 BTW, you can reproduce this with a simple "nc -l -p 631" as root.

>    This should be fixed by finding the culprit and telling it not to
>  contact port 631 if it has no clue that a CUPS server might run there.

 I have built libgnomecups with debugging symbols, and got a cleaner
 stacktrace.  Here's the interesting part:

#5  0x4112fef6 in cupsGetDests () from /usr/lib/libcups.so.2
#6  0x411215f6 in get_default () at gnome-cups-printer.c:352
#7  0x41121705 in update_default () at gnome-cups-printer.c:392
#8  0x41121a69 in update_printers () at gnome-cups-printer.c:523
#9  0x41120a89 in gnome_cups_init (opt_auth_fn=0xfffffe00)
    at gnome-cups-init.c:20
#10 0x41102a12 in gnome_print_cups_printer_list_append (
    printers_list=0x82c3878, 
    path=0x82c50e0 "/usr/lib/libgnomeprint/2.8.0.1/modules/libgnomeprintcups.so") at gnome-print-cups.c:462
#11 0x402aa1b6 in gpa_printer_get_type () from /usr/lib/libgnomeprint-2-2.so.0

 Now with debugging symbols in libcups (libcupsys2-gnutls10):

#0  0x407217ac in recv () from /lib/tls/libpthread.so.0
#1  0x41133cd6 in httpGets (line=0xbfff5890 "", length=1024, http=0x8441828)
    at http.c:1326
#2  0x41133fee in httpUpdate (http=0x8441828) at http.c:1565
#3  0x411407be in cupsDoFileRequest (http=0x8441828, request=0x844e6e8, 
    resource=0x41142d9f "/", filename=0x0) at util.c:314
#4  0x41130b46 in cups_get_sdests (op=4294966784, num_dests=0, 
    dests=0xbfffeb48) at dest.c:717
#5  0x4112fef6 in cupsGetDests (dests=0xbfffeb48) at dest.c:235
#6  0x411215f6 in get_default () at gnome-cups-printer.c:352

 Reading a bit of libcupsys2-gnutls10, it seems that cupsServer()
 (cups/usersys.c) is assuming "localhost" when no server is found in the
 configs (line 237).

 This is called from cups_get_sdests() which role is to "Get
 destinations from a server", but has no server parameter.

 The cups_get_sdests() call is in cups/dest.c, at line 235, and I see no
 code to search for a server or whatever, so the problem is probably in
 cups_get_sdests().

 The httpConnectEncrypt() call in that function in itself is already a
 problem, prior to that, a check should be inserted so that if
 cupsServer() returns nothing (NULL, "", or whatever), no connection
 attempt is done.  The API should either force its programs to provide a
 server or return an error when functions needing a server are called
 and no server has been set.

 I don't understand how cupsServer() is supposed to be working, so I'll
 leave the modification to the libcups maintainer.

      Regards,

-- 
Loïc Minier <lool@dooz.org>