dovecot-1.2: Removed login_greeting_capability setting. Instead ...

dovecot at dovecot.org dovecot at dovecot.org
Sat Jun 21 12:51:44 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.2/rev/4b4d2a4423ec
changeset: 7922:4b4d2a4423ec
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Jun 21 10:39:45 2008 +0300
description:
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.

diffstat:

10 files changed, 20 insertions(+), 19 deletions(-)
configure.in                         |    4 +++-
src/imap-login/client-authenticate.c |    8 +++++++-
src/imap-login/client.c              |   16 +++++++---------
src/imap-login/client.h              |    1 +
src/login-common/common.h            |    2 +-
src/login-common/main.c              |    3 +--
src/master/login-process.c           |    2 --
src/master/master-settings-defs.c    |    1 -
src/master/master-settings.c         |    1 -
src/master/master-settings.h         |    1 -

diffs (172 lines):

diff -r 9a7469e52f91 -r 4b4d2a4423ec configure.in
--- 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 ** 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"
 
diff -r 9a7469e52f91 -r 4b4d2a4423ec src/imap-login/client-authenticate.c
--- 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 @@ static void sasl_callback(struct client 
 				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:
diff -r 9a7469e52f91 -r 4b4d2a4423ec src/imap-login/client.c
--- 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 @@ bool client_skip_line(struct imap_client
 	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 const char *get_capability(struct
 
 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 @@ static void client_send_greeting(struct 
 
 	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 @@ struct client *client_create(int fd, boo
 
 	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);
diff -r 9a7469e52f91 -r 4b4d2a4423ec src/imap-login/client.h
--- 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 @@ struct imap_client {
 	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);
diff -r 9a7469e52f91 -r 4b4d2a4423ec src/login-common/common.h
--- 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;
diff -r 9a7469e52f91 -r 4b4d2a4423ec src/login-common/main.c
--- 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 @@ static void main_init(void)
 	greeting = getenv("GREETING");
 	if (greeting == NULL)
 		greeting = PACKAGE" ready.";
-	greeting_capability = getenv("GREETING_CAPABILITY") != NULL;
 
 	value = getenv("LOG_FORMAT_ELEMENTS");
 	if (value == NULL)
diff -r 9a7469e52f91 -r 4b4d2a4423ec src/master/login-process.c
--- 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 @@ static void login_process_init_env(struc
 	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=",
diff -r 9a7469e52f91 -r 4b4d2a4423ec src/master/master-settings-defs.c
--- 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 @@ static struct setting_def setting_defs[]
 
 	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),
diff -r 9a7469e52f91 -r 4b4d2a4423ec src/master/master-settings.c
--- 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 @@ struct settings default_settings = {
 
 	MEMBER(login_process_per_connection) TRUE,
 	MEMBER(login_chroot) TRUE,
-	MEMBER(login_greeting_capability) FALSE,
 	MEMBER(login_trusted_networks) "",
 
 	MEMBER(login_process_size) 64,
diff -r 9a7469e52f91 -r 4b4d2a4423ec src/master/master-settings.h
--- 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 @@ struct settings {
 
 	bool login_process_per_connection;
 	bool login_chroot;
-	bool login_greeting_capability;
 	const char *login_trusted_networks;
 
 	unsigned int login_process_size;


More information about the dovecot-cvs mailing list