dovecot-2.2: Adjust IMAP URL parser to changes in uri-util.

dovecot at dovecot.org dovecot at dovecot.org
Thu Oct 11 00:02:28 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/b8929da80876
changeset: 15194:b8929da80876
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Wed Oct 10 23:56:01 2012 +0300
description:
Adjust IMAP URL parser to changes in uri-util.

diffstat:

 src/lib-imap/imap-url.c      |  10 ++++++----
 src/lib-imap/test-imap-url.c |  10 ++++++----
 2 files changed, 12 insertions(+), 8 deletions(-)

diffs (62 lines):

diff -r f960ad98429c -r b8929da80876 src/lib-imap/imap-url.c
--- a/src/lib-imap/imap-url.c	Wed Oct 10 23:55:21 2012 +0300
+++ b/src/lib-imap/imap-url.c	Wed Oct 10 23:56:01 2012 +0300
@@ -726,10 +726,12 @@
 	}
 
 	if (*segment != NULL) {
-		parser->error = t_strdup_printf(
-			"Unexpected IMAP URL path segment: %s",
-			str_sanitize(*segment, 80));
-		return -1;
+		if (urlext != NULL || **segment != '\0' || *(segment+1) != NULL ) {
+			parser->error = t_strdup_printf(
+				"Unexpected IMAP URL path segment: `%s'",
+				str_sanitize(*segment, 80));
+			return -1;
+		}
 	}
 
 	/* ";" {...} at end of URL */ 
diff -r f960ad98429c -r b8929da80876 src/lib-imap/test-imap-url.c
--- a/src/lib-imap/test-imap-url.c	Wed Oct 10 23:55:21 2012 +0300
+++ b/src/lib-imap/test-imap-url.c	Wed Oct 10 23:56:01 2012 +0300
@@ -114,7 +114,7 @@
 		.url_parsed = {
 			.host_name = "example.com",
 			.userid = "user",
-			.mailbox = "INBOX" }
+			.mailbox = "INBOX/" }
 	},{
 		.url = "imap://user@example.com/INBOX/Trash/../",
 		.url_parsed = {
@@ -176,7 +176,7 @@
 		.url_parsed = {
 			.host_name = "example.com",
 			.userid = "user",
-			.mailbox = "INBOX", .uidvalidity = 0,
+			.mailbox = "INBOX/", .uidvalidity = 0,
 			.uid = 0 }
 	},{
 		.url = "imap://user@example.com/INBOX/Junk;UIDVALIDITY=27667/"
@@ -207,7 +207,7 @@
 			.host_name = "example.com",
 			.userid = "user",
 			.mailbox = "INBOX/Important",
-			.uid = 56, .section = "AA" }
+			.uid = 56, .section = "AA/" }
 	},{
 		.url = "imap://user@example.com/INBOX/Important/;UID=56/"
 			";SECTION=AA/BB/../..",
@@ -897,8 +897,10 @@
 
 const char *parse_create_url_tests[] = {
 	"imap://host.example.com/",
+	"imap://10.0.0.1/",
+#ifdef HAVE_IPV6
 	"imap://[::1]/",
-	"imap://10.0.0.1/",
+#endif
 	"imap://user@host.example.com/",
 	"imap://user@host.example.com:993/",
 	"imap://user;AUTH=PLAIN@host.example.com/",


More information about the dovecot-cvs mailing list