1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

MDTM support added

This commit is contained in:
Daniel Stenberg 2003-04-09 11:52:24 +00:00
parent 1a2db0dfb1
commit 5b13106f54

View File

@ -18,6 +18,10 @@ use strict;
require "getpart.pm"; require "getpart.pm";
if($] >= 5.8) {
require 'open'; import( 'open', OUT => ':raw' );
}
open(FTPLOG, ">log/ftpd.log") || open(FTPLOG, ">log/ftpd.log") ||
print STDERR "failed to open log file, runs without logging\n"; print STDERR "failed to open log file, runs without logging\n";
@ -95,7 +99,8 @@ my %commandok = (
'QUIT' => 'loggedin|twosock', 'QUIT' => 'loggedin|twosock',
'RNFR' => 'loggedin|twosock', 'RNFR' => 'loggedin|twosock',
'RNTO' => 'loggedin|twosock', 'RNTO' => 'loggedin|twosock',
'DELE' => 'loggedin|twosock' 'DELE' => 'loggedin|twosock',
'MDTM' => 'loggedin|twosock',
); );
# initially, we're in 'fresh' state # initially, we're in 'fresh' state
@ -134,6 +139,7 @@ my %commandfunc = ( 'PORT' => \&PORT_command,
'REST' => \&REST_command, 'REST' => \&REST_command,
'STOR' => \&STOR_command, 'STOR' => \&STOR_command,
'APPE' => \&STOR_command, # append looks like upload 'APPE' => \&STOR_command, # append looks like upload
'MDTM' => \&MDTM_command,
); );
my $rest=0; my $rest=0;
@ -179,6 +185,33 @@ sub NLST_command {
return 0; 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 { sub SIZE_command {
my $testno = $_[0]; my $testno = $_[0];