summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/broker
diff options
context:
space:
mode:
authorCharles E. Rolke <chug@apache.org>2012-08-10 17:19:51 +0000
committerCharles E. Rolke <chug@apache.org>2012-08-10 17:19:51 +0000
commit83cd0d00a444d1e1b5f8e15135bf377eba03388d (patch)
tree3e188ba92b1c822b06732b3bedfa8ee4a59a20e1 /cpp/src/qpid/broker
parenta4c9bc20238bf256b919c8ba5c32c8b056130041 (diff)
downloadqpid-python-83cd0d00a444d1e1b5f8e15135bf377eba03388d.tar.gz
QPID-4142 C++ Broker connection counting gets usernames confused
when various auth mechanism are used. The issue is that the connection's userId is changed as the auth progresses. Also, the shadowed connections change differently from the non-shadowed connections. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1371772 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/broker')
-rw-r--r--cpp/src/qpid/broker/AclModule.h4
-rw-r--r--cpp/src/qpid/broker/Connection.cpp8
2 files changed, 12 insertions, 0 deletions
diff --git a/cpp/src/qpid/broker/AclModule.h b/cpp/src/qpid/broker/AclModule.h
index 7c180439cf..f1eb0fc5f9 100644
--- a/cpp/src/qpid/broker/AclModule.h
+++ b/cpp/src/qpid/broker/AclModule.h
@@ -145,6 +145,10 @@ namespace broker {
*/
virtual bool approveConnection (const Connection& connection)=0;
+ /** Change connection's counted userId
+ */
+ virtual void setUserId(const Connection& connection, const std::string& username)=0;
+
virtual ~AclModule() {};
};
} // namespace broker
diff --git a/cpp/src/qpid/broker/Connection.cpp b/cpp/src/qpid/broker/Connection.cpp
index 8d250a32e5..e68c906cc2 100644
--- a/cpp/src/qpid/broker/Connection.cpp
+++ b/cpp/src/qpid/broker/Connection.cpp
@@ -25,6 +25,7 @@
#include "qpid/broker/Bridge.h"
#include "qpid/broker/Broker.h"
#include "qpid/broker/Queue.h"
+#include "qpid/broker/AclModule.h"
#include "qpid/sys/SecuritySettings.h"
#include "qpid/sys/ClusterSafe.h"
@@ -278,6 +279,13 @@ void Connection::notifyConnectionForced(const string& text)
void Connection::setUserId(const string& userId)
{
+ // Account for changing userId
+ AclModule* acl = broker.getAcl();
+ if (acl)
+ {
+ acl->setUserId(*this, userId);
+ }
+
ConnectionState::setUserId(userId);
// In a cluster, the cluster code will raise the connect event
// when the connection is replicated to the cluster.