From: Timo Sirainen Date: Fri, 7 May 2021 17:37:02 +0000 (+0300) Subject: lib-storage: Fix corrupted cache when adding attachment keywords X-Git-Tag: 2.3.16~75 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c8ac1fd03b7b626d379d6e47262f289c1a39ad3b;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: Fix corrupted cache when adding attachment keywords If IMAP BODYSTRUCTURE parsing fails, it means the BODYSTRUCTURE doesn't match the MIME parts. This likely means that one or both of them are corrupted. Handle this by deleting the email from cache, so this error won't keep repeating. --- diff --git a/src/lib-storage/mail.c b/src/lib-storage/mail.c index fff45d345d..0cad154d0c 100644 --- a/src/lib-storage/mail.c +++ b/src/lib-storage/mail.c @@ -526,8 +526,8 @@ static int mail_parse_parts(struct mail *mail, struct message_part **parts_r) } if (imap_bodystructure_parse_full(structure, pmail->data_pool, parts_r, &error) < 0) { - mail_set_critical(mail, "imap_bodystructure_parse() failed: %s", - error); + mail_set_cache_corrupted(mail, MAIL_FETCH_IMAP_BODYSTRUCTURE, + error); return -1; } return 0;