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.
This commit is contained in:
Oswald Buddenhagen 2021-02-14 21:25:26 +01:00
parent 9e3041de93
commit 32392adbe3

View File

@ -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) {