1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-24 23:32:05 +01:00

Make XMPPTCPConnection fail without a HostnameVerifier

This commit is contained in:
Georg Lukas 2014-07-26 21:55:52 +02:00 committed by Florian Schmaus
parent 7b3331dda0
commit 5f67345275

View file

@ -676,7 +676,9 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
sslSocket.startHandshake();
final HostnameVerifier verifier = getConfiguration().getHostnameVerifier();
if (verifier != null && !verifier.verify(getServiceName(), sslSocket.getSession())) {
if (verifier == null) {
throw new IllegalStateException("No HostnameVerifier set. Use connectionConfiguration.setHostnameVerifier() to configure.");
} else if (!verifier.verify(getServiceName(), sslSocket.getSession())) {
throw new CertificateException("Hostname verification of certificate failed. Certificate does not authenticate " + getServiceName());
}