about summary refs log tree commit
diff options
context:
space:
mode:
authorSteve Hay <steve.m.hay@googlemail.com>2014-10-04 13:03:37 +0100
committerSteve Hay <steve.m.hay@googlemail.com>2014-10-04 13:03:37 +0100
commitd3f979bc23484557d092f464afb2c6f8759237b1 (patch)
treebffa758d656191cb8fe629abc376eb035aa067fc
parent8bb43845710aa538de6b26d78891bc195053e4f8 (diff)
downloadperl-libnet-d3f979bc23484557d092f464afb2c6f8759237b1.tar.gz
Don't use the ALLO command on FTP servers that don't support it
Despite always having been present in the FTP specification, some servers
(e.g. Enterprise FTP server (version 6600)) do not support the ALLO
command. Do not use the command on such servers otherwise its failure will
cause the PUT command which normally follows it to fail (since the success
of the ALLO command is now checked, as of commit 0d616e68cc).

Fixes CPAN RT#95717, also reported by an Enterprise FTP server user.
-rw-r--r--Changes2
-rw-r--r--lib/Net/FTP.pm6
2 files changed, 6 insertions, 2 deletions
diff --git a/Changes b/Changes
index 1d5a19d..b65075a 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,7 @@
 libnet 1.28  -- TODO
 
+  * Don't use the ALLO command on FTP servers that don't support it.  [Resolves
+    CPAN RT#95717]
   * Stop Makefile.PL from requiring interactive configuration when running via
     cpan, cpanp or cpanm: just accept all defaults in these cases, as when
     running non-interactively.  [Resolves CPAN RT#48966]
diff --git a/lib/Net/FTP.pm b/lib/Net/FTP.pm
index eb8e7dc..e8b2d95 100644
--- a/lib/Net/FTP.pm
+++ b/lib/Net/FTP.pm
@@ -490,7 +490,7 @@ sub alloc {
     unless (defined $size);
 
   return
-    unless ($ftp->_ALLO($size, @_));
+    unless ($ftp->supported("ALLO") and $ftp->_ALLO($size, @_));
 
   ${*$ftp}{'net_ftp_allo'} = join(" ", $size, @_);
 
@@ -1148,7 +1148,9 @@ sub _data_cmd {
   return
     unless $ok;
 
-  if ($cmd =~ /(STOR|APPE|STOU)/ and exists ${*$ftp}{net_ftp_allo}) {
+  if ($cmd =~ /(STOR|APPE|STOU)/ and exists ${*$ftp}{net_ftp_allo} and
+      $ftp->supported("ALLO"))
+  {
     $ftp->_ALLO(delete ${*$ftp}{net_ftp_allo})
       or return;
   }