{
char tmp[MAX_LOG_LINE];
const char* i_str = item.toString(tmp);
- std::cout << "checkpolicy for ownership: " << i_str <<std::endl;
-}
-
-static void __log_item(const ItemOwn& item)
-{
- char tmp[MAX_LOG_LINE];
- const char* i_str = item.toString(tmp);
- std::cout << "checkpolicy for: " << i_str <<std::endl;
+ std::cout << "checkpolicy for: " << i_str <<std::endl;
}
DbAdapter& NaivePolicyChecker::generateAdapter() {
gid_t gid,
const char* const label,
const char* const name) {
- return this->checkItemOwn(bus_type, uid, gid, label, name, ItemType::OWN);
+ return this->checkItemOwn(bus_type, uid, gid, label, name);
}
DecisionResult NaivePolicyChecker::check(bool bus_type,
assert(node);
Decision ret = Decision::ANY;
while ((name != NULL) && (*name != '\0')) {
- childIndex = char_map[*name];
+ childIndex = char_map[static_cast<unsigned>(*name)];
if (childIndex > 64) {
/* name contains forbidden char */
if (tslog::verbose()) {
return node->__decisionItem.getDecision();
}
-DecisionResult NaivePolicyChecker::checkItemOwn(bool bus_type, uid_t uid, gid_t gid, const char* label, const ItemOwn& item, const ItemType type) {
+DecisionResult NaivePolicyChecker::checkItemOwn(bool bus_type, uid_t uid, gid_t gid, const char* label, const ItemOwn& item) {
NaivePolicyDb& policy_db = getPolicyDb(bus_type);
Decision ret = Decision::ANY;
const char* privilege;
const NaivePolicyDb::PolicyOwn* curr_policy = NULL;
if (ret == Decision::ANY) {
- if (policy_db.getPolicy(type, PolicyType::CONTEXT, PolicyTypeValue(ContextType::MANDATORY), curr_policy))
+ if (policy_db.getPolicy(PolicyType::CONTEXT, PolicyTypeValue(ContextType::MANDATORY), curr_policy))
ret = checkPolicyOwn(*curr_policy, item, privilege);
}
if (ret == Decision::ANY) {
- if (policy_db.getPolicy(type, PolicyType::USER, PolicyTypeValue(uid), curr_policy))
+ if (policy_db.getPolicy(PolicyType::USER, PolicyTypeValue(uid), curr_policy))
ret = checkPolicyOwn(*curr_policy, item, privilege);
}
if (ret == Decision::ANY) {
- if (policy_db.getPolicy(type, PolicyType::GROUP, PolicyTypeValue(gid), curr_policy))
+ if (policy_db.getPolicy(PolicyType::GROUP, PolicyTypeValue(gid), curr_policy))
ret = checkPolicyOwn(*curr_policy, item, privilege);
}
if (ret == Decision::ANY) {
- if (policy_db.getPolicy(type, PolicyType::CONTEXT, PolicyTypeValue(ContextType::DEFAULT), curr_policy))
+ if (policy_db.getPolicy(PolicyType::CONTEXT, PolicyTypeValue(ContextType::DEFAULT), curr_policy))
ret = checkPolicyOwn(*curr_policy, item, privilege);
}
if (ret != Decision::ANY) {
namespace ldp_xml_parser
{
/** Char map used in ownership policy. Single character from given name is mapped to index of tree node child*/
- const char char_map[128] {65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ const char char_map[256] {65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 10, 12, 65,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 65, 65, 65, 65, 65, 65,
65, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 65, 65, 65, 11,
65, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
- 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 65, 65, 65, 65, 65};
+ 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 65, 65, 65, 65, 65,
+
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65};
/** Type of sent message*/
enum class MessageType : uint8_t {
ANY = 0,
const char* member = NULL,
const char* path = NULL,
MessageType type = MessageType::ANY,
- MessageDirection direction = MessageDirection::ANY,
- Decision decision = Decision::ANY,
- const char* privilege = NULL);
+ MessageDirection direction = MessageDirection::ANY);
~ItemSendReceive();
bool match(const MatchItemSR& item) const;
MessageDirection getDirection() const;