static const char* message_decision[] = {"NO_DECISION", "ALLOW", "DENY", "CHECK"};
static MessageType __str_to_message_type(const char* str) {
+ if (!str)
+ return MessageType::ANY;
+
if (!std::strcmp(str, "method_call"))
return MessageType::METHOD_CALL;
else if (!std::strcmp(str, "method_return"))
if (v.second.data() != "*")
value = v.second.data().c_str();
- if (v.first == "context") {
- if (std::strcmp(value, "mandatory") == 0 ) {
- policy_type = PolicyType::CONTEXT;
- policy_type_value.context = ContextType::MANDATORY;
- } else if (std::strcmp(value, "default") == 0) {
- policy_type = PolicyType::CONTEXT;
- policy_type_value.context = ContextType::DEFAULT;
+ if (value) {
+ if (v.first == "context") {
+ if (std::strcmp(value, "mandatory") == 0 ) {
+ policy_type = PolicyType::CONTEXT;
+ policy_type_value.context = ContextType::MANDATORY;
+ } else if (std::strcmp(value, "default") == 0) {
+ policy_type = PolicyType::CONTEXT;
+ policy_type_value.context = ContextType::DEFAULT;
+ }
+ } else if (v.first == "user") {
+ policy_type = PolicyType::USER;
+ policy_type_value.user = convertToUid(value);
+ } else if (v.first == "group") {
+ policy_type = PolicyType::GROUP;
+ policy_type_value.group = convertToGid(value);
}
- } else if (v.first == "user") {
- policy_type = PolicyType::USER;
- policy_type_value.user = convertToUid(value);
- } else if (v.first == "group") {
- policy_type = PolicyType::GROUP;
- policy_type_value.group = convertToGid(value);
- } else {
- attr = false;
- t = NONE;
}
} else if (attr && t == ALLOW_DENY_CHECK) {
if (v.second.data() != "*")