summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/acl/AclData.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/qpid/acl/AclData.cpp')
-rw-r--r--cpp/src/qpid/acl/AclData.cpp46
1 files changed, 18 insertions, 28 deletions
diff --git a/cpp/src/qpid/acl/AclData.cpp b/cpp/src/qpid/acl/AclData.cpp
index a03d5b4d55..f7143c33c1 100644
--- a/cpp/src/qpid/acl/AclData.cpp
+++ b/cpp/src/qpid/acl/AclData.cpp
@@ -26,22 +26,12 @@ namespace acl {
AclData::AclData():decisionMode(qpid::acl::DENY),transferAcl(false),aclSource("UNKNOWN")
{
- for (unsigned int cnt=0; cnt< qpid::acl::ACTIONSIZE; cnt++){
- actionList[cnt]=0;
- }
-
+ actionList.resize(qpid::acl::ACTIONSIZE);
}
void AclData::clear ()
{
- for (unsigned int cnt=0; cnt< qpid::acl::ACTIONSIZE; cnt++){
- if (actionList[cnt]){
- for (unsigned int cnt1=0; cnt1< qpid::acl::OBJECTSIZE; cnt1++)
- delete actionList[cnt][cnt1];
- }
- delete[] actionList[cnt];
- }
-
+ actionList.clear();
}
bool AclData::matchProp(const std::string & src, const std::string& src1)
@@ -62,21 +52,21 @@ AclResult AclData::lookup(const std::string& id, const Action& action, const Obj
<< " with params " << AclHelper::propertyMapToString(params));
AclResult aclresult = decisionMode;
- if (actionList[action] && actionList[action][objType]) {
- AclData::actObjItr itrRule = actionList[action][objType]->find(id);
- if (itrRule == actionList[action][objType]->end())
- itrRule = actionList[action][objType]->find("*");
+ if (!actionList[action].empty() && !actionList[action][objType].empty()) {
+ AclData::ActObjItr itrRule = actionList[action][objType].find(id);
+ if (itrRule == actionList[action][objType].end())
+ itrRule = actionList[action][objType].find("*");
- if (itrRule != actionList[action][objType]->end()) {
+ if (itrRule != actionList[action][objType].end()) {
QPID_LOG(debug, "ACL: checking the following rules for : " << itrRule->first );
//loop the vector
- for (ruleSetItr i = itrRule->second.begin(); i < itrRule->second.end(); i++) {
+ for (RuleSetItr i = itrRule->second.begin(); i < itrRule->second.end(); i++) {
QPID_LOG(debug, "ACL: checking rule " << i->toString());
// loop the names looking for match
bool match = true;
- for (propertyMapItr pMItr = i->props.begin(); (pMItr != i->props.end()) && match; pMItr++) {
+ for (PropertyMapItr pMItr = i->props.begin(); (pMItr != i->props.end()) && match; pMItr++) {
//match name is exists first
if (pMItr->first == acl::PROP_NAME) {
if (matchProp(pMItr->second, name)){
@@ -88,7 +78,7 @@ AclResult AclData::lookup(const std::string& id, const Action& action, const Obj
<< pMItr->second << "' given in the rule");
}
} else if (params) { //match pMItr against params
- propertyMapItr paramItr = params->find(pMItr->first);
+ PropertyMapItr paramItr = params->find(pMItr->first);
if (paramItr == params->end()) {
match = false;
QPID_LOG(debug, "ACL: the given parameter map in lookup doesn't contain the property '"
@@ -172,24 +162,24 @@ AclResult AclData::lookup(const std::string& id, const Action& action, const Obj
<< " with routing key " << RoutingKey);
AclResult aclresult = decisionMode;
-
- if (actionList[action] && actionList[action][objType]){
- AclData::actObjItr itrRule = actionList[action][objType]->find(id);
+
+ if (!actionList[action].empty() && !actionList[action][objType].empty()) {
+ AclData::ActObjItr itrRule = actionList[action][objType].find(id);
- if (itrRule == actionList[action][objType]->end())
- itrRule = actionList[action][objType]->find("*");
+ if (itrRule == actionList[action][objType].end())
+ itrRule = actionList[action][objType].find("*");
- if (itrRule != actionList[action][objType]->end() ) {
+ if (itrRule != actionList[action][objType].end() ) {
QPID_LOG(debug, "ACL: checking the following rules for : " << itrRule->first );
//loop the vector
- for (ruleSetItr i=itrRule->second.begin(); i<itrRule->second.end(); i++) {
+ for (RuleSetItr i=itrRule->second.begin(); i<itrRule->second.end(); i++) {
QPID_LOG(debug, "ACL: checking rule " << i->toString());
// loop the names looking for match
bool match =true;
- for (propertyMapItr pMItr = i->props.begin(); (pMItr != i->props.end()) && match; pMItr++)
+ for (PropertyMapItr pMItr = i->props.begin(); (pMItr != i->props.end()) && match; pMItr++)
{
//match name is exists first
if (pMItr->first == acl::PROP_NAME){