mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-25 07:42:06 +01:00
Make XMPPTCPConnection fail without a HostnameVerifier
This commit is contained in:
parent
7b3331dda0
commit
5f67345275
1 changed files with 3 additions and 1 deletions
|
@ -676,7 +676,9 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
||||||
sslSocket.startHandshake();
|
sslSocket.startHandshake();
|
||||||
|
|
||||||
final HostnameVerifier verifier = getConfiguration().getHostnameVerifier();
|
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());
|
throw new CertificateException("Hostname verification of certificate failed. Certificate does not authenticate " + getServiceName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue