]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap-proxy: Don't break ID capability check if it's the last capability.
authorTimo Sirainen <tss@iki.fi>
Wed, 22 Apr 2009 16:28:22 +0000 (12:28 -0400)
committerTimo Sirainen <tss@iki.fi>
Wed, 22 Apr 2009 16:28:22 +0000 (12:28 -0400)
--HG--
branch : HEAD

src/imap-login/imap-proxy.c

index 2b7667d4431b0f89f437a2c01649ecae3eb01824..3331622bec8249c1221e13c25eb63f3bc9557bd1 100644 (file)
@@ -21,13 +21,10 @@ static bool imap_banner_has_capability(const char *line, const char *capability)
 {
        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 imap_client *client,
        }
 
        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 */