about summary refs log tree commit
diff options
context:
space:
mode:
authorGraham Barr <gbarr@pobox.com>1998-07-09 04:00:20 +0000
committerGraham Barr <gbarr@pobox.com>1998-07-09 04:00:20 +0000
commit4b0dbb2e4e374bb3b697e6ee636bb3c474ca0472 (patch)
treeabc77b80d4a55f1bf26400e3f019f168c34c1d21
parentfef487c94039c8c46fd617bf0e8d250671c7611f (diff)
downloadperl-libnet-4b0dbb2e4e374bb3b697e6ee636bb3c474ca0472.tar.gz
Net::FTP
- login will now send ACCT if $acct is defined and the PASS
  command completed with 2xx or 3xx
- Added a check for the close of the dataconn in _store_cmd
- Debug trace will hide any parameter given to ACCT

-rw-r--r--Net/FTP.pm17
1 files changed, 9 insertions, 8 deletions
diff --git a/Net/FTP.pm b/Net/FTP.pm
index a9d86d7..0031506 100644
--- a/Net/FTP.pm
+++ b/Net/FTP.pm
@@ -21,7 +21,7 @@ use Net::Cmd;
 use Net::Config;
 # use AutoLoader qw(AUTOLOAD);
 
-$VERSION = "2.43"; # $Id: //depot/libnet/Net/FTP.pm#28 $
+$VERSION = "2.44"; # $Id: //depot/libnet/Net/FTP.pm#29 $
 @ISA     = qw(Exporter Net::Cmd IO::Socket::INET);
 
 # Someday I will "use constant", when I am not bothered to much about
@@ -240,8 +240,8 @@ sub login
    $ok = $ftp->_PASS($pass || "");
   }
 
- $ok = $ftp->_ACCT($acct || "")
-        if ($ok == CMD_MORE);
+ $ok = $ftp->_ACCT($acct)
+        if (defined($acct) && ($ok == CMD_MORE || $ok == CMD_OK));
 
  $ftp->authorize()
     if($ok == CMD_OK && defined ${*$ftp}{'net_ftp_firewall'});
@@ -557,11 +557,12 @@ sub _store_cmd
     }
   }
 
- $sock->close();
-
  close($loc)
         unless defined $localfd;
 
+ $sock->close() or
+        return undef;
+
  ($remote) = $ftp->message =~ /unique file name:\s*(\S*)\s*\)/
         if ('STOU' eq uc $cmd);
 
@@ -842,7 +843,7 @@ sub _data_cmd
 ## Over-ride methods (Net::Cmd)
 ##
 
-sub debug_text { $_[2] =~ /^(pass|resp)/i ? "$1 ....\n" : $_[2]; }
+sub debug_text { $_[2] =~ /^(pass|resp|acct)/i ? "$1 ....\n" : $_[2]; }
 
 sub command
 {
@@ -988,8 +989,8 @@ Net::FTP - FTP Client class
 
     use Net::FTP;
     
-    $ftp = Net::FTP->new("some.host.name");
-    $ftp->login("anonymous","me@here.there");
+    $ftp = Net::FTP->new("some.host.name", Debug => 0);
+    $ftp->login("anonymous",'me@here.there');
     $ftp->cwd("/pub");
     $ftp->get("that.file");
     $ftp->quit;