From 9d35ad9552f7248dea199402b049c8599e14ab7b Mon Sep 17 00:00:00 2001 From: Steve Holme Date: Fri, 30 Aug 2013 07:35:00 +0100 Subject: ftpserver.pl: Added support for IMAP CREATE, DELETE and RENAME commands --- tests/ftpserver.pl | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'tests/ftpserver.pl') diff --git a/tests/ftpserver.pl b/tests/ftpserver.pl index 2756e07ca..9237a69fb 100755 --- a/tests/ftpserver.pl +++ b/tests/ftpserver.pl @@ -578,10 +578,13 @@ sub protocolsetup { %commandfunc = ( 'APPEND' => \&APPEND_imap, 'CAPABILITY' => \&CAPABILITY_imap, + 'CREATE' => \&CREATE_imap, + 'DELETE' => \&DELETE_imap, 'EXAMINE' => \&EXAMINE_imap, 'FETCH' => \&FETCH_imap, 'LIST' => \&LIST_imap, 'LOGOUT' => \&LOGOUT_imap, + 'RENAME' => \&RENAME_imap, 'SEARCH' => \&SEARCH_imap, 'SELECT' => \&SELECT_imap, 'STATUS' => \&STATUS_imap, @@ -1080,6 +1083,55 @@ sub SEARCH_imap { return 0; } +sub CREATE_imap { + my ($args) = @_; + fix_imap_params($args); + + logmsg "CREATE_imap got $args\n"; + + if ($args eq "") { + sendcontrol "$cmdid BAD Command Argument\r\n"; + } + else { + sendcontrol "$cmdid OK CREATE completed\r\n"; + } + + return 0; +} + +sub DELETE_imap { + my ($args) = @_; + fix_imap_params($args); + + logmsg "DELETE_imap got $args\n"; + + if ($args eq "") { + sendcontrol "$cmdid BAD Command Argument\r\n"; + } + else { + sendcontrol "$cmdid OK DELETE completed\r\n"; + } + + return 0; +} + +sub RENAME_imap { + my ($args) = @_; + my ($from_mailbox, $to_mailbox) = split(/ /, $args, 2); + fix_imap_params($from_mailbox, $to_mailbox); + + logmsg "RENAME_imap got $args\n"; + + if (($from_mailbox eq "") || (to_mailbox eq "")) { + sendcontrol "$cmdid BAD Command Argument\r\n"; + } + else { + sendcontrol "$cmdid OK RENAME completed\r\n"; + } + + return 0; +} + sub LOGOUT_imap { sendcontrol "* BYE cURL IMAP server signing off\r\n"; sendcontrol "$cmdid OK LOGOUT completed\r\n"; -- cgit v1.2.3