changeset 8978:2e3baa171e20 HEAD

imap-proxy: Don't break ID capability check if it's the last capability.
author Timo Sirainen <tss@iki.fi>
date Wed, 22 Apr 2009 12:28:22 -0400
parents 59a3130bd4ed
children f8404c0f14de
files src/imap-login/imap-proxy.c
diffstat 1 files changed, 7 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/imap-login/imap-proxy.c	Tue Apr 21 16:36:52 2009 -0400
+++ b/src/imap-login/imap-proxy.c	Wed Apr 22 12:28:22 2009 -0400
@@ -21,13 +21,10 @@
 {
 	unsigned int capability_len = strlen(capability);
 
-	if (strncmp(line, "[CAPABILITY ", 12) != 0)
-		return FALSE;
-
-	line += 12;
-	while (strncmp(line, capability, capability_len) != 0 ||
+	while (strncasecmp(line, capability, capability_len) != 0 ||
 	       (line[capability_len] != ' ' &&
-		line[capability_len] != '\0')) {
+		line[capability_len] != '\0' &&
+		line[capability_len] != ']')) {
 		/* skip over the capability */
 		while (*line != ' ') {
 			if (*line == '\0')
@@ -101,8 +98,10 @@
 	}
 
 	str = t_str_new(128);
-	if (imap_banner_has_capability(line + 5, "ID"))
-		proxy_write_id(client, str);
+	if (strncmp(line + 5, "[CAPABILITY ", 12) == 0) {
+		if (imap_banner_has_capability(line + 5 + 12, "ID"))
+			proxy_write_id(client, str);
+	}
 
 	if (client->proxy_master_user == NULL) {
 		/* logging in normally - use LOGIN command */