From 2ceadc0de106a25012c5bcae1665a96764006d4f Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Thu, 16 May 2019 16:50:47 +0200 Subject: [PATCH] Introduce verificationSuccessful boolean --- .../java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java | 6 +++++- 1 file changed, 5 insertions(+), 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 0329ef4b1..405b06d23 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 @@ -879,7 +879,11 @@ public class XMPPTCPConnection extends AbstractXMPPConnection { verifierHostname = getXMPPServiceDomain().toString(); } } - if (!verifier.verify(verifierHostname, sslSocket.getSession())) { + + final boolean verificationSuccessful; + // Verify the TLS session. + verificationSuccessful = verifier.verify(verifierHostname, sslSocket.getSession()); + if (!verificationSuccessful) { throw new CertificateException( "Hostname verification of certificate failed. Certificate does not authenticate " + getXMPPServiceDomain());