mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-06-30 13:14:16 -04:00
pulse-server: implement more valid_args on modules
If the valid_args is NULL, reject all arguments.
This commit is contained in:
parent
5fa87d67a1
commit
6d1c242433
26 changed files with 337 additions and 8 deletions
|
|
@ -180,15 +180,14 @@ static bool find_key(const struct module_args args[], const char *key)
|
|||
|
||||
static int module_args_check(struct pw_properties *props, const struct module_args valid_args[])
|
||||
{
|
||||
if (valid_args != NULL) {
|
||||
const struct spa_dict_item *it;
|
||||
spa_dict_for_each(it, &props->dict) {
|
||||
if (!find_key(valid_args, it->key)) {
|
||||
pw_log_warn("'%s' is not a valid module argument key", it->key);
|
||||
return -EINVAL;
|
||||
}
|
||||
const struct spa_dict_item *it;
|
||||
spa_dict_for_each(it, &props->dict) {
|
||||
if (valid_args == NULL || !find_key(valid_args, it->key)) {
|
||||
pw_log_warn("'%s' is not a valid module argument key", it->key);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
}
|
||||
if (valid_args != NULL) {
|
||||
for (int i = 0; valid_args[i].key != NULL; i++)
|
||||
if (SPA_FLAG_IS_SET(valid_args[i].flags, MODULE_ARG_MANDATORY) &&
|
||||
pw_properties_get(props, valid_args[i].key) == NULL) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue