diff options
author | Charles E. Rolke <chug@apache.org> | 2015-05-01 20:48:56 +0000 |
---|---|---|
committer | Charles E. Rolke <chug@apache.org> | 2015-05-01 20:48:56 +0000 |
commit | 388040f927b3f3c617f67f24dad410c86f100c8e (patch) | |
tree | fb30bb4d0ad32f08541215dd98c3f2ffc6a66f03 /cpp | |
parent | 4d9c275a63e976fc411d2c02014e002161811c47 (diff) | |
download | qpid-python-388040f927b3f3c617f67f24dad410c86f100c8e.tar.gz |
QPID-6511: AMQP 0.10 windows clients cannot connect to no-auth qpidd broker.
1. Do not negotiate SASL EXTERNAL or PLAIN if no username is
specified. Note that a blank PLAIN password is allowed.
2. If SASL ANONYMOUS is negotiated then return a response of
"anonymous@<hostname>", which is what the linux client returns.
The client provides a username for the host in all cases.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1677224 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/qpid/client/windows/SaslFactory.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/cpp/src/qpid/client/windows/SaslFactory.cpp b/cpp/src/qpid/client/windows/SaslFactory.cpp index 25cae05543..ecaad4a730 100644 --- a/cpp/src/qpid/client/windows/SaslFactory.cpp +++ b/cpp/src/qpid/client/windows/SaslFactory.cpp @@ -27,6 +27,7 @@ #include "qpid/sys/SecuritySettings.h" #include "qpid/log/Statement.h" #include "qpid/NullSaslServer.h" +#include "qpid/sys/SystemInfo.h" #include "boost/tokenizer.hpp" @@ -153,17 +154,26 @@ bool WindowsSasl::start(const std::string& mechanisms, std::string& response, if (!haveAnon && !havePlain && !haveExt) throw InternalErrorException(QPID_MSG("Sasl error: no common mechanism")); - if (haveExt) { + if (haveExt && settings.username.size() > 0) { mechanism = EXTERNAL; response = ((char)0) + settings.username.c_str(); } - else if (havePlain) { + else if (havePlain && settings.username.size() > 0) { mechanism = PLAIN; response = ((char)0) + settings.username + ((char)0) + settings.password; } - else { + else if (haveAnon) { + std::string osName; + std::string nodeName; + std::string release; + std::string version; + std::string machine; + qpid::sys::SystemInfo::getSystemId(osName, nodeName, release, version, machine); + mechanism = ANONYMOUS; - response = ""; + response = "anonymous@" + nodeName; + } else { + throw InternalErrorException(QPID_MSG("Sasl error: no user name specified")); } return true; } |