From 3d0b127a8f8780637c66fa50765b3bec8dea90fa Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 13 Jul 2017 19:27:36 +0200 Subject: [PATCH] verify with hostname in direct tls connections --- src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java index ee82ef512..c820a1d02 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java @@ -41,7 +41,6 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import java.util.regex.Matcher; -import javax.net.ssl.HostnameVerifier; import javax.net.ssl.KeyManager; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSession; @@ -393,7 +392,7 @@ public class XmppConnection implements Runnable { localSocket.connect(addr, Config.SOCKET_TIMEOUT * 1000); - if (!tlsFactoryVerifier.verifier.verify(account.getServer().getDomainpart(), ((SSLSocket) localSocket).getSession())) { + if (!tlsFactoryVerifier.verifier.verify(account.getServer().getDomainpart(), verifiedHostname, ((SSLSocket) localSocket).getSession())) { Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": TLS certificate verification failed"); if (!iterator.hasNext()) { throw new StateChangingException(Account.State.TLS_ERROR);