* Kairam, Raj ([EMAIL PROTECTED]) [011130 15:10]:
> In my perl script I have a line like this.
> system( "'/usr/bin/lp -dhp4si /tmp/plotreq.txt' > /tmp/plotid.txt");
> 
> hp4si is the destination printer.
> /tmp/plotreq.txt  is small text file to be sent to the printer.
> /tmp/plotid.txt is the output of lp command ( just one line to indicate job
> id )to be saved.
> 
> If I run the command /usr/bin/lp -dhp4si /tmp/plotreq.txt > /tmp/plotid.txt
> it is fine as a command line.
> 
> The same in the perl script as above, doesn't send the file to printer nor
> does it create the /tmp/plotid.txt file.
> 
> I have tried this also and did not work.
> @lplist = ("/usr/bin/lp", "-dhp4si /tmp/plotreq.txt");
> system(@lplist);
> 
> This is the context.
> sub search {
>   some code
>   ....
>   open(REQFILE, ">/tmp/plotreq.txt") || die "sorry, could not open
> /tmp/plotreq.txt";
>   some more code to generate content for plotreq.txt
>   ......
>   close(REQFILE);
>   .... This is where I tried the above to send the file to the printer.
> }
> 
> This sub is part of a cgi script that creates output for the browser. The
> browser output is OK.
> The /tmp/plotreq.txt is generated but not being sent to the printer.
> 
> Can somebody guide me to do it right ?.
> Thanks
> Raj kairam
> 

Have you tried to 'su -' to nobody (or whomever your server is running as)
and run the command that way?  Have you tried to run the script from the command-line
and see what that yields?

On a side note, you may want to ensure that you are using Taint for all of your CGI
scripts when they interact with the OS.

Thanks,
JJ


-- 
J. J. Horner
"H*","6a686f726e657240326a6e6574776f726b732e636f6d"
***************************************************
"H*","6a6a686f726e65724062656c6c736f7574682e6e6574"

Freedom is an all-or-nothing proposition:  either we 
are completely free, or we are subjects of a
tyrannical system.  If we lose one freedom in a
thousand, we become completely subjugated.

Attachment: msg23183/pgp00000.pgp
Description: PGP signature

Reply via email to