return match;
}
+
+/**
+ * kdbus_conn_policy_own_name() - verify a connection can own the given name
+ * @conn: Connection
+ * @name: Name
+ *
+ * This verifies that @conn is allowed to acquire the well-known name @name.
+ *
+ * Return: 0 if allowed, negative error code if not.
+ */
+int kdbus_conn_policy_own_name(struct kdbus_conn *conn, const char *name)
+{
+ int ret;
+
+ if (conn->ep->has_policy) {
+ ret = kdbus_policy_check_own_access(&conn->ep->policy_db,
+ conn->cred, name);
+ if (ret < 0)
+ return ret;
+ }
+
+ if (conn->privileged)
+ return 0;
+
+ return kdbus_policy_check_own_access(&conn->ep->bus->policy_db,
+ conn->cred, name);
+}
u64 name_id);
bool kdbus_conn_has_name(struct kdbus_conn *conn, const char *name);
+int kdbus_conn_policy_own_name(struct kdbus_conn *conn, const char *name);
+
/* command dispatcher */
int kdbus_cmd_msg_recv(struct kdbus_conn *conn,
struct kdbus_cmd_recv *recv);
return kdbus_policy_check_talk_access(&ep->bus->policy_db,
conn_src, conn_dst);
}
-
-/**
- * kdbus_ep_policy_check_own_access() - verify a connection can own the passed
- * name
- * @ep: Endpoint to operate on
- * @conn: Connection that acquires a name
- * @name: Name that is about to be acquired
- *
- * This verifies that @conn is allowed to acquire the well-known name @name via
- * the endpoint @ep.
- *
- * Return: 0 if allowed, negative error code if not.
- */
-int kdbus_ep_policy_check_own_access(struct kdbus_ep *ep,
- const struct kdbus_conn *conn,
- const char *name)
-{
- int ret;
-
- if (ep->has_policy) {
- ret = kdbus_policy_check_own_access(&ep->policy_db,
- conn->cred, name);
- if (ret < 0)
- return ret;
- }
-
- if (conn->privileged)
- return 0;
-
- return kdbus_policy_check_own_access(&ep->bus->policy_db,
- conn->cred, name);
-}
int kdbus_ep_policy_check_talk_access(struct kdbus_ep *ep,
struct kdbus_conn *conn_src,
struct kdbus_conn *conn_dst);
-int kdbus_ep_policy_check_own_access(struct kdbus_ep *ep,
- const struct kdbus_conn *conn,
- const char *name);
#endif
goto out_dec;
}
- ret = kdbus_ep_policy_check_own_access(conn->ep, conn, name);
+ ret = kdbus_conn_policy_own_name(conn, name);
if (ret < 0)
goto out_dec;