From: Siavash Tavakoli Date: Tue, 19 Jan 2021 10:33:17 +0000 (+0000) Subject: dsync: Don't send out of tree namespace parents for syncing X-Git-Tag: 2.3.15~406 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cd0a0a42407eccf6ba6dce05921ae183107eea78;p=thirdparty%2Fdovecot%2Fcore.git dsync: Don't send out of tree namespace parents for syncing 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. --- diff --git a/src/doveadm/dsync/dsync-brain-mailbox-tree.c b/src/doveadm/dsync/dsync-brain-mailbox-tree.c index 823f0bb1c1..ba9ddeb07d 100644 --- a/src/doveadm/dsync/dsync-brain-mailbox-tree.c +++ b/src/doveadm/dsync/dsync-brain-mailbox-tree.c @@ -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;