From: Timo Sirainen Date: Tue, 26 Jan 2021 16:55:22 +0000 (+0200) Subject: dsync: Replace escape characters in outgoing mailbox names with alt_char X-Git-Tag: 2.3.14.rc1~25 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=00c76645055fa9f878627878296ba6cd99d67734;p=thirdparty%2Fdovecot%2Fcore.git dsync: Replace escape characters in outgoing mailbox names with alt_char Especially when dsync is used for migration, we don't want to end up having invalid mUTF7 mailbox names locally. Also, remote might not even be configured to use the same escape character. --- diff --git a/src/doveadm/dsync/dsync-brain-mailbox-tree.c b/src/doveadm/dsync/dsync-brain-mailbox-tree.c index 14fb2c1791..823f0bb1c1 100644 --- a/src/doveadm/dsync/dsync-brain-mailbox-tree.c +++ b/src/doveadm/dsync/dsync-brain-mailbox-tree.c @@ -3,6 +3,7 @@ #include "lib.h" #include "str.h" #include "mail-namespace.h" +#include "mailbox-list-private.h" #include "dsync-ibc.h" #include "dsync-mailbox-tree.h" #include "dsync-brain-private.h" @@ -93,6 +94,18 @@ void dsync_brain_send_mailbox_tree(struct dsync_brain *brain) dsync_mailbox_node_to_string(node)); } + /* Avoid sending out mailbox names with escape + characters. Especially when dsync is used for + migration, we don't want to end up having invalid + mUTF7 mailbox names locally. Also, remote might not + even be configured to use the same escape + character. */ + if (node->ns != NULL) { + i_assert(brain->alt_char != '\0'); + full_name = t_str_replace(full_name, + node->ns->list->set.vname_escape_char, + brain->alt_char); + } parts = t_strsplit(full_name, sep); ret = dsync_ibc_send_mailbox_tree_node(brain->ibc, parts, node);