diff options
| author | Alan Conway <aconway@apache.org> | 2013-12-05 20:21:30 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2013-12-05 20:21:30 +0000 |
| commit | ae253369fa099345d3839a53227845e86827bfae (patch) | |
| tree | 518fdc987720203a9e86c7d377957cb73206c5ba /qpid/cpp/src | |
| parent | 99023d40b640f426c01aae60e14462953276da5b (diff) | |
| download | qpid-python-ae253369fa099345d3839a53227845e86827bfae.tar.gz | |
QPID-3981: Windows C++ Broker fails ACL self tests
Most failures caused by a bug in NullAuthenticator, it was not adding the
default realm to user IDs that didn't already have a realm. This fixes 20 of the
23 failures for this test, 3 tests are still failing:
16: acl.ACLTests.test_connection_limits_by_ip_address ....................... fail
16: acl.ACLTests.test_connection_limits_cli_sets_all ........................ fail
16: acl.ACLTests.test_queue_per_user_quota .................................. fail
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1548268 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src')
| -rw-r--r-- | qpid/cpp/src/qpid/broker/windows/SaslAuthenticator.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/qpid/cpp/src/qpid/broker/windows/SaslAuthenticator.cpp b/qpid/cpp/src/qpid/broker/windows/SaslAuthenticator.cpp index 98c7516ebe..814c236712 100644 --- a/qpid/cpp/src/qpid/broker/windows/SaslAuthenticator.cpp +++ b/qpid/cpp/src/qpid/broker/windows/SaslAuthenticator.cpp @@ -43,6 +43,7 @@ class NullAuthenticator : public SaslAuthenticator { qpid::broker::amqp_0_10::Connection& connection; framing::AMQP_ClientProxy::Connection client; + string realm; public: NullAuthenticator(qpid::broker::amqp_0_10::Connection& connection); ~NullAuthenticator(); @@ -92,7 +93,8 @@ std::auto_ptr<SaslAuthenticator> SaslAuthenticator::createAuthenticator(qpid::br } } -NullAuthenticator::NullAuthenticator(qpid::broker::amqp_0_10::Connection& c) : connection(c), client(c.getOutput()) {} +NullAuthenticator::NullAuthenticator(qpid::broker::amqp_0_10::Connection& c) : + connection(c), client(c.getOutput()), realm("@"+c.getBroker().getOptions().realm) {} NullAuthenticator::~NullAuthenticator() {} void NullAuthenticator::getMechanisms(Array& mechanisms) @@ -101,6 +103,13 @@ void NullAuthenticator::getMechanisms(Array& mechanisms) mechanisms.add(boost::shared_ptr<FieldValue>(new Str16Value("PLAIN"))); } +namespace { +bool endsWith(const std::string& str, const std::string& ending) { + return (ending.size() <= str.size()) && + (str.compare(str.size() - ending.size(), ending.size(), ending) == 0); +} +} + void NullAuthenticator::start(const string& mechanism, const string* response) { QPID_LOG(warning, "SASL: No Authentication Performed"); @@ -110,6 +119,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); + if (!endsWith(uid, realm)) uid += realm; connection.setUserId(uid); } } else { |
