[Commits] [SCM] claws branch, master, updated. 3.13.2-44-g74e1542

ticho at claws-mail.org ticho at claws-mail.org
Fri Feb 19 17:54:51 CET 2016


The branch, master has been updated
       via  74e15427f6a0e237ff74f2a001ca3c5759bf2320 (commit)
      from  7047fa7f29ac1837915c139bc4ca71b153886d3e (commit)

Summary of changes:
 src/etpan/imap-thread.c |    2 +-
 src/imap.c              |   11 ++++++++---
 src/imap.h              |    5 +++--
 src/prefs_account.c     |    3 ++-
 4 files changed, 14 insertions(+), 7 deletions(-)


- Log -----------------------------------------------------------------
commit 74e15427f6a0e237ff74f2a001ca3c5759bf2320
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Fri Feb 19 17:52:50 2016 +0100

    Implement real LOGIN auth method for IMAP.
    
    The "old LOGIN" was in fact just a basic plaintext login method,
    using: "LOGIN username password", not the SASL LOGIN method.

diff --git a/src/etpan/imap-thread.c b/src/etpan/imap-thread.c
index ffe0598..76223c4 100644
--- a/src/etpan/imap-thread.c
+++ b/src/etpan/imap-thread.c
@@ -894,7 +894,7 @@ static void login_run(struct etpan_thread_op * op)
 	old_debug = mailstream_debug;
 	mailstream_debug = 0;
 #endif
-	if (!strcmp(param->type, "LOGIN"))
+	if (!strcmp(param->type, "plaintext"))
 		r = mailimap_login(param->imap,
 			   param->login, param->password);
 	else if (!strcmp(param->type, "GSSAPI"))
diff --git a/src/imap.c b/src/imap.c
index 241ad0f..e430c8f 100644
--- a/src/imap.c
+++ b/src/imap.c
@@ -908,6 +908,9 @@ static gint imap_auth(IMAPSession *session, const gchar *user, const gchar *pass
 	case IMAP_AUTH_LOGIN:
 		ok = imap_cmd_login(session, user, pass, "LOGIN");
 		break;
+	case IMAP_AUTH_PLAINTEXT:
+		ok = imap_cmd_login(session, user, pass, "plaintext");
+		break;
 	case IMAP_AUTH_GSSAPI:
 		ok = imap_cmd_login(session, user, pass, "GSSAPI");
 		break;
@@ -935,10 +938,12 @@ static gint imap_auth(IMAPSession *session, const gchar *user, const gchar *pass
 			ok = imap_cmd_login(session, user, pass, "SCRAM-SHA-1");
 		if (ok == MAILIMAP_ERROR_LOGIN && imap_has_capability(session, "PLAIN"))
 			ok = imap_cmd_login(session, user, pass, "PLAIN");
+		if (ok == MAILIMAP_ERROR_LOGIN && imap_has_capability(session, "LOGIN"))
+			ok = imap_cmd_login(session, user, pass, "LOGIN");
 		if (ok == MAILIMAP_ERROR_LOGIN && imap_has_capability(session, "GSSAPI"))
 			ok = imap_cmd_login(session, user, pass, "GSSAPI");
-		if (ok == MAILIMAP_ERROR_LOGIN) /* we always try LOGIN before giving up */
-			ok = imap_cmd_login(session, user, pass, "LOGIN");
+		if (ok == MAILIMAP_ERROR_LOGIN) /* we always try plaintext login before giving up */
+			ok = imap_cmd_login(session, user, pass, "plaintext");
 	}
 
 	if (ok == MAILIMAP_NO_ERROR)
@@ -4091,7 +4096,7 @@ static gint imap_cmd_login(IMAPSession *session,
 	int r;
 	gint ok;
 
-	if (!strcmp(type, "LOGIN") && imap_has_capability(session, "LOGINDISABLED")) {
+	if (!strcmp(type, "plaintext") && imap_has_capability(session, "LOGINDISABLED")) {
 		gint ok = MAILIMAP_ERROR_BAD_STATE;
 		if (imap_has_capability(session, "STARTTLS")) {
 #ifdef USE_GNUTLS
diff --git a/src/imap.h b/src/imap.h
index b7eae6c..50569e0 100644
--- a/src/imap.h
+++ b/src/imap.h
@@ -24,13 +24,14 @@
 
 typedef enum
 {
-	IMAP_AUTH_LOGIN		= 1 << 0,
+	IMAP_AUTH_PLAINTEXT		= 1 << 0,
 	IMAP_AUTH_CRAM_MD5	= 1 << 1,
 	IMAP_AUTH_ANON		= 1 << 2,
 	IMAP_AUTH_GSSAPI	= 1 << 3,
 	IMAP_AUTH_DIGEST_MD5	= 1 << 4,
 	IMAP_AUTH_SCRAM_SHA1	= 1 << 5,
-	IMAP_AUTH_PLAIN   = 1 << 6
+	IMAP_AUTH_PLAIN   = 1 << 6,
+	IMAP_AUTH_LOGIN   = 1 << 7
 } IMAPAuthType;
 
 FolderClass *imap_get_class		(void);
diff --git a/src/prefs_account.c b/src/prefs_account.c
index e57dd21..6bd3716 100644
--- a/src/prefs_account.c
+++ b/src/prefs_account.c
@@ -1578,13 +1578,14 @@ static void receive_create_widget_func(PrefsPage * _page,
 
 	COMBOBOX_ADD (menu, _("Automatic"), 0);
 	COMBOBOX_ADD (menu, NULL, 0);
-	COMBOBOX_ADD (menu, "LOGIN", IMAP_AUTH_LOGIN);
+	COMBOBOX_ADD (menu, _("Plain text"), IMAP_AUTH_PLAINTEXT);
 	COMBOBOX_ADD (menu, "CRAM-MD5", IMAP_AUTH_CRAM_MD5);
 	COMBOBOX_ADD (menu, "ANONYMOUS", IMAP_AUTH_ANON);
 	COMBOBOX_ADD (menu, "GSSAPI", IMAP_AUTH_GSSAPI);
 	COMBOBOX_ADD (menu, "DIGEST-MD5", IMAP_AUTH_DIGEST_MD5);
 	COMBOBOX_ADD (menu, "SCRAM-SHA-1", IMAP_AUTH_SCRAM_SHA1);
 	COMBOBOX_ADD (menu, "PLAIN", IMAP_AUTH_PLAIN);
+	COMBOBOX_ADD (menu, "LOGIN", IMAP_AUTH_LOGIN);
 
 	hbox1 = gtk_hbox_new (FALSE, 8);
 	gtk_widget_show (hbox1);

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list