diff options
Diffstat (limited to 'cpp/src/qpid')
-rw-r--r-- | cpp/src/qpid/acl/Acl.cpp | 10 | ||||
-rw-r--r-- | cpp/src/qpid/acl/Acl.h | 6 | ||||
-rw-r--r-- | cpp/src/qpid/acl/AclData.cpp | 32 | ||||
-rw-r--r-- | cpp/src/qpid/acl/AclData.h | 12 | ||||
-rw-r--r-- | cpp/src/qpid/acl/AclReader.h | 2 | ||||
-rw-r--r-- | cpp/src/qpid/acl/AclValidator.cpp | 24 | ||||
-rw-r--r-- | cpp/src/qpid/acl/AclValidator.h | 18 | ||||
-rw-r--r-- | cpp/src/qpid/broker/AclModule.h | 10 |
8 files changed, 57 insertions, 57 deletions
diff --git a/cpp/src/qpid/acl/Acl.cpp b/cpp/src/qpid/acl/Acl.cpp index a4cc24cc65..6f758e46bf 100644 --- a/cpp/src/qpid/acl/Acl.cpp +++ b/cpp/src/qpid/acl/Acl.cpp @@ -74,7 +74,7 @@ bool Acl::authorise( std::map<Property, std::string>* params) { boost::shared_ptr<AclData> dataLocal; - { + { Mutex::ScopedLock locker(dataLock); dataLocal = data; //rcu copy } @@ -114,7 +114,7 @@ bool Acl::result( const std::string& name) { bool result(false); - + switch (aclreslt) { case ALLOWLOG: @@ -159,7 +159,7 @@ bool Acl::readAclFile(std::string& errorText) return readAclFile(aclValues.aclFile, errorText); } -bool Acl::readAclFile(std::string& aclFile, std::string& errorText) { +bool Acl::readAclFile(std::string& aclFile, std::string& errorText) { boost::shared_ptr<AclData> d(new AclData); AclReader ar; if (ar.read(aclFile, d)){ @@ -172,7 +172,7 @@ bool Acl::readAclFile(std::string& aclFile, std::string& errorText) { AclValidator validator; validator.validate(d); - { + { Mutex::ScopedLock locker(dataLock); data = d; } @@ -182,7 +182,7 @@ bool Acl::readAclFile(std::string& aclFile, std::string& errorText) { QPID_LOG(debug,"ACL: Transfer ACL is Enabled!"); } - data->aclSource = aclFile; + data->aclSource = aclFile; if (mgmtObject!=0){ mgmtObject->set_transferAcl(transferAcl?1:0); mgmtObject->set_policyFile(aclFile); diff --git a/cpp/src/qpid/acl/Acl.h b/cpp/src/qpid/acl/Acl.h index 74b0872f11..cc90fa4097 100644 --- a/cpp/src/qpid/acl/Acl.h +++ b/cpp/src/qpid/acl/Acl.h @@ -56,15 +56,15 @@ private: boost::shared_ptr<AclData> data; qmf::org::apache::qpid::acl::Acl* mgmtObject; // mgnt owns lifecycle qpid::management::ManagementAgent* agent; - mutable qpid::sys::Mutex dataLock; + mutable qpid::sys::Mutex dataLock; public: Acl (AclValues& av, broker::Broker& b); void initialize(); - + inline virtual bool doTransferAcl() {return transferAcl;}; - + // create specilied authorise methods for cases that need faster matching as needed. virtual bool authorise( const std::string& id, diff --git a/cpp/src/qpid/acl/AclData.cpp b/cpp/src/qpid/acl/AclData.cpp index 30e4b67dcc..03a8a19db9 100644 --- a/cpp/src/qpid/acl/AclData.cpp +++ b/cpp/src/qpid/acl/AclData.cpp @@ -38,7 +38,7 @@ namespace acl { } } - + // // clear // @@ -49,7 +49,7 @@ namespace acl { if (actionList[cnt]) { for (unsigned int cnt1=0; cnt1< qpid::acl::OBJECTSIZE; cnt1++) - delete actionList[cnt][cnt1]; + delete actionList[cnt][cnt1]; } delete[] actionList[cnt]; } @@ -105,7 +105,7 @@ namespace acl { // with params { durable=false passive=false autodelete=false // exclusive=false alternate= policytype= maxqueuesize=0 // maxqueuecount=0 } - + // Default result is blanket decision mode for the entire ACL list. AclResult aclresult = decisionMode; @@ -138,7 +138,7 @@ namespace acl { // in the lookup param list. The lookup may specify things // (they usually do) that are not in the rule properties but // these things don't interfere with the rule match. - + for (specPropertyMapItr rulePropMapItr = rsItr->props.begin(); (rulePropMapItr != rsItr->props.end()) && match; rulePropMapItr++) @@ -186,7 +186,7 @@ namespace acl { lookupParamItr = params->find((Property)rulePropMapItr->first); break; }; - + if (lookupParamItr == params->end()) { // Now the rule has a specified property @@ -348,7 +348,7 @@ namespace acl { { case acl::SPECPROP_NAME: if (matchProp(pMItr->second, name)) - { + { QPID_LOG(debug, "ACL: lookup exchange name '" << name << "' matched with rule name '" << pMItr->second << "'"); @@ -415,10 +415,10 @@ namespace acl { bool AclData::compareIntMax(const qpid::acl::SpecProperty theProperty, const std::string theAclValue, const std::string theLookupValue) - { + { uint64_t aclMax (0); uint64_t paramMax (0); - + try { aclMax = boost::lexical_cast<uint64_t>(theAclValue); @@ -428,7 +428,7 @@ namespace acl { assert (false); return false; } - + try { paramMax = boost::lexical_cast<uint64_t>(theLookupValue); @@ -441,12 +441,12 @@ namespace acl { << "' : " << theLookupValue); return false; } - + QPID_LOG(debug, "ACL: Numeric greater-than comparison for property " << AclHelper::getPropertyStr(theProperty) << " (value given in lookup = " << theLookupValue << ", value give in rule = " << theAclValue << " )"); - + if (( aclMax ) && ( paramMax == 0 || paramMax > aclMax)) { QPID_LOG(debug, "ACL: Max limit exceeded for property '" @@ -467,7 +467,7 @@ namespace acl { { uint64_t aclMin (0); uint64_t paramMin (0); - + try { aclMin = boost::lexical_cast<uint64_t>(theAclValue); @@ -477,7 +477,7 @@ namespace acl { assert (false); return false; } - + try { paramMin = boost::lexical_cast<uint64_t>(theLookupValue); @@ -490,19 +490,19 @@ namespace acl { << "' : " << theLookupValue); return false; } - + QPID_LOG(debug, "ACL: Numeric less-than comparison for property " << AclHelper::getPropertyStr(theProperty) << " (value given in lookup = " << theLookupValue << ", value give in rule = " << theAclValue << " )"); - + if (( aclMin ) && ( paramMin == 0 || paramMin < aclMin)) { QPID_LOG(debug, "ACL: Min limit exceeded for property '" << AclHelper::getPropertyStr(theProperty) << "'"); return false; } - + return true; } diff --git a/cpp/src/qpid/acl/AclData.h b/cpp/src/qpid/acl/AclData.h index 751062817b..1c1cb3e9c6 100644 --- a/cpp/src/qpid/acl/AclData.h +++ b/cpp/src/qpid/acl/AclData.h @@ -34,7 +34,7 @@ public: typedef std::map<qpid::acl::Property, std::string> propertyMap; typedef propertyMap::const_iterator propertyMapItr; - + typedef std::map<qpid::acl::SpecProperty, std::string> specPropertyMap; typedef specPropertyMap::const_iterator specPropertyMapItr; @@ -52,7 +52,7 @@ public: int rawRuleNum; // rule number in ACL file qpid::acl::AclResult ruleMode; // combined allow/deny log/nolog - specPropertyMap props; // + specPropertyMap props; // rule (int ruleNum, qpid::acl::AclResult res, specPropertyMap& p) : @@ -77,10 +77,10 @@ public: return ruleStr.str(); } }; - + typedef std::vector<rule> ruleSet; typedef ruleSet::const_iterator ruleSetItr; - typedef std::map<std::string, ruleSet > actionObject; // user + typedef std::map<std::string, ruleSet > actionObject; // user typedef actionObject::iterator actObjItr; typedef actionObject* aclAction; @@ -88,7 +88,7 @@ public: aclAction* actionList[qpid::acl::ACTIONSIZE]; qpid::acl::AclResult decisionMode; // allow/deny[-log] if no matching rule found bool transferAcl; - std::string aclSource; + std::string aclSource; AclResult lookup( const std::string& id, // actor id @@ -96,7 +96,7 @@ public: const ObjectType& objType, const std::string& name, // object name std::map<Property, std::string>* params=0); - + AclResult lookup( const std::string& id, // actor id const Action& action, diff --git a/cpp/src/qpid/acl/AclReader.h b/cpp/src/qpid/acl/AclReader.h index beeedf953a..730013f4ed 100644 --- a/cpp/src/qpid/acl/AclReader.h +++ b/cpp/src/qpid/acl/AclReader.h @@ -54,7 +54,7 @@ class AclReader { class aclRule { public: enum objectStatus {NONE, VALUE, ALL}; - + AclResult res; nameSet names; bool actionAll; // True if action is set to keyword "all" diff --git a/cpp/src/qpid/acl/AclValidator.cpp b/cpp/src/qpid/acl/AclValidator.cpp index d9ce3734ea..49bb65db4b 100644 --- a/cpp/src/qpid/acl/AclValidator.cpp +++ b/cpp/src/qpid/acl/AclValidator.cpp @@ -29,7 +29,7 @@ namespace qpid { namespace acl { - AclValidator::IntPropertyType::IntPropertyType(int64_t i,int64_t j) : min(i), max(j){ + AclValidator::IntPropertyType::IntPropertyType(int64_t i,int64_t j) : min(i), max(j){ } bool AclValidator::IntPropertyType::validate(const std::string& val) { @@ -49,12 +49,12 @@ namespace acl { } std::string AclValidator::IntPropertyType::allowedValues() { - return "values should be between " + + return "values should be between " + boost::lexical_cast<std::string>(min) + " and " + boost::lexical_cast<std::string>(max); } - AclValidator::EnumPropertyType::EnumPropertyType(std::vector<std::string>& allowed): values(allowed){ + AclValidator::EnumPropertyType::EnumPropertyType(std::vector<std::string>& allowed): values(allowed){ } bool AclValidator::EnumPropertyType::validate(const std::string& val) { @@ -89,11 +89,11 @@ namespace acl { validators.insert(Validator(acl::SPECPROP_MAXQUEUECOUNTLOWERLIMIT, boost::shared_ptr<PropertyType>( new IntPropertyType(0,std::numeric_limits<int64_t>::max())))); - + validators.insert(Validator(acl::SPECPROP_MAXQUEUECOUNTUPPERLIMIT, boost::shared_ptr<PropertyType>( new IntPropertyType(0,std::numeric_limits<int64_t>::max())))); - + std::string policyTypes[] = {"ring", "ring_strict", "flow_to_disk", "reject"}; std::vector<std::string> v(policyTypes, policyTypes + sizeof(policyTypes) / sizeof(std::string)); validators.insert(Validator(acl::SPECPROP_POLICYTYPE, @@ -118,8 +118,8 @@ namespace acl { std::for_each(d->actionList[cnt][cnt1]->begin(), d->actionList[cnt][cnt1]->end(), - boost::bind(&AclValidator::validateRuleSet, this, _1)); - }//if + boost::bind(&AclValidator::validateRuleSet, this, _1)); + }//if }//for }//if }//for @@ -128,13 +128,13 @@ namespace acl { void AclValidator::validateRuleSet(std::pair<const std::string, qpid::acl::AclData::ruleSet>& rules){ std::for_each(rules.second.begin(), rules.second.end(), - boost::bind(&AclValidator::validateRule, this, _1)); + boost::bind(&AclValidator::validateRule, this, _1)); } void AclValidator::validateRule(qpid::acl::AclData::rule& rule){ std::for_each(rule.props.begin(), rule.props.end(), - boost::bind(&AclValidator::validateProperty, this, _1)); + boost::bind(&AclValidator::validateProperty, this, _1)); } void AclValidator::validateProperty(std::pair<const qpid::acl::SpecProperty, std::string>& prop){ @@ -146,11 +146,11 @@ namespace acl { if (!itr->second->validate(prop.second)){ QPID_LOG(debug, "ACL: Property failed validation. '" << prop.second << "' is not a valid value for '" << AclHelper::getPropertyStr(prop.first) << "'"); - - throw Exception( prop.second + " is not a valid value for '" + + + throw Exception( prop.second + " is not a valid value for '" + AclHelper::getPropertyStr(prop.first) + "', " + itr->second->allowedValues()); - } + } } } diff --git a/cpp/src/qpid/acl/AclValidator.h b/cpp/src/qpid/acl/AclValidator.h index 414f6181d2..f85c241b06 100644 --- a/cpp/src/qpid/acl/AclValidator.h +++ b/cpp/src/qpid/acl/AclValidator.h @@ -33,18 +33,18 @@ namespace acl { class AclValidator { /* Base Property */ - class PropertyType{ - + class PropertyType{ + public: virtual ~PropertyType(){}; virtual bool validate(const std::string& val)=0; virtual std::string allowedValues()=0; }; - class IntPropertyType : public PropertyType{ + class IntPropertyType : public PropertyType{ int64_t min; int64_t max; - + public: IntPropertyType(int64_t min,int64_t max); virtual ~IntPropertyType (){}; @@ -53,7 +53,7 @@ class AclValidator { }; class EnumPropertyType : public PropertyType{ - std::vector<std::string> values; + std::vector<std::string> values; public: EnumPropertyType(std::vector<std::string>& allowed); @@ -61,11 +61,11 @@ class AclValidator { virtual bool validate(const std::string& val); virtual std::string allowedValues(); }; - + typedef std::pair<acl::SpecProperty,boost::shared_ptr<PropertyType> > Validator; typedef std::map<acl::SpecProperty,boost::shared_ptr<PropertyType> > ValidatorMap; typedef ValidatorMap::iterator ValidatorItr; - + ValidatorMap validators; public: @@ -73,11 +73,11 @@ public: void validateRuleSet(std::pair<const std::string, qpid::acl::AclData::ruleSet>& rules); void validateRule(qpid::acl::AclData::rule& rule); void validateProperty(std::pair<const qpid::acl::SpecProperty, std::string>& prop); - void validate(boost::shared_ptr<AclData> d); + void validate(boost::shared_ptr<AclData> d); AclValidator(); ~AclValidator(); }; - + }} // namespace qpid::acl #endif // QPID_ACL_ACLVALIDATOR_H diff --git a/cpp/src/qpid/broker/AclModule.h b/cpp/src/qpid/broker/AclModule.h index a168fe6f90..be143a23e7 100644 --- a/cpp/src/qpid/broker/AclModule.h +++ b/cpp/src/qpid/broker/AclModule.h @@ -102,7 +102,7 @@ namespace acl { SPECPROP_MAXQUEUESIZEUPPERLIMIT, SPECPROP_MAXQUEUECOUNTLOWERLIMIT, SPECPROP_MAXQUEUECOUNTUPPERLIMIT }; - + // AclResult shared between ACL spec and ACL authorise interface enum AclResult { ALLOW, @@ -130,7 +130,7 @@ namespace broker { const acl::ObjectType& objType, const std::string& name, std::map<acl::Property, std::string>* params=0)=0; - + virtual bool authorise( const std::string& id, const acl::Action& action, @@ -312,7 +312,7 @@ namespace acl { typedef propMap::const_iterator propMapItr; typedef std::map<SpecProperty, std::string> specPropMap; typedef specPropMap::const_iterator specPropMapItr; - + // This map contains the legal combinations of object/action/properties // found in an ACL file static void loadValidationMap(objectMapPtr& map) { @@ -407,10 +407,10 @@ namespace acl { ss << " }"; return ss.str(); } - + }; - + }} // namespace qpid::acl #endif // QPID_ACLMODULE_ACL_H |