]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imapc: Handle missing BODY[] reply by returning an empty mail instead of disconnecting.
authorTimo Sirainen <tss@iki.fi>
Wed, 14 Dec 2011 09:57:20 +0000 (11:57 +0200)
committerTimo Sirainen <tss@iki.fi>
Wed, 14 Dec 2011 09:57:20 +0000 (11:57 +0200)
src/lib-storage/index/imapc/imapc-mail.c

index 771faaa6d730f991042422f3c3152166409359e7..1fb6003cfaafcffdc6bb7920c0aa3cf420e01648 100644 (file)
@@ -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);
                }
        }