]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Don't wrongly ignore subscriptions=no namespace entries.
authorTimo Sirainen <tss@iki.fi>
Fri, 1 Oct 2010 20:33:38 +0000 (21:33 +0100)
committerTimo Sirainen <tss@iki.fi>
Fri, 1 Oct 2010 20:33:38 +0000 (21:33 +0100)
src/lib-storage/list/mailbox-list-subscriptions.c
src/lib-storage/list/subscription-file.c

index ceb7f032d1541b2716d0de31c127ef49755863ba..bfda4b4749cbb996c6e04dbc5f92265f7b116320 100644 (file)
@@ -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);
index fcf7b68586e8b6a6db21c4d2ea753fd788134421..02439dc7c08131380f35ce6e4de4bbd91a02386a 100644 (file)
@@ -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;