Need help with Net::FTPSSL

Need help with Net::FTPSSL

am 20.01.2007 20:09:45 von dsiomtw

I'm trying to write a simple script to upload a file to a remote server
using Net::FTPSSL. Everything works fine until I try to actually upload
the file. Based on the warnings and trace info it seems to have
something to do with using PASV mode. I'm able to connect and transfer
files just fine in PASV mode using my desktop FTP client, so I have no
idea what the problem might be. Here is the output when I run the
script. Any ideas?

>>> USER *****
<<< 331 Password required for *****.
>>> PASS *****
<<< 230-Welcome to the ***** Secure FTP Server!
>>> CWD /*****/
<<< 230 User ***** logged in.
>>> TYPE A
<<< 250 CWD command successful now (/******)
>>> PBSZ 0
<<< 200 Type set to A
>>> PROT P
<<< 200 Great whatever you say
>>> PASV
<<< 200 Data channel will be encrypted
Use of uninitialized value in split at
/usr/lib/perl5/site_perl/5.8.5/Net/FTPSSL.pm line 141.
Use of uninitialized value in join or string at
/usr/lib/perl5/site_perl/5.8.5/Net/FTPSSL.pm line 143.
Use of uninitialized value in join or string at
/usr/lib/perl5/site_perl/5.8.5/Net/FTPSSL.pm line 143.
Use of uninitialized value in join or string at
/usr/lib/perl5/site_perl/5.8.5/Net/FTPSSL.pm line 143.
Use of uninitialized value in join or string at
/usr/lib/perl5/site_perl/5.8.5/Net/FTPSSL.pm line 143.
Use of uninitialized value in multiplication (*) at
/usr/lib/perl5/site_perl/5.8.5/Net/FTPSSL.pm line 144.
Use of uninitialized value in addition (+) at
/usr/lib/perl5/site_perl/5.8.5/Net/FTPSSL.pm line 144.
Use of uninitialized value in subroutine entry at
/usr/lib/perl5/5.8.5/i386-linux-thread-multi/Socket.pm line 373.
Bad arg length for Socket::pack_sockaddr_in, length is 0, should be 4
at /usr/lib/perl5/5.8.5/i386-linux-thread-multi/Socket.pm line 373.

Re: Need help with Net::FTPSSL

am 20.01.2007 20:33:53 von dsiomtw

I forgot to mention, I get the exact same errors if I try to get a file
from the FTP server too ...

Re: Need help with Net::FTPSSL

am 25.01.2007 16:54:23 von Andy

You should take a look at the code in the Net::FTPSSL module (when you
install perl modules from cpan, the source code is downloaded to your
computer) to see what the problem might be related to.

On windows, open the folder in which you installed the PERL interpreter
(usually c:/PERL) and navigate the to the following directory:

Perl/Site/lib/Net

If you are on UNIX, then I would try:

/usr/lib/perl5/site_perl/5.8.5/net

In there, you should find FTPSSL.pm. If you can't find it, do a fgrep
search for FTPSSL.pm


Open this file in a text editor (preferably one with line numbers, such
as crimson) and scroll to line 140. What is being split? Does the
variable name sound like any parameter name that you may need to
initialize Net::FTPSSL with (which you haven't yet)?

Re: Need help with Net::FTPSSL

am 25.01.2007 23:39:02 von dsiomtw

Here's the relavent code:

136: unless ( substr( $msg, 0, 1 ) == CMD_OK ) { return 0; }
137:
138: $msg =~ m/(\d+)\s(.*)\(((\d+,?)+)\)\.?/
139: ; # [227] [Entering Passive Mode] ([h1,h2,h3,h4,p1,p2]).
140:
141: my @address = split( /,/, $3 );

So it seems like it's not getting a proper response back after issuing
the PASV command. But if it's not getting a proper response it should
return 0 it seems.

When I do the same thing with my desktop FTP client it works fine, so
the FTP server doesn't seem to be the problem. This is from my desktop
client:

\par\cf1 PASV
\par\cf1 227 Entering Passive Mode (67,137,159,254,4,0).