]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Fix detecting duplicate nodes in mailbox list index
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 24 Mar 2021 14:09:51 +0000 (16:09 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Fri, 23 Apr 2021 09:15:25 +0000 (09:15 +0000)
The duplicates were checked only for root nodes, not for child nodes.

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

index 1610f5ef9c4af642471d4e326551fd7ce73921b4..08db83ff42ac1882c900128d9361efaab60a7d0e 100644 (file)
@@ -410,7 +410,6 @@ static int mailbox_list_index_parse_records(struct mailbox_list_index *ilist,
                                node->parent = parent;
                                node->next = parent->children;
                                parent->children = node;
-                               continue;
                        }
                } else if (strcasecmp(node->raw_name, "INBOX") == 0) {
                        ilist->rebuild_on_missing_inbox = FALSE;
@@ -437,8 +436,10 @@ static int mailbox_list_index_parse_records(struct mailbox_list_index *ilist,
                                "Duplicate mailbox '%s' in index, renaming to %s",
                                old_name, node->raw_name);
                }
-               node->next = ilist->mailbox_tree;
-               ilist->mailbox_tree = node;
+               if (node->parent == NULL) {
+                       node->next = ilist->mailbox_tree;
+                       ilist->mailbox_tree = node;
+               }
        }
        hash_table_destroy(&duplicate_hash);
        return *error_r == NULL ? 0 : -1;