Net::FTPSSL problem (or how to do FTP over SSL another way?)

D

DSIOMTW

I'm trying to write a simple script to upload a file to an FTP 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. I get the same result whether I try to upload or download a
file. Any ideas? Is there any other easy way to do FTP over SSL in
Perl?

<<< 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.
 
S

Sisyphus

..
..
Here is the output when I run the script.

Can you show us the conversation that takes place when you use the "desktop
FTP client" ?
That might help us determine where things are going awry in the perl script.
..
..
Is there any other easy way to do FTP over SSL in Perl?

For secure FTP, there's also Net::SFTP, which uses Net::SSH::perl. This, of
course, means that the server has to be running SSH. However, I'm not
impressed with Net::SSH::perl, so perhaps this is not a good suggestion.

I would prefer to FTP using Net::SSH2 (which needs the libssh2 library).
Again, there's a need for the server to be running SSH2, and, on top of
that, I have a nagging doubt that the libssh2 library is not being as
actively maintained as it ought.

I don't know much about Net::FTPSSL. (What is needed on the server side for
it to work ?)

Perhaps you're better off sticking with Net::FTPSSL - if you can just get
around the problem you're having. I see you sought help at
comp.lang.perl.modules (to no avail). If you don't get useful help here, try
contacting the author of Net::FTPSSL. He may be willing (and able) to help.

Otherwise my (non-expert) advice is to try Net::SSH2.

Cheers,
Rob
 
D

DSIOMTW

Unfortunately the service I need to access only supports ftps...

It's definitely a problem when switching to PASV mode, but Net::FTPSSL
seems to do that automatically and there doesn't appear to be any way
to switch that off (although I think it's required).

When using my desktop FTP client I get this ...

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

With the perl script using Net::FTPSSL I get all those errors
immediately after PASV is requested.

I've also emailed the author of Net::FTPSSL and have not received a
reply.
 
D

DSIOMTW

Here's the relavent code from FTPSSL.pm:

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 and not even get to line 141 where it runs into the
first problem...
 
S

Sisyphus

DSIOMTW said:
Unfortunately the service I need to access only supports ftps...

It's definitely a problem when switching to PASV mode, but Net::FTPSSL
seems to do that automatically and there doesn't appear to be any way
to switch that off (although I think it's required).

When using my desktop FTP client I get this ...

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

With the perl script using Net::FTPSSL I get all those errors
immediately after PASV is requested.

I've also emailed the author of Net::FTPSSL and have not received a
reply.

If you haven't already done so, turn on debugging in your script (by
specifying 'Debug => 1' in the constructor).
Also try applying the change provided at
http://rt.cpan.org/Public/Bug/Display.html?id=24136 .

And check the other bug reports at
http://rt.cpan.org/Public/Dist/Display.html?Name=Net-FTPSSL in case they
contain something relevant.

Sorry, I don't have access to an sftp server - so that's about the best I
can come up with.

Cheers,
Rob
 
D

DSIOMTW

Hey Rob,

Thanks a lot for your response. I was able to find the necessary patch
and now it works like a champ!
 
S

Sisyphus

DSIOMTW said:
Hey Rob,

Thanks a lot for your response. I was able to find the necessary patch
and now it works like a champ!

Which patch was needed ? And where did you find it ? (The answers to those
questions may be helpful to others.)

Cheers,
Rob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top