isync

mailbox synchronization program
git clone https://git.code.sf.net/p/isync/isync
Log | Files | Refs | README | LICENSE

commit 32392adbe3fd349e18d282a4e73208c32d6bfd1b
parent 9e3041de9367113f3b2d7d7543d2eae4c78e2c67
Author: Oswald Buddenhagen <ossi@users.sf.net>
Date:   Sun, 14 Feb 2021 21:25:26 +0100

accept unsolicited FETCH responses (without payload) after all

while the spec says that the server SHOULD not send FETCH responses
about STORE FLAGS when .SILENT is used, at least gmail and fastmail seem
to do it nonetheless. also, in case of concurrent flag updates on the
affected messages such responses can be legitimately sent.

in earlier versions of mbsync this would lead to duplicate messages
piling up in the store, though that would pose no problem at that point.

Diffstat:
Msrc/drv_imap.c | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/drv_imap.c b/src/drv_imap.c @@ -1181,7 +1181,8 @@ parse_fetch_rsp( imap_store_t *ctx, list_t *list, char *s ATTR_UNUSED ) for (cmdp = ctx->in_progress; cmdp; cmdp = cmdp->next) if (cmdp->param.uid == uid) goto gotuid; - goto badrsp; + error( "IMAP error: unexpected FETCH response with BODY (UID %u)\n", uid ); + return LIST_BAD; gotuid: msgdata = ((imap_cmd_fetch_msg_t *)cmdp)->msg_data; msgdata->data = body->val; @@ -1208,9 +1209,8 @@ parse_fetch_rsp( imap_store_t *ctx, list_t *list, char *s ATTR_UNUSED ) memcpy( cur->tuid, tuid, TUIDL ); status &= ~(M_FLAGS | M_RECENT | M_SIZE | M_HEADER); } else { - badrsp: - error( "IMAP error: unexpected FETCH response (UID %u)\n", uid ); - return LIST_BAD; + // These may come in as a result of STORE FLAGS despite .SILENT. + status &= ~(M_FLAGS | M_RECENT); } if (status) {