diff options
| author | Steve Holme <steve_holme@hotmail.com> | 2013-09-14 15:02:34 +0100 | 
|---|---|---|
| committer | Steve Holme <steve_holme@hotmail.com> | 2013-09-14 15:04:26 +0100 | 
| commit | 4d6ef6297ae9b6944f647c562ff447f8774fe0b1 (patch) | |
| tree | 5d52316a5fcd07020c58ecd70ba4efeb52164bd1 | |
| parent | b68c52704bc2732a3eebcd3be830545a82d3b023 (diff) | |
ftpserver.pl: Added capability prerequisite for extended POP3 commands
| -rwxr-xr-x | tests/ftpserver.pl | 24 | 
1 files changed, 16 insertions, 8 deletions
diff --git a/tests/ftpserver.pl b/tests/ftpserver.pl index 6f099b105..075e02e77 100755 --- a/tests/ftpserver.pl +++ b/tests/ftpserver.pl @@ -1556,16 +1556,21 @@ sub UIDL_pop3 {          "3 4\r\n", # Note that UID 3 is a simulated "deleted" message      ); -    logmsg "retrieve a message UID list\n"; +    if (!grep /^UIDL$/, @capabilities) { +        sendcontrol "-ERR Unrecognized command\r\n"; +    } +    else { +        logmsg "retrieve a message UID list\n"; -    sendcontrol "+OK Listing starts\r\n"; +        sendcontrol "+OK Listing starts\r\n"; -    for my $d (@data) { -        sendcontrol $d; -    } +        for my $d (@data) { +            sendcontrol $d; +        } -    # End with the magic 3-byte end of listing marker -    sendcontrol ".\r\n"; +        # End with the magic 3-byte end of listing marker +        sendcontrol ".\r\n"; +    }      return 0;  } @@ -1576,7 +1581,10 @@ sub TOP_pop3 {      logmsg "TOP_pop3 got $args\n"; -    if (($msg eq "") || ($lines eq "")) { +    if (!grep /^TOP$/, @capabilities) { +        sendcontrol "-ERR Unrecognized command\r\n"; +    } +    elsif ((!$msg) || (!$lines)) {          sendcontrol "-ERR Protocol error\r\n";      }      else {  | 
