From: Timo Sirainen Date: Fri, 1 Oct 2010 20:33:38 +0000 (+0100) Subject: lib-storage: Don't wrongly ignore subscriptions=no namespace entries. X-Git-Tag: 2.0.5~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2e426575a63e13cab644d5d3c3136a11a2a9f71a;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: Don't wrongly ignore subscriptions=no namespace entries. --- diff --git a/src/lib-storage/list/mailbox-list-subscriptions.c b/src/lib-storage/list/mailbox-list-subscriptions.c index ceb7f032d1..bfda4b4749 100644 --- a/src/lib-storage/list/mailbox-list-subscriptions.c +++ b/src/lib-storage/list/mailbox-list-subscriptions.c @@ -17,7 +17,7 @@ mailbox_list_subscriptions_fill_real(struct mailbox_list_iterate_context *ctx, struct mailbox_list_iter_update_context update_ctx; struct subsfile_list_context *subsfile_ctx; struct mail_namespace *ns; - const char *path, *name, *name2, *full_name; + const char *path, *name, *name2, *full_name, *orig_name; string_t *vname; vname = str_new(default_pool, 256); @@ -38,6 +38,7 @@ mailbox_list_subscriptions_fill_real(struct mailbox_list_iterate_context *ctx, (ctx->flags & MAILBOX_LIST_ITER_SELECT_RECURSIVEMATCH) != 0; while ((name = subsfile_list_next(subsfile_ctx)) != NULL) T_BEGIN { + orig_name = name; full_name = name2 = t_strconcat(default_ns->prefix, name, NULL); ns = mail_namespace_find_unsubscribable(namespaces, &name2); @@ -45,7 +46,9 @@ mailbox_list_subscriptions_fill_real(struct mailbox_list_iterate_context *ctx, ns = default_ns; else if (ns->type == NAMESPACE_SHARED && (ns->flags & NAMESPACE_FLAG_AUTOCREATED) == 0) { - /* we'll need to get the namespace autocreated. */ + /* we'll need to get the namespace autocreated. + one easy way is to just ask if a mailbox name under + it is valid, and it gets created */ (void)mailbox_list_is_valid_existing_name(ns->list, name2); name = full_name; @@ -54,8 +57,16 @@ mailbox_list_subscriptions_fill_real(struct mailbox_list_iterate_context *ctx, } else { name = name2; } - name = mail_namespace_get_vname(ns, vname, name); - mailbox_list_iter_update(&update_ctx, name); + + if (!mailbox_list_is_valid_existing_name(ns->list, name)) { + /* we'll only get into trouble if we show this */ + i_warning("Subscriptions file %s: " + "Ignoring invalid entry: %s", + path, orig_name); + } else { + name = mail_namespace_get_vname(ns, vname, name); + mailbox_list_iter_update(&update_ctx, name); + } } T_END; str_free(&vname); return subsfile_list_deinit(subsfile_ctx); diff --git a/src/lib-storage/list/subscription-file.c b/src/lib-storage/list/subscription-file.c index fcf7b68586..02439dc7c0 100644 --- a/src/lib-storage/list/subscription-file.c +++ b/src/lib-storage/list/subscription-file.c @@ -245,14 +245,6 @@ const char *subsfile_list_next(struct subsfile_list_context *ctx) for (i = 0;; i++) { line = next_line(ctx->list, ctx->path, ctx->input, &ctx->failed, i < SUBSCRIPTION_FILE_ESTALE_RETRY_COUNT); - if (line != NULL && - !mailbox_list_is_valid_existing_name(ctx->list, line)) { - /* we'll only get into trouble if we show this */ - i_warning("Subscriptions file %s: " - "Ignoring invalid entry: %s", - ctx->path, line); - continue; - } if (ctx->input->stream_errno != ESTALE || i == SUBSCRIPTION_FILE_ESTALE_RETRY_COUNT) break;