Mercurial > dovecot > original-hg > dovecot-1.2
changeset 9448:ab32d7e2c0d6 HEAD
imap-login: If imap_capability is set, show it in the banner instead of the default.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 20 Oct 2009 15:49:01 -0400 |
parents | 36b8d97d0f58 |
children | c7948ebd433e |
files | src/imap-login/client.c src/login-common/common.h src/login-common/main.c src/login-common/ssl-proxy-openssl.c src/master/login-process.c |
diffstat | 5 files changed, 16 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/imap-login/client.c Tue Oct 20 15:40:51 2009 -0400 +++ b/src/imap-login/client.c Tue Oct 20 15:49:01 2009 -0400 @@ -93,11 +93,12 @@ static const char *get_capability(struct imap_client *client, bool full) { - const char *auths; + const char *auths, *cap_str; + cap_str = full || capability_string_overridden ? capability_string : + CAPABILITY_BANNER_STRING; auths = client_authenticate_get_capabilities(client->common.secured); - return t_strconcat(full ? capability_string : CAPABILITY_BANNER_STRING, - (ssl_initialized && !client->common.tls) ? + return t_strconcat(cap_str, (ssl_initialized && !client->common.tls) ? " STARTTLS" : "", disable_plaintext_auth && !client->common.secured ? " LOGINDISABLED" : "", auths, NULL);
--- a/src/login-common/common.h Tue Oct 20 15:40:51 2009 -0400 +++ b/src/login-common/common.h Tue Oct 20 15:49:01 2009 -0400 @@ -23,7 +23,7 @@ extern unsigned int max_connections; extern unsigned int login_process_uid; extern struct auth_client *auth_client; -extern bool closing_down; +extern bool closing_down, capability_string_overridden; void main_ref(void); void main_unref(void);
--- a/src/login-common/main.c Tue Oct 20 15:40:51 2009 -0400 +++ b/src/login-common/main.c Tue Oct 20 15:49:01 2009 -0400 @@ -28,7 +28,7 @@ unsigned int max_connections; unsigned int login_process_uid; struct auth_client *auth_client; -bool closing_down; +bool closing_down, capability_string_overridden; static const char *process_name; static struct ioloop *ioloop; @@ -354,8 +354,11 @@ /* capability default is set in imap/pop3-login */ value = getenv("CAPABILITY_STRING"); - if (value != NULL && *value != '\0') + if (value != NULL && *value != '\0') { capability_string = value; + if (getenv("CAPABILITY_STRING_OVERRIDDEN") != NULL) + capability_string_overridden = TRUE; + } closing_down = FALSE; main_refcount = 0;
--- a/src/login-common/ssl-proxy-openssl.c Tue Oct 20 15:40:51 2009 -0400 +++ b/src/login-common/ssl-proxy-openssl.c Tue Oct 20 15:49:01 2009 -0400 @@ -721,6 +721,7 @@ return ssl_params.dh_1024; } +#ifdef HAVE_SSL_CTX_SET_INFO_CALLBACK static void ssl_info_callback(const SSL *ssl, int where, int ret) { struct ssl_proxy *proxy; @@ -738,6 +739,7 @@ net_ip2addr(&proxy->ip)); } } +#endif static int ssl_verify_client_cert(int preverify_ok, X509_STORE_CTX *ctx) { @@ -820,8 +822,10 @@ cafile, ssl_last_error()); } } +#ifdef HAVE_SSL_CTX_SET_INFO_CALLBACK if (verbose_ssl) SSL_CTX_set_info_callback(ssl_ctx, ssl_info_callback); +#endif if (SSL_CTX_need_tmp_RSA(ssl_ctx)) SSL_CTX_set_tmp_rsa_callback(ssl_ctx, ssl_gen_rsa_key); SSL_CTX_set_tmp_dh_callback(ssl_ctx, ssl_tmp_dh_callback);
--- a/src/master/login-process.c Tue Oct 20 15:40:51 2009 -0400 +++ b/src/master/login-process.c Tue Oct 20 15:49:01 2009 -0400 @@ -619,6 +619,8 @@ *set->imap_capability != '\0' ? set->imap_capability : set->imap_generated_capability, NULL)); + if (*set->imap_capability != '\0') + env_put("CAPABILITY_STRING_OVERRIDDEN=1"); } if (*set->login_trusted_networks != '\0') { env_put(t_strconcat("TRUSTED_NETWORKS=",