[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-sync-update.c, 1.40, 1.41

cras at dovecot.org cras at dovecot.org
Fri Oct 28 17:32:38 EEST 2005


Update of /var/lib/cvs/dovecot/src/lib-storage/index/mbox
In directory talvi:/tmp/cvs-serv28242

Modified Files:
	mbox-sync-update.c 
Log Message:
We were handling wrapped X-IMAPbase and X-Keywords headers very badly.



Index: mbox-sync-update.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-sync-update.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- mbox-sync-update.c	28 Oct 2005 14:16:16 -0000	1.40
+++ mbox-sync-update.c	28 Oct 2005 14:32:35 -0000	1.41
@@ -274,12 +274,18 @@
 	if (ctx->header_first_change > pos)
 		ctx->header_first_change = pos;
 
-	hdr = str_c(ctx->header) + pos;
-	p = strchr(hdr, '\n');
-
-	if (p == NULL) {
-		/* shouldn't really happen, but allow anyway.. */
-		p = hdr + strlen(hdr);
+	/* set p = end of header, handle also wrapped headers */
+	hdr = p = str_c(ctx->header) + pos;
+	for (;;) {
+		p = strchr(p, '\n');
+		if (p == NULL) {
+			/* shouldn't really happen, but allow anyway.. */
+			p = hdr + strlen(hdr);
+			break;
+		}
+		if (p[1] != '\t' && p[1] != ' ')
+			break;
+		p += 2;
 	}
 
 	file_pos = pos + ctx->hdr_offset;



More information about the dovecot-cvs mailing list