ftpserver.pl: Added the ability to send custom full text replies

This commit is contained in:
Steve Holme 2013-12-22 19:10:43 +00:00
parent 95ae389e17
commit 7da9c95bcf
1 changed files with 28 additions and 19 deletions

View File

@ -3251,36 +3251,45 @@ while(1) {
my $check = 1; # no response yet my $check = 1; # no response yet
# See if there is a custom reply for our command # See if there is a custom reply for the full text
my $text = $commandreply{$FTPCMD}; my $fulltext = $FTPCMD . " " . $FTPARG;
my $text = $fulltextreply{$fulltext};
if($text && ($text ne "")) { if($text && ($text ne "")) {
if($customcount{$FTPCMD} && (!--$customcount{$FTPCMD})) {
# used enough times so blank the custom command reply
$commandreply{$FTPCMD}="";
}
sendcontrol "$text\r\n"; sendcontrol "$text\r\n";
$check = 0; $check = 0;
} }
else { else {
# See if there is any display text for our command # See if there is a custom reply for the command
$text = $displaytext{$FTPCMD}; $text = $commandreply{$FTPCMD};
if($text && ($text ne "")) { if($text && ($text ne "")) {
if($proto eq 'imap') { if($customcount{$FTPCMD} && (!--$customcount{$FTPCMD})) {
sendcontrol "$cmdid $text\r\n"; # used enough times so blank the custom command reply
} $commandreply{$FTPCMD}="";
else {
sendcontrol "$text\r\n";
} }
sendcontrol "$text\r\n";
$check = 0; $check = 0;
} }
else {
# See if there is any display text for the command
$text = $displaytext{$FTPCMD};
if($text && ($text ne "")) {
if($proto eq 'imap') {
sendcontrol "$cmdid $text\r\n";
}
else {
sendcontrol "$text\r\n";
}
# only perform this if we're not faking a reply $check = 0;
my $func = $commandfunc{$FTPCMD}; }
if($func) {
&$func($FTPARG, $FTPCMD); # only perform this if we're not faking a reply
$check=0; # taken care of my $func = $commandfunc{$FTPCMD};
if($func) {
&$func($FTPARG, $FTPCMD);
$check = 0;
}
} }
} }