Subject: | Minor bug in Net::FTP |
Date: | Fri, 7 Aug 2009 18:00:03 -0500 |
To: | bug-libnet [...] rt.cpan.org |
From: | Troy Loveday <troyl [...] ti.com> |
I have found a bug in the Net::FTP module. The authorize() method (used
for FirewallType => 7) incorrectly interprets the return value of the
_RESP() method, and falsely reports a failure. Here are the details:
$ perl -v
This is perl, v5.8.0 built for x86_64-linux-thread-multi
Copyright 1987-2002, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'. If you have access to the
Internet, point your browser at http://www.perl.com/, the Perl Home Page.
$ perl -MNet::FTP -e 'print $Net::FTP::VERSION, "\n";'
2.65
(However, the included one-line patch is against the most recent version,
2.77)
$ uname -a
Linux retro22.dal.design.ti.com 2.6.9-67.0.4.ELsmp #1 SMP Fri Jan 18 05:00:00 EST 2008 x86_64 x86_64 x86_64 GNU/Linux
To run the example.pl file, you'll need to modify these variables for
your local environment:
my $host = 'ftp.ti.com';
my $login = 'anonymous';
my $password = 'troyl@ti.com';
my $proxy_host = 'gate.ti.com';
my $proxy_login = '<proxy_login>';
my $proxy_password = '<proxy_password>';
Output of example.pl demonstrating the bug:
$ perl ./example.pl
Net::FTP: Net::FTP(2.65)
Net::FTP: Exporter(5.566)
Net::FTP: Net::Cmd(2.21)
Net::FTP: IO::Socket::INET(1.26)
Net::FTP: IO::Socket(1.27)
Net::FTP: IO::Handle(1.21)
Net::FTP=GLOB(0x5d2a80)<<< 220-This is the TI FTP proxy service.
Net::FTP=GLOB(0x5d2a80)<<< 220-Access by unauthorized users is prohibited.
Net::FTP=GLOB(0x5d2a80)<<< 220-All transfers through this proxy are logged.
Net::FTP=GLOB(0x5d2a80)<<< 220-When prompted for username, enter ``RemoteUsername@RemoteHost''.
Net::FTP=GLOB(0x5d2a80)<<< 220 For example: anonymous@ftp.uu.net
Net::FTP=GLOB(0x5d2a80)>>> user anonymous@ftp.ti.com
Net::FTP=GLOB(0x5d2a80)<<< 331-(----GATEWAY CONNECTED TO ftp.ti.com----)
Net::FTP=GLOB(0x5d2a80)<<< 331-(220 ProFTPD 1.2.8 Server (ProFTPD) [192.91.81.243])
Net::FTP=GLOB(0x5d2a80)<<< 331 Anonymous login ok, send your complete email address as your password.
Net::FTP=GLOB(0x5d2a80)>>> PASS ....
Net::FTP=GLOB(0x5d2a80)<<< 230 Anonymous access granted, restrictions apply.
Net::FTP=GLOB(0x5d2a80)>>> AUTH rts
Net::FTP=GLOB(0x5d2a80)<<< 331 Enter authentication password for rts
Net::FTP=GLOB(0x5d2a80)>>> RESP ....
Net::FTP=GLOB(0x5d2a80)<<< 230 User authenticated to proxy
ERROR: User authenticated to proxy
at ./example.pl line 28.
Output of example.pl with patched Net::FTP module:
$ perl ./example.pl
Net::FTP: Net::FTP(2.65)
Net::FTP: Exporter(5.566)
Net::FTP: Net::Cmd(2.21)
Net::FTP: IO::Socket::INET(1.26)
Net::FTP: IO::Socket(1.27)
Net::FTP: IO::Handle(1.21)
Net::FTP=GLOB(0x60e690)<<< 220-This is the TI FTP proxy service.
Net::FTP=GLOB(0x60e690)<<< 220-Access by unauthorized users is prohibited.
Net::FTP=GLOB(0x60e690)<<< 220-All transfers through this proxy are logged.
Net::FTP=GLOB(0x60e690)<<< 220-When prompted for username, enter ``RemoteUsername@RemoteHost''.
Net::FTP=GLOB(0x60e690)<<< 220 For example: anonymous@ftp.uu.net
Net::FTP=GLOB(0x60e690)>>> user anonymous@ftp.ti.com
Net::FTP=GLOB(0x60e690)<<< 331-(----GATEWAY CONNECTED TO ftp.ti.com----)
Net::FTP=GLOB(0x60e690)<<< 331-(220 ProFTPD 1.2.8 Server (ProFTPD) [192.91.81.243])
Net::FTP=GLOB(0x60e690)<<< 331 Anonymous login ok, send your complete email address as your password.
Net::FTP=GLOB(0x60e690)>>> PASS ....
Net::FTP=GLOB(0x60e690)<<< 230 Anonymous access granted, restrictions apply.
Net::FTP=GLOB(0x60e690)>>> AUTH rts
Net::FTP=GLOB(0x60e690)<<< 331 Enter authentication password for rts
Net::FTP=GLOB(0x60e690)>>> RESP ....
Net::FTP=GLOB(0x60e690)<<< 230 User authenticated to proxy
Net::FTP=GLOB(0x60e690)>>> QUIT
Net::FTP=GLOB(0x60e690)<<< 221 Goodbye.
--
Troy Loveday e-mail: <troyl@ti.com>
Custom Business PG Team phone: 214-567-6463
Texas Instruments, Inc.
Dallas, Texas
Message body not shown because it is not plain text.