From 55a77c083fee51b12baf62156e19e01eb7120e2a Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Mon, 23 Oct 2023 14:40:40 +0200 Subject: [PATCH] store SSLSocket after starttls to fix channel binding mechanism detection --- .../eu/siacs/conversations/xmpp/XmppConnection.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java index 7ba266794..402cd1ba2 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java @@ -1260,8 +1260,9 @@ public class XmppConnection implements Runnable { tagReader.readTag(); final Socket socket = this.socket; final SSLSocket sslSocket = upgradeSocketToTls(socket); - tagReader.setInputStream(sslSocket.getInputStream()); - tagWriter.setOutputStream(sslSocket.getOutputStream()); + this.socket = sslSocket; + this.tagReader.setInputStream(sslSocket.getInputStream()); + this.tagWriter.setOutputStream(sslSocket.getOutputStream()); Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": TLS connection established"); final boolean quickStart; try { @@ -2218,9 +2219,13 @@ public class XmppConnection implements Runnable { private boolean establishStream(final SSLSockets.Version sslVersion) throws IOException, InterruptedException { - final SaslMechanism quickStartMechanism = - SaslMechanism.ensureAvailable(account.getQuickStartMechanism(), sslVersion); final boolean secureConnection = sslVersion != SSLSockets.Version.NONE; + final SaslMechanism quickStartMechanism; + if (secureConnection) { + quickStartMechanism = SaslMechanism.ensureAvailable(account.getQuickStartMechanism(), sslVersion); + } else { + quickStartMechanism = null; + } if (secureConnection && Config.QUICKSTART_ENABLED && quickStartMechanism != null