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,16 +1034,12 @@ void var_OptionParse( vlc_object_t *p_obj, const char *psz_option, ...@@ -1034,16 +1034,12 @@ 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 ); msg_Err( p_obj, "unsafe option \"%s\" has been ignored for "
if( !p_config || !p_config->b_safe ) "security reasons", psz_name );
{ free( psz_name );
msg_Err( p_obj, "unsafe option \"%s\" has been ignored for " return;
"security reasons", psz_name );
free( psz_name );
return;
}
} }
/* Create the variable in the input object. /* Create the variable in the input object.
......
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