From: Aki Tuomi Date: Mon, 20 Nov 2017 11:40:03 +0000 (+0200) Subject: lib-storage: mailbox-list-iter - Refresh subscriptions before setting flags X-Git-Tag: 2.3.0.rc1~172 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e4f8e7a2f30b34f6ac39b5e228c3c94ea271c253;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: mailbox-list-iter - Refresh subscriptions before setting flags This happens when list patterns match the namespace prefix, but mailbox_list_ns_match_patterns() returns FALSE. And one of the ways for that to happen is if namespace has alias_for set. --- diff --git a/src/lib-storage/list/mailbox-list-iter.c b/src/lib-storage/list/mailbox-list-iter.c index 01110ac70b..72bce8f568 100644 --- a/src/lib-storage/list/mailbox-list-iter.c +++ b/src/lib-storage/list/mailbox-list-iter.c @@ -37,6 +37,7 @@ struct ns_list_iterate_context { bool inbox_listed:1; }; +static void mailbox_list_ns_iter_failed(struct ns_list_iterate_context *ctx); static bool ns_match_next(struct ns_list_iterate_context *ctx, struct mail_namespace *ns, const char *pattern); static int mailbox_list_match_anything(struct ns_list_iterate_context *ctx, @@ -470,6 +471,13 @@ mailbox_list_ns_prefix_return(struct ns_list_iterate_context *ctx, if ((ctx->ctx.flags & (MAILBOX_LIST_ITER_RETURN_SUBSCRIBED | MAILBOX_LIST_ITER_SELECT_SUBSCRIBED)) != 0) { + /* Refresh subscriptions first, this won't cause a duplicate + call later on as this is only called when the namespace's + children definitely don't match */ + if (mailbox_list_iter_subscriptions_refresh(ns->list) < 0) { + mailbox_list_ns_iter_failed(ctx); + return FALSE; + } mailbox_list_set_subscription_flags(ns->list, ctx->ns_info.vname, &ctx->ns_info.flags);