aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2013-08-28 18:56:19 +0100
committerSteve Holme <steve_holme@hotmail.com>2013-08-28 18:56:19 +0100
commit4ae7b7ea691497b76b564f42a1974c202bfe368f (patch)
treea927f8439d7f8bb4f2e133c3802b1274e45ef318
parent13a2e325489d12396a6107594d99e77f1f418c13 (diff)
ftpserver.pl: Added SELECT check to IMAP SEARCH command
-rwxr-xr-xtests/ftpserver.pl33
1 files changed, 19 insertions, 14 deletions
diff --git a/tests/ftpserver.pl b/tests/ftpserver.pl
index d5ae6bbf6..2732b1696 100755
--- a/tests/ftpserver.pl
+++ b/tests/ftpserver.pl
@@ -1034,27 +1034,32 @@ sub STATUS_imap {
sub SEARCH_imap {
my ($what) = @_;
- my $testno = $selected;
fix_imap_params($what);
- logmsg "SEARCH_imap got test $testno\n";
+ if ($selected eq "") {
+ sendcontrol "$cmdid BAD Command received in Invalid state\r\n";
+ else {
+ my $testno = $selected;
- $testno =~ s/^([^0-9]*)//;
- my $testpart = "";
- if ($testno > 10000) {
- $testpart = $testno % 10000;
- $testno = int($testno / 10000);
- }
+ logmsg "SEARCH_imap got test $testno\n";
- loadtest("$srcdir/data/test$testno");
+ $testno =~ s/^([^0-9]*)//;
+ my $testpart = "";
+ if ($testno > 10000) {
+ $testpart = $testno % 10000;
+ $testno = int($testno / 10000);
+ }
- my @data = getpart("reply", "data$testpart");
+ loadtest("$srcdir/data/test$testno");
- for my $d (@data) {
- sendcontrol $d;
- }
+ my @data = getpart("reply", "data$testpart");
- sendcontrol "$cmdid OK SEARCH completed\r\n";
+ for my $d (@data) {
+ sendcontrol $d;
+ }
+
+ sendcontrol "$cmdid OK SEARCH completed\r\n";
+ }
return 0;
}