[dovecot-cvs] dovecot/src/lib-storage/index index-mail-headers.c, 1.37, 1.38 index-mail.c, 1.51, 1.52

cras at dovecot.org cras at dovecot.org
Sat Aug 28 16:10:25 EEST 2004


Update of /home/cvs/dovecot/src/lib-storage/index
In directory talvi:/tmp/cvs-serv24725/index

Modified Files:
	index-mail-headers.c index-mail.c 
Log Message:
Fixed crash if mail data was fetched in specific order. Plus some minor
fixes.



Index: index-mail-headers.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-mail-headers.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- index-mail-headers.c	22 Aug 2004 10:32:55 -0000	1.37
+++ index-mail-headers.c	28 Aug 2004 13:10:22 -0000	1.38
@@ -321,7 +321,7 @@
 	struct index_mail_data *data = &mail->data;
 
 	if (mail->mail.get_stream(&mail->mail, NULL, NULL) == NULL)
-		return FALSE;
+		return -1;
 
 	index_mail_parse_header_init(mail, headers);
 
@@ -340,7 +340,7 @@
 	data->hdr_size_set = TRUE;
 	data->parse_header = FALSE;
 
-	return TRUE;
+	return 0;
 }
 
 static void
@@ -525,6 +525,12 @@
 		(struct index_header_lookup_ctx *)_headers;
 	string_t *dest;
 
+	if (mail->data.save_bodystructure_header) {
+		/* we have to parse the header. */
+		if (index_mail_parse_headers(mail, _headers) < 0)
+			return NULL;
+	}
+
 	dest = str_new(mail->pool, 256);
 	if (mail_cache_lookup_headers(mail->trans->cache_view, dest,
 				      mail->data.seq, headers->idx,
@@ -536,7 +542,7 @@
 	p_free(mail->pool, dest);
 
 	if (mail->mail.get_stream(&mail->mail, NULL, NULL) == NULL)
-		return FALSE;
+		return NULL;
 
 	if (mail->data.filter_stream != NULL)
 		i_stream_unref(mail->data.filter_stream);

Index: index-mail.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-mail.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- index-mail.c	28 Aug 2004 10:32:17 -0000	1.51
+++ index-mail.c	28 Aug 2004 13:10:22 -0000	1.52
@@ -182,7 +182,7 @@
 		return data->parts;
 
 	if (data->parser_ctx == NULL) {
-		if (!index_mail_parse_headers(mail, NULL))
+		if (index_mail_parse_headers(mail, NULL) < 0)
 			return NULL;
 	}
 	index_mail_parse_body(mail, TRUE);
@@ -410,7 +410,7 @@
 
 	if (hdr_size != NULL) {
 		if (!data->hdr_size_set) {
-			if (!index_mail_parse_headers(mail, NULL))
+			if (index_mail_parse_headers(mail, NULL) < 0)
 				return NULL;
 		}
 
@@ -449,7 +449,7 @@
 			/* we haven't parsed the header yet */
 			data->save_bodystructure_header = TRUE;
 			data->save_bodystructure_body = TRUE;
-			if (!index_mail_parse_headers(mail, NULL))
+			if (index_mail_parse_headers(mail, NULL) < 0)
 				return;
 		}
 



More information about the dovecot-cvs mailing list