dovecot-1.2: imap-login: Using CAPABILITY command after STARTTLS...
dovecot at dovecot.org
dovecot at dovecot.org
Wed Jun 17 20:05:45 EEST 2009
details: http://hg.dovecot.org/dovecot-1.2/rev/5ee5def4f0ff
changeset: 9142:5ee5def4f0ff
user: Timo Sirainen <tss at iki.fi>
date: Wed Jun 17 13:05:40 2009 -0400
description:
imap-login: Using CAPABILITY command after STARTTLS shouldn't trigger CAPABILITY pushing workaround.
diffstat:
3 files changed, 11 insertions(+), 5 deletions(-)
src/imap-login/client.c | 7 ++++++-
src/imap-login/client.h | 3 ++-
src/imap-login/imap-proxy.c | 6 +++---
diffs (71 lines):
diff -r d21bd1a1710a -r 5ee5def4f0ff src/imap-login/client.c
--- 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:40 2009 -0400
@@ -105,7 +105,11 @@ static const char *get_capability(struct
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, TRUE), NULL));
client_send_tagline(client, "OK Capability completed.");
@@ -130,6 +134,7 @@ static void client_start_tls(struct imap
return;
}
+ client->starttls = TRUE;
client->common.tls = TRUE;
client->common.secured = TRUE;
client_set_title(client);
diff -r d21bd1a1710a -r 5ee5def4f0ff src/imap-login/client.h
--- 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:40 2009 -0400
@@ -28,6 +28,7 @@ struct imap_client {
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;
@@ -38,7 +39,7 @@ struct imap_client {
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);
diff -r d21bd1a1710a -r 5ee5def4f0ff src/imap-login/imap-proxy.c
--- 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:40 2009 -0400
@@ -113,12 +113,12 @@ client_send_capability_if_needed(struct
const char *const *backend_capabilities;
const char *const *proxy_capabilities;
- 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. if backend server has different
@@ -138,7 +138,7 @@ client_send_capability_if_needed(struct
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) {
More information about the dovecot-cvs
mailing list