From 5f4374ec260809f934093bfd26885c370dc3e713 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Thu, 19 Feb 2015 09:23:36 +0100 Subject: [PATCH] Use host(name) to construct the SSLSocket in XMPPTCPConnection. So that the hostname and not the IP is available to the SSLSocket and the SSLSession, which handed over to HostnameVerifier. This leaves the HostnameVerifier with the - name of the XMPP service (first argument of verify(String, SSLSession) - name of the used host (found in the SSLSession) allowing more complex verification mechanisms performed by the HostnameVerifier. --- .../main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java b/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java index f7d98b6dd..501d9d7fa 100644 --- a/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java +++ b/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java @@ -721,7 +721,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection { Socket plain = socket; // Secure the plain connection socket = context.getSocketFactory().createSocket(plain, - plain.getInetAddress().getHostAddress(), plain.getPort(), true); + host, plain.getPort(), true); // Initialize the reader and writer with the new secured version initReaderAndWriter();