[Samba] windows printer queue failure

Christoph Litauer litauer at uni-koblenz.de
Thu May 15 12:32:25 GMT 2003

Kurt Pfeifle wrote:
> Christoph Litauer <litauer at uni-koblenz.de> wrote on CUPS digest:
>> Message: 6
>> From: Christoph Litauer <litauer at uni-koblenz.de>
>> Date: Wed, 14 May 2003 17:45:49 +0200
>> Organization: Easy Software Products
>> To: cups at easysw.com
>> Subject: [cups.general] Re: [Samba] windows printer queue failure
>> Reply-To: cups at easysw.com
>> Christoph Litauer wrote:
>>>> I am driving Suse 8.2, samba 2.2.7a, cups 1.1.18
>>>> As I mentioned recently I cannot see the cups printer queues from a 
>>>> windows client even if lpq -Pprinter on the cups server gives the 
>>>> correct status.
>>>> I tested a litte more and got the following results:
>>>> 1.) If I configure samba to
>>>>     printing = CUPS
>>>>     printcap name = CUPS
>>>>     I can see all queue entries in the windows status panel, too -- 
>>>> except for those jobs, that were sent by users with account names >= 
>>>> 8 characters. Is this a bug?
>>>> 2.) If I configure samba to
>>>>     printing = sysv
>>>>     printcap name = CUPS
>>>>     lpq command = lpstat -o %p
>>>>   I can see the jobs only as they appear on the samba-/cups-server. 
>>>> They disappear from the status panel immediatly when the spooling is 
>>>> finished. Should it work? Anybody else has this problem?
> I repied to that part already on the Samba list, with a few suggestions
> for things to try and test...
>> Another amazing thing is that I can use
>>     print command = my own command with parameters
>> even if I configured
> I will try to verify this on my system...
>>     printing = CUPS
>>     printcap name = CUPS
>> My smbd is linked against cups:
>> printhost:~ # ldd `which smbd`
>>          libacl.so.1 => /lib/libacl.so.1 (0x40026000)
> When I verify your report, I will have *no* ACL support compiled in....
>>          libcups.so.2 => /usr/lib/libcups.so.2 (0x4002d000)
>>          ...
>> Here is what the documentation says:
>> "With printing = cups, and if SAMBA is compiled against libcups, any 
>> manually set print command will be ignored."
>> And yes I am shure "my own command" is executed
> Must be a Samba bug then. The documentation is "right" since it expressed
> what the programmers intention was at the time the man page was 
> written... ;-)
>> I am a little bit confused ... what's happening here?

Confusion goes on ... I examined the problem a little more. I think 
there are two kinds of problems.

1.) lpq of cups should return another format.
I looked up the sources of the printing section of samba 
(source/printing). There are a few functions parsing the output of a lpq 
command. I examined the parsing function for BSD (parse_lpq_bsd) and saw 
that the parser tries to parse the output using the separator characters 
' ', '\t' (by using strtok).
If the username is longer or equal 8 characters, no separator character 
appears between the username and job number in the output of lpq. For 

printhost:~ # lpq -Pf112
f112 is ready and printing
Rank    Owner   Job     File(s)                         Total Size
active  lunaz   9439    http://www.stjosef.at/konzil/DV.524288 bytes
1st     sabru   9444    http://rz-anzeigen.de/betrachte 357376 bytes
2nd     ffries  9447    http://www.uni-bonn.de/Studium/B548864 bytes
3rd     jennyhoc9448    Microsoft Word - trendshandoutne215040 bytes
4th     jennyhoc9454    Microsoft Word - Rundhäkeln-link208896 bytes

The last 2 lines are ignored by the parsing process because the number 
of tokens found in these lines is lower than 5.
I am not a specialist for the specifications of the lpq output, but I 
think the output has to print the whole length of the username followed 
by a separator character, followed by the jobname, followed by a 
seperator, right?

2.) Why is lpq command used at any time?
I increased the debug-level of my smbd process just before pressing F5 
in the windows printers status window (F5 does an update then).
Looking up the debug messages of samba I found

[2003/05/15 13:26:44, 3] printing/print_generic.c:print_run_command(88)
   Running the command `lpq -Pf112' gave 0
[2003/05/15 13:26:44, 3] printing/printing.c:print_queue_update(436)
   6 jobs in queue for f112

f112 is the name of one of my printers (and in fact there where 29 
queued jobs).

So you can see that samba calls lpq to get the printers status -- even 
if I configured
	printing = CUPS
in smb.conf.
Again, yes, my samba is linked against cups:

printhost:/var/log/samba # ldd `which smbd`
         libacl.so.1 => /lib/libacl.so.1 (0x40026000)
         libcups.so.2 => /usr/lib/libcups.so.2 (0x4002d000)
         libssl.so.0.9.6 => /usr/lib/libssl.so.0.9.6 (0x40048000)
         libcrypto.so.0.9.6 => /usr/lib/libcrypto.so.0.9.6 (0x40078000)
         libnsl.so.1 => /lib/libnsl.so.1 (0x4014f000)
         libpam.so.0 => /lib/libpam.so.0 (0x40164000)
         libldap.so.2 => /usr/lib/libldap.so.2 (0x4016c000)
         libpopt.so.0 => /usr/lib/libpopt.so.0 (0x4019e000)
         libc.so.6 => /lib/libc.so.6 (0x401a6000)
         libdl.so.2 => /lib/libdl.so.2 (0x402dc000)
         libattr.so.1 => /lib/libattr.so.1 (0x402df000)
         liblber.so.2 => /usr/lib/liblber.so.2 (0x402e3000)
         libresolv.so.2 => /lib/libresolv.so.2 (0x402ef000)
         libsasl2.so.2 => /usr/lib/libsasl2.so.2 (0x40301000)
         /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

So I did a fresh setup of a Suse 8.2 machine installing the Suse rpms 
for cups (1.1.18) and samba (2.2.7a) using the defaults defined in 
smb.conf (attached). Examining the samba debug output on this machine 
still results in called lpq commands instead of calling the cups library 
functions (what I think should have happend?).

So I am still confused. Maybe I am doing a lot of things wrong, maybe 
the samba-distribution of Suse 8.2 has a bug?

Christoph Litauer
Christoph Litauer                  litauer at uni-koblenz.de
Uni Koblenz, Rechenzentrum,        http://www.uni-koblenz.de/~litauer
Postfach 201602, 56016 Koblenz     Fon: +49 261 287-1311, Fax: -100 1311
PGP-Key: http://www.uni-koblenz.de/~litauer/public-key.html
-------------- next part --------------
# smb.conf is the main samba configuration file. You find a full commented
# version at /usr/share/doc/packages/samba/examples/smb.conf.SuSE
# Date: 2003-04-07
	workgroup = TUX-NET
	os level = 2
	time server = Yes
	unix extensions = Yes
	encrypt passwords = Yes
	map to guest = Bad User
	log level = 1
        security = SERVER
        password server = tricia
	syslog = 0
	printing = CUPS
	printcap name = CUPS
	print command = /var/tmp/print %s %p; rm %s 
	wins support = No
	veto files = /*.eml/*.nws/riched20.dll/*.{*}/
	comment = Home Directories
	valid users = %S
	browseable = No
	read only = No
	create mask = 0640
	directory mask = 0750
	comment = All Printers
	path = /var/tmp
	printable = Yes
	create mask = 0600
	browseable = No
	comment = Printer Drivers
	path = /var/lib/samba/drivers
	write list = @ntadmin root rz
	force group = ntadmin
	create mask = 0664
	directory mask = 0775

More information about the samba mailing list