dovecot-2.0: message_id_get_next(): Fixed parsing message-ids wi...

dovecot at dovecot.org dovecot at dovecot.org
Sun Feb 12 03:47:31 EET 2012


details:   http://hg.dovecot.org/dovecot-2.0/rev/71dbe30caedb
changeset: 13051:71dbe30caedb
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Feb 12 03:47:01 2012 +0200
description:
message_id_get_next(): Fixed parsing message-ids with no-fold-quotes.

diffstat:

 src/lib-mail/message-id.c      |  7 ++++++-
 src/lib-mail/test-message-id.c |  4 +++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diffs (42 lines):

diff -r e3d46fd04105 -r 71dbe30caedb src/lib-mail/message-id.c
--- a/src/lib-mail/message-id.c	Sun Feb 12 03:31:24 2012 +0200
+++ b/src/lib-mail/message-id.c	Sun Feb 12 03:47:01 2012 +0200
@@ -8,6 +8,7 @@
 static bool get_untokenized_msgid(const char **msgid_p, string_t *msgid)
 {
 	struct rfc822_parser_context parser;
+	int ret;
 
 	rfc822_parser_init(&parser, (const unsigned char *)*msgid_p,
 			   strlen(*msgid_p), NULL);
@@ -22,7 +23,11 @@
 
 	(void)rfc822_skip_lwsp(&parser);
 
-	if (rfc822_parse_dot_atom(&parser, msgid) <= 0)
+	if (*parser.data == '"')
+		ret = rfc822_parse_quoted_string(&parser, msgid);
+	else
+		ret = rfc822_parse_dot_atom(&parser, msgid);
+	if (ret <= 0)
 		return FALSE;
 
 	if (*parser.data != '@')
diff -r e3d46fd04105 -r 71dbe30caedb src/lib-mail/test-message-id.c
--- a/src/lib-mail/test-message-id.c	Sun Feb 12 03:31:24 2012 +0200
+++ b/src/lib-mail/test-message-id.c	Sun Feb 12 03:47:01 2012 +0200
@@ -10,11 +10,13 @@
 		"<foo at bar>",
 		"<foo at bar>,skipped,<foo2 at bar2>",
 		"(c) < (c) foo (c) @ (c) bar (c) > (c)",
+		"<\"foo 2\"@bar>"
 	};
 	const char *output[] = {
 		"foo at bar", NULL,
 		"foo at bar", "foo2 at bar2", NULL,
-		"foo at bar", NULL
+		"foo at bar", NULL,
+		"foo 2 at bar", NULL
 	};
 	const char *msgid, *next_msgid;
 	unsigned int i, j;


More information about the dovecot-cvs mailing list