From: Timo Sirainen Date: Fri, 10 Jan 2014 18:00:39 +0000 (-0500) Subject: imap proxy: Avoid duplicate CAPABILITY reply when backend is Dovecot. X-Git-Tag: 2.2.11~49 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3bc9d91f987261e989aa653fd412b0e8095e4810;p=thirdparty%2Fdovecot%2Fcore.git imap proxy: Avoid duplicate CAPABILITY reply when backend is Dovecot. This happened if the client sent a CAPABILITY command to the proxy. --- diff --git a/src/imap-login/imap-proxy.c b/src/imap-login/imap-proxy.c index 741615ff69..db299c485f 100644 --- a/src/imap-login/imap-proxy.c +++ b/src/imap-login/imap-proxy.c @@ -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. */