<size>
number to return on a ftp SIZE command
</size>
+<cmd>
+special purpose server-command to control its behavior *before* the
+reply is sent
+</cmd>
+<postcmd>
+special purpose server-command to control its behavior *after* the
+reply is sent
+</oistcmd>
</reply>
<client>
$SIG{CHLD} = \&REAPER;
my %customreply;
+my %delayreply;
sub customize {
undef %customreply;
open(CUSTOM, "<log/ftpserver.cmd") ||
if($_ =~ /REPLY ([A-Z]+) (.*)/) {
$customreply{$1}=$2;
}
+ elsif($_ =~ /DELAY ([A-Z]+) (\d*)/) {
+ $delayreply{$1}=$2;
+ }
}
close(CUSTOM);
}
$state = $newstate;
}
+ my $delay = $delayreply{$FTPCMD};
+ if($delay) {
+ # just go sleep this many seconds!
+ sleep($delay);
+ }
+
my $text;
$text = $customreply{$FTPCMD};
my $fake = $text;
logmsg "reaped $waitedpid" . ($? ? " with exit $?" : '');
}
+sub performcmd {
+ my @cmd = @_;
+ for(@cmd) {
+ if($_ =~ /^ *wait *(\d*)/) {
+ # instructed to sleep!
+ sleep($1);
+ }
+ }
+}
+
$SIG{CHLD} = \&REAPER;
for ( $waitedpid = 0;
}
loadtest("data/test$testnum");
+
+
+ my @cmd = getpart("reply", "cmd");
+ performcmd(@cmd);
+
+ # flush data:
+ $| = 1;
+
# send a custom reply to the client
my @data = getpart("reply", "data$part");
for(@data) {
print STDERR "OUT: $_";
}
}
+ my @postcmd = getpart("reply", "postcmd");
+ performcmd(@postcmd);
}
}
# print "Hello there, $name, it's now ", scalar localtime, "\r\n";