summaryrefslogtreecommitdiff
path: root/tests/ftpserver.pl.in
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ftpserver.pl.in')
-rwxr-xr-xtests/ftpserver.pl.in39
1 files changed, 21 insertions, 18 deletions
diff --git a/tests/ftpserver.pl.in b/tests/ftpserver.pl.in
index a70aac9cf..ae9ac05f4 100755
--- a/tests/ftpserver.pl.in
+++ b/tests/ftpserver.pl.in
@@ -83,6 +83,7 @@ my $proto = 'ftp'; # default server protocol
my $srcdir; # directory where ftpserver.pl is located
my $srvrname; # server name for presentation purposes
my $cwd_testno; # test case numbers extracted from CWD command
+my $testno = 0; # test case number (read from ftpserver.cmd)
my $path = '.';
my $logdir = $path .'/log';
@@ -449,17 +450,14 @@ sub startsf {
# Returns the given test's reply data
#
sub getreplydata {
- my ($testno) = @_;
+ my ($num) = @_;
my $testpart = "";
- $testno =~ s/^([^0-9]*)//;
- if($testno > 10000) {
- $testpart = $testno % 10000;
- $testno = int($testno / 10000);
+ $num =~ s/^([^0-9]*)//;
+ if($num > 10000) {
+ $testpart = $num % 10000;
}
- loadtest("$srcdir/data/test$testno");
-
my @data = getpart("reply", "data$testpart");
if((!@data) && ($testpart ne "")) {
@data = getpart("reply", "data");
@@ -835,13 +833,8 @@ sub MAIL_smtp {
}
}
- # Validate the from address (only <> and a valid email address inside
- # <> are allowed, such as <user@example.com>)
- if (($from eq "<>") ||
- (!$smtputf8 && $from =~
- /^<([a-zA-Z0-9._%+-]+)\@(([a-zA-Z0-9-]+)\.)+([a-zA-Z]{2,4})>$/) ||
- ($smtputf8 && $from =~
- /^<([a-zA-Z0-9\x{80}-\x{ff}._%+-]+)\@(([a-zA-Z0-9\x{80}-\x{ff}-]+)\.)+([a-zA-Z]{2,4})>$/)) {
+ # this server doesn't "validate" MAIL FROM addresses
+ if (length($from)) {
my @found;
my $valid = 1;
@@ -2098,7 +2091,8 @@ my @ftpdir=("total 20\r\n",
logmsg "pass LIST data on data connection\n";
if($cwd_testno) {
- loadtest("$srcdir/data/test$cwd_testno");
+ loadtest("$logdir/test$cwd_testno") ||
+ loadtest("$srcdir/data/test$cwd_testno");
my @data = getpart("reply", "data");
for(@data) {
@@ -2161,7 +2155,8 @@ sub MDTM_ftp {
$testno = int($testno / 10000);
}
- loadtest("$srcdir/data/test$testno");
+ loadtest("$logdir/test$testno") ||
+ loadtest("$srcdir/data/test$testno");
my @data = getpart("reply", "mdtm");
@@ -2214,7 +2209,8 @@ sub SIZE_ftp {
$testno = int($testno / 10000);
}
- loadtest("$srcdir/data/test$testno");
+ loadtest("$logdir/test$testno") ||
+ loadtest("$srcdir/data/test$testno");
my @data = getpart("reply", "size");
@@ -2303,7 +2299,8 @@ sub RETR_ftp {
$testno = int($testno / 10000);
}
- loadtest("$srcdir/data/test$testno");
+ loadtest("$logdir/test$testno") ||
+ loadtest("$srcdir/data/test$testno");
my @data = getpart("reply", "data$testpart");
@@ -2886,6 +2883,10 @@ sub customize {
$nosave = 1;
logmsg "FTPD: NOSAVE prevents saving of uploaded data\n";
}
+ elsif($_ =~ /^Testnum (\d+)/){
+ $testno = $1;
+ logmsg "FTPD: run test case number: $testno\n";
+ }
}
close(CUSTOM);
}
@@ -3074,6 +3075,8 @@ while(1) {
$| = 1;
&customize(); # read test control instructions
+ loadtest("$logdir/test$testno") ||
+ loadtest("$srcdir/data/test$testno");
my $welcome = $commandreply{"welcome"};
if(!$welcome) {