From 8609825d4e30be69b0d35a6025a37643ebfeda64 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Thu, 16 Jun 2022 10:55:42 +0300 Subject: [PATCH] dsync: Fix dsync_features=no-header-hashes to match UIDs Mails were previously assumed to be the same, even if their UIDs didn't match. This caused the sync to misbehave in some situations. --- src/doveadm/dsync/dsync-mailbox-import.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/doveadm/dsync/dsync-mailbox-import.c b/src/doveadm/dsync/dsync-mailbox-import.c index 19442495ae..6cc23b85c2 100644 --- a/src/doveadm/dsync/dsync-mailbox-import.c +++ b/src/doveadm/dsync/dsync-mailbox-import.c @@ -817,10 +817,12 @@ static bool dsync_mailbox_try_save_cur(struct dsync_mailbox_importer *importer, /* one of the headers is empty. assume it's broken and that the header matches what we have currently. */ diff = 0; - } else if (importer->no_header_hashes && !importer->mails_have_guids && + } else if (importer->no_header_hashes && m1.uid == m2.uid && + !importer->mails_have_guids && importer->cur_mail != NULL && save_change != NULL && (m1.guid[0] == '\0' || m2.guid[0] == '\0')) { - /* Header hashes aren't known. Assume that the mails match. */ + /* Header hashes aren't known. Assume that the mails match if + their UIDs match. */ diff = 0; } else { diff = importer_mail_cmp(&m1, &m2); -- 2.47.3