[dovecot-cvs] dovecot/src/lib-imap imap-bodystructure.c,1.38,1.39

cras at procontrol.fi cras at procontrol.fi
Mon Jul 14 03:01:08 EEST 2003


Update of /home/cvs/dovecot/src/lib-imap
In directory danu:/tmp/cvs-serv31754

Modified Files:
	imap-bodystructure.c 
Log Message:
Fixes for handling missing Mime-Version



Index: imap-bodystructure.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-imap/imap-bodystructure.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- imap-bodystructure.c	13 Jul 2003 01:08:10 -0000	1.38
+++ imap-bodystructure.c	13 Jul 2003 23:01:06 -0000	1.39
@@ -240,13 +240,28 @@
 {
 	pool_t pool = context;
 	struct message_part_body_data *part_data;
+	struct message_part_envelope_data *envelope;
 	int parent_rfc822;
 
-	if (hdr == NULL || hdr->eoh)
+	if (hdr == NULL) {
+		/* If there was no Mime-Version, forget all the Content-stuff */
+		if ((part->flags & MESSAGE_PART_FLAG_IS_MIME) == 0 &&
+		    part->context != NULL) {
+			part_data = part->context;
+			envelope = part_data->envelope;
+
+			memset(part_data, 0, sizeof(*part_data));
+			part_data->pool = pool;
+			part_data->envelope = envelope;
+		}
+		return;
+	}
+
+	if (hdr->eoh)
 		return;
 
 	parent_rfc822 = part->parent != NULL &&
-		(part->parent->flags & MESSAGE_PART_FLAG_MESSAGE_RFC822);
+		(part->parent->flags & MESSAGE_PART_FLAG_MESSAGE_RFC822) != 0;
 	if (!parent_rfc822 && strncasecmp(hdr->name, "Content-", 8) != 0)
 		return;
 
@@ -260,8 +275,7 @@
 
 	t_push();
 
-	if ((part->flags & MESSAGE_PART_FLAG_IS_MIME) != 0)
-		parse_content_header(part_data, hdr, pool);
+	parse_content_header(part_data, hdr, pool);
 
 	if (parent_rfc822) {
 		/* message/rfc822, we need the envelope */



More information about the dovecot-cvs mailing list