From: Timo Sirainen Date: Thu, 16 Jun 2022 07:55:42 +0000 (+0300) Subject: dsync: Fix dsync_features=no-header-hashes to match UIDs X-Git-Tag: 2.3.20~51 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8609825d4e30be69b0d35a6025a37643ebfeda64;p=thirdparty%2Fdovecot%2Fcore.git 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. --- 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);