Mercurial > dovecot > core-2.2
changeset 9489:e8301a8f9cf7 HEAD
imap-login: Using CAPABILITY command after STARTTLS shouldn't trigger CAPABILITY pushing workaround.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 17 Jun 2009 13:05:32 -0400 |
parents | 1492d688d8a9 |
children | a6e1f054a808 |
files | src/imap-login/client-authenticate.c src/imap-login/client.c src/imap-login/client.h src/imap-login/imap-proxy.c |
diffstat | 4 files changed, 13 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/imap-login/client-authenticate.c Wed Jun 17 12:44:33 2009 -0400 +++ b/src/imap-login/client-authenticate.c Wed Jun 17 13:05:32 2009 -0400 @@ -327,7 +327,8 @@ { char *prefix; - prefix = i_strdup_printf("%d%s", client->capability_command_used, + prefix = i_strdup_printf("%d%s", + client->client_ignores_capability_resp_code, client->cmd_tag); i_free(client->common.master_data_prefix);
--- a/src/imap-login/client.c Wed Jun 17 12:44:33 2009 -0400 +++ b/src/imap-login/client.c Wed Jun 17 13:05:32 2009 -0400 @@ -111,7 +111,11 @@ static int cmd_capability(struct imap_client *client) { - client->capability_command_used = TRUE; + /* Client is required to send CAPABILITY after STARTTLS, so the + capability resp-code workaround checks only pre-STARTTLS + CAPABILITY commands. */ + if (!client->starttls) + client->client_ignores_capability_resp_code = TRUE; client_send_line(client, t_strconcat( "* CAPABILITY ", get_capability(client), NULL)); client_send_tagline(client, "OK Capability completed."); @@ -135,6 +139,7 @@ return; } + client->starttls = TRUE; client->common.proxying = TRUE; client->common.tls = TRUE; client->common.secured = TRUE;
--- a/src/imap-login/client.h Wed Jun 17 12:44:33 2009 -0400 +++ b/src/imap-login/client.h Wed Jun 17 13:05:32 2009 -0400 @@ -27,6 +27,7 @@ const char *cmd_tag, *cmd_name; + unsigned int starttls:1; unsigned int login_success:1; unsigned int cmd_finished:1; unsigned int proxy_sasl_ir:1; @@ -37,7 +38,7 @@ unsigned int greeting_sent:1; unsigned int id_logged:1; unsigned int auth_initializing:1; - unsigned int capability_command_used:1; + unsigned int client_ignores_capability_resp_code:1; }; void client_destroy(struct imap_client *client, const char *reason);
--- a/src/imap-login/imap-proxy.c Wed Jun 17 12:44:33 2009 -0400 +++ b/src/imap-login/imap-proxy.c Wed Jun 17 13:05:32 2009 -0400 @@ -73,12 +73,12 @@ client_send_capability_if_needed(struct imap_client *client, string_t *str, const char *capability) { - if (!client->capability_command_used || capability == NULL) + if (!client->client_ignores_capability_resp_code || capability == NULL) return; /* reset this so that we don't re-send the CAPABILITY in case server sends it multiple times */ - client->capability_command_used = FALSE; + client->client_ignores_capability_resp_code = FALSE; /* client has used CAPABILITY command, so it didn't understand the capabilities in the banner. send the backend's untagged CAPABILITY @@ -88,7 +88,7 @@ static void proxy_write_login(struct imap_client *client, string_t *str) { - if (client->capability_command_used) + if (client->client_ignores_capability_resp_code) str_append(str, "C CAPABILITY\r\n"); if (client->proxy_master_user == NULL) {