summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
1b60043)
Just some cleanups around policy checks that came up during review.
The code is still not productive.
int message_type;
const char *interface;
const char *path;
int message_type;
const char *interface;
const char *path;
+ union {
+ const char *name;
+ const char *member;
+ };
char **names_strv;
Hashmap *names_hash;
};
char **names_strv;
Hashmap *names_hash;
};
- if (i->message_type && (i->message_type != filter->message_type))
+ if ((i->message_type != _POLICY_ITEM_CLASS_UNSET) && (i->message_type != filter->message_type))
break;
if (i->path && !streq_ptr(i->path, filter->path))
break;
if (i->path && !streq_ptr(i->path, filter->path))
case POLICY_ITEM_OWN:
assert(filter->member);
case POLICY_ITEM_OWN:
assert(filter->member);
- if (streq(i->name, filter->member))
+ if (streq(i->name, "*") || streq(i->name, filter->name))
return is_permissive(i);
break;
case POLICY_ITEM_OWN_PREFIX:
assert(filter->member);
return is_permissive(i);
break;
case POLICY_ITEM_OWN_PREFIX:
assert(filter->member);
- if (startswith(i->name, filter->member))
+ if (streq(i->name, "*") || startswith(i->name, filter->name))
return is_permissive(i);
break;
return is_permissive(i);
break;
bool policy_check_own(Policy *p, const struct ucred *ucred, const char *name) {
struct policy_check_filter filter = {
bool policy_check_own(Policy *p, const struct ucred *ucred, const char *name) {
struct policy_check_filter filter = {
- .class = POLICY_ITEM_OWN,
- .ucred = ucred,
- .member = name,
+ .class = POLICY_ITEM_OWN,
+ .ucred = ucred,
+ .name = name,
};
return policy_check(p, &filter) == ALLOW;
};
return policy_check(p, &filter) == ALLOW;
bool policy_check_hello(Policy *p, const struct ucred *ucred) {
struct policy_check_filter filter = {
bool policy_check_hello(Policy *p, const struct ucred *ucred) {
struct policy_check_filter filter = {
- .class = POLICY_ITEM_USER,
.ucred = ucred,
};
int user, group;
.ucred = ucred,
};
int user, group;
+ filter.class = POLICY_ITEM_USER;
user = policy_check(p, &filter);
if (user == DENY)
return false;
filter.class = POLICY_ITEM_GROUP;
group = policy_check(p, &filter);
user = policy_check(p, &filter);
if (user == DENY)
return false;
filter.class = POLICY_ITEM_GROUP;
group = policy_check(p, &filter);
- if (user == DUNNO && group == DUNNO)
- return !(user == DENY || group == DENY);
+ return !(user == DUNNO && group == DUNNO);
}
bool policy_check_recv(Policy *p,
}
bool policy_check_recv(Policy *p,
<allow send_destination="org.test.test1" send_interface="org.test.int1"/>
<allow send_destination="org.test.test1" send_interface="org.test.int2"/>
<allow send_destination="org.test.test1" send_interface="org.test.int1"/>
<allow send_destination="org.test.test1" send_interface="org.test.int2"/>
- <allow receive_sender="org.test.test3" receive_interface="org.test.int3" receiver_member="Member111"/>
+ <allow receive_sender="org.test.test3" receive_interface="org.test.int3" receive_member="Member111"/>