From 58cc4848f23b372c2940112e8bde0e0108997d2b Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 30 Oct 2020 11:02:08 +0100 Subject: [PATCH] client: do access check after receiving properties After we receive the properties from the client, do the access check and then pause client messages until the session manager sets client permissions. Without this we would do access control right after creating the client which would block the client messages, which would then never register the global of the client, which would leave the client blocked forever because the session manager doesn't see the client and can't configure permissions. Fixes #352 --- src/pipewire/impl-client.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/pipewire/impl-client.c b/src/pipewire/impl-client.c index d30de58e8..f22e52999 100644 --- a/src/pipewire/impl-client.c +++ b/src/pipewire/impl-client.c @@ -171,10 +171,18 @@ static int update_properties(struct pw_impl_client *client, const struct spa_dic return changed; } +static void update_busy(struct pw_impl_client *client) +{ + struct pw_permission *def; + def = find_permission(client, PW_ID_CORE); + pw_impl_client_set_busy(client, (def->permissions & PW_PERM_R) ? false : true); +} + static int finish_register(struct pw_impl_client *client) { struct impl *impl = SPA_CONTAINER_OF(client, struct impl, this); const char *keys[] = { + PW_KEY_ACCESS, PW_KEY_CLIENT_ACCESS, PW_KEY_APP_NAME, NULL @@ -182,6 +190,9 @@ static int finish_register(struct pw_impl_client *client) if (impl->registered) return 0; + pw_context_emit_check_access(client->context, client); + update_busy(client); + pw_global_update_keys(client->global, client->info.props, keys); pw_global_register(client->global); impl->registered = true; @@ -332,13 +343,6 @@ static const struct pw_context_events context_events = { .global_removed = context_global_removed, }; -static void update_busy(struct pw_impl_client *client) -{ - struct pw_permission *def; - def = find_permission(client, PW_ID_CORE); - pw_impl_client_set_busy(client, (def->permissions & PW_PERM_R) ? false : true); -} - /** Make a new client object * * \param context a \ref pw_context object to register the client with @@ -410,10 +414,6 @@ struct pw_impl_client *pw_context_create_client(struct pw_impl_core *core, this->info.props = &this->properties->dict; - pw_context_emit_check_access(this->context, this); - - update_busy(this); - return this; error_clear_array: @@ -452,8 +452,6 @@ int pw_impl_client_register(struct pw_impl_client *client, PW_KEY_SEC_UID, PW_KEY_SEC_GID, PW_KEY_SEC_LABEL, - PW_KEY_ACCESS, - PW_KEY_CLIENT_ACCESS, NULL };