From 2da66c9b0a5b3acd90049ee633d2ad557a080ec4 Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Tue, 21 Oct 2008 22:59:47 +0000 Subject: Qualify userid with realm when authentication is turned off git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@706806 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'qpid/cpp/src') diff --git a/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp b/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp index d0e0d5bead..1f9bd9c576 100644 --- a/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp +++ b/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp @@ -26,12 +26,15 @@ #include "Connection.h" #include "qpid/log/Statement.h" #include "qpid/framing/reply_exceptions.h" +#include #if HAVE_SASL #include #endif using namespace qpid::framing; +using boost::format; +using boost::str; namespace qpid { namespace broker { @@ -41,6 +44,7 @@ class NullAuthenticator : public SaslAuthenticator { Connection& connection; framing::AMQP_ClientProxy::Connection client; + std::string realm; public: NullAuthenticator(Connection& connection); ~NullAuthenticator(); @@ -119,7 +123,8 @@ std::auto_ptr SaslAuthenticator::createAuthenticator(Connecti } } -NullAuthenticator::NullAuthenticator(Connection& c) : connection(c), client(c.getOutput()) {} +NullAuthenticator::NullAuthenticator(Connection& c) : connection(c), client(c.getOutput()), + realm(c.getBroker().getOptions().realm) {} NullAuthenticator::~NullAuthenticator() {} void NullAuthenticator::getMechanisms(Array& mechanisms) @@ -136,7 +141,7 @@ void NullAuthenticator::start(const string& mechanism, const string& response) string::size_type i = temp.find((char)0); string uid = temp.substr(0, i); string pwd = temp.substr(i + 1); - connection.setUserId(uid); + connection.setUserId(str(format("%1%@%2%") % uid % realm)); } } else { connection.setUserId("anonymous"); -- cgit v1.2.1