store SSLSocket after starttls to fix channel binding mechanism detection

This commit is contained in:
Daniel Gultsch 2023-10-23 14:40:40 +02:00
parent 68eb17d400
commit 55a77c083f
No known key found for this signature in database
GPG key ID: F43D18AD2A0982C2

View file

@ -1260,8 +1260,9 @@ public class XmppConnection implements Runnable {
tagReader.readTag(); tagReader.readTag();
final Socket socket = this.socket; final Socket socket = this.socket;
final SSLSocket sslSocket = upgradeSocketToTls(socket); final SSLSocket sslSocket = upgradeSocketToTls(socket);
tagReader.setInputStream(sslSocket.getInputStream()); this.socket = sslSocket;
tagWriter.setOutputStream(sslSocket.getOutputStream()); this.tagReader.setInputStream(sslSocket.getInputStream());
this.tagWriter.setOutputStream(sslSocket.getOutputStream());
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": TLS connection established"); Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": TLS connection established");
final boolean quickStart; final boolean quickStart;
try { try {
@ -2218,9 +2219,13 @@ public class XmppConnection implements Runnable {
private boolean establishStream(final SSLSockets.Version sslVersion) private boolean establishStream(final SSLSockets.Version sslVersion)
throws IOException, InterruptedException { throws IOException, InterruptedException {
final SaslMechanism quickStartMechanism =
SaslMechanism.ensureAvailable(account.getQuickStartMechanism(), sslVersion);
final boolean secureConnection = sslVersion != SSLSockets.Version.NONE; final boolean secureConnection = sslVersion != SSLSockets.Version.NONE;
final SaslMechanism quickStartMechanism;
if (secureConnection) {
quickStartMechanism = SaslMechanism.ensureAvailable(account.getQuickStartMechanism(), sslVersion);
} else {
quickStartMechanism = null;
}
if (secureConnection if (secureConnection
&& Config.QUICKSTART_ENABLED && Config.QUICKSTART_ENABLED
&& quickStartMechanism != null && quickStartMechanism != null