changeset 9120:3e1899f7c205 HEAD

IMAP: DELETE command didn't properly check if we were deleting selected mailbox.
author Timo Sirainen <tss@iki.fi>
date Thu, 04 Jun 2009 18:31:16 -0400
parents b4b21b51dbc5
children 9da0277755a2
files src/imap/cmd-delete.c
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/imap/cmd-delete.c	Wed Jun 03 15:56:38 2009 -0400
+++ b/src/imap/cmd-delete.c	Thu Jun 04 18:31:16 2009 -0400
@@ -21,8 +21,13 @@
 		return TRUE;
 	}
 
+	storage = client_find_storage(cmd, &name);
+	if (storage == NULL)
+		return TRUE;
+
 	mailbox = client->mailbox;
-	if (mailbox != NULL && strcmp(mailbox_get_name(mailbox), name) == 0) {
+	if (mailbox != NULL && mailbox_get_storage(mailbox) == storage &&
+	    strcmp(mailbox_get_name(mailbox), name) == 0) {
 		/* deleting selected mailbox. close it first */
 		client_search_updates_free(client);
 		storage = mailbox_get_storage(mailbox);
@@ -30,10 +35,6 @@
 
 		if (mailbox_close(&mailbox) < 0)
 			client_send_untagged_storage_error(client, storage);
-	} else {
-		storage = client_find_storage(cmd, &name);
-		if (storage == NULL)
-			return TRUE;
 	}
 
 	if ((client_workarounds & WORKAROUND_TB_EXTRA_MAILBOX_SEP) != 0 &&