I have been working on a text to postscript filter that makes better
use of user controled lpr options.
I have come up against two problems.
The first is What is the deal with the -T option?
In earlier versions of LPRng -T was used to pass extra printcap "Z" like
options to the IFHP filter from the printcap. That of course was
superseded by the :ifhp=... printcap entry
In my tests however, if no -T option is specified as a ifhp filter
argument LPRng will gladly pass on the control file "T" option as it
should normally.
To me that seem to open a posible security hole as that line is set by
the user using lpr -T, to se the "pr" filter title of a print job.
The second problem is in passing arguments to sub-filters from the
IFHP control file.
Escentually Argument passing is broken specifically using %s{ARGV}
is a absolutely usless endevour!
Reference: IFHP HOWTO guide "7.6.2 Conversion"
If I have something like..
file_output_match = [
# ....
*text* ps \%s{text_filter}
# ...
]
# ...
filter_dir= /opt/lprng/libexec/converters
text_filter= \%s{filter_dir}/text_filter \%s{ARGV}
And the user then runs....
lpr -T "more than one word" "test 1 2 3"
I found that the arguments passed to the filter are broken up
into indivitual words...
EG something like...
text_filter ... '-Tmore' 'than' 'one' 'word' ... '-ftest' '1' '2' '3' ...
Not good. The arguments have been de-quoted. and usaly option handling
will breakdown and fail at the first multi-word arguement.
Lucky for us special shell characters are replaced with underscores or
the situation could also become a major security hole.
Even using something like..
text_filter= \%s{filter_dir}/text_filter
-n'\%s{n}' -h'\%s{h}' -i'\%{i}' -T'\%s{T}' -N'\%s{N}' -Z'\%s{Z}'
Does not quote the arguments correctly they are still broken up into
words.
Appending a ';' to the end, to force parsing by a shell, does however
fix the problem. But is is a hack.
I think some of the above should be added to that section of the HowTo
Guide. If only as an example on how it all works.
Anthony Thyssen ( System Programmer ) http://www.sct.gu.edu.au/~anthony/
-----------------------------------------------------------------------------
Signature presently being upgraded. New .sig should be bigger, better,
less harmful to the ozone layer, much friendlier to gay and lesbian whales,
offend less university staff. Coming soon, to a newsgroup near you!
-----------------------------------------------------------------------------
Anthony's Home is his Castle http://www.sct.gu.edu.au/~anthony/
-----------------------------------------------------------------------------
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.
-----------------------------------------------------------------------------