aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2010-08-09 09:42:43 +0000
committerJeremy Lainé <jeremy.laine@m4x.org>2010-08-09 09:42:43 +0000
commit73b8366617e350f0da161e3a7ed734e40d7b0f52 (patch)
tree8ddb5fd185f1cb439bac197aea9578c7a5b90e31 /source
parenta89181602654a01a36c0a67304d18a1d3ac83131 (diff)
downloadqxmpp-73b8366617e350f0da161e3a7ed734e40d7b0f52.tar.gz
add support for SASL Anonymous authentication (issue #57)
Diffstat (limited to 'source')
-rw-r--r--source/QXmppConfiguration.h11
-rw-r--r--source/QXmppStream.cpp6
2 files changed, 12 insertions, 5 deletions
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("<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='ANONYMOUS'/>");
+ break;
+ }
default:
info("Desired SASL Auth mechanism not available trying the available ones");
if(mechanisms.contains("DIGEST-MD5"))