From 8d2f454479632465387d8d824a56bd46aa9397e5 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Fri, 2 Jan 2015 01:39:19 +0100 Subject: [PATCH] prefer PLAIN over DIGEST-MD5 DIGEST-MD5 seems to be broken for a lot of cases (OpenFire) switched priority of PLAIN to not cause any security errors --- src/main/java/eu/siacs/conversations/crypto/sasl/Plain.java | 2 +- src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/crypto/sasl/Plain.java b/src/main/java/eu/siacs/conversations/crypto/sasl/Plain.java index c7dedc5e4..40a551515 100644 --- a/src/main/java/eu/siacs/conversations/crypto/sasl/Plain.java +++ b/src/main/java/eu/siacs/conversations/crypto/sasl/Plain.java @@ -14,7 +14,7 @@ public class Plain extends SaslMechanism { @Override public int getPriority() { - return 0; + return 10; } @Override diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java index c9a478d4d..f7f0c3467 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java @@ -576,10 +576,10 @@ public class XmppConnection implements Runnable { auth.setAttribute("xmlns", "urn:ietf:params:xml:ns:xmpp-sasl"); if (mechanisms.contains("SCRAM-SHA-1")) { saslMechanism = new ScramSha1(tagWriter, account, mXmppConnectionService.getRNG()); - //} else if (mechanisms.contains("DIGEST-MD5")) { - // saslMechanism = new DigestMd5(tagWriter, account, mXmppConnectionService.getRNG()); } else if (mechanisms.contains("PLAIN")) { saslMechanism = new Plain(tagWriter, account); + } else if (mechanisms.contains("DIGEST-MD5")) { + saslMechanism = new DigestMd5(tagWriter, account, mXmppConnectionService.getRNG()); } final JSONObject keys = account.getKeys(); try {