Mercurial > dovecot > original-hg > dovecot-1.2
changeset 7922:4b4d2a4423ec HEAD
Removed login_greeting_capability setting. Instead now a minimal pre-login
capability list is sent in the banner. CAPABILITY command still returns a
full list. If CAPABILITY command wasn't used, the full capability list is
sent in LOGIN/AUTHENTICATE tagged OK reply.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sat, 21 Jun 2008 10:39:45 +0300 |
parents | 9a7469e52f91 |
children | 67a2d45e8e95 |
files | configure.in src/imap-login/client-authenticate.c src/imap-login/client.c src/imap-login/client.h src/login-common/common.h src/login-common/main.c src/master/login-process.c src/master/master-settings-defs.c src/master/master-settings.c src/master/master-settings.h |
diffstat | 10 files changed, 20 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/configure.in Sat Jun 21 10:14:13 2008 +0300 +++ b/configure.in Sat Jun 21 10:39:45 2008 +0300 @@ -2185,8 +2185,10 @@ dnl ** capabilities dnl ** -capability="IMAP4rev1 SASL-IR SORT THREAD=REFERENCES MULTIAPPEND UNSELECT LITERAL+ IDLE CHILDREN NAMESPACE LOGIN-REFERRALS UIDPLUS LIST-EXTENDED I18NLEVEL=1 ENABLE CONDSTORE QRESYNC ESEARCH SEARCHRES WITHIN CONTEXT=SEARCH ID" +capability_banner="IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID" +capability="$capability_banner SORT THREAD=REFERENCES MULTIAPPEND UNSELECT IDLE CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 ENABLE CONDSTORE QRESYNC ESEARCH SEARCHRES WITHIN CONTEXT=SEARCH" AC_DEFINE_UNQUOTED(CAPABILITY_STRING, "$capability", IMAP capabilities) +AC_DEFINE_UNQUOTED(CAPABILITY_BANNER_STRING, "$capability_banner", IMAP capabilities advertised in banner) CFLAGS="$CFLAGS $EXTRA_CFLAGS"
--- a/src/imap-login/client-authenticate.c Sat Jun 21 10:14:13 2008 +0300 +++ b/src/imap-login/client-authenticate.c Sat Jun 21 10:39:45 2008 +0300 @@ -208,7 +208,13 @@ break; } - client_send_tagline(client, "OK Logged in."); + if (client->full_capability_sent) + client_send_tagline(client, "OK Logged in."); + else { + client_send_tagline(client, t_strdup_printf( + "OK [CAPABILITY %s] Logged in.", + capability_string)); + } client_destroy_success(client, "Login"); break; case SASL_SERVER_REPLY_AUTH_FAILED:
--- a/src/imap-login/client.c Sat Jun 21 10:14:13 2008 +0300 +++ b/src/imap-login/client.c Sat Jun 21 10:39:45 2008 +0300 @@ -97,12 +97,12 @@ return FALSE; } -static const char *get_capability(struct imap_client *client) +static const char *get_capability(struct imap_client *client, bool full) { const char *auths; auths = client_authenticate_get_capabilities(client->common.secured); - return t_strconcat(capability_string, + return t_strconcat(full ? capability_string : CAPABILITY_BANNER_STRING, (ssl_initialized && !client->common.tls) ? " STARTTLS" : "", disable_plaintext_auth && !client->common.secured ? @@ -111,8 +111,9 @@ static int cmd_capability(struct imap_client *client) { - client_send_line(client, t_strconcat("* CAPABILITY ", - get_capability(client), NULL)); + client->full_capability_sent = TRUE; + client_send_line(client, t_strconcat( + "* CAPABILITY ", get_capability(client, TRUE), NULL)); client_send_tagline(client, "OK Capability completed."); return 1; } @@ -461,10 +462,7 @@ 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_printfa(greet, "[CAPABILITY %s] ", get_capability(client, FALSE)); str_append(greet, greeting); client_send_line(client, str_c(greet)); @@ -522,7 +520,7 @@ main_ref(); - if (!greeting_capability || auth_client_is_connected(auth_client)) + if (auth_client_is_connected(auth_client)) client_send_greeting(client); else client_set_auth_waiting(client);
--- a/src/imap-login/client.h Sat Jun 21 10:14:13 2008 +0300 +++ b/src/imap-login/client.h Sat Jun 21 10:39:45 2008 +0300 @@ -32,6 +32,7 @@ unsigned int destroyed:1; unsigned int greeting_sent:1; unsigned int id_logged:1; + unsigned int full_capability_sent:1; }; void client_destroy(struct imap_client *client, const char *reason);
--- a/src/login-common/common.h Sat Jun 21 10:14:13 2008 +0300 +++ b/src/login-common/common.h Sat Jun 21 10:39:45 2008 +0300 @@ -13,7 +13,7 @@ extern const char *login_protocol; -extern bool disable_plaintext_auth, process_per_connection, greeting_capability; +extern bool disable_plaintext_auth, process_per_connection; extern bool verbose_proctitle, verbose_ssl, verbose_auth; extern const char *greeting, *log_format; extern const char *const *log_format_elements;
--- a/src/login-common/main.c Sat Jun 21 10:14:13 2008 +0300 +++ b/src/login-common/main.c Sat Jun 21 10:39:45 2008 +0300 @@ -19,7 +19,7 @@ #include <unistd.h> #include <syslog.h> -bool disable_plaintext_auth, process_per_connection, greeting_capability; +bool disable_plaintext_auth, process_per_connection; bool verbose_proctitle, verbose_ssl, verbose_auth; const char *greeting, *log_format; const char *const *log_format_elements; @@ -319,7 +319,6 @@ greeting = getenv("GREETING"); if (greeting == NULL) greeting = PACKAGE" ready."; - greeting_capability = getenv("GREETING_CAPABILITY") != NULL; value = getenv("LOG_FORMAT_ELEMENTS"); if (value == NULL)
--- a/src/master/login-process.c Sat Jun 21 10:14:13 2008 +0300 +++ b/src/master/login-process.c Sat Jun 21 10:39:45 2008 +0300 @@ -573,8 +573,6 @@ env_put(t_strconcat("LOG_FORMAT=", set->login_log_format, NULL)); env_put(t_strconcat("IMAP_ID_SEND=", set->imap_id_send, NULL)); env_put(t_strconcat("IMAP_ID_LOG=", set->imap_id_log, NULL)); - if (set->login_greeting_capability) - env_put("GREETING_CAPABILITY=1"); if (group->mail_process_type == PROCESS_TYPE_IMAP) { env_put(t_strconcat("CAPABILITY_STRING=",
--- a/src/master/master-settings-defs.c Sat Jun 21 10:14:13 2008 +0300 +++ b/src/master/master-settings-defs.c Sat Jun 21 10:39:45 2008 +0300 @@ -45,7 +45,6 @@ DEF_BOOL(login_process_per_connection), DEF_BOOL(login_chroot), - DEF_BOOL(login_greeting_capability), DEF_STR(login_trusted_networks), DEF_INT(login_process_size),
--- a/src/master/master-settings.c Sat Jun 21 10:14:13 2008 +0300 +++ b/src/master/master-settings.c Sat Jun 21 10:39:45 2008 +0300 @@ -207,7 +207,6 @@ MEMBER(login_process_per_connection) TRUE, MEMBER(login_chroot) TRUE, - MEMBER(login_greeting_capability) FALSE, MEMBER(login_trusted_networks) "", MEMBER(login_process_size) 64,
--- a/src/master/master-settings.h Sat Jun 21 10:14:13 2008 +0300 +++ b/src/master/master-settings.h Sat Jun 21 10:39:45 2008 +0300 @@ -59,7 +59,6 @@ bool login_process_per_connection; bool login_chroot; - bool login_greeting_capability; const char *login_trusted_networks; unsigned int login_process_size;