From 63f9b95b7a11eedd552e93ca7ba0172d8fd2d505 Mon Sep 17 00:00:00 2001 From: "Charles E. Rolke" Date: Fri, 1 May 2015 20:48:56 +0000 Subject: 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@", 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 --- qpid/cpp/src/qpid/client/windows/SaslFactory.cpp | 18 ++++++++++++++---- 1 file 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; } -- cgit v1.2.1