summaryrefslogtreecommitdiff
path: root/qpid/cpp
diff options
context:
space:
mode:
authorCharles E. Rolke <chug@apache.org>2014-07-18 19:28:10 +0000
committerCharles E. Rolke <chug@apache.org>2014-07-18 19:28:10 +0000
commit60254f81d26c37339428162d8789f74dfb27f9d2 (patch)
treed2c4a6e7e0ce3b3d1804de51b47a4210d2d3435f /qpid/cpp
parentcc8050efba878ea8615afb18b065760105e25fe7 (diff)
downloadqpid-python-60254f81d26c37339428162d8789f74dfb27f9d2.tar.gz
QPID-4947: Injecting derived host address failed to strip IPv6 [] decoration
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1611776 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp')
-rw-r--r--qpid/cpp/src/qpid/acl/AclConnectionCounter.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/qpid/cpp/src/qpid/acl/AclConnectionCounter.cpp b/qpid/cpp/src/qpid/acl/AclConnectionCounter.cpp
index 75cca29b02..0e780a95bc 100644
--- a/qpid/cpp/src/qpid/acl/AclConnectionCounter.cpp
+++ b/qpid/cpp/src/qpid/acl/AclConnectionCounter.cpp
@@ -106,7 +106,7 @@ bool ConnectionCounter::countConnectionLH(
} else {
theMap[theName] = count = 1;
}
- if (enforceLimit) {
+ if (enforceLimit) {
result = count <= theLimit;
}
if (emitLog) {
@@ -230,7 +230,7 @@ bool ConnectionCounter::approveConnection(
//
// TODO: The global check could be run way back in AsynchIO where
// disapproval would mean that the socket is not accepted. Or
- // it may be accepted and closed right away without running any
+ // it may be accepted and closed right away without running any
// protocol and creating the connection churn that gets here.
//
sys::SocketAddress sa(hostName, "");
@@ -354,7 +354,12 @@ std::string ConnectionCounter::getClientHost(const std::string mgmtId)
size_t colon = mgmtId.find_last_of(':');
if (std::string::npos != colon) {
// trailing colon found
- return mgmtId.substr(hyphen+1, colon - hyphen - 1);
+ std::string tmp = mgmtId.substr(hyphen+1, colon - hyphen - 1);
+ // undecorate ipv6
+ if (tmp.length() >= 3 && tmp.find("[") == 0 && tmp.rfind("]") == tmp.length()-1)
+ tmp = tmp.substr(1, tmp.length()-2);
+ return tmp;
+
} else {
// colon not found - use everything after hyphen
return mgmtId.substr(hyphen+1);