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

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


details:   http://hg.dovecot.org/dovecot-1.1/rev/0419fbac1112
changeset: 8304:0419fbac1112
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Jun 04 18:29:14 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 (28 lines):

diff -r 3d526f8db2a0 -r 0419fbac1112 src/imap/cmd-delete.c
--- a/src/imap/cmd-delete.c	Wed Jun 03 15:56:08 2009 -0400
+++ b/src/imap/cmd-delete.c	Thu Jun 04 18:29:14 2009 -0400
@@ -21,18 +21,19 @@ 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 */
 		storage = mailbox_get_storage(mailbox);
 		client->mailbox = NULL;
 
 		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