From 73b8366617e350f0da161e3a7ed734e40d7b0f52 Mon Sep 17 00:00:00 2001 From: Jeremy Lainé Date: Mon, 9 Aug 2010 09:42:43 +0000 Subject: add support for SASL Anonymous authentication (issue #57) --- source/QXmppConfiguration.h | 11 ++++++----- source/QXmppStream.cpp | 6 ++++++ 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'source') diff --git a/source/QXmppConfiguration.h b/source/QXmppConfiguration.h index 8300da82..61df33c1 100644 --- a/source/QXmppConfiguration.h +++ b/source/QXmppConfiguration.h @@ -47,7 +47,7 @@ public: /// Depending upon all this user can specify following options. enum StreamSecurityMode { - TLSEnabled = 0, ///< Default, encryption is used if available + 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 @@ -58,8 +58,8 @@ public: /// specifying the mechanism is just a hint to the library. enum NonSASLAuthMechanism { - NonSASLPlain = 0,///< Plain - NonSASLDigest ///< Default, + NonSASLPlain = 0,///< Plain + NonSASLDigest ///< Digest (default) }; /// An enumeration for various SASL authentication mechanisms available. @@ -68,8 +68,9 @@ public: /// a mechanism. enum SASLAuthMechanism { - SASLPlain = 0, - SASLDigestMD5 ///< Default + SASLPlain = 0, ///< Plain + SASLDigestMD5, ///< Digest MD5 (default) + SASLAnonymous ///< Anonymous }; QXmppConfiguration(); diff --git a/source/QXmppStream.cpp b/source/QXmppStream.cpp index b888a521..d73e1392 100644 --- a/source/QXmppStream.cpp +++ b/source/QXmppStream.cpp @@ -375,6 +375,12 @@ void QXmppStream::parser(const QByteArray& data) sendAuthDigestMD5(); break; } + case QXmppConfiguration::SASLAnonymous: + if(mechanisms.contains("ANONYMOUS")) + { + sendToServer(""); + break; + } default: info("Desired SASL Auth mechanism not available trying the available ones"); if(mechanisms.contains("DIGEST-MD5")) -- cgit v1.2.3