permissions: check permissions more

Pass client to some core functions to make it possible to check
permissions when iterating globals.
Check permissions of factory before using it.
Check permissions in link factory, only allow linking of nodes we can
see.
Check permissions in the autolink module, only try to link to nodes
we can see.
Make client permissions update behave like an atomic update of an
unordered set of permissions, which is perhaps a bit more intuitive.
This commit is contained in:
Wim Taymans 2018-01-24 10:42:40 +01:00
parent 1804e47a91
commit ab099d09dd
11 changed files with 79 additions and 38 deletions

View file

@ -185,6 +185,8 @@ static void try_link_port(struct pw_node *node, struct pw_port *port, struct nod
struct pw_link *link;
struct pw_port *target;
struct link_data *ld;
struct pw_global *global = pw_node_get_global(info->node);
struct pw_client *owner = pw_global_get_owner(global);
props = pw_node_get_properties(node);
@ -202,7 +204,7 @@ static void try_link_port(struct pw_node *node, struct pw_port *port, struct nod
pw_log_debug("module %p: try to find and link to node '%d'", impl, path_id);
target = pw_core_find_port(impl->core, port, path_id, NULL, 0, NULL, &error);
target = pw_core_find_port(impl->core, owner, port, path_id, NULL, 0, NULL, &error);
if (target == NULL)
goto error;
@ -234,12 +236,8 @@ static void try_link_port(struct pw_node *node, struct pw_port *port, struct nod
error:
pw_log_error("module %p: can't link node '%s'", impl, error);
{
struct pw_global *global = pw_node_get_global(info->node);
struct pw_client *owner = pw_global_get_owner(global);
if (owner)
pw_resource_error(pw_client_get_core_resource(owner), -EINVAL, error);
}
if (owner)
pw_resource_error(pw_client_get_core_resource(owner), -EINVAL, error);
free(error);
return;
}