]> granicus.if.org Git - curl/commitdiff
imap: Fixed ftpserver.pl to allow verification even through LIST command
authorJiri Hruska <jirka@fud.cz>
Wed, 6 Mar 2013 21:16:19 +0000 (22:16 +0100)
committerSteve Holme <steve_holme@hotmail.com>
Wed, 6 Mar 2013 21:36:12 +0000 (21:36 +0000)
Commit 198012ee inadvertently broke LIST_imap().

tests/ftpserver.pl

index 1be686196093ec7e14e45bcf08b2e0b9c9c4f882..b4076f4bed3d2dda0ad454d4e51c8bb7a6cf1fc5 100755 (executable)
@@ -940,20 +940,32 @@ sub STORE_imap {
 sub LIST_imap {
     my ($args) = @_;
     my ($reference, $mailbox) = split(/ /, $args, 2);
+    my @data;
 
     logmsg "LIST_imap got $args\n";
 
-    my $testno = $reference;
-    $testno =~ s/^([^0-9]*)//;
-    my $testpart = "";
-    if ($testno > 10000) {
-        $testpart = $testno % 10000;
-        $testno = int($testno / 10000);
+    if ($reference eq '"verifiedserver"') {
+         # this is the secret command that verifies that this actually is
+         # the curl test server
+         @data = ("* LIST () \"/\" \"WE ROOLZ: $$\"\r\n");
+         if($verbose) {
+             print STDERR "FTPD: We returned proof we are the test server\n";
+         }
+         logmsg "return proof we are we\n";
     }
+    else {
+        my $testno = $reference;
+        $testno =~ s/^([^0-9]*)//;
+        my $testpart = "";
+        if ($testno > 10000) {
+            $testpart = $testno % 10000;
+            $testno = int($testno / 10000);
+        }
     
-    loadtest("$srcdir/data/test$testno");
+        loadtest("$srcdir/data/test$testno");
 
-    my @data = getpart("reply", "data$testpart");
+        @data = getpart("reply", "data$testpart");
+    }
 
     for my $d (@data) {
         sendcontrol $d;