[dovecot-cvs] dovecot/src/lib-storage/index index-mail.c, 1.47,
1.48 index-mail.h, 1.20, 1.21
cras at dovecot.org
cras at dovecot.org
Fri Jul 23 21:36:13 EEST 2004
Update of /home/cvs/dovecot/src/lib-storage/index
In directory talvi:/tmp/cvs-serv13683/lib-storage/index
Modified Files:
index-mail.c index-mail.h
Log Message:
Fixed a crash with fetch (rfc822.size body). Also fixed it so it doesn't
anymore parse the message body twice.
Index: index-mail.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-mail.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- index-mail.c 23 Jul 2004 16:28:40 -0000 1.47
+++ index-mail.c 23 Jul 2004 18:36:10 -0000 1.48
@@ -307,6 +307,8 @@
message_parser_parse_body(data->parser_ctx,
parse_bodystructure_part_header,
NULL, mail->pool);
+ data->save_bodystructure_body = FALSE;
+ data->parsed_bodystructure = TRUE;
} else {
message_parser_parse_body(data->parser_ctx, NULL, NULL, NULL);
}
@@ -406,21 +408,28 @@
string_t *str;
int bodystructure_cached = FALSE;
- if (data->save_bodystructure_header || !data->save_bodystructure_body) {
- /* we haven't parsed the header yet */
- data->save_bodystructure_header = TRUE;
- data->save_bodystructure_body = TRUE;
- if (!index_mail_parse_headers(mail, NULL))
- return;
- }
+ if (!data->parsed_bodystructure) {
+ if (data->save_bodystructure_header ||
+ !data->save_bodystructure_body) {
+ /* we haven't parsed the header yet */
+ data->save_bodystructure_header = TRUE;
+ data->save_bodystructure_body = TRUE;
+ if (!index_mail_parse_headers(mail, NULL))
+ return;
+ }
- if (data->parts != NULL) {
- i_assert(data->parts->next == NULL);
- message_parse_from_parts(data->parts->children, data->stream,
- parse_bodystructure_part_header,
- mail->pool);
- } else {
- index_mail_parse_body(mail, FALSE);
+ if (data->parts != NULL) {
+ i_assert(data->parts->next == NULL);
+ i_stream_seek(data->stream,
+ data->hdr_size.physical_size);
+ message_parse_from_parts(data->parts->children,
+ data->stream,
+ parse_bodystructure_part_header,
+ mail->pool);
+ data->parsed_bodystructure = TRUE;
+ } else {
+ index_mail_parse_body(mail, FALSE);
+ }
}
dec = mail_cache_field_get_decision(mail->ibox->cache,
Index: index-mail.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-mail.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- index-mail.h 23 Jul 2004 16:28:40 -0000 1.20
+++ index-mail.h 23 Jul 2004 18:36:10 -0000 1.21
@@ -77,6 +77,7 @@
unsigned int save_sent_date:1;
unsigned int save_bodystructure_header:1;
unsigned int save_bodystructure_body:1;
+ unsigned int parsed_bodystructure:1;
unsigned int hdr_size_set:1;
unsigned int body_size_set:1;
unsigned int open_mail:1;
More information about the dovecot-cvs
mailing list