mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-10 13:30:05 -05:00
client: properties with "pipewire." prefix are read-only
Properties that start with "pipewire." can only be set once. This prevents a client from overwriting the ucred or any of the other protected properties once they are set by the core or a module.
This commit is contained in:
parent
3f5b3b7cb1
commit
fa0b4f9321
2 changed files with 14 additions and 4 deletions
|
|
@ -370,9 +370,18 @@ int pw_client_update_properties(struct pw_client *client, const struct spa_dict
|
||||||
struct pw_resource *resource;
|
struct pw_resource *resource;
|
||||||
uint32_t i, changed = 0;
|
uint32_t i, changed = 0;
|
||||||
|
|
||||||
for (i = 0; i < dict->n_items; i++)
|
for (i = 0; i < dict->n_items; i++) {
|
||||||
changed += pw_properties_set(client->properties,
|
const char *key = dict->items[i].key, *old, *val = dict->items[i].value;
|
||||||
dict->items[i].key, dict->items[i].value);
|
|
||||||
|
if (strstr(key, "pipewire.") == key &&
|
||||||
|
(old = pw_properties_get(client->properties, key)) != NULL &&
|
||||||
|
(val == NULL || strcmp(old, val))) {
|
||||||
|
pw_log_warn("client %p: refused update of key %s from %s to %s",
|
||||||
|
client, key, old, val);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
changed += pw_properties_set(client->properties, key, val);
|
||||||
|
}
|
||||||
|
|
||||||
pw_log_debug("client %p: updated %d properties", client, changed);
|
pw_log_debug("client %p: updated %d properties", client, changed);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,8 @@ static void core_hello(void *object)
|
||||||
static void core_client_update(void *object, const struct spa_dict *props)
|
static void core_client_update(void *object, const struct spa_dict *props)
|
||||||
{
|
{
|
||||||
struct pw_resource *resource = object;
|
struct pw_resource *resource = object;
|
||||||
pw_client_update_properties(resource->client, props);
|
struct pw_client *client = resource->client;
|
||||||
|
pw_client_update_properties(client, props);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void core_permissions(void *object, const struct spa_dict *props)
|
static void core_permissions(void *object, const struct spa_dict *props)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue