[evolution-data-server] I#157 - IMAPx: Does not respect LOGINDISABLED



commit 723c1224a8b4baf3b26c63fe878326dbd8186088
Author: Milan Crha <mcrha redhat com>
Date:   Tue Oct 15 12:00:22 2019 +0200

    I#157 - IMAPx: Does not respect LOGINDISABLED
    
    Closes https://gitlab.gnome.org/GNOME/evolution-data-server/issues/157

 src/camel/providers/imapx/camel-imapx-server.c | 8 ++++++++
 src/camel/providers/imapx/camel-imapx-utils.c  | 3 ++-
 src/camel/providers/imapx/camel-imapx-utils.h  | 3 ++-
 3 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/camel/providers/imapx/camel-imapx-server.c b/src/camel/providers/imapx/camel-imapx-server.c
index 65aa11d03..e51529eb6 100644
--- a/src/camel/providers/imapx/camel-imapx-server.c
+++ b/src/camel/providers/imapx/camel-imapx-server.c
@@ -3203,6 +3203,14 @@ camel_imapx_server_authenticate_sync (CamelIMAPXServer *is,
 
        if (sasl != NULL) {
                ic = camel_imapx_command_new (is, CAMEL_IMAPX_JOB_AUTHENTICATE, "AUTHENTICATE %A", sasl);
+       } else if (CAMEL_IMAPX_HAVE_CAPABILITY (is->priv->cinfo, LOGINDISABLED)) {
+                       g_set_error (
+                               error, CAMEL_SERVICE_ERROR,
+                               CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
+                               _("Plaintext authentication disallowed on insecure connections. Change 
encryption to STARTTLS or TLS for account ā€œ%sā€."),
+                               camel_service_get_display_name (service));
+                       result = CAMEL_AUTHENTICATION_ERROR;
+                       goto exit;
        } else {
                const gchar *password;
 
diff --git a/src/camel/providers/imapx/camel-imapx-utils.c b/src/camel/providers/imapx/camel-imapx-utils.c
index f5a12171a..3c2a3ed88 100644
--- a/src/camel/providers/imapx/camel-imapx-utils.c
+++ b/src/camel/providers/imapx/camel-imapx-utils.c
@@ -482,7 +482,8 @@ struct {
        { "SPECIAL-USE", IMAPX_CAPABILITY_SPECIAL_USE },
        { "X-GM-EXT-1", IMAPX_CAPABILITY_X_GM_EXT_1 },
        { "UTF8=ACCEPT", IMAPX_CAPABILITY_UTF8_ACCEPT },
-       { "UTF8=ONLY", IMAPX_CAPABILITY_UTF8_ONLY }
+       { "UTF8=ONLY", IMAPX_CAPABILITY_UTF8_ONLY },
+       { "LOGINDISABLED", IMAPX_CAPABILITY_LOGINDISABLED }
 };
 
 static GMutex capa_htable_lock;         /* capabilities lookup table lock */
diff --git a/src/camel/providers/imapx/camel-imapx-utils.h b/src/camel/providers/imapx/camel-imapx-utils.h
index a379b075b..b16fc25a0 100644
--- a/src/camel/providers/imapx/camel-imapx-utils.h
+++ b/src/camel/providers/imapx/camel-imapx-utils.h
@@ -196,7 +196,8 @@ enum {
        IMAPX_CAPABILITY_SPECIAL_USE = (1 << 15),
        IMAPX_CAPABILITY_X_GM_EXT_1 = (1 << 16),
        IMAPX_CAPABILITY_UTF8_ACCEPT = (1 << 17),
-       IMAPX_CAPABILITY_UTF8_ONLY = (1 << 18)
+       IMAPX_CAPABILITY_UTF8_ONLY = (1 << 18),
+       IMAPX_CAPABILITY_LOGINDISABLED = (1 << 19)
 };
 
 struct _capability_info {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]