Author: chug
Date: Fri May  1 20:48:56 2015
New Revision: 1677224

URL: http://svn.apache.org/r1677224
Log:
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.

Modified:
    qpid/trunk/qpid/cpp/src/qpid/client/windows/SaslFactory.cpp

Modified: qpid/trunk/qpid/cpp/src/qpid/client/windows/SaslFactory.cpp
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/client/windows/SaslFactory.cpp?rev=1677224&r1=1677223&r2=1677224&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/client/windows/SaslFactory.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/client/windows/SaslFactory.cpp Fri May  1 
20:48:56 2015
@@ -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::strin
     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;
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to