aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2013-11-07 20:12:51 +0000
committerSteve Holme <steve_holme@hotmail.com>2013-11-10 15:18:04 +0000
commit460adfef937a345944e8963e84101856baa04337 (patch)
treee9d148aa554ae1284e9d3da7846f7e6fc418f619 /tests
parentc876f6ae6d8eac640dc9c9880daa0137d6d5d8fd (diff)
ftpserver.pl: Reworked custom reply handling code
1) To fix issues with IMAP custom replies 2) So initial space is not required in IMAP display text 3) To be more readable and understandable
Diffstat (limited to 'tests')
-rwxr-xr-xtests/ftpserver.pl31
1 files changed, 15 insertions, 16 deletions
diff --git a/tests/ftpserver.pl b/tests/ftpserver.pl
index 4f0e9f20c..96cfdfe98 100755
--- a/tests/ftpserver.pl
+++ b/tests/ftpserver.pl
@@ -3108,34 +3108,33 @@ while(1) {
}
}
- my $text;
- $text = $customreply{$FTPCMD};
- my $fake = $text;
+ my $check = 1; # no response yet
+ # See if there is a custom reply for our command
+ my $text = $customreply{$FTPCMD};
if($text && ($text ne "")) {
if($customcount{$FTPCMD} && (!--$customcount{$FTPCMD})) {
# used enough number of times, now blank the customreply
$customreply{$FTPCMD}="";
}
+
+ sendcontrol "$text\r\n";
+ $check = 0;
}
else {
+ # See if there is any display text for our command
$text = $displaytext{$FTPCMD};
- }
+ if($text && ($text ne "")) {
+ if($proto eq 'imap') {
+ sendcontrol "$cmdid $text\r\n";
+ }
+ else {
+ sendcontrol "$text\r\n";
+ }
- my $check;
- if($text && ($text ne "")) {
- if(($cmdid) && ($cmdid ne "") && ($fake) && ($fake ne "")) {
- sendcontrol "$cmdid$text\r\n";
+ $check = 0;
}
- else {
- sendcontrol "$text\r\n";
- }
- }
- else {
- $check=1; # no response yet
- }
- unless($fake && ($fake ne "")) {
# only perform this if we're not faking a reply
my $func = $commandfunc{$FTPCMD};
if($func) {