1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
From: paul <paul@claws-mail.org>
Date: Mon, 12 Jul 2021 09:08:33 +0000 (+0100)
Subject: move OAuth2 to last place in auto auth selection
X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=commitdiff_plain;h=9c2585c58b49815a0eab8d683f0a94f75cbbe64e;hp=fae6b35be779b37270e76ef319128e3bb5251e51
move OAuth2 to last place in auto auth selection
IMAP: when using 'automatic' auth type, if the server offers LOGIN, GSSAPI or plaintext in addition to OAUTH2, yet OAUTH2 is unconfigured, authentication will fail. This broke previously working config
---
diff --git a/src/imap.c b/src/imap.c
index c486c471a..b72ceea76 100644
--- a/src/imap.c
+++ b/src/imap.c
@@ -951,14 +951,14 @@ 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, "XOAUTH2"))
- ok = imap_cmd_login(session, user, pass, "XOAUTH2");
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 plaintext login before giving up */
ok = imap_cmd_login(session, user, pass, "plaintext");
+ if (ok == MAILIMAP_ERROR_LOGIN && imap_has_capability(session, "XOAUTH2"))
+ ok = imap_cmd_login(session, user, pass, "XOAUTH2");
}
if (ok == MAILIMAP_NO_ERROR)
@@ -994,6 +994,11 @@ static gint imap_auth(IMAPSession *session, const gchar *user, const gchar *pass
"LOGIN SASL plugin is installed.");
}
+ if (type == IMAP_AUTH_OAUTH2) {
+ ext_info = _("\n\nOAuth2 error. Check and correct your OAuth2 "
+ "account preferences.");
+ }
+
if (time(NULL) - last_login_err > 10) {
if (!prefs_common.no_recv_err_panel) {
alertpanel_error_log(_("Connection to %s failed: "
|