aboutsummaryrefslogtreecommitdiff
path: root/source/QXmppStream.cpp
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2010-08-09 11:12:03 +0000
committerJeremy Lainé <jeremy.laine@m4x.org>2010-08-09 11:12:03 +0000
commitf5db6870fdbb0bf4e2577369866d3ad09a6e5574 (patch)
tree4d744c7de2fccb20eb4d8f0444ccb17ee4239111 /source/QXmppStream.cpp
parent1190f3c77074cb9236ca05762b891843d0a09de3 (diff)
downloadqxmpp-f5db6870fdbb0bf4e2577369866d3ad09a6e5574.tar.gz
check SSL is available before enabling TLS
Diffstat (limited to 'source/QXmppStream.cpp')
-rw-r--r--source/QXmppStream.cpp18
1 files changed, 13 insertions, 5 deletions
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