Mercurial > dovecot > original-hg > dovecot-1.2
changeset 3706:2422546e3c44 HEAD
If capability is sent in greeting, don't send it before we have received
authentication capabilities from auth process.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 28 Oct 2005 19:52:20 +0300 |
parents | 561e81dfa20b |
children | c278d40d99e7 |
files | src/imap-login/client.c src/imap-login/client.h |
diffstat | 2 files changed, 21 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/imap-login/client.c Fri Oct 28 19:24:49 2005 +0300 +++ b/src/imap-login/client.c Fri Oct 28 19:52:20 2005 +0300 @@ -389,12 +389,27 @@ } } +static void client_send_greeting(struct imap_client *client) +{ + string_t *greet; + + greet = t_str_new(128); + str_append(greet, "* OK "); + if (greeting_capability) { + i_assert(auth_client_is_connected(auth_client)); + str_printfa(greet, "[CAPABILITY %s] ", get_capability(client)); + } + str_append(greet, greeting); + + client_send_line(client, str_c(greet)); + client->greeting_sent = TRUE; +} + struct client *client_create(int fd, int ssl, const struct ip_addr *local_ip, const struct ip_addr *ip) { struct imap_client *client; const char *addr; - string_t *greet; if (max_logging_users > CLIENT_DESTROY_OLDEST_COUNT && hash_size(clients) >= max_logging_users) { @@ -429,13 +444,8 @@ main_ref(); - greet = t_str_new(128); - str_append(greet, "* OK "); - if (greeting_capability) - str_printfa(greet, "[CAPABILITY %s] ", get_capability(client)); - str_append(greet, greeting); - - client_send_line(client, str_c(greet)); + if (!greeting_capability || auth_client_is_connected(auth_client)) + client_send_greeting(client); client_set_title(client); client->created = TRUE; @@ -591,6 +601,8 @@ while (hash_iterate(iter, &key, &value)) { struct imap_client *client = key; + if (!client->greeting_sent) + client_send_greeting(client); if (client->input_blocked) { client->input_blocked = FALSE; client_input(client);
--- a/src/imap-login/client.h Fri Oct 28 19:24:49 2005 +0300 +++ b/src/imap-login/client.h Fri Oct 28 19:52:20 2005 +0300 @@ -29,6 +29,7 @@ unsigned int skip_line:1; unsigned int input_blocked:1; unsigned int destroyed:1; + unsigned int greeting_sent:1; }; void client_destroy(struct imap_client *client, const char *reason);