diff options
| author | Jeremy Lainé <jeremy.laine@m4x.org> | 2014-04-06 12:21:40 +0200 |
|---|---|---|
| committer | Jeremy Lainé <jeremy.laine@m4x.org> | 2014-04-06 12:21:40 +0200 |
| commit | 88e35246fed9345f540e7f6eb749097fd74f5cfb (patch) | |
| tree | 0bb469a350c2be7febc5c7dde128e9ba58b411c9 | |
| parent | 89abcd28004dec5011cfa597a923ead8c542eb0d (diff) | |
| download | qxmpp-88e35246fed9345f540e7f6eb749097fd74f5cfb.tar.gz | |
add support for legacy SSL
| -rw-r--r-- | CHANGELOG | 3 | ||||
| -rw-r--r-- | src/client/QXmppConfiguration.h | 9 | ||||
| -rw-r--r-- | src/client/QXmppOutgoingClient.cpp | 11 |
3 files changed, 18 insertions, 5 deletions
@@ -1,9 +1,12 @@ QXmpp 0.8.1 (UNRELEASED) +------------------------ - Use QString() instead of "" for default methods arguments, to enable building project which use QT_NO_CAST_FROM_ASCII. + - Add support for legacy SSL. QXmpp 0.8.0 (Mar 26, 2014) +-------------------------- - Fix QXmppServer incoming connections with Qt5 (issue 175). - Support for QXmppMessage extensions having tag names other than 'x'. diff --git a/src/client/QXmppConfiguration.h b/src/client/QXmppConfiguration.h index 513075c3..0de57e79 100644 --- a/src/client/QXmppConfiguration.h +++ b/src/client/QXmppConfiguration.h @@ -53,10 +53,11 @@ public: /// Depending upon all this user can specify following options. enum StreamSecurityMode { - TLSEnabled = 0, ///< Encryption is used if available (default) - TLSDisabled, ///< No encryption is server allows - TLSRequired ///< Encryption is a must otherwise connection would not - ///< be established + TLSEnabled = 0, ///< Encryption is used if available (default). + TLSDisabled, ///< No encryption even if the server offers it. + TLSRequired, ///< Encryption must be available, otherwise the + ///< connection will not be established. + LegacySSL ///< Use only legacy SSL mode. }; /// An enumeration for various Non-SASL authentication mechanisms available. diff --git a/src/client/QXmppOutgoingClient.cpp b/src/client/QXmppOutgoingClient.cpp index 0ee1d1af..666b0365 100644 --- a/src/client/QXmppOutgoingClient.cpp +++ b/src/client/QXmppOutgoingClient.cpp @@ -129,7 +129,16 @@ void QXmppOutgoingClientPrivate::connectToHost(const QString &host, quint16 port #endif // connect to host - q->socket()->connectToHost(host, port); + const QXmppConfiguration::StreamSecurityMode localSecurity = q->configuration().streamSecurityMode(); + if (localSecurity == QXmppConfiguration::LegacySSL) { + if (!q->socket()->supportsSsl()) { + q->warning("Not connecting as legacy SSL was requested, but SSL support is not available"); + return; + } + q->socket()->connectToHostEncrypted(host, port); + } else { + q->socket()->connectToHost(host, port); + } } /// Constructs an outgoing client stream. |
