P. 1
Samba

Samba

|Views: 167|Likes:
Publicado porNurul Istiqomah

More info:

Published by: Nurul Istiqomah on Dec 14, 2010
Direitos Autorais:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

02/21/2014

pdf

text

original

A categoryof parameters known as the printer command type parametersmap print
queue functions to shell commands. They are all share parameters. If they are not explic-
itly declared for a share,the smbdprogram supplies a default.

However,it’s a little more complicated than that,because the default supplied depends
on another parameter—the printing=parameter—that defines the type of printing sys-
tem on the machine (BSD,AIX,LPRNG,PLP,SYSV,HPUX,QNX,or SOFTQ).

What makes this tricky is that testparmreports the SYSV defaults,regardless of the
actual printing=parameter value.

Theoretically,none of the printer command type parameters are necessary in a system
falling neatly into any of the categories BSD,AIX,LPRNG,PLP,SYSV,HPUX,QNX,
and SOFTQ. In an ideal world,it’s best to try not to use these printer command type
parameters. However,it’s nice to know they exist for the purposes of troubleshooting and
configuring Samba printing on odd-duck systems. In practice,only print command=is
commonly specified explicitly.

All these parameters use Samba substitution characters such as %s(the “temporary”
name of the file to be printed) and %p(the print queue on which to print it).

Creating a Turnkey Samba System

PARTII

238

11 8628 CH08 3/17/00 12:59 PM Page 238

print command=

This isa share parameter,whose default depends on compilation parameters. It can
get tricky. For instance,on a Red Hat 6 standard setup,this parameter’s default is

lp -c -d%p %s; rm %s,at least according to testparm. However,this is not necessarily
the real default. Consider this tiny smb.confon a Red Hat Linux 6 box:

encrypt passwords=yes
netbios name=mainserv
workgroup=MYGROUP
printcap name=/etc/printcap
printing=bsd
[mysmb_lp]
path=/var/spool/samba
print ok=yes
browseable=yes
printer name = lp_text
#print command=lp -c -d%p %s; rm %s

Configuring Printer Shares

CHAPTER8

239

8

C

O
N
F
I
G
U
R
I
N
G

P

R
I
N
T
E
R

S

H
A
R
E
S

Tip

If you’re interested in global and share initialization as well as other initializa-
tion, here are some excellent source code starting points:

In source/param/loadparm.c, see the following:

init_locals(void), the top comments on how to add a service, struct global,

static struct Globals, struct service, static struct sDefault, the
various static structenum_listarrays, parm_table, static void

init_globals(void).

Ever wonder how testparmchecks shares and outputs error messages? Look at

static BOOL service_ok(int iService). lp_load()reads in a services file,
such as smb.conf, and stores it in the proper data structures.

The source/include/smb.hfile also yields helpful information:

See the various STYPE_defines. See the LP related enums (search for LPQ_). See
the various FLAG_defines. See enum security_typesand enum printing_types.
See the various OPLOCK_defines. See the MAP_TO_GUESTdefines at the end of

smb.h.

File source/include/local.hdefines many important constants:

See the WORKGROUP, GLOBAL_NAME, GLOBAL_NAME2, HOMES_NAME, PRINTERS_NAME,

MAX_OPEN_FILES, LOCKDIR, GUEST_ACCOUNT, DEFAULT_PASSWD_CHAT, and

MINPASSWDLENGTHdefines.

11 8628 CH08 3/17/00 12:59 PM Page 239

As you can see,the commented-out print command is simply the default according to

testparm. This printer works perfectly,but when the print command is uncommented,it
stops working. Such problems occur rarely,but it’s good to understand that under certain
circumstances the reported default print command=parameter may in fact not be the one
actually used by the daemons.

The smb.confman page sheds some light on this matter. The actual default changes
depending on the value of printing=,as shown in Table 8.1.

TABLE 8.1Default Printer Commands

Operating System

Default print command=

BSD,AIX,QNX,LPRNG,PLP

lpr -r -P%p %s

SYS or HPUX

lp -c -d%p %s; rm %s

SOFTQ

lp -d%p -s %s; rm %s

The testparmprogram is not sophisticated enough to deduce the print command=
value from the printing=parameter; instead it reports the SYSV default. Likewise,
although SWAT correctly identifies the present value based on printing=,clicking the
Default button sets the print command=value to the default for SYSV,in spite of the

printing=parameter.

The print command=parameter points to the shell command capable of printing the
file. Notice that most versions of this command end with rm %s,so the temporary file is
deleted after it’s successfully spooled to the print queue.

lppause command=

This is a share parameter that defaults to lp -i %p-%j -H holdfor SYSV,and

qstat -s -j%j -hfor SOFTQ. See init_locals()in source/param/loadparm.c
for other defaults. The program connected to this parameter should take the printer name
(%p) and job number (%j) as arguments and pause the appropriate print job.

lpq command=

This is a share parameter. On SYSV-compiled systems it defaults to lpstat -o%p. See

init_locals()in source/param/loadparm.cfor defaults on non-SYSV operating sys-
tems. The program connected to this parameter should take the printer name (%p) as an
argument and output printer status information.

lpresume command=

This is a share parameter. On SYSV-compiled systems it defaults to lp -i %p-%j -H

resume. See init_locals()in source/param/loadparm.cfor defaults on non-SYSV

Creating a Turnkey Samba System

PARTII

240

11 8628 CH08 3/17/00 12:59 PM Page 240

operating systems. The program connected to this parameter should take the printer name
(%p) and job number (%j) as arguments and continue printing the job,which was presum-
ably paused earlier by the lppausecommand.

lprm command=

This is a share parameter. On SYSV-compiled systems it defaults to cancel %p-%j. See

init_locals()in source/param/loadparm.cfor defaults on non-SYSV operating sys-
tems. The program connected to this parameter should take the printer name (%p) and job
number (%j) as arguments,delete the print job,and output printer status information.

queuepause command=

This is a share parameter. On SYSV-compiled systems it defaults to lpc stop %p. See

init_locals()in source/param/loadparm.cfor defaults on non-SYSV operating sys-
tems. The program connected to this parameter should take the printer name (%p) as its
argument and pause the entire print queue. Note that this pauses the whole queue and
stops queued jobs from printing,as opposed to the lppausecommand,which pauses one
job and lets other jobs through.

queueresume command=

This is a share parameter. On SYSV-compiled systems it defaults to lpc start %p. See

init_locals()in source/param/loadparm.cfor defaults on non-SYSV operating sys-
tems. The program connected to this parameter should take the printer name (%p) as its
argument and resume the queue so that queued jobs start printing again. Note that this
resumes the whole queue,as opposed to the lpresumecommand,which resumes only
one job.

You're Reading a Free Preview

Descarregar
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->