]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imapc: Update mail size also when istream_opened() hook is called
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 15 Mar 2018 10:20:14 +0000 (12:20 +0200)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Tue, 20 Mar 2018 10:51:03 +0000 (12:51 +0200)
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.

src/lib-storage/index/imapc/imapc-mail-fetch.c

index 1d4465daad3cc829106904dcdb06e1d2d086f806..9478c5cbd4303da3c5ebf8465b6a6687ba7ec9c3 100644 (file)
@@ -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);