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
This commit is contained in:
Wim Taymans 2020-11-03 09:35:51 +01:00
parent 6962c27af9
commit bc46ead017
2 changed files with 5 additions and 4 deletions

View file

@ -129,7 +129,6 @@ context_check_access(void *data, struct pw_impl_client *client)
struct pw_permission permissions[1]; struct pw_permission permissions[1];
struct spa_dict_item items[2]; struct spa_dict_item items[2];
const struct pw_properties *props; const struct pw_properties *props;
struct pw_impl_client *current;
const char *str, *access; const char *str, *access;
int pid, res; int pid, res;
@ -213,11 +212,8 @@ granted:
items[0] = SPA_DICT_ITEM_INIT(PW_KEY_ACCESS, access); items[0] = SPA_DICT_ITEM_INIT(PW_KEY_ACCESS, access);
pw_impl_client_update_properties(client, &SPA_DICT_INIT(items, 1)); 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); permissions[0] = PW_PERMISSION_INIT(PW_ID_ANY, PW_PERM_ALL);
pw_impl_client_update_permissions(client, 1, permissions); pw_impl_client_update_permissions(client, 1, permissions);
client->context->current_client = current;
return; return;
wait_permissions: wait_permissions:

View file

@ -181,6 +181,7 @@ static void update_busy(struct pw_impl_client *client)
static int finish_register(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 impl *impl = SPA_CONTAINER_OF(client, struct impl, this);
struct pw_impl_client *current;
const char *keys[] = { const char *keys[] = {
PW_KEY_ACCESS, PW_KEY_ACCESS,
PW_KEY_CLIENT_ACCESS, PW_KEY_CLIENT_ACCESS,
@ -192,7 +193,11 @@ static int finish_register(struct pw_impl_client *client)
impl->registered = true; impl->registered = true;
current = client->context->current_client;
client->context->current_client = NULL;
pw_context_emit_check_access(client->context, client); pw_context_emit_check_access(client->context, client);
client->context->current_client = current;
update_busy(client); update_busy(client);
pw_global_update_keys(client->global, client->info.props, keys); pw_global_update_keys(client->global, client->info.props, keys);