Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Net::FTPSSL problem (or how to do FTP over SSL another way?)

Reply
Thread Tools

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

 
 
DSIOMTW
Guest
Posts: n/a
 
      01-25-2007
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?


>>> 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:ack_sockaddr_in, length is 0, should be 4
at /usr/lib/perl5/5.8.5/i386-linux-thread-multi/Socket.pm line 373.

 
Reply With Quote
 
 
 
 
Sisyphus
Guest
Posts: n/a
 
      01-25-2007

"DSIOMTW" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
..
..
> 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:erl. This, of
course, means that the server has to be running SSH. However, I'm not
impressed with Net::SSH:erl, 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


 
Reply With Quote
 
 
 
 
DSIOMTW
Guest
Posts: n/a
 
      01-25-2007
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.

 
Reply With Quote
 
DSIOMTW
Guest
Posts: n/a
 
      01-25-2007
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...

 
Reply With Quote
 
Sisyphus
Guest
Posts: n/a
 
      01-26-2007

"DSIOMTW" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> 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/Displ...ame=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


 
Reply With Quote
 
DSIOMTW
Guest
Posts: n/a
 
      01-26-2007
Hey Rob,

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

 
Reply With Quote
 
Sisyphus
Guest
Posts: n/a
 
      01-27-2007

"DSIOMTW" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
VOIP over VPN over TCP over WAP over 3G Theo Markettos UK VOIP 2 02-14-2008 03:27 PM
Net::FTP problems getting files from Windows FTP server, but not Linux FTP Server. D. Buck Perl Misc 2 06-29-2004 02:05 PM
FTPS ( FTP over SSL) Problem with Python's builtin SSL Robert Python 2 06-10-2004 10:27 AM
FTP over SSL vs FTP over SSH someone Java 1 04-25-2004 03:30 PM



Advertisments