index-mail.c (dovecot-2.3.16) | : | index-mail.c (dovecot-2.3.17) | ||
---|---|---|---|---|
skipping to change at line 1198 | skipping to change at line 1198 | |||
} | } | |||
if (ret <= 0) { | if (ret <= 0) { | |||
if (ret == 0) { | if (ret == 0) { | |||
i_assert(error != NULL); | i_assert(error != NULL); | |||
index_mail_set_message_parts_corrupted(&mail->mail.mail, error); | index_mail_set_message_parts_corrupted(&mail->mail.mail, error); | |||
} | } | |||
mail->data.parts = NULL; | mail->data.parts = NULL; | |||
mail->data.parsed_bodystructure = FALSE; | mail->data.parsed_bodystructure = FALSE; | |||
if (mail->data.save_bodystructure_body) | if (mail->data.save_bodystructure_body) | |||
mail->data.save_bodystructure_header = TRUE; | mail->data.save_bodystructure_header = TRUE; | |||
if (mail->data.header_parser_initialized) | ||||
index_mail_parse_header_deinit(mail); | ||||
return -1; | return -1; | |||
} | } | |||
if (mail->data.header_parser_initialized) { | ||||
i_assert(!success); | ||||
index_mail_parse_header_deinit(mail); | ||||
} | ||||
if (mail->data.save_bodystructure_body) { | if (mail->data.save_bodystructure_body) { | |||
mail->data.parsed_bodystructure = TRUE; | mail->data.parsed_bodystructure = TRUE; | |||
mail->data.save_bodystructure_header = FALSE; | mail->data.save_bodystructure_header = FALSE; | |||
mail->data.save_bodystructure_body = FALSE; | mail->data.save_bodystructure_body = FALSE; | |||
i_assert(mail->data.parts != NULL); | i_assert(mail->data.parts != NULL); | |||
} | } | |||
if (mail->data.no_caching) { | if (mail->data.no_caching) { | |||
/* if we're here because we aborted parsing, don't get any | /* if we're here because we aborted parsing, don't get any | |||
further or we may crash while generating output from | further or we may crash while generating output from | |||
skipping to change at line 1370 | skipping to change at line 1377 | |||
} | } | |||
bool want_attachment_kw = | bool want_attachment_kw = | |||
index_mail_want_attachment_keywords_on_fetch(mail); | index_mail_want_attachment_keywords_on_fetch(mail); | |||
if (want_attachment_kw) | if (want_attachment_kw) | |||
data->access_part |= PARSE_HDR | PARSE_BODY; | data->access_part |= PARSE_HDR | PARSE_BODY; | |||
if (hdr_size != NULL || body_size != NULL) | if (hdr_size != NULL || body_size != NULL) | |||
(void)get_cached_msgpart_sizes(mail); | (void)get_cached_msgpart_sizes(mail); | |||
if (hdr_size != NULL || body_size != NULL || want_attachment_kw) { | bool want_body_parsing = want_attachment_kw || | |||
(body_size != NULL && !data->body_size_set && | ||||
(data->access_part & PARSE_BODY) != 0); | ||||
if (hdr_size != NULL || body_size != NULL || want_body_parsing) { | ||||
i_stream_seek(data->stream, 0); | i_stream_seek(data->stream, 0); | |||
if (!data->hdr_size_set || want_attachment_kw) { | if (!data->hdr_size_set || want_body_parsing) { | |||
if ((data->access_part & (PARSE_HDR | PARSE_BODY)) != 0) { | if ((data->access_part & (PARSE_HDR | PARSE_BODY)) != 0) { | |||
(void)get_cached_parts(mail); | (void)get_cached_parts(mail); | |||
if (index_mail_parse_headers_internal(mail, NULL) < 0) | if (index_mail_parse_headers_internal(mail, NULL) < 0) | |||
return -1; | return -1; | |||
} else { | } else { | |||
if (message_get_header_size(data->stream, | if (message_get_header_size(data->stream, | |||
&data->hdr_size, | &data->hdr_size, | |||
&has_nuls) < 0) { | &has_nuls) < 0) { | |||
index_mail_stream_log_failure(mail); | index_mail_stream_log_failure(mail); | |||
return -1; | return -1; | |||
} | } | |||
data->hdr_size_set = TRUE; | data->hdr_size_set = TRUE; | |||
} | } | |||
} | } | |||
if (hdr_size != NULL) | if (hdr_size != NULL) | |||
*hdr_size = data->hdr_size; | *hdr_size = data->hdr_size; | |||
} | } | |||
if (body_size != NULL || want_attachment_kw) { | if (body_size != NULL || want_body_parsing) { | |||
if (!data->body_size_set && body_size != NULL) | if (!data->body_size_set && body_size != NULL) | |||
index_mail_get_cached_body_size(mail); | index_mail_get_cached_body_size(mail); | |||
if (!data->body_size_set || want_attachment_kw) { | if (!data->body_size_set || want_body_parsing) { | |||
i_stream_seek(data->stream, | i_stream_seek(data->stream, | |||
data->hdr_size.physical_size); | data->hdr_size.physical_size); | |||
if ((data->access_part & PARSE_BODY) != 0) { | if ((data->access_part & PARSE_BODY) != 0) { | |||
if (index_mail_parse_body(mail, 0) < 0) | if (index_mail_parse_body(mail, 0) < 0) | |||
return -1; | return -1; | |||
} else { | } else { | |||
if (message_get_body_size(data->stream, | if (message_get_body_size(data->stream, | |||
&data->body_size, | &data->body_size, | |||
&has_nuls) < 0) { | &has_nuls) < 0) { | |||
index_mail_stream_log_failure(mail); | index_mail_stream_log_failure(mail); | |||
skipping to change at line 2328 | skipping to change at line 2339 | |||
struct index_mail *mail = INDEX_MAIL(_mail); | struct index_mail *mail = INDEX_MAIL(_mail); | |||
if (!success) { | if (!success) { | |||
/* we're going to delete this mail anyway, | /* we're going to delete this mail anyway, | |||
don't bother trying to update cache file */ | don't bother trying to update cache file */ | |||
mail->data.no_caching = TRUE; | mail->data.no_caching = TRUE; | |||
mail->data.forced_no_caching = TRUE; | mail->data.forced_no_caching = TRUE; | |||
if (mail->data.parser_ctx == NULL) { | if (mail->data.parser_ctx == NULL) { | |||
/* we didn't even start cache parsing */ | /* we didn't even start cache parsing */ | |||
i_assert(!mail->data.header_parser_initialized); | ||||
return; | return; | |||
} | } | |||
} | } | |||
/* This is needed with 0 byte mails to get hdr=NULL call done. */ | /* This is needed with 0 byte mails to get hdr=NULL call done. */ | |||
index_mail_cache_parse_continue(_mail); | index_mail_cache_parse_continue(_mail); | |||
if (mail->data.received_date == (time_t)-1) | if (mail->data.received_date == (time_t)-1) | |||
mail->data.received_date = received_date; | mail->data.received_date = received_date; | |||
if (mail->data.save_date == (time_t)-1) { | if (mail->data.save_date == (time_t)-1) { | |||
End of changes. 7 change blocks. | ||||
4 lines changed or deleted | 16 lines changed or added |