]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap proxy: Avoid duplicate CAPABILITY reply when backend is Dovecot.
authorTimo Sirainen <tss@iki.fi>
Fri, 10 Jan 2014 18:00:39 +0000 (13:00 -0500)
committerTimo Sirainen <tss@iki.fi>
Fri, 10 Jan 2014 18:00:39 +0000 (13:00 -0500)
This happened if the client sent a CAPABILITY command to the proxy.

src/imap-login/imap-proxy.c

index 741615ff69dbcc35043e256e5a05ae54cfceae44..db299c485f6004bcb3e90af90a0beab81baae6fa 100644 (file)
@@ -63,7 +63,14 @@ static int proxy_write_login(struct imap_client *client, string_t *str)
        unsigned int len;
        const char *mech_name, *error;
 
-       if (client->proxy_backend_capability == NULL) {
+       /* Send CAPABILITY command if we don't know the capabilities yet.
+          Also as kind of a Dovecot-backend workaround if the client insisted
+          on sending CAPABILITY command (even though our banner already sent
+          it), send the (unnecessary) CAPABILITY command to backend as well
+          to avoid sending the CAPABILITY reply twice (untagged and OK resp
+          code). */
+       if (client->proxy_backend_capability == NULL ||
+           client->client_ignores_capability_resp_code) {
                str_append(str, "C CAPABILITY\r\n");
                if (client->common.proxy_nopipelining) {
                        /* authenticate only after receiving C OK reply. */