cups/samba integration problems

Greg Saunders greg at
Thu Jul 22 12:53:27 PDT 2004

Some notes first:

Fedora Core 1 (2 node HA cluster, heartbeat & drbd)
Cups 1.1.20
Samba 3.0.4
400 Windows 2000/XP clients
50 print queues
HP Laserjets, Xerox colour multifunctionals, Ricoh mulitfunctionals, HP 
DesignJet plotters

2000+ print jobs/day
8000+ pages/day
5GB + print data/day

I have a custom printer accounting application that is run by samba when 
a print job arrives at the server. This application supports PCL5, PCL6, 
postscript and HPGL2 blah blah blah.

PROBLEM: Because samba and cups are now tightly integrated, samba does 
not offer the facility to issue a custom print command (print command =) 
when you tell samba the printing system is cups. Samba quietly ignores 
any custom print command, postexec, and preexec directives.

The right thing to would be to write a cups filter to invoke the printer 
accounting, however, the cups command line arguments to a filter program 
and the environment variables seem lacking some key pieces of 
information, namely, the remote host and remote ip address of the client.

So, in my case, I must break the relationship between cups and samba and 
tell samba that the printing system is bsd or lprng in order to use my 
printer accounting application. This is where all hell breaks loose. 
There seems to be no valid lpq command that samba can hand off to cups 
that reports anything that samba understands. Worse, the default lpq 
command (lpq -P%p) invokes (I assume) cups lpstat program. Under the 
right (or wrong) conditions, this has brought my server to its knees. I 
don't know what's wrong with lpstat but it seems to be horribly 
inefficient, especially when 400 windows desktops query the samba server 
for print queue status (which it is unable to report anyway). In order 
to stop the samba/cups duo from crashing my server (doesn't really 
crash, it just can't do anything, like a self inflicted DOS attack) i 
have to map the samba lpq command to /bin/false.

So here are my two questions:
1. Is it samba or cups that prevents samba from using a custom print command
2. What the heck is wrong with lpstat. Even a script that runs lpsat 
(multiple times) to collect different pieces of information seems to tax 
the system.



P.S. I love CUPS

More information about the cups mailing list