[dovecot-cvs] dovecot/src/lib-storage/index index-mail-headers.c,1.10,1.11

cras at procontrol.fi cras at procontrol.fi
Wed Sep 10 06:16:32 EEST 2003


Update of /home/cvs/dovecot/src/lib-storage/index
In directory danu:/tmp/cvs-serv7785/lib-storage/index

Modified Files:
	index-mail-headers.c 
Log Message:
get_header() returned only first line of multiline headers



Index: index-mail-headers.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-mail-headers.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- index-mail-headers.c	10 Sep 2003 02:07:05 -0000	1.10
+++ index-mail-headers.c	10 Sep 2003 02:16:30 -0000	1.11
@@ -573,6 +573,7 @@
 {
 	struct index_mail *mail = (struct index_mail *) _mail;
 	struct cached_header *hdr;
+	const unsigned char *start, *end, *p;
 	const char *arr[2];
 	int idx;
 
@@ -600,8 +601,19 @@
 		}
 	}
 
-	return hdr->value_idx == 0 ? NULL :
-		t_strcut(str_c(mail->data.header_data) + hdr->value_idx, '\n');
+	if (hdr->value_idx == 0)
+		return NULL;
+
+	start = str_data(mail->data.header_data);
+	end = start + str_len(mail->data.header_data);
+	for (p = start + hdr->value_idx; p != end; p++) {
+		if (*p == '\n') {
+			if (p+1 == end || (p[1] != ' ' && p[1] != '\t'))
+				break;
+		}
+	}
+
+	return t_strdup_until(start, p);
 }
 
 struct istream *index_mail_get_headers(struct mail *_mail,



More information about the dovecot-cvs mailing list