diff options
| author | Charles E. Rolke <chug@apache.org> | 2012-07-15 10:17:26 +0000 |
|---|---|---|
| committer | Charles E. Rolke <chug@apache.org> | 2012-07-15 10:17:26 +0000 |
| commit | 1546cdee0c71494dfecd91bdec7055aa9dde34a8 (patch) | |
| tree | 3d16058f0fbef7a722ac49b212cc7ee2a8665b2a /cpp/src/qpid/acl/AclReader.cpp | |
| parent | 1a9c54d2d606d785123e532e1325ba29e9658371 (diff) | |
| download | qpid-python-1546cdee0c71494dfecd91bdec7055aa9dde34a8.tar.gz | |
QPID-3892 C++ broker add routing key wildcard support to Acl 'publish exchange' lookups. Although this patch does not address the original issue's regex request it provides the desired functionality in a more comprehensive manner.
* Acl publish exchange rules may specify routing keys using the topic exchange syntax with '*' and '#' wildcard match tokens.
* Acl lookups hook in to the broker's topic exchange key match code to perform the wildcard match.
* Acl rules written using the old Acl wildcard syntax (with a single trailing '*') will continue to work the same as before.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1361678 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/acl/AclReader.cpp')
| -rw-r--r-- | cpp/src/qpid/acl/AclReader.cpp | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/cpp/src/qpid/acl/AclReader.cpp b/cpp/src/qpid/acl/AclReader.cpp index 0830f3f4f4..f9be49b88d 100644 --- a/cpp/src/qpid/acl/AclReader.cpp +++ b/cpp/src/qpid/acl/AclReader.cpp @@ -101,7 +101,7 @@ namespace acl { << AclHelper::getAclResultStr(d->decisionMode)); foundmode = true; } else { - AclData::rule rule(cnt, (*i)->res, (*i)->props); + AclData::Rule rule(cnt, (*i)->res, (*i)->props); // Action -> Object -> map<user -> set<Rule> > std::ostringstream actionstr; @@ -110,8 +110,27 @@ namespace acl { (*i)->actionAll ? acnt++ : acnt = acl::ACTIONSIZE) { if (acnt == acl::ACT_PUBLISH) + { d->transferAcl = true; // we have transfer ACL - + // For Publish the only object should be Exchange + // and the only property should be routingkey. + // Go through the rule properties and find the name and the key. + // If found then place them specially for the lookup engine. + for (pmCitr pItr=(*i)->props.begin(); pItr!=(*i)->props.end(); pItr++) { + if (acl::SPECPROP_ROUTINGKEY == pItr->first) + { + rule.pubRoutingKeyInRule = true; + rule.pubRoutingKey = (std::string)pItr->second; + rule.addTopicTest(rule.pubRoutingKey); + break; + } + if (acl::SPECPROP_NAME == pItr->first) + { + rule.pubExchNameInRule = true; + rule.pubExchName = pItr->second; + } + } + } actionstr << AclHelper::getActionStr((Action) acnt) << ","; //find the Action, create if not exist @@ -285,7 +304,7 @@ namespace acl { if (ws) { ret = true; } else { - errorStream << ACL_FORMAT_ERR_LOG_PREFIX << "Line : " << lineNumber + errorStream << ACL_FORMAT_ERR_LOG_PREFIX << "Line : " << lineNumber << ", Non-continuation line must start with \"group\" or \"acl\"."; ret = false; } @@ -330,7 +349,7 @@ namespace acl { } else { const unsigned minimumSize = (cont ? 2 : 3); if (toksSize < minimumSize) { - errorStream << ACL_FORMAT_ERR_LOG_PREFIX << "Line : " << lineNumber + errorStream << ACL_FORMAT_ERR_LOG_PREFIX << "Line : " << lineNumber << ", Insufficient tokens for group definition."; return false; } @@ -479,7 +498,7 @@ namespace acl { nvPair propNvp = splitNameValuePair(toks[i]); if (propNvp.second.size() == 0) { errorStream << ACL_FORMAT_ERR_LOG_PREFIX << "Line : " << lineNumber - <<", Badly formed property name-value pair \"" + <<", Badly formed property name-value pair \"" << propNvp.first << "\". (Must be name=value)"; return false; } |
