[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-from.c, 1.4, 1.5

cras at dovecot.org cras at dovecot.org
Tue Dec 21 14:40:49 EET 2004


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

Modified Files:
	mbox-from.c 
Log Message:
Support "quoted spaces" in From-line sender's local-part. Postfix at least
may write these..



Index: mbox-from.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-from.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- mbox-from.c	16 Jun 2004 02:47:28 -0000	1.4
+++ mbox-from.c	21 Dec 2004 12:40:46 -0000	1.5
@@ -22,7 +22,7 @@
 {
 	const unsigned char *msg_start, *sender_end, *msg_end;
 	struct tm tm;
-	int i, timezone = 0, seen_timezone = FALSE;
+	int i, esc, timezone = 0, seen_timezone = FALSE;
 	time_t t;
 
 	*time_r = (time_t)-1;
@@ -33,6 +33,19 @@
 	msg_end = msg + size;
 
 	/* get sender */
+	if (msg < msg_end && *msg == '"') {
+		/* "x y z"@domain - skip the quoted part */
+		esc = FALSE;
+		msg++;
+		while (msg < msg_end && (*msg != '"' || esc)) {
+			if (*msg == '\r' || *msg == '\n')
+				return -1;
+			esc = *msg == '\\';
+			msg++;
+		}
+		msg++;
+	} 
+
 	while (msg < msg_end && *msg != ' ') {
 		if (*msg == '\r' || *msg == '\n')
 			return -1;



More information about the dovecot-cvs mailing list