Browse Source

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.
1.4
Oswald Buddenhagen 4 years ago
parent
commit
32392adbe3
  1. 8
      src/drv_imap.c

8
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) for (cmdp = ctx->in_progress; cmdp; cmdp = cmdp->next)
if (cmdp->param.uid == uid) if (cmdp->param.uid == uid)
goto gotuid; goto gotuid;
goto badrsp; error( "IMAP error: unexpected FETCH response with BODY (UID %u)\n", uid );
return LIST_BAD;
gotuid: gotuid:
msgdata = ((imap_cmd_fetch_msg_t *)cmdp)->msg_data; msgdata = ((imap_cmd_fetch_msg_t *)cmdp)->msg_data;
msgdata->data = body->val; 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 ); memcpy( cur->tuid, tuid, TUIDL );
status &= ~(M_FLAGS | M_RECENT | M_SIZE | M_HEADER); status &= ~(M_FLAGS | M_RECENT | M_SIZE | M_HEADER);
} else { } else {
badrsp: // These may come in as a result of STORE FLAGS despite .SILENT.
error( "IMAP error: unexpected FETCH response (UID %u)\n", uid ); status &= ~(M_FLAGS | M_RECENT);
return LIST_BAD;
} }
if (status) { if (status) {

Loading…
Cancel
Save