+ return check_policy_items(p->default_items, 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,
+ };
+
+ return policy_check(p, &filter) == ALLOW;
+}
+
+bool policy_check_hello(Policy *p, const struct ucred *ucred) {
+
+ struct policy_check_filter filter = {
+ .class = POLICY_ITEM_USER,
+ .ucred = ucred,
+ };
+ int user, group;
+
+ 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 false;
+
+ return !(user == DENY || group == DENY);
+}
+
+bool policy_check_recv(Policy *p,
+ const struct ucred *ucred,
+ Hashmap *names,
+ int message_type,
+ const char *path,
+ const char *interface,
+ const char *member) {
+
+ struct policy_check_filter filter = {
+ .class = POLICY_ITEM_RECV,
+ .ucred = ucred,
+ .names_hash = names,
+ .message_type = message_type,
+ .interface = interface,
+ .path = path,
+ .member = member,
+ };
+
+ return policy_check(p, &filter) == ALLOW;
+}
+
+bool policy_check_send(Policy *p,
+ const struct ucred *ucred,
+ char **names,
+ int message_type,
+ const char *path,
+ const char *interface,
+ const char *member) {
+
+ struct policy_check_filter filter = {
+ .class = POLICY_ITEM_SEND,
+ .ucred = ucred,
+ .names_strv = names,
+ .message_type = message_type,
+ .interface = interface,
+ .path = path,
+ .member = member,
+ };
+
+ return policy_check(p, &filter) == ALLOW;
+}
+
+int policy_load(Policy *p, char **files) {
+ char **i;
+ int r;
+
+ assert(p);
+
+ STRV_FOREACH(i, files) {
+
+ r = file_load(p, *i);
+ if (r == -EISDIR) {
+ _cleanup_strv_free_ char **l = NULL;
+ char **j;
+
+ r = conf_files_list(&l, ".conf", NULL, *i, NULL);
+ if (r < 0) {
+ log_error("Failed to get configuration file list: %s", strerror(-r));
+ return r;
+ }
+
+ STRV_FOREACH(j, l)
+ file_load(p, *j);
+ }
+
+ /* We ignore all errors but EISDIR, and just proceed. */
+ }