From bc46ead017f92216e645b1e10fc91b87d58dfd4c Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 3 Nov 2020 09:35:51 +0100 Subject: [PATCH] client: emit check access in global context Drop the current client context to check permissions. This restores the previous behaviour and fixes the permissions set by the portal module. This fixes screen sharing again. Fixes #362 --- src/modules/module-access.c | 4 ---- src/pipewire/impl-client.c | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/modules/module-access.c b/src/modules/module-access.c index b3ad84d15..dcec8488c 100644 --- a/src/modules/module-access.c +++ b/src/modules/module-access.c @@ -129,7 +129,6 @@ context_check_access(void *data, struct pw_impl_client *client) struct pw_permission permissions[1]; struct spa_dict_item items[2]; const struct pw_properties *props; - struct pw_impl_client *current; const char *str, *access; int pid, res; @@ -213,11 +212,8 @@ granted: items[0] = SPA_DICT_ITEM_INIT(PW_KEY_ACCESS, access); pw_impl_client_update_properties(client, &SPA_DICT_INIT(items, 1)); - current = client->context->current_client; - client->context->current_client = NULL; permissions[0] = PW_PERMISSION_INIT(PW_ID_ANY, PW_PERM_ALL); pw_impl_client_update_permissions(client, 1, permissions); - client->context->current_client = current; return; wait_permissions: diff --git a/src/pipewire/impl-client.c b/src/pipewire/impl-client.c index 54337e1ba..243463376 100644 --- a/src/pipewire/impl-client.c +++ b/src/pipewire/impl-client.c @@ -181,6 +181,7 @@ static void update_busy(struct pw_impl_client *client) static int finish_register(struct pw_impl_client *client) { struct impl *impl = SPA_CONTAINER_OF(client, struct impl, this); + struct pw_impl_client *current; const char *keys[] = { PW_KEY_ACCESS, PW_KEY_CLIENT_ACCESS, @@ -192,7 +193,11 @@ static int finish_register(struct pw_impl_client *client) impl->registered = true; + current = client->context->current_client; + client->context->current_client = NULL; pw_context_emit_check_access(client->context, client); + client->context->current_client = current; + update_busy(client); pw_global_update_keys(client->global, client->info.props, keys);