aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtests/ftpserver.pl43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/ftpserver.pl b/tests/ftpserver.pl
index 9c4d15372..ac52a496c 100755
--- a/tests/ftpserver.pl
+++ b/tests/ftpserver.pl
@@ -585,9 +585,11 @@ sub protocolsetup {
'APPEND' => \&APPEND_imap,
'CAPABILITY' => \&CAPABILITY_imap,
'CHECK' => \&CHECK_imap,
+ 'CLOSE' => \&CLOSE_imap,
'CREATE' => \&CREATE_imap,
'DELETE' => \&DELETE_imap,
'EXAMINE' => \&EXAMINE_imap,
+ 'EXPUNGE' => \&EXPUNGE_imap,
'FETCH' => \&FETCH_imap,
'LIST' => \&LIST_imap,
'LOGOUT' => \&LOGOUT_imap,
@@ -1196,6 +1198,47 @@ sub CHECK_imap {
return 0;
}
+sub CLOSE_imap {
+ if ($selected eq "") {
+ sendcontrol "$cmdid BAD Command received in Invalid state\r\n";
+ }
+ elsif (!@deleted) {
+ sendcontrol "$cmdid BAD Command Argument\r\n";
+ }
+ else {
+ sendcontrol "$cmdid OK CLOSE completed\r\n";
+
+ @deleted = ();
+ }
+
+ return 0;
+}
+
+sub EXPUNGE_imap {
+ if ($selected eq "") {
+ sendcontrol "$cmdid BAD Command received in Invalid state\r\n";
+ }
+ else {
+ if (!@deleted) {
+ # Report the number of existing messages as per the SELECT
+ # command
+ sendcontrol "* 172 EXISTS\r\n";
+ }
+ else {
+ # Report the message UIDs being deleted
+ for my $d (@deleted) {
+ sendcontrol "* $d EXPUNGE\r\n";
+ }
+
+ @deleted = ();
+ }
+
+ sendcontrol "$cmdid OK EXPUNGE completed\r\n";
+ }
+
+ return 0;
+}
+
sub LOGOUT_imap {
sendcontrol "* BYE cURL IMAP server signing off\r\n";
sendcontrol "$cmdid OK LOGOUT completed\r\n";