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

Discussion in 'Perl Misc' started by DSIOMTW, Jan 25, 2007.

  1. DSIOMTW

    DSIOMTW Guest

    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::pack_sockaddr_in, length is 0, should be 4
    at /usr/lib/perl5/5.8.5/i386-linux-thread-multi/Socket.pm line 373.
    DSIOMTW, Jan 25, 2007
    #1
    1. Advertising

  2. DSIOMTW

    Sisyphus Guest

    "DSIOMTW" <> wrote in message
    news:...
    ..
    ..
    > 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
    Sisyphus, Jan 25, 2007
    #2
    1. Advertising

  3. DSIOMTW

    DSIOMTW Guest

    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.
    DSIOMTW, Jan 25, 2007
    #3
  4. DSIOMTW

    DSIOMTW Guest

    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...
    DSIOMTW, Jan 25, 2007
    #4
  5. DSIOMTW

    Sisyphus Guest

    "DSIOMTW" <> wrote in message
    news:...
    > 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
    Sisyphus, Jan 26, 2007
    #5
  6. DSIOMTW

    DSIOMTW Guest

    Hey Rob,

    Thanks a lot for your response. I was able to find the necessary patch
    and now it works like a champ!
    DSIOMTW, Jan 26, 2007
    #6
  7. DSIOMTW

    Sisyphus Guest

    "DSIOMTW" <> wrote in message
    news:...
    > 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
    Sisyphus, Jan 27, 2007
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. someone

    FTP over SSL vs FTP over SSH

    someone, Apr 24, 2004, in forum: Java
    Replies:
    1
    Views:
    4,578
    iksrazal
    Apr 25, 2004
  2. Robert
    Replies:
    2
    Views:
    1,962
    Robert
    Jun 10, 2004
  3. D. Buck
    Replies:
    2
    Views:
    477
    D. Buck
    Jun 29, 2004
  4. Net::FTPSSL

    , Apr 13, 2007, in forum: Perl Misc
    Replies:
    0
    Views:
    101
  5. chrisg

    Net::FTPSSL Issue, can't put/get

    chrisg, Apr 17, 2009, in forum: Perl Misc
    Replies:
    0
    Views:
    225
    chrisg
    Apr 17, 2009
Loading...

Share This Page