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

dovecot at dovecot.org dovecot at dovecot.org
Wed Apr 22 20:54:59 EEST 2009


details:   http://hg.dovecot.org/dovecot-1.2/rev/2e3baa171e20
changeset: 8978:2e3baa171e20
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 59a3130bd4ed -r 2e3baa171e20 src/imap-login/imap-proxy.c
--- 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 @@ 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