FTP server: allow EPRT by default

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.
This commit is contained in:
Daniel Stenberg 2011-10-24 22:54:53 +02:00
parent e8d8843a02
commit f4405d30e0
2 changed files with 8 additions and 6 deletions

View 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>

View File

@ -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+)$/)) {