]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imapc: Added imapc_features=fetch-msn-workarounds
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Sun, 24 Jan 2016 15:39:28 +0000 (17:39 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Sun, 24 Jan 2016 15:39:28 +0000 (17:39 +0200)
This can be used to work around broken servers that send invalid MSNs. This
avoids errors like:

imapc: Mailbox 'INBOX' state corrupted: FETCH UID mismatch (78976 != 82589)

src/lib-storage/index/imapc/imapc-mailbox.c
src/lib-storage/index/imapc/imapc-settings.c
src/lib-storage/index/imapc/imapc-settings.h

index f5925d5533920a489b379300b1b8dfb276d2224a..c3e12d17021768b61473354a3c848cd6209bf17e 100644 (file)
@@ -222,6 +222,16 @@ imapc_mailbox_msgmap_update(struct imapc_mailbox *mbox,
 
        msgmap = imapc_client_mailbox_get_msgmap(mbox->client_box);
        msg_count = imapc_msgmap_count(msgmap);
+       if (fetch_uid != 0 &&
+           IMAPC_BOX_HAS_FEATURE(mbox, IMAPC_FEATURE_FETCH_MSN_WORKAROUNDS)) {
+               /* if we know the UID, use own own generated rseq instead of
+                  the potentially broken rseq that the server sent. */
+               uint32_t fixed_rseq;
+
+               if (imapc_msgmap_uid_to_rseq(msgmap, fetch_uid, &fixed_rseq))
+                       rseq = fixed_rseq;
+       }
+
        if (rseq <= msg_count) {
                uid = imapc_msgmap_rseq_to_uid(msgmap, rseq);
                if (uid != fetch_uid && fetch_uid != 0) {
index 9bf13660f9ef6a8d82d2931f3ef6e495e4ccb754..d05e05edd71dba616f1383d100227aa237a6782c 100644 (file)
@@ -89,6 +89,7 @@ static const struct imapc_feature_list imapc_feature_list[] = {
        { "zimbra-workarounds", IMAPC_FEATURE_ZIMBRA_WORKAROUNDS },
        { "no-examine", IMAPC_FEATURE_NO_EXAMINE },
        { "proxyauth", IMAPC_FEATURE_PROXYAUTH },
+       { "fetch-msn-workarounds", IMAPC_FEATURE_FETCH_MSN_WORKAROUNDS },
        { NULL, 0 }
 };
 
index 048ac989aa4400628deae57746bfaf6e704fdd5f..6d9c861428c6e4c116001c3044b23e9f5e331f0a 100644 (file)
@@ -12,7 +12,8 @@ enum imapc_features {
        IMAPC_FEATURE_SEARCH                    = 0x10,
        IMAPC_FEATURE_ZIMBRA_WORKAROUNDS        = 0x20,
        IMAPC_FEATURE_NO_EXAMINE                = 0x40,
-       IMAPC_FEATURE_PROXYAUTH                 = 0x80
+       IMAPC_FEATURE_PROXYAUTH                 = 0x80,
+       IMAPC_FEATURE_FETCH_MSN_WORKAROUNDS     = 0x100
 };
 /* </settings checks> */