mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-24 21:12:05 +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();
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue