Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/iNPUTmice/Conversations.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2022-09-26 08:53:48 +0300
committerDaniel Gultsch <daniel@gultsch.de>2022-09-26 08:53:48 +0300
commit3d56d01826e53ce5bb5b6450d99a195957a40626 (patch)
treec0925c0cc21d5a7c896f072f6e992f335419ece4
parent717aeddb82e25fed0b4dc4591985f762cb81536d (diff)
handle case when server loses support for quick start
-rw-r--r--src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java30
1 files changed, 20 insertions, 10 deletions
diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java
index 911b22686..e753e4b39 100644
--- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java
+++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java
@@ -898,6 +898,10 @@ public class XmppConnection implements Runnable {
}
sendPacket(packet);
}
+ changeStatusToOnline();
+ }
+
+ private void changeStatusToOnline() {
Log.d(
Config.LOGTAG,
account.getJid().asBareJid() + ": online with resource " + account.getResource());
@@ -1184,12 +1188,20 @@ public class XmppConnection implements Runnable {
features.encryptionEnabled || Config.ALLOW_NON_TLS_CONNECTIONS || account.isOnion();
final boolean needsBinding = !isBound && !account.isOptionSet(Account.OPTION_REGISTER);
if (this.quickStartInProgress) {
- Log.d(
- Config.LOGTAG,
- account.getJid().asBareJid()
- + ": quick start in progress. ignoring features: "
- + XmlHelper.printElementNames(this.streamFeatures));
- } else if (this.streamFeatures.hasChild("starttls", Namespace.TLS)
+ if (this.streamFeatures.hasChild("authentication", Namespace.SASL_2)) {
+ Log.d(
+ Config.LOGTAG,
+ account.getJid().asBareJid()
+ + ": quick start in progress. ignoring features: "
+ + XmlHelper.printElementNames(this.streamFeatures));
+ return;
+ }
+ Log.d(Config.LOGTAG,account.getJid().asBareJid()+": server lost support for SASL 2. quick start not possible");
+ this.account.setOption(Account.OPTION_QUICKSTART_AVAILABLE, false);
+ mXmppConnectionService.updateAccount(account);
+ throw new StateChangingException(Account.State.INCOMPATIBLE_SERVER);
+ }
+ if (this.streamFeatures.hasChild("starttls", Namespace.TLS)
&& !features.encryptionEnabled) {
sendStartTLS();
} else if (this.streamFeatures.hasChild("register", Namespace.REGISTER_STREAM_FEATURE)
@@ -1878,13 +1890,10 @@ public class XmppConnection implements Runnable {
}
private void finalizeBind() {
- Log.d(
- Config.LOGTAG,
- account.getJid().asBareJid() + ": online with resource " + account.getResource());
if (bindListener != null) {
bindListener.onBind(account);
}
- changeStatus(Account.State.ONLINE);
+ changeStatusToOnline();
}
private void enableAdvancedStreamFeatures() {
@@ -2012,6 +2021,7 @@ public class XmppConnection implements Runnable {
private boolean establishStream(final boolean secureConnection) throws IOException {
final SaslMechanism saslMechanism = account.getPinnedMechanism();
if (secureConnection
+ && Config.SASL_2_ENABLED
&& saslMechanism != null
&& account.isOptionSet(Account.OPTION_QUICKSTART_AVAILABLE)) {
this.saslMechanism = saslMechanism;