diff options
| author | Jeremy Lainé <jeremy.laine@m4x.org> | 2010-02-11 08:04:05 +0000 |
|---|---|---|
| committer | Jeremy Lainé <jeremy.laine@m4x.org> | 2010-02-11 08:04:05 +0000 |
| commit | 4e325a8574e4823d8b9ef270974d7514ec5d396e (patch) | |
| tree | dc3f8aebbee378c4652f1c0b7449a17f28bd4ffb /source | |
| parent | 1fceaa86f263122c90fd9e7e3a85cb05a0fc505f (diff) | |
| download | qxmpp-4e325a8574e4823d8b9ef270974d7514ec5d396e.tar.gz | |
add a configuration item to decide whether to ignore SSL errors (issue #42)
Diffstat (limited to 'source')
| -rw-r--r-- | source/QXmppConfiguration.cpp | 17 | ||||
| -rw-r--r-- | source/QXmppConfiguration.h | 5 | ||||
| -rw-r--r-- | source/QXmppStream.cpp | 4 |
3 files changed, 25 insertions, 1 deletions
diff --git a/source/QXmppConfiguration.cpp b/source/QXmppConfiguration.cpp index 279cbe65..0ab584cc 100644 --- a/source/QXmppConfiguration.cpp +++ b/source/QXmppConfiguration.cpp @@ -32,6 +32,7 @@ QXmppConfiguration::QXmppConfiguration() : m_port(5222), m_keepAlivePingsInterval(100), m_autoReconnectionEnabled(true), m_useSASLAuthentication(true), + m_ignoreSslErrors(true), m_streamSecurityMode(QXmppConfiguration::TLSEnabled), m_nonSASLAuthMechanism(QXmppConfiguration::NonSASLDigest), m_SASLAuthMechanism(QXmppConfiguration::SASLDigestMD5) @@ -133,6 +134,22 @@ void QXmppConfiguration::setAutoReconnectionEnabled(bool value) m_autoReconnectionEnabled = value; } +/// Returns whether SSL errors (such as certificate validation errors) +/// are to be ignored when connecting to the XMPP server. + +bool QXmppConfiguration::getIgnoreSslErrors() const +{ + return m_ignoreSslErrors; +} + +/// Specifies whether SSL errors (such as certificate validation errors) +/// are to be ignored when connecting to an XMPP server. + +void QXmppConfiguration::setIgnoreSslErrors(bool value) +{ + m_ignoreSslErrors = value; +} + /// Returns the type of authentication system specified by the user. /// \return true if SASL was specified else false. If the specified /// system is not available QXmpp will resort to the other one. diff --git a/source/QXmppConfiguration.h b/source/QXmppConfiguration.h index a1d0c0e7..d9ff059c 100644 --- a/source/QXmppConfiguration.h +++ b/source/QXmppConfiguration.h @@ -90,6 +90,9 @@ public: bool getUseSASLAuthentication() const; void setUseSASLAuthentication(bool); + bool getIgnoreSslErrors() const; + void setIgnoreSslErrors(bool); + QXmppConfiguration::StreamSecurityMode getStreamSecurityMode() const; void setStreamSecurityMode(QXmppConfiguration::StreamSecurityMode mode); @@ -124,6 +127,8 @@ private: ///< to be used ///< defualt is true and use SASL ///< false would use NonSASL if available + // default is true + bool m_ignoreSslErrors; StreamSecurityMode m_streamSecurityMode; NonSASLAuthMechanism m_nonSASLAuthMechanism; diff --git a/source/QXmppStream.cpp b/source/QXmppStream.cpp index c0bc03d3..f0b9f91c 100644 --- a/source/QXmppStream.cpp +++ b/source/QXmppStream.cpp @@ -140,9 +140,11 @@ void QXmppStream::connect() void QXmppStream::socketSslErrors(const QList<QSslError> & error) { log(QString("SSL errors")); - m_socket.ignoreSslErrors(); for(int i = 0; i< error.count(); ++i) log(error.at(i).errorString()); + + if (getConfiguration().getIgnoreSslErrors()) + m_socket.ignoreSslErrors(); } void QXmppStream::socketHostFound() |
