Support COUNT in the control file, to set the number of times the custom
REPLY is to be sent back before getting blanked and reverted to the built-in action. Now, we can make CWD fail once and then succeed when retried.
This commit is contained in:
parent
7954eee639
commit
6e3adc9b14
@ -92,6 +92,7 @@ my %commandok = (
|
|||||||
'SYST' => 'loggedin',
|
'SYST' => 'loggedin',
|
||||||
'SIZE' => 'loggedin|twosock',
|
'SIZE' => 'loggedin|twosock',
|
||||||
'PWD' => 'loggedin|twosock',
|
'PWD' => 'loggedin|twosock',
|
||||||
|
'MKD' => 'loggedin|twosock',
|
||||||
'QUIT' => 'loggedin|twosock',
|
'QUIT' => 'loggedin|twosock',
|
||||||
'RNFR' => 'loggedin|twosock',
|
'RNFR' => 'loggedin|twosock',
|
||||||
'RNTO' => 'loggedin|twosock',
|
'RNTO' => 'loggedin|twosock',
|
||||||
@ -118,6 +119,7 @@ my %displaytext = ('USER' => '331 We are happy you popped in!',
|
|||||||
'SYST' => '215 UNIX Type: L8', # just fake something
|
'SYST' => '215 UNIX Type: L8', # just fake something
|
||||||
'QUIT' => '221 bye bye baby', # just reply something
|
'QUIT' => '221 bye bye baby', # just reply something
|
||||||
'PWD' => '257 "/nowhere/anywhere" is current directory',
|
'PWD' => '257 "/nowhere/anywhere" is current directory',
|
||||||
|
'MKD' => '257 Created your requested directory',
|
||||||
'REST' => '350 Yeah yeah we set it there for you',
|
'REST' => '350 Yeah yeah we set it there for you',
|
||||||
'DELE' => '200 OK OK OK whatever you say',
|
'DELE' => '200 OK OK OK whatever you say',
|
||||||
'RNFR' => '350 Received your order. Please provide more',
|
'RNFR' => '350 Received your order. Please provide more',
|
||||||
@ -428,6 +430,7 @@ sub PORT_command {
|
|||||||
$SIG{CHLD} = \&REAPER;
|
$SIG{CHLD} = \&REAPER;
|
||||||
|
|
||||||
my %customreply;
|
my %customreply;
|
||||||
|
my %customcount;
|
||||||
my %delayreply;
|
my %delayreply;
|
||||||
sub customize {
|
sub customize {
|
||||||
undef %customreply;
|
undef %customreply;
|
||||||
@ -440,6 +443,11 @@ sub customize {
|
|||||||
if($_ =~ /REPLY ([A-Z]+) (.*)/) {
|
if($_ =~ /REPLY ([A-Z]+) (.*)/) {
|
||||||
$customreply{$1}=$2;
|
$customreply{$1}=$2;
|
||||||
}
|
}
|
||||||
|
if($_ =~ /COUNT ([A-Z]+) (.*)/) {
|
||||||
|
# we blank the customreply for this command when having
|
||||||
|
# been used this number of times
|
||||||
|
$customcount{$1}=$2;
|
||||||
|
}
|
||||||
elsif($_ =~ /DELAY ([A-Z]+) (\d*)/) {
|
elsif($_ =~ /DELAY ([A-Z]+) (\d*)/) {
|
||||||
$delayreply{$1}=$2;
|
$delayreply{$1}=$2;
|
||||||
}
|
}
|
||||||
@ -540,6 +548,10 @@ for ( $waitedpid = 0;
|
|||||||
$text = $displaytext{$FTPCMD};
|
$text = $displaytext{$FTPCMD};
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if($customcount{$FTPCMD} && (!--$customcount{$FTPCMD})) {
|
||||||
|
# used enough number of times, now blank the customreply
|
||||||
|
$customreply{$FTPCMD}="";
|
||||||
|
}
|
||||||
logmsg "$FTPCMD made to send '$text'\n";
|
logmsg "$FTPCMD made to send '$text'\n";
|
||||||
}
|
}
|
||||||
if($text) {
|
if($text) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user