FTP server: allow EPRT by default
authorDaniel Stenberg <daniel@haxx.se>
Mon, 24 Oct 2011 20:54:53 +0000 (22:54 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 24 Oct 2011 21:07:53 +0000 (23:07 +0200)
EPRT is now supported by default by the server. To disable it, use the
generic REPLY instruction in the <servercmd> tag. Test 116 now has it
disabled. All other existing active FTP port tests strip out the port
commands from the logs already so the change of the server isn't that
noticable.

tests/data/test116
tests/ftpserver.pl

index bf04492..9a36f97 100644 (file)
@@ -4,11 +4,13 @@
 FTP
 PORT
 FAILURE
+EPRT refused
 </keywords>
 </info>
 # Server-side
 <reply>
 <servercmd>
+REPLY EPRT 500 we don't like EPRT now
 REPLY PORT 314 bluah you f00l!
 </servercmd>
 </reply>
index 43bdbae..55c1c50 100755 (executable)
@@ -76,7 +76,6 @@ my $ipvnum = 4;     # server IPv number (4 or 6)
 my $proto = 'ftp';  # default server protocol
 my $srcdir;         # directory where ftpserver.pl is located
 my $srvrname;       # server name for presentation purposes
-my $grok_eprt;
 
 my $path   = '.';
 my $logdir = $path .'/log';
@@ -1154,7 +1153,9 @@ sub PASV_ftp {
     return;
 }
 
-# Support both PORT and EPRT here. Consider LPRT too.
+#
+# Support both PORT and EPRT here.
+#
 
 sub PORT_ftp {
     my ($arg, $cmd) = @_;
@@ -1173,8 +1174,9 @@ sub PORT_ftp {
         $addr = "$1.$2.$3.$4";
     }
     # EPRT |2|::1|49706|
-    elsif(($cmd eq "EPRT") && ($grok_eprt)) {
+    elsif($cmd eq "EPRT") {
         if($arg !~ /(\d+)\|([^\|]+)\|(\d+)/) {
+            logmsg "bad EPRT-line: $arg\n";
             sendcontrol "500 silly you, go away\r\n";
             return 0;
         }
@@ -1242,7 +1244,7 @@ sub customize {
             $customreply{$1}=eval "qq{$2}";
             logmsg "FTPD: set custom reply for $1\n";
         }
-        if($_ =~ /COUNT ([A-Z]+) (.*)/) {
+        elsif($_ =~ /COUNT ([A-Z]+) (.*)/) {
             # we blank the customreply for this command when having
             # been used this number of times
             $customcount{$1}=$2;
@@ -1341,12 +1343,10 @@ while(@ARGV) {
     elsif($ARGV[0] eq '--ipv4') {
         $ipvnum = 4;
         $listenaddr = '127.0.0.1' if($listenaddr eq '::1');
-        $grok_eprt = 0;
     }
     elsif($ARGV[0] eq '--ipv6') {
         $ipvnum = 6;
         $listenaddr = '::1' if($listenaddr eq '127.0.0.1');
-        $grok_eprt = 1;
     }
     elsif($ARGV[0] eq '--port') {
         if($ARGV[1] && ($ARGV[1] =~ /^(\d+)$/)) {