aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2003-04-09 11:52:24 +0000
committerDaniel Stenberg <daniel@haxx.se>2003-04-09 11:52:24 +0000
commit5b13106f542df45a8b10669ddd9c151edc3bc961 (patch)
tree55852f35bc245589eece071672c67be2fc85dd5f
parent1a2db0dfb14d755071b4f321b3401a7091b0a467 (diff)
MDTM support added
-rw-r--r--tests/ftpserver.pl35
1 files changed, 34 insertions, 1 deletions
diff --git a/tests/ftpserver.pl b/tests/ftpserver.pl
index 6b0ca0199..bd1b1fbec 100644
--- a/tests/ftpserver.pl
+++ b/tests/ftpserver.pl
@@ -18,6 +18,10 @@ use strict;
require "getpart.pm";
+if($] >= 5.8) {
+ require 'open'; import( 'open', OUT => ':raw' );
+}
+
open(FTPLOG, ">log/ftpd.log") ||
print STDERR "failed to open log file, runs without logging\n";
@@ -95,7 +99,8 @@ my %commandok = (
'QUIT' => 'loggedin|twosock',
'RNFR' => 'loggedin|twosock',
'RNTO' => 'loggedin|twosock',
- 'DELE' => 'loggedin|twosock'
+ 'DELE' => 'loggedin|twosock',
+ 'MDTM' => 'loggedin|twosock',
);
# initially, we're in 'fresh' state
@@ -134,6 +139,7 @@ my %commandfunc = ( 'PORT' => \&PORT_command,
'REST' => \&REST_command,
'STOR' => \&STOR_command,
'APPE' => \&STOR_command, # append looks like upload
+ 'MDTM' => \&MDTM_command,
);
my $rest=0;
@@ -179,6 +185,33 @@ sub NLST_command {
return 0;
}
+sub MDTM_command {
+ my $testno = $_[0];
+
+ loadtest("data/test$testno");
+
+ logmsg "MDTM $testno\n";
+
+ my @data = getpart("reply", "mdtm");
+
+ my $reply = $data[0];
+ chomp $reply;
+
+ if($reply <0) {
+ print "550 $testno: no such file.\r\n";
+ logmsg "MDTM $testno: no such file\n";
+ }
+ elsif($reply) {
+ print "$reply\r\n";
+ logmsg "MDTM $testno returned $reply\n";
+ }
+ else {
+ print "500 MDTM: no such command.\r\n";
+ logmsg "MDTM: no such command\n";
+ }
+ return 0;
+}
+
sub SIZE_command {
my $testno = $_[0];