]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Fix setting \Noinferiors flag for detached INBOX
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 11 Jul 2019 12:08:10 +0000 (15:08 +0300)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 11 Jul 2019 14:48:10 +0000 (17:48 +0300)
The "" namespace is nowadays automatically created, so we can't just check
if mail_namespace_find_prefix() returns NULL.

I left the NULL check there for now at least, just in case there's some
reason I couldn't think of when it could be NULL.

src/lib-storage/list/mailbox-list-iter.c

index 96e999bc8a52339df687d4acef1c99e22054b144..95ad8c52c966734e14c428fab69d72840e822b89 100644 (file)
@@ -518,6 +518,7 @@ mailbox_list_ns_prefix_return(struct ns_list_iterate_context *ctx,
 
 static void inbox_set_children_flags(struct ns_list_iterate_context *ctx)
 {
+       struct mail_namespace *ns;
        const char *prefix;
        int ret;
 
@@ -527,7 +528,8 @@ static void inbox_set_children_flags(struct ns_list_iterate_context *ctx)
                                      MAILBOX_NOCHILDREN)) != 0)
                return;
 
-       if (mail_namespace_find_prefix(ctx->namespaces, "") == NULL) {
+       ns = mail_namespace_find_prefix(ctx->namespaces, "");
+       if (ns == NULL || (ns->flags & NAMESPACE_FLAG_UNUSABLE) != 0) {
                /* prefix="" namespace doesn't exist, and neither does
                   anything beginning with prefix=INBOX/ (we checked this
                   earlier). there's no way to create children for INBOX. */