mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-15 21:45:07 -05:00
mark account with incompatible server when no sasl mechansim could be found
This commit is contained in:
parent
48e8e0f1fc
commit
c4bfffe6a9
@ -581,10 +581,11 @@ public class XmppConnection implements Runnable {
|
|||||||
} else if (mechanisms.contains("DIGEST-MD5")) {
|
} else if (mechanisms.contains("DIGEST-MD5")) {
|
||||||
saslMechanism = new DigestMd5(tagWriter, account, mXmppConnectionService.getRNG());
|
saslMechanism = new DigestMd5(tagWriter, account, mXmppConnectionService.getRNG());
|
||||||
}
|
}
|
||||||
|
if (saslMechanism != null) {
|
||||||
final JSONObject keys = account.getKeys();
|
final JSONObject keys = account.getKeys();
|
||||||
try {
|
try {
|
||||||
if (keys.has(Account.PINNED_MECHANISM_KEY) &&
|
if (keys.has(Account.PINNED_MECHANISM_KEY) &&
|
||||||
keys.getInt(Account.PINNED_MECHANISM_KEY) > saslMechanism.getPriority() ) {
|
keys.getInt(Account.PINNED_MECHANISM_KEY) > saslMechanism.getPriority()) {
|
||||||
Log.e(Config.LOGTAG, "Auth failed. Authentication mechanism " + saslMechanism.getMechanism() +
|
Log.e(Config.LOGTAG, "Auth failed. Authentication mechanism " + saslMechanism.getMechanism() +
|
||||||
" has lower priority (" + String.valueOf(saslMechanism.getPriority()) +
|
" has lower priority (" + String.valueOf(saslMechanism.getPriority()) +
|
||||||
") than pinned priority (" + keys.getInt(Account.PINNED_MECHANISM_KEY) +
|
") than pinned priority (" + keys.getInt(Account.PINNED_MECHANISM_KEY) +
|
||||||
@ -595,12 +596,16 @@ public class XmppConnection implements Runnable {
|
|||||||
} catch (final JSONException e) {
|
} catch (final JSONException e) {
|
||||||
Log.d(Config.LOGTAG, "Parse error while checking pinned auth mechanism");
|
Log.d(Config.LOGTAG, "Parse error while checking pinned auth mechanism");
|
||||||
}
|
}
|
||||||
Log.d(Config.LOGTAG,account.getJid().toString()+": Authenticating with " + saslMechanism.getMechanism());
|
Log.d(Config.LOGTAG, account.getJid().toString() + ": Authenticating with " + saslMechanism.getMechanism());
|
||||||
auth.setAttribute("mechanism", saslMechanism.getMechanism());
|
auth.setAttribute("mechanism", saslMechanism.getMechanism());
|
||||||
if (!saslMechanism.getClientFirstMessage().isEmpty()) {
|
if (!saslMechanism.getClientFirstMessage().isEmpty()) {
|
||||||
auth.setContent(saslMechanism.getClientFirstMessage());
|
auth.setContent(saslMechanism.getClientFirstMessage());
|
||||||
}
|
}
|
||||||
tagWriter.writeElement(auth);
|
tagWriter.writeElement(auth);
|
||||||
|
} else {
|
||||||
|
disconnect(true);
|
||||||
|
changeStatus(Account.State.INCOMPATIBLE_SERVER);
|
||||||
|
}
|
||||||
} else if (this.streamFeatures.hasChild("sm", "urn:xmpp:sm:"
|
} else if (this.streamFeatures.hasChild("sm", "urn:xmpp:sm:"
|
||||||
+ smVersion)
|
+ smVersion)
|
||||||
&& streamId != null) {
|
&& streamId != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user