]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dsync: Don't send out of tree namespace parents for syncing
authorSiavash Tavakoli <siavash.tavakoli@open-xchange.com>
Tue, 19 Jan 2021 10:33:17 +0000 (10:33 +0000)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Thu, 11 Feb 2021 10:42:15 +0000 (10:42 +0000)
For namespaces prefixes with multiple hierarchical names, we shouldn't
send parents (i.e. first part/parts of the prefix) that are outside of syncing.

src/doveadm/dsync/dsync-brain-mailbox-tree.c

index 823f0bb1c1b44e9f4366fbc79736cbe0f67886ab..ba9ddeb07d7666fc5d9a099c8c3bc5c0c9a87146 100644 (file)
@@ -85,6 +85,17 @@ void dsync_brain_send_mailbox_tree(struct dsync_brain *brain)
        sep[0] = brain->hierarchy_sep; sep[1] = '\0';
        while (dsync_mailbox_tree_iter_next(brain->local_tree_iter,
                                            &full_name, &node)) {
+               if (node->ns == NULL) {
+                       /* This node was created when adding a namespace prefix
+                          to the tree that has multiple hierarchical names,
+                          but the parent names don't belong to any synced
+                          namespace. For example when syncing "-n Shared/user/"
+                          so "Shared/" is skipped. Or if there is e.g.
+                          "Public/files/" namespace prefix, but no "Public/"
+                          namespace at all. */
+                       continue;
+               }
+
                T_BEGIN {
                        const char *const *parts;