dovecot-1.3: imap-proxy: Don't break ID capability check if it's...

dovecot at dovecot.org dovecot at dovecot.org
Wed Apr 22 19:28:44 EEST 2009


details:   http://hg.dovecot.org/dovecot-1.3/rev/fa66e66850fa
changeset: 9152:fa66e66850fa
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Apr 22 12:28:22 2009 -0400
description:
imap-proxy: Don't break ID capability check if it's the last capability.

diffstat:

1 file changed, 7 insertions(+), 8 deletions(-)
src/imap-login/imap-proxy.c |   15 +++++++--------

diffs (33 lines):

diff -r cab82d03d00d -r fa66e66850fa src/imap-login/imap-proxy.c
--- a/src/imap-login/imap-proxy.c	Tue Apr 21 16:38:20 2009 -0400
+++ b/src/imap-login/imap-proxy.c	Wed Apr 22 12:28:22 2009 -0400
@@ -21,13 +21,10 @@ static bool imap_banner_has_capability(c
 {
 	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 @@ static int proxy_input_banner(struct ima
 	}
 
 	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 */


More information about the dovecot-cvs mailing list