Set security error status on TLS cert mismatch

This commit is contained in:
Sam Whited 2014-11-15 11:40:41 -05:00
parent d2388a5a7e
commit 17cec63c14
1 changed files with 7 additions and 6 deletions

View File

@ -593,12 +593,13 @@ public class XmppConnection implements Runnable {
}
sslSocket.setEnabledProtocols(supportProtocols);
if (verifier != null
&& !verifier.verify(account.getServer().getDomainpart(),
sslSocket.getSession())) {
sslSocket.close();
throw new IOException("host mismatch in TLS connection");
}
if (verifier != null
&& !verifier.verify(account.getServer().getDomainpart(),
sslSocket.getSession())) {
account.setStatus(Account.State.SECURITY_ERROR);
sslSocket.close();
throw new IOException("Host mismatch in TLS connection");
}
tagReader.setInputStream(sslSocket.getInputStream());
tagWriter.setOutputStream(sslSocket.getOutputStream());
sendStartStream();