From f5db6870fdbb0bf4e2577369866d3ad09a6e5574 Mon Sep 17 00:00:00 2001 From: Jeremy Lainé Date: Mon, 9 Aug 2010 11:12:03 +0000 Subject: check SSL is available before enabling TLS --- source/QXmppStream.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'source') diff --git a/source/QXmppStream.cpp b/source/QXmppStream.cpp index 8c09132a..f2a4593f 100644 --- a/source/QXmppStream.cpp +++ b/source/QXmppStream.cpp @@ -318,17 +318,25 @@ void QXmppStream::parser(const QByteArray& data) // determine TLS mode to use const QXmppConfiguration::StreamSecurityMode localSecurity = configuration().streamSecurityMode(); + if (!m_socket.supportsSsl() && + (localSecurity == QXmppConfiguration::TLSRequired || + remoteSecurity == QXmppConfiguration::TLSRequired)) + { + warning("Disconnecting as TLS is required, but SSL support is not available"); + disconnect(); + return; + } if (localSecurity == QXmppConfiguration::TLSRequired && remoteSecurity == QXmppConfiguration::TLSDisabled) { - // disconnect as TLS is required by the client - // but not available on the server - warning("Disconnecting as TLS not available at the server"); + warning("Disconnecting as TLS is required, but not supported by the server"); disconnect(); return; } - if (remoteSecurity == QXmppConfiguration::TLSRequired || - localSecurity != QXmppConfiguration::TLSDisabled) + + if (m_socket.supportsSsl() && + (remoteSecurity == QXmppConfiguration::TLSRequired || + localSecurity != QXmppConfiguration::TLSDisabled)) { // enable TLS as it is required by the server // or supported by the client -- cgit v1.2.3