dovecot-2.0: message_id_get_next() didn't contain @ in reply whe...

dovecot at dovecot.org dovecot at dovecot.org
Mon Jun 1 07:42:14 EEST 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/97f62a823666
changeset: 9424:97f62a823666
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Jun 01 00:41:23 2009 -0400
description:
message_id_get_next() didn't contain @ in reply when msgid wasn't in canonical form.

diffstat:

3 files changed, 46 insertions(+)
src/lib-mail/Makefile.am       |    5 +++++
src/lib-mail/message-id.c      |    1 +
src/lib-mail/test-message-id.c |   40 ++++++++++++++++++++++++++++++++++++++++

diffs (77 lines):

diff -r fa17414cfe77 -r 97f62a823666 src/lib-mail/Makefile.am
--- a/src/lib-mail/Makefile.am	Mon Jun 01 00:29:53 2009 -0400
+++ b/src/lib-mail/Makefile.am	Mon Jun 01 00:41:23 2009 -0400
@@ -55,6 +55,7 @@ test_programs = \
 	test-message-address \
 	test-message-date \
 	test-message-header-parser \
+	test-message-id \
 	test-message-parser \
 	test-rfc2231-parser
 
@@ -84,6 +85,10 @@ test_message_header_parser_LDADD = messa
 test_message_header_parser_LDADD = message-header-parser.lo $(test_libs)
 test_message_header_parser_DEPENDENCIES = message-header-parser.lo $(test_libs)
 
+test_message_id_SOURCES = test-message-id.c
+test_message_id_LDADD = message-id.lo rfc822-parser.lo $(test_libs)
+test_message_id_DEPENDENCIES = message-id.lo rfc822-parser.lo $(test_libs)
+
 test_message_parser_SOURCES = test-message-parser.c
 test_message_parser_LDADD = message-parser.lo message-header-parser.lo message-size.lo rfc822-parser.lo rfc2231-parser.lo $(test_libs)
 test_message_parser_DEPENDENCIES = message-parser.lo message-header-parser.lo message-size.lo rfc822-parser.lo rfc2231-parser.lo $(test_libs)
diff -r fa17414cfe77 -r 97f62a823666 src/lib-mail/message-id.c
--- a/src/lib-mail/message-id.c	Mon Jun 01 00:29:53 2009 -0400
+++ b/src/lib-mail/message-id.c	Mon Jun 01 00:41:23 2009 -0400
@@ -27,6 +27,7 @@ static bool get_untokenized_msgid(const 
 
 	if (*parser.data != '@')
 		return FALSE;
+	str_append_c(msgid, '@');
 	parser.data++;
 	(void)rfc822_skip_lwsp(&parser);
 
diff -r fa17414cfe77 -r 97f62a823666 src/lib-mail/test-message-id.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lib-mail/test-message-id.c	Mon Jun 01 00:41:23 2009 -0400
@@ -0,0 +1,40 @@
+/* Copyright (c) 2007-2009 Dovecot authors, see the included COPYING file */
+
+#include "lib.h"
+#include "message-id.h"
+#include "test-common.h"
+
+static void test_message_id_get_next(void)
+{
+	const char *input[] = {
+		"<foo at bar>",
+		"<foo at bar>,skipped,<foo2 at bar2>",
+		"(c) < (c) foo (c) @ (c) bar (c) > (c)",
+	};
+	const char *output[] = {
+		"foo at bar", NULL,
+		"foo at bar", "foo2 at bar2", NULL,
+		"foo at bar", NULL
+	};
+	const char *msgid, *next_msgid;
+	unsigned int i, j;
+
+	test_begin("message id parser");
+	for (i = 0, j = 0; i < N_ELEMENTS(input); i++) {
+		msgid = input[i];
+		while ((next_msgid = message_id_get_next(&msgid)) != NULL)
+			test_assert(strcmp(output[j++], next_msgid) == 0);
+		test_assert(output[j++] == NULL);
+	}
+	test_assert(j == N_ELEMENTS(output));
+	test_end();
+}
+
+int main(void)
+{
+	static void (*test_functions[])(void) = {
+		test_message_id_get_next,
+		NULL
+	};
+	return test_run(test_functions);
+}


More information about the dovecot-cvs mailing list