[PATCH] Don't try to contact the CUPS server when no printers are needed

Christian Perrier bubulle at debian.org
Fri Apr 24 18:19:01 GMT 2009


The attached small patch is intended to uselessly avoid contacting a
CUPS server when it can safely be determined no printers are not needed.

The original bug report that lead to this was:

The samba server always tries to connect to a cups server, even when
there are no printing shares, and "load printers" is set to no.

When this server does not respond (as it drops the packets) samba blocks
indefinitely trying to connect to the server failing to open its
listening sockets at all.

This is serious usability, and possibly security bug. The server fails
when another service that is not even required for proper operation

Please note that our user mentioned that his server was existing *but*
configured to drop packets. Of course, I don't think this should be
considered an issue. Only, at worse, some kind of possible minor DoS

Later comments by Steve Langášek:

FWIW, I can only confirm this bug if cupsys is *not* running on localhost.

If it is running, then libcupsys by default uses the unix socket
/var/run/cups/cups.sock, and samba is able to connect in spite of any

If cups is not running, then I can reproduce the problem with the following

# /etc/init.d/cupsys stop
Stopping Common Unix Printing System: cupsd.
# testparm --parameter-name='load printers'  -s -v 2>/dev/null
# iptables -A INPUT -p tcp -d --dport 631 -j DROP
# telnet localhost ipp
# /etc/init.d/samba restart
Stopping Samba daemons: nmbd smbd.
Starting Samba daemons: nmbd smbd<hangs>

(please note that s/cupsys/cups is now needed)

The attached patch, reported in Bugzilla #5525, fixes that
issue. Unfortunately, it seems that nobody picked on it as of now...

Would you mind considering it for 3.3 or 3.4. I'm not sure it's worth
having it in 3.2

-------------- next part --------------
A non-text attachment was scrubbed...
Name: no-unnecessary-cups.patch
Type: text/x-diff
Size: 626 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20090424/cdba5cbf/no-unnecessary-cups.bin

More information about the samba-technical mailing list