Commit 719507f3 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Add config_IsSafe() internal helper

parent 98f81c29
......@@ -89,6 +89,12 @@ int config_GetType( vlc_object_t *p_this, const char *psz_name )
return i_type;
}
bool config_IsSafe( const char *name )
{
module_config_t *p_config = config_FindConfig( NULL, name );
return p_config != NULL && p_config->b_safe;
}
#undef config_GetInt
/*****************************************************************************
* config_GetInt: get the value of an int variable
......
......@@ -235,6 +235,7 @@ extern const size_t libvlc_config_count;
* Variables stuff
*/
void var_OptionParse (vlc_object_t *, const char *, bool trusted);
bool config_IsSafe (const char *);
/*
......
......@@ -1034,17 +1034,13 @@ void var_OptionParse( vlc_object_t *p_obj, const char *psz_option,
( !psz_value || !*psz_value ) ) goto cleanup; /* Invalid value */
/* check if option is unsafe */
if( !trusted )
{
module_config_t *p_config = config_FindConfig( p_obj, psz_name );
if( !p_config || !p_config->b_safe )
if( !trusted && !config_IsSafe( psz_name ) )
{
msg_Err( p_obj, "unsafe option \"%s\" has been ignored for "
"security reasons", psz_name );
free( psz_name );
return;
}
}
/* Create the variable in the input object.
* Children of the input object will be able to retreive this value
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment