dovecot-2.2: imap-login: If PLAIN mechanism is disabled, adverti...

dovecot at dovecot.org dovecot at dovecot.org
Fri Jun 7 20:12:29 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/bee2dfd00ac5
changeset: 16476:bee2dfd00ac5
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Jun 07 20:12:15 2013 +0300
description:
imap-login: If PLAIN mechanism is disabled, advertise LOGINDISABLED always.

diffstat:

 src/imap-login/client.c |  19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diffs (36 lines):

diff -r e5bd0a7c6a1e -r bee2dfd00ac5 src/imap-login/client.c
--- a/src/imap-login/client.c	Thu Jun 06 16:43:01 2013 +0300
+++ b/src/imap-login/client.c	Fri Jun 07 20:12:15 2013 +0300
@@ -48,6 +48,22 @@
 	return FALSE;
 }
 
+static bool is_login_cmd_disabled(struct client *client)
+{
+	if (client->secured) {
+		if (auth_client_find_mech(auth_client, "PLAIN") == NULL) {
+			/* no PLAIN authentication, can't use LOGIN command */
+			return TRUE;
+		}
+		return FALSE;
+	}
+	if (client->set->disable_plaintext_auth)
+		return TRUE;
+	if (strcmp(client->ssl_set->ssl, "required") == 0)
+		return TRUE;
+	return FALSE;
+}
+
 static const char *get_capability(struct client *client)
 {
 	struct imap_client *imap_client = (struct imap_client *)client;
@@ -65,8 +81,7 @@
 
 	if (client_is_tls_enabled(client) && !client->tls)
 		str_append(cap_str, " STARTTLS");
-	if (!client->secured & (client->set->disable_plaintext_auth ||
-				strcmp(client->ssl_set->ssl, "required") == 0))
+	if (is_login_cmd_disabled(client))
 		str_append(cap_str, " LOGINDISABLED");
 
 	client_authenticate_get_capabilities(client, cap_str);


More information about the dovecot-cvs mailing list