]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: Fixed assert-crash in NOTIFY when using multiple namespaces.
authorTimo Sirainen <tss@iki.fi>
Mon, 7 Sep 2015 19:14:18 +0000 (22:14 +0300)
committerTimo Sirainen <tss@iki.fi>
Mon, 7 Sep 2015 19:14:18 +0000 (22:14 +0300)
I'm not sure why the original code was trying to add it to multiple
namespaces. A single mailbox name should be matching only a single
namespace (visible one at least). In any case we can't use
mail_namespace_find() with only partial namespaces-list, because it'll
assert-crash if it can't find a namespace for the mailbox.

src/imap/cmd-notify.c

index 446378eb2e5c1cb82b62ec12b13ba743fb2b3342..d093573c84323f3a9da41687fe05eb961edb4e9b 100644 (file)
@@ -225,11 +225,8 @@ cmd_notify_add_mailbox_namespaces(struct imap_notify_context *ctx,
 {
        struct mail_namespace *ns;
 
-       /* add to all matching namespaces */
-       for (ns = ctx->client->user->namespaces; ns != NULL; ns = ns->next) {
-               if (mail_namespace_find(ns, name) == ns)
-                       cmd_notify_add_mailbox(ctx, ns, name, type, events);
-       }
+       ns = mail_namespace_find(ctx->client->user->namespaces, name);
+       cmd_notify_add_mailbox(ctx, ns, name, type, events);
 }
 
 static int