From: Timo Sirainen Date: Wed, 14 Dec 2011 09:57:20 +0000 (+0200) Subject: imapc: Handle missing BODY[] reply by returning an empty mail instead of disconnecting. X-Git-Tag: 2.1.rc2~43 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dab64e8f3e74acd6934e82843cd5df89cca84d79;p=thirdparty%2Fdovecot%2Fcore.git imapc: Handle missing BODY[] reply by returning an empty mail instead of disconnecting. --- diff --git a/src/lib-storage/index/imapc/imapc-mail.c b/src/lib-storage/index/imapc/imapc-mail.c index 771faaa6d7..1fb6003cfa 100644 --- a/src/lib-storage/index/imapc/imapc-mail.c +++ b/src/lib-storage/index/imapc/imapc-mail.c @@ -157,7 +157,15 @@ imapc_mail_get_stream(struct mail *_mail, bool get_body, if (data->stream == NULL) { imapc_mail_failed(_mail, "BODY[]"); - return -1; + /* this could be either a temporary server bug, or the + server may permanently just not return anything for + this mail. the latter happens at least with Exchange + when trying to fetch calendar "mails", so we'll just + return them as empty mails instead of disconnecting + the client. */ + mail->body_fetched = TRUE; + data->stream = i_stream_create_from_data(NULL, 0); + imapc_mail_init_stream(mail, TRUE); } }