changeset 22484:71589abee915

lib-storage: Fix mailbox list notification assert-crash when mailbox is deleted Reproduced with if IMAP NOTIFY is used for non-selected mailboxes without MailboxName being specified. Another session then does changes to a mailbox and immediately deletes it, which causes the crash. Fixes: Panic: file mailbox-list-index-notify.c: line 751: unreached
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Mon, 11 Sep 2017 12:27:17 +0300
parents 2a7fb92d36eb
children ca38a4e36fad
files src/lib-storage/list/mailbox-list-index-notify.c
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/list/mailbox-list-index-notify.c	Mon Sep 11 12:59:27 2017 +0300
+++ b/src/lib-storage/list/mailbox-list-index-notify.c	Mon Sep 11 12:27:17 2017 +0300
@@ -746,8 +746,12 @@
 
 	if (!mailbox_list_index_notify_lookup(inotify, inotify->view,
 					      uid, notify_status_items,
-					      &status, &rec))
-		i_unreached();
+					      &status, &rec)) {
+		/* Mailbox is already deleted. We won't get here if we're
+		   tracking MAILBOX_LIST_NOTIFY_DELETE or _RENAME
+		   (which update expunged_uids). */
+		return FALSE;
+	}
 
 	/* get the old status */
 	nnode = mailbox_list_notify_tree_lookup(inotify->tree,