1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-12-22 10:37:59 +01:00

Fix XMPPTCPConnection.setEnabledSSL(Protocols|Ciphers)

The problem caused by opening input/ output stream before setting ssl
parameters to SSLSession and fixed by changing order of this operations.

Fixes SMACK-712.

Minor-Modifications-By: Florian Schmaus <flo@geekplace.eu>
This commit is contained in:
Tomas Nosek 2016-02-08 10:07:14 +01:00 committed by Florian Schmaus
parent bcdfb5398a
commit cf3024668e

View file

@ -751,12 +751,16 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
// Secure the plain connection
socket = context.getSocketFactory().createSocket(plain,
host, plain.getPort(), true);
// Initialize the reader and writer with the new secured version
initReaderAndWriter();
final SSLSocket sslSocket = (SSLSocket) socket;
// Immediately set the enabled SSL protocols and ciphers. See SMACK-712 why this is
// important (at least on certain platforms) and it seems to be a good idea anyways to
// prevent an accidental implicit handshake.
TLSUtils.setEnabledProtocolsAndCiphers(sslSocket, config.getEnabledSSLProtocols(), config.getEnabledSSLCiphers());
// Initialize the reader and writer with the new secured version
initReaderAndWriter();
// Proceed to do the handshake
sslSocket.startHandshake();