Hi again!

I'm narrowing down my initial problem, and i believe i've found the error to be 
occuring due to 
the fact that before the Net::FTP calls are made, i have made a call to chroot!

Run the test script below (please please please please)

#! /usr/bin/perl
 
use strict;
use warnings;
use Net::FTP;
use Cwd ('abs_path', 'getcwd') ;
 
# Why doesn't PWD ever change?
# To test, point $Home and $Some_Child_Dir to valid directories such as i have below...
# Then run, everything will work except FTP
# To test again, comment out the chroot call and the chdir call.
# The point of the second test is to see that everything (FTP) works when Perl doesn't 
chroot.....

my $Home = '/home/drpoo';
my $Some_Child_Dir = 'bin';
 
my @foo = ("TESTING", "One", "Two", "Three!");
 
print "(PWD BEFORE CHROOT: $ENV{PWD})\n";
print "CWD BEFORE CHROOT:" . getcwd() . "\n";
print "ABS BEFORE CHROOT:" . abs_path() . "\n\n\n";
 
chroot($Home) || die "Couldn't chroot($Home) [$!]---\n";
 
print "(PWD AFTER CHROOT: $ENV{PWD})\n";
print "CWD AFTER CHROOT:" . getcwd() . "\n";
print "ABS AFTER CHROOT:" . abs_path() . "\n\n\n";
 
 
chdir($Some_Child_Dir) || die "couldn't change to $Some_Child_Dir [$!]\n";
 
print "(PWD AFTER CHDIR: $ENV{PWD})\n";
print "CWD AFTER CHDIR:" . getcwd() . "\n";
print "ABS AFTER CHDIR:" . abs_path() . "\n\n\n";
 
print "CALLING FTP COMMANDS! (REMEMBER, WE ARE IN CHROOTED ENVIRONMENT\n\n\n";
 
# This works if we are not in a chrooted environment!
# But fails with $!=[Net::FTP: Bad protocol 'tcp'] when in a chrooted environment!
 
my $ftpLogin = 'anonymous';
my $ftpPasswd = '-anonymous@';
#my $ftpHost = '207.70.162.228';
my $ftpHost = 'updates.redhat.com';
my $localArchiveDBPath = '/home/drpoo/ftptest.pl';
#my $ftpUploadLocation = 'pub/drop/RackShackBackup/ftptest.pl';
my $ftpUploadLocation = '6.1/en/os/i386';
 
print "Logging user '$ftpLogin' into $ftpHost...";
 
my $ftp = Net::FTP->new($ftpHost, Debug => 0) || die "Unable to connect to $ftpHost 
[REASON: $@] {$!}\n";
 
$ftp->login($ftpLogin, $ftpPasswd) || die "Unable to login to $ftpHost with $ftpLogin 
and Password\n";
 
print "SUCCESS!\n\n";
print "Quitting NOW!\n\n";
 
$ftp->quit;


Thanks for your help!
        -Chris

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to