diff options
author | Charles E. Rolke <chug@apache.org> | 2014-07-18 19:28:10 +0000 |
---|---|---|
committer | Charles E. Rolke <chug@apache.org> | 2014-07-18 19:28:10 +0000 |
commit | 1f08d3e06b84afd145efde9dc501d430494e4acb (patch) | |
tree | af36c0f197eea0b449b3de35edf0f1e4b7fc9e88 | |
parent | 20735b99c966b71511c3094afaa4bbdccd66a2e3 (diff) | |
download | qpid-python-1f08d3e06b84afd145efde9dc501d430494e4acb.tar.gz |
QPID-4947: Injecting derived host address failed to strip IPv6 [] decoration
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1611776 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | cpp/src/qpid/acl/AclConnectionCounter.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/cpp/src/qpid/acl/AclConnectionCounter.cpp b/cpp/src/qpid/acl/AclConnectionCounter.cpp index 75cca29b02..0e780a95bc 100644 --- a/cpp/src/qpid/acl/AclConnectionCounter.cpp +++ b/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); |