From bf15070fef52edb494c3496e2f75921091e69802 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 15 Sep 2022 13:10:15 +0200 Subject: [PATCH] bump sasl2 namespace --- .../java/eu/siacs/conversations/xml/Namespace.java | 2 +- .../eu/siacs/conversations/xmpp/XmppConnection.java | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/xml/Namespace.java b/src/main/java/eu/siacs/conversations/xml/Namespace.java index e9f9639ec..819e5fb21 100644 --- a/src/main/java/eu/siacs/conversations/xml/Namespace.java +++ b/src/main/java/eu/siacs/conversations/xml/Namespace.java @@ -16,7 +16,7 @@ public final class Namespace { public static final String DATA = "jabber:x:data"; public static final String OOB = "jabber:x:oob"; public static final String SASL = "urn:ietf:params:xml:ns:xmpp-sasl"; - public static final String SASL_2 = "urn:xmpp:sasl:1"; + public static final String SASL_2 = "urn:xmpp:sasl:2"; public static final String CHANNEL_BINDING = "urn:xmpp:sasl-cb:0"; public static final String TLS = "urn:ietf:params:xml:ns:xmpp-tls"; public static final String PUBSUB = "http://jabber.org/protocol/pubsub"; diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java index 3bcec5a5a..d0ea1349f 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java @@ -1187,7 +1187,7 @@ public class XmppConnection implements Runnable { && account.isOptionSet(Account.OPTION_REGISTER)) { throw new StateChangingException(Account.State.REGISTRATION_NOT_SUPPORTED); } else if (Config.SASL_2_ENABLED - && this.streamFeatures.hasChild("mechanisms", Namespace.SASL_2) + && this.streamFeatures.hasChild("authentication", Namespace.SASL_2) && shouldAuthenticate && isSecure) { authenticate(SaslMechanism.Version.SASL_2); @@ -1230,8 +1230,12 @@ public class XmppConnection implements Runnable { } private void authenticate(final SaslMechanism.Version version) throws IOException { - final Element element = - this.streamFeatures.findChild("mechanisms", SaslMechanism.namespace(version)); + final Element element; + if (version == SaslMechanism.Version.SASL) { + element = this.streamFeatures.findChild("mechanisms", Namespace.SASL); + } else { + element = this.streamFeatures.findChild("authentication", Namespace.SASL_2); + } final Collection mechanisms = Collections2.transform( Collections2.filter(