dovecot-1.2: IMAP: DELETE command didn't properly check if we we...

dovecot at dovecot.org dovecot at dovecot.org
Fri Jun 5 01:31:22 EEST 2009


details:   http://hg.dovecot.org/dovecot-1.2/rev/3e1899f7c205
changeset: 9120:3e1899f7c205
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Jun 04 18:31:16 2009 -0400
description:
IMAP: DELETE command didn't properly check if we were deleting selected mailbox.

diffstat:

1 file changed, 6 insertions(+), 5 deletions(-)
src/imap/cmd-delete.c |   11 ++++++-----

diffs (29 lines):

diff -r b4b21b51dbc5 -r 3e1899f7c205 src/imap/cmd-delete.c
--- 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 @@ bool cmd_delete(struct client_command_co
 		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 @@ bool cmd_delete(struct client_command_co
 
 		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 &&


More information about the dovecot-cvs mailing list