pulse: don't try to do set_param when not writable

This commit is contained in:
Wim Taymans 2020-07-16 13:25:03 +02:00
parent cbc579825c
commit ac97175380
3 changed files with 16 additions and 0 deletions

View file

@ -372,6 +372,9 @@ static int set_node_volume(pa_context *c, struct global *g, const pa_cvolume *vo
}
g->node_info.mute = mute;
if (!SPA_FLAG_IS_SET(g->permissions, PW_PERM_W | PW_PERM_X))
return PA_ERR_ACCESS;
pw_node_set_param((struct pw_node*)g->proxy,
SPA_PARAM_Props, 0,
spa_pod_builder_add_object(&b,
@ -416,6 +419,9 @@ static int set_device_volume(pa_context *c, struct global *g, struct global *cg,
}
g->node_info.mute = mute;
if (!SPA_FLAG_IS_SET(cg->permissions, PW_PERM_W | PW_PERM_X))
return PA_ERR_ACCESS;
spa_pod_builder_push_object(&b, &f[0],
SPA_TYPE_OBJECT_ParamRoute, SPA_PARAM_Route);
spa_pod_builder_add(&b,
@ -696,6 +702,9 @@ static int set_device_route(pa_context *c, struct global *g, const char *port, e
if (id == SPA_ID_INVALID)
return PA_ERR_NOENTITY;
if (!SPA_FLAG_IS_SET(cg->permissions, PW_PERM_W | PW_PERM_X))
return PA_ERR_ACCESS;
pw_device_set_param((struct pw_device*)cg->proxy,
SPA_PARAM_Route, 0,
spa_pod_builder_add_object(&b,
@ -1753,6 +1762,11 @@ static void card_profile(pa_operation *o, void *userdata)
if (id == SPA_ID_INVALID)
goto done;;
if (!SPA_FLAG_IS_SET(g->permissions, PW_PERM_W | PW_PERM_X)) {
pa_context_set_error(c, PA_ERR_ACCESS);
goto done;
}
pw_device_set_param((struct pw_device*)g->proxy,
SPA_PARAM_Profile, 0,
spa_pod_builder_add_object(&b,