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 ) ...@@ -89,6 +89,12 @@ int config_GetType( vlc_object_t *p_this, const char *psz_name )
return i_type; 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 #undef config_GetInt
/***************************************************************************** /*****************************************************************************
* config_GetInt: get the value of an int variable * config_GetInt: get the value of an int variable
......
...@@ -235,6 +235,7 @@ extern const size_t libvlc_config_count; ...@@ -235,6 +235,7 @@ extern const size_t libvlc_config_count;
* Variables stuff * Variables stuff
*/ */
void var_OptionParse (vlc_object_t *, const char *, bool trusted); 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, ...@@ -1034,17 +1034,13 @@ void var_OptionParse( vlc_object_t *p_obj, const char *psz_option,
( !psz_value || !*psz_value ) ) goto cleanup; /* Invalid value */ ( !psz_value || !*psz_value ) ) goto cleanup; /* Invalid value */
/* check if option is unsafe */ /* check if option is unsafe */
if( !trusted ) if( !trusted && !config_IsSafe( psz_name ) )
{
module_config_t *p_config = config_FindConfig( p_obj, psz_name );
if( !p_config || !p_config->b_safe )
{ {
msg_Err( p_obj, "unsafe option \"%s\" has been ignored for " msg_Err( p_obj, "unsafe option \"%s\" has been ignored for "
"security reasons", psz_name ); "security reasons", psz_name );
free( psz_name ); free( psz_name );
return; return;
} }
}
/* Create the variable in the input object. /* Create the variable in the input object.
* Children of the input object will be able to retreive this value * 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