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 | 63f9b95b7a11eedd552e93ca7ba0172d8fd2d505 (patch) | |
tree | 2b58558b0aebde8c9cee5e7cfbc78a9adf3a2f91 | |
parent | 9c2ff9ab3ed372494e14394065dd0b61d3b948b7 (diff) | |
download | qpid-python-63f9b95b7a11eedd552e93ca7ba0172d8fd2d505.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@1677224 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/cpp/src/qpid/client/windows/SaslFactory.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/qpid/cpp/src/qpid/client/windows/SaslFactory.cpp b/qpid/cpp/src/qpid/client/windows/SaslFactory.cpp index 25cae05543..ecaad4a730 100644 --- a/qpid/cpp/src/qpid/client/windows/SaslFactory.cpp +++ b/qpid/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; } |