diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-10-19 20:48:01 +0200 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-10-19 20:48:01 +0200 |
commit | e8bf75d79b74637d369d2a7134416c1f0852c420 (patch) | |
tree | 66eaf1436135844ffa88e74155b3f04b6d7f7fe3 /src/eu/siacs | |
parent | 9372a98c0c42c9bbd1a4ea6a701cc21fcca05354 (diff) |
force tls
Diffstat (limited to 'src/eu/siacs')
-rw-r--r-- | src/eu/siacs/conversations/xmpp/XmppConnection.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/eu/siacs/conversations/xmpp/XmppConnection.java b/src/eu/siacs/conversations/xmpp/XmppConnection.java index 9755be6a..be56927c 100644 --- a/src/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/eu/siacs/conversations/xmpp/XmppConnection.java @@ -80,6 +80,7 @@ public class XmppConnection implements Runnable { private SparseArray<String> messageReceipts = new SparseArray<String>(); private boolean usingCompression = false; + private boolean usingEncryption = false; private int stanzasReceived = 0; private int stanzasSent = 0; @@ -135,6 +136,7 @@ public class XmppConnection implements Runnable { protected void connect() { Log.d(Config.LOGTAG, account.getJid() + ": connecting"); usingCompression = false; + usingEncryption = false; lastConnect = SystemClock.elapsedRealtime(); lastPingSent = SystemClock.elapsedRealtime(); this.attempt++; @@ -546,6 +548,7 @@ public class XmppConnection implements Runnable { sendStartStream(); Log.d(Config.LOGTAG, account.getJid() + ": TLS connection established"); + usingEncryption = true; processStream(tagReader.readTag()); sslSocket.close(); } catch (NoSuchAlgorithmException e1) { @@ -575,8 +578,7 @@ public class XmppConnection implements Runnable { private void processStreamFeatures(Tag currentTag) throws XmlPullParserException, IOException { this.streamFeatures = tagReader.readElement(currentTag); - if (this.streamFeatures.hasChild("starttls") - && account.isOptionSet(Account.OPTION_USETLS)) { + if (this.streamFeatures.hasChild("starttls") && !usingEncryption) { sendStartTLS(); } else if (compressionAvailable()) { sendCompressionZlib(); @@ -588,7 +590,7 @@ public class XmppConnection implements Runnable { changeStatus(Account.STATUS_REGISTRATION_NOT_SUPPORTED); disconnect(true); } else if (this.streamFeatures.hasChild("mechanisms") - && shouldAuthenticate) { + && shouldAuthenticate && usingEncryption) { List<String> mechanisms = extractMechanisms(streamFeatures .findChild("mechanisms")); if (mechanisms.contains("PLAIN")) { |