Skip to content

Commit

Permalink
lib-storage: mailbox-list-iter - Refresh subscriptions before setting…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
cmouse committed Dec 9, 2017
1 parent a612b56 commit e4f8e7a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/lib-storage/list/mailbox-list-iter.c
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit e4f8e7a

Please sign in to comment.