|
|
@ -858,6 +858,7 @@ public class IMAPStore extends Store
|
|
|
|
* the mechanism and we have an authenticator for the mechanism,
|
|
|
|
* the mechanism and we have an authenticator for the mechanism,
|
|
|
|
* and it hasn't been disabled, use it.
|
|
|
|
* and it hasn't been disabled, use it.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
ProtocolException pex = null;
|
|
|
|
StringTokenizer st = new StringTokenizer(mechs);
|
|
|
|
StringTokenizer st = new StringTokenizer(mechs);
|
|
|
|
while (st.hasMoreTokens()) {
|
|
|
|
while (st.hasMoreTokens()) {
|
|
|
|
String m = st.nextToken();
|
|
|
|
String m = st.nextToken();
|
|
|
@ -888,28 +889,45 @@ public class IMAPStore extends Store
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
if (m.equals("PLAIN"))
|
|
|
|
if (m.equals("PLAIN")) {
|
|
|
|
p.authplain(authzid, user, password);
|
|
|
|
p.authplain(authzid, user, password);
|
|
|
|
else if (m.equals("LOGIN"))
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (m.equals("LOGIN")) {
|
|
|
|
p.authlogin(user, password);
|
|
|
|
p.authlogin(user, password);
|
|
|
|
else if (m.equals("NTLM"))
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (m.equals("NTLM")) {
|
|
|
|
p.authntlm(authzid, user, password);
|
|
|
|
p.authntlm(authzid, user, password);
|
|
|
|
else if (m.equals("XOAUTH2"))
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (m.equals("XOAUTH2")) {
|
|
|
|
p.authoauth2(user, password);
|
|
|
|
p.authoauth2(user, password);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
logger.log(Level.FINE, "no authenticator for mechanism {0}", m);
|
|
|
|
logger.log(Level.FINE, "no authenticator for mechanism {0}", m);
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (ProtocolException ex) {
|
|
|
|
} catch (ProtocolException ex) {
|
|
|
|
|
|
|
|
eu.faircode.email.Log.w(ex);
|
|
|
|
|
|
|
|
if (pex == null)
|
|
|
|
|
|
|
|
pex = ex;
|
|
|
|
if (m.equals("PLAIN") || m.equals("LOGIN")) {
|
|
|
|
if (m.equals("PLAIN") || m.equals("LOGIN")) {
|
|
|
|
eu.faircode.email.Log.i("Falling back to classic LOGIN");
|
|
|
|
eu.faircode.email.Log.w("Falling back to classic LOGIN");
|
|
|
|
p.authclassic(user, password);
|
|
|
|
try {
|
|
|
|
} else
|
|
|
|
p.authclassic(user, password);
|
|
|
|
throw ex;
|
|
|
|
return;
|
|
|
|
|
|
|
|
} catch (ProtocolException exex) {
|
|
|
|
|
|
|
|
eu.faircode.email.Log.w(exex);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (pex != null)
|
|
|
|
|
|
|
|
throw pex;
|
|
|
|
|
|
|
|
|
|
|
|
if (!p.hasCapability("LOGINDISABLED")) {
|
|
|
|
if (!p.hasCapability("LOGINDISABLED")) {
|
|
|
|
p.login(user, password);
|
|
|
|
p.login(user, password);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|