[Samba] Rpcclient - setdriver.

Kurt Pfeifle kpfeifle at danka.de
Thu May 8 12:19:31 GMT 2003

Lars Göransson larg at spray.se wrote on Samba-Digest:

> Mon May 5 17:08:58 GMT 2003
> I have done one succesful driver for downloading to my windows 2000-client. 
> When i try set another with "setdriver " I get a result as : SetPrinter call failed!

Sorry, Lars,

I didn't notice your attachment the first time I read your post. So
I didn't consider it in my answer.

So here is my second take....

> The only differens between them is in the desritption-field
>        flags:[0x800000]
>        name:[\\localhost\HP4600]
>        description:[\\localhost\HP4600,HP4600,H4600]
>        comment:[H4600]
>        flags:[0x800000]
>        name:[\\localhost\HP4600CLJ]
>        description:[\\localhost\HP4600CLJ,,HP4600CLJ]
>        comment:[HP4600CLJ]
> How can I put in HP4600CLJ in between ",," in description:[\\localhost\HP4600CLJ,,HP4600CLJ]
> In Windows It is shown as "Model", If that is the solution, dont think so..or?
> I can't understand why there is a difference between this printer as shown with enumprinters, the printcap entrys are similar.

The printcap entry details are of no interest for Samba. It only wants to see
the printer name in there.

> This is my printcap:
> -----SNIP--------------------------------------------------------------------
> # /etc/printcap
> ##LPRNGTOOL##SOCKET filtertype=IFHP ifhp_options=status,sync,pagecount,waitend printerdb_entry=hpcolorlj
> H4600|HP4600
> :cm=HP Color LaserJet 4600
> :filter=/usr/libexec/filters/ifhp
> :ifhp=model=hpcolorlj,status,sync,pagecount,waitend
> :lp=
> :lprngtooloptions=FILTERTYPE="IFHP" IFHP_OPTIONS="status,sync,pagecount,waitend" PRINTERDB_ENTRY="hpcolorlj"
> :mx=0
> :sd=/var/spool/lpd/%P
> :sh
> ##LPRNGTOOL## SOCKET filtertype=IFHP ifhp_options=status,sync,pagecount,waitend printerdb_entry=hpcolorlj
> HP4600CLJ|HP4600CLJ
> :cm=HP Color LaserJet 4600
> :filter=/usr/libexec/filters/ifhp
> :ifhp=model=hpcolorlj,status,sync,pagecount,waitend
> :lprngtooloptions=FILTERTYPE="IFHP" IFHP_OPTIONS="status,sync,pagecount,waitend" PRINTERDB_ENTRY="hpcolorlj"
> :mx=0
> :sd=/var/spool/lpd/%P
> :sh
> :lp=
> ---- END SNIP------------------------------------------------------------
> -
> BTW i have "guest account = root" and "printer admin = root" in smb.conf.


> "enumdriver 2"
> ---------------------------------------------------------------------
> Printer Driver Info 2:
>         Version: [3]
>         Driver Name: [HP4600]
>         Architecture: [Windows NT x86]
>         Driver Path: [\\localhost\print$\W32X86\3\HPBF422G.DLL]
>         Datafile: [\\localhost\print$\W32X86\3\HPBF422I.PMD]
>         Configfile: [\\localhost\print$\W32X86\3\HPBF422E.DLL]

Are you sure that there are not *more* files? Try running "enumdrivers 3"
to also see the "Dependentfiles" listed.

An alternative method to learn to know all the Dependent files is to
print a "Test Page" from a Windows client. If your Samba rpcclient
installation did not work yet, you need to install it the non-SPOOLSS
("use client driver") way first. An "enumdriver 3" would show possibly
s.th. like that:

  "enumdriver 3"
  Printer Driver Info 3:
          Version: [3]
          Driver Name: [HP4600]
          Architecture: [Windows NT x86]
          Driver Path: [\\localhost\print$\W32X86\3\HPBF422G.DLL]
          Datafile: [\\localhost\print$\W32X86\3\HPBF422I.PMD]
          Configfile: [\\localhost\print$\W32X86\3\HPBF422E.DLL]
          Helpfile: [\\localhost\print$\W32X86\3\something.HLP]

          Dependentfiles: [\\localhost\print$\W32X86\3\firstname.DLL]
          Dependentfiles: [\\localhost\print$\W32X86\3\secondname.INI]
          Dependentfiles: [\\localhost\print$\W32X86\3\thirdname.DLL]
          Dependentfiles: [\\localhost\print$\W32X86\3\fourthname.dat]
          Dependentfiles: [\\localhost\print$\W32X86\3\lastname.cat]

(Dependentfiles may or may not be there. Their names vary largely)
Can you check for this and report back?

> Printer Driver Info 2:
>         Version: [3]
>         Driver Name: [HP4600CLJ]
>         Architecture: [Windows NT x86]
>         Driver Path: [\\localhost\print$\W32X86\3\HPBF422G.DLL]
>         Datafile: [\\localhost\print$\W32X86\3\HPBF422I.PMD]
>         Configfile: [\\localhost\print$\W32X86\3\HPBF422E.DLL]

OK -- this is a more modern driver, version 3, going into the "3"
subdirectory (reserved for drivers which don't run in Kernal mode).
I have not much experience with those. I believe the "3" subdir is
only there on W2k/XP, but not on WinNT. [Could someome please shout
very loudly "NOT TRUE!" if he notices otherwise on an NT system??]

This listing seems to suggest that the "HP4600CLJ" driver is indeed
registered with Samba. From this I would derive that your adddriver
command had been this:

   rpcclient -Uroot%xxxx -c `adddriver "Windows NT x86" "HP4600CLJ:HPBF422G.DLL:HP4600CLJ.PND:HPBF422E.DLL:[HERE_SHOULD_BE_NAME_OF_HELP_FILE]:NULL:RAW:NULL" localhost'

But if your driver/print-combo with the name HP4600 is working, but
the one with the name HP4600CLJ is *not* (with really identical
installations!), then I am stumped too. My only wild speculation
then is this: could it be that the driver name is too long (with 9

Try these steps then:

*   [ Collect all the files --  HPBF422G.DLL; HP4600CLJ.PND;
      firstname.DLL thru lastname.cat; in one directory

*   cd into that directory.

*   smbclient //localhost/print\$ -U'root%xxx -c 'cd W32X86; put HPBF422G.DLL; put HP4600CLJ.PND; put HPBF422E.DLL put [HERE_SHOULD_BE_NAME_OF_HELP_FILE]'

*   rpcclient -Uroot%xxxx -c `adddriver "Windows NT x86" "HP4600CL:HPBF422G.DLL:HP4600CLJ.PND:HPBF422E.DLL:[HERE_SHOULD_BE_NAME_OF_HELP_FILE]:NULL:RAW:NULL" localhost'
     MOTE. that this uses an 8-character long driver name "HP4600CL".
     If this fails, check for typos, but repeat the smbclient
     command before...)

*   rpcclient  -Uroot%xxxx -c `setdriver HP4600CL HP4600CLJ' localhost
     NOTE that this uses the 8-char drivername, but the 9 char
     printer name. If this fails, create another printer with 8 chars
     too and and try again.


One last wild speculation is: Your printing *.tdb files might have
become corrupted. Try to delete them (and loose all your printing
setup!) and start again. (Or make a backup of the *.tdb files first,
for easier re-build in case that was not the culprit)


BTW, I forgot which version of Samba you are running....


> -----------------------------------------------------------------------------
> They are exactly the same.
> When I run setdriver HP4600CLJ HP4600CLJ (rpccliend -d 5localhost)  this is a part of the log-file:
> -----------------------------------------------------------------
> rpc_api_pipe: len left: 0 smbtrans read: 28
> rpc_api_pipe: fragment first and last both set
> 000018 spoolss_io_r_setprinter
>     0018 status: WERR_ACCESS_DENIED

What were the credentials use for this rpcclient command?
Is there any hint above that that the context was switched?

> SetPrinter call failed!
> make_spoolss_q_closeprinter
> 000000 spoolss_io_q_closeprinter
>     000000 smb_io_pol_hnd printer handle
>         0000 data1: 00000000
>         0004 data2: 00000002
>         0008 data3: 0000
>         000a data4: 0000
>         000c data5: a6 6e b6 3e f0 05 00 00
> rpc_api_pipe_req: Outgoing data not a multiple of 8 bytes....
> create_rpc_request: opnum: 0x1d data_len: 0x2c
> create_rpc_request: data_len: 2c auth_len: 0 alloc_hint: 1c
> -----------------------------------------------------------------------
> ACCESS DENIED, why? I´m  running this as root.
> Is there another way to log rpcclient then the rpcclient -d [level] option?

You can increase or decrease the smbd log level "on the fly" as root

    smbcontrol smbd debug 5

Check current value with

    smbcontrol smbd debuglevel

It then all goes into the log files. You can disble the
timestamps with

    debug timestamp = no

in smb.conf which makes for better readability of the log files.

> Lars


More information about the samba mailing list