]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dsync: Fix dsync_features=no-header-hashes to match UIDs
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 16 Jun 2022 07:55:42 +0000 (10:55 +0300)
committerMarkus Valentin <markus.valentin@open-xchange.com>
Thu, 16 Jun 2022 10:43:48 +0000 (12:43 +0200)
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

index 19442495ae1666f57f3ce4d417ef3dc67f569b19..6cc23b85c2acc7905c924669565412e90350b976 100644 (file)
@@ -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);