From: Timo Sirainen Date: Thu, 15 Mar 2018 10:20:14 +0000 (+0200) Subject: imapc: Update mail size also when istream_opened() hook is called X-Git-Tag: 2.3.9~2127 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6f466048f1c1b601d5f06f76a3685ed863c7dc35;p=thirdparty%2Fdovecot%2Fcore.git imapc: Update mail size also when istream_opened() hook is called When fetching a message body the cached message size was set. However, if istream_opened() hook was used this wasn't done. If a client had fetched both (RFC822.SIZE BODY.PEEK[]) and the server sent a wrong RFC822.SIZE, that size was used for the message body size, which resulted in "Cached message size larger than expected" errors. --- diff --git a/src/lib-storage/index/imapc/imapc-mail-fetch.c b/src/lib-storage/index/imapc/imapc-mail-fetch.c index 30a5df9a82..542f962128 100644 --- a/src/lib-storage/index/imapc/imapc-mail-fetch.c +++ b/src/lib-storage/index/imapc/imapc-mail-fetch.c @@ -576,7 +576,8 @@ void imapc_mail_init_stream(struct imapc_mail *mail) index_mail_close_streams(imail); return; } - } else if (mail->body_fetched) { + } + if (mail->body_fetched) { ret = i_stream_get_size(imail->data.stream, TRUE, &size); if (ret < 0) { index_mail_close_streams(imail);