I am converting a perl program that uses Net::FTP to use Net::SFTP::Foreign. It is quite nifty and has all manner of fine capabilities. We run the ftp version as root, actually its run out of a non root crontab where the program is owned by root with it's sticky bit set. Running perl as root automatically invokes trust (-T) so I have to untaint all my variables. No problem with the Net::FTP module, but Net::SFTP::Foreign only has one response to trust, FAIL!
GetOptions(
"r=s" => \$opt_remote_dir,
);
$opt_remote_dir =~ /^(.*)$/;
if ( ! $sftp->setcwd( "$opt_remote_dir" ) ) {
$sftp->error returns:
Insecure argument '/test/in' on method call while running with -T switch at /ftp/sbin/sftp.pl line 1674
Even if I untaint the entire command:
$cd_remote_dir="\$sftp->setcwd( \"$opt_remote_dir\" )";
if ( ! eval $cd_remote_dir )
I get the same error.
If I run the script as a non root user with the -T switch I get the same thing.
Evidently there is an issue with running Net::SFTP::Foreign under taint.
Hope you can help. I invested a lot of time and effort in Net::SFTP::Foreign. I hate to trash it at the last moment.
Thanks
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.