> From [EMAIL PROTECTED] Sun Sep 21 14:58:01 2003
> Date: Sun, 21 Sep 2003 22:57:34 +0200
> From: Eric PEYREMORTE <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: LPRng: my own filter
>
> hi
>
> i wrote my own filter but when it writes on it's stdout it doesn't run. 
> Shall i
> redirect its output on /dev/fd3 ? I tried but it doesn't run ....
> Please help ! If you have a sample script send it please !
>
> Thanks
>
>
> -----------------------------------------------------------------------------
> YOU MUST BE A LIST MEMBER IN ORDER TO POST TO THE LPRNG MAILING LIST
> The address you post from MUST be your subscription address
>
> If you need help, send email to [EMAIL PROTECTED] (or lprng-requests
> or lprng-digest-requests) with the word 'help' in the body.  For the impatient,
> to subscribe to a list with name LIST,  send mail to [EMAIL PROTECTED]
> with:                           | example:
> subscribe LIST <mailaddr>       |  subscribe lprng-digest [EMAIL PROTECTED]
> unsubscribe LIST <mailaddr>     |  unsubscribe lprng [EMAIL PROTECTED]
>
> If you have major problems,  send email to [EMAIL PROTECTED] with the word
> LPRNGLIST in the SUBJECT line.
> -----------------------------------------------------------------------------
>

The best way to write a filter is to start with baby steps.
ON A SYSTEM WITH NOT OTHER USERS...  Because all of this opens
a slew of security loopholes:


Here is the printcap entry:

lp:sd=/var/spool/lpd/%P
  :filter=/tmp/myfilter
  :lp=/tmp/lptest

/tmp/myfilter:

#!/bin/sh
PATH=/usr/local/bin:/usr/bin:/bin
export PATH
date
printenv
cat
exit 0

Now  do:

touch /tmp/lptest
chmod 666 /tmp/lptest

checkpc -f
lpc reread

Now you can do:

echo hi |lpr

and open /tmp/lptest and see the output:

Tue Sep 30 15:08:45 PDT 2003
PATH=/usr/local/bin:/usr/bin:/bin
hi

Now you add stuff and go on from there.

Patrick Powell                 Astart Technologies
[EMAIL PROTECTED]            6741 Convoy Court
Network and System             San Diego, CA 92111
  Consulting                   858-874-6543 FAX 858-751-2435
LPRng - Print Spooler (http://www.lprng.com)

-----------------------------------------------------------------------------
YOU MUST BE A LIST MEMBER IN ORDER TO POST TO THE LPRNG MAILING LIST
The address you post from MUST be your subscription address

If you need help, send email to [EMAIL PROTECTED] (or lprng-requests
or lprng-digest-requests) with the word 'help' in the body.  For the impatient,
to subscribe to a list with name LIST,  send mail to [EMAIL PROTECTED]
with:                           | example:
subscribe LIST <mailaddr>       |  subscribe lprng-digest [EMAIL PROTECTED]
unsubscribe LIST <mailaddr>     |  unsubscribe lprng [EMAIL PROTECTED]

If you have major problems,  send email to [EMAIL PROTECTED] with the word
LPRNGLIST in the SUBJECT line.
-----------------------------------------------------------------------------

Reply via email to