diff options
author | Steve Holme <steve_holme@hotmail.com> | 2013-09-15 00:34:58 +0100 |
---|---|---|
committer | Steve Holme <steve_holme@hotmail.com> | 2013-09-15 09:00:13 +0100 |
commit | e9cca79dd1d38f94fdecf7af4b1a8a5512207913 (patch) | |
tree | 91ef2835eff4d6cc54db94e6b7563af8e2228baf | |
parent | 4ba3b6c05a33b8b4fb7a74b8286022d24be7aa25 (diff) |
ftpserver.pl: Added mailbox check to IMAP SELECT handler
-rwxr-xr-x | tests/ftpserver.pl | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/tests/ftpserver.pl b/tests/ftpserver.pl index 3fffcd7a6..c1df82408 100755 --- a/tests/ftpserver.pl +++ b/tests/ftpserver.pl @@ -844,22 +844,27 @@ sub LOGIN_imap { } sub SELECT_imap { - my ($testno) = @_; - fix_imap_params($testno); - - logmsg "SELECT_imap got test $testno\n"; + my ($mailbox) = @_; + fix_imap_params($mailbox); - # Example from RFC 3501, 6.3.1. SELECT Command - sendcontrol "* 172 EXISTS\r\n"; - sendcontrol "* 1 RECENT\r\n"; - sendcontrol "* OK [UNSEEN 12] Message 12 is first unseen\r\n"; - sendcontrol "* OK [UIDVALIDITY 3857529045] UIDs valid\r\n"; - sendcontrol "* OK [UIDNEXT 4392] Predicted next UID\r\n"; - sendcontrol "* FLAGS (\\Answered \\Flagged \\Deleted \\Seen \\Draft)\r\n"; - sendcontrol "* OK [PERMANENTFLAGS (\\Deleted \\Seen \\*)] Limited\r\n"; - sendcontrol "$cmdid OK [READ-WRITE] SELECT completed\r\n"; + logmsg "SELECT_imap got test $mailbox\n"; - $selected = $testno; + if($mailbox eq "") { + sendcontrol "$cmdid BAD Command Argument\r\n"; + } + else { + # Example from RFC 3501, 6.3.1. SELECT Command + sendcontrol "* 172 EXISTS\r\n"; + sendcontrol "* 1 RECENT\r\n"; + sendcontrol "* OK [UNSEEN 12] Message 12 is first unseen\r\n"; + sendcontrol "* OK [UIDVALIDITY 3857529045] UIDs valid\r\n"; + sendcontrol "* OK [UIDNEXT 4392] Predicted next UID\r\n"; + sendcontrol "* FLAGS (\\Answered \\Flagged \\Deleted \\Seen \\Draft)\r\n"; + sendcontrol "* OK [PERMANENTFLAGS (\\Deleted \\Seen \\*)] Limited\r\n"; + sendcontrol "$cmdid OK [READ-WRITE] SELECT completed\r\n"; + + $selected = $mailbox; + } return 0; } |