diff options
| author | Thibault "bui" Koechlin | 2017-12-28 17:04:06 +0100 |
|---|---|---|
| committer | jvoisin | 2017-12-28 17:04:06 +0100 |
| commit | 9f5e8d12f05fb24c915a5266a1e908a75c8aed08 (patch) | |
| tree | 9160075ea943c7fd29a3923f844a0ac0d6b8b457 /src/sp_disabled_functions.c | |
| parent | 62c48bf9a85e0294b7b32cea438e904e1cd50669 (diff) | |
Clang-format pass
- `clang-format --style="{BasedOnStyle: google, SortIncludes: false}" -i snuffleu*.c sp_*.c sp_*.h`
- Update the documentation accordingly
Diffstat (limited to 'src/sp_disabled_functions.c')
| -rw-r--r-- | src/sp_disabled_functions.c | 95 |
1 files changed, 48 insertions, 47 deletions
diff --git a/src/sp_disabled_functions.c b/src/sp_disabled_functions.c index 9736d2b..9382b09 100644 --- a/src/sp_disabled_functions.c +++ b/src/sp_disabled_functions.c | |||
| @@ -64,25 +64,25 @@ end: | |||
| 64 | static bool is_local_var_matching( | 64 | static bool is_local_var_matching( |
| 65 | zend_execute_data* execute_data, | 65 | zend_execute_data* execute_data, |
| 66 | const sp_disabled_function* const config_node) { | 66 | const sp_disabled_function* const config_node) { |
| 67 | zval *var_value; | 67 | zval* var_value; |
| 68 | 68 | ||
| 69 | var_value = get_value(execute_data, config_node->var, false); | 69 | var_value = get_value(execute_data, config_node->var, false); |
| 70 | if (var_value) { | 70 | if (var_value) { |
| 71 | char *var_value_str = sp_convert_to_string(var_value); | 71 | char* var_value_str = sp_convert_to_string(var_value); |
| 72 | if (Z_TYPE_P(var_value) == IS_ARRAY) { | 72 | if (Z_TYPE_P(var_value) == IS_ARRAY) { |
| 73 | if (config_node->key || config_node->r_key) { | 73 | if (config_node->key || config_node->r_key) { |
| 74 | if (sp_match_array_key(var_value, config_node->key, | 74 | if (sp_match_array_key(var_value, config_node->key, |
| 75 | config_node->r_key)) { | 75 | config_node->r_key)) { |
| 76 | efree(var_value_str); | 76 | efree(var_value_str); |
| 77 | return true; | 77 | return true; |
| 78 | } | 78 | } |
| 79 | } else if (sp_match_array_value(var_value, config_node->value, | 79 | } else if (sp_match_array_value(var_value, config_node->value, |
| 80 | config_node->value_r)) { | 80 | config_node->value_r)) { |
| 81 | efree(var_value_str); | 81 | efree(var_value_str); |
| 82 | return true; | 82 | return true; |
| 83 | } | 83 | } |
| 84 | } else if (sp_match_value(var_value_str, config_node->value, | 84 | } else if (sp_match_value(var_value_str, config_node->value, |
| 85 | config_node->value_r)) { | 85 | config_node->value_r)) { |
| 86 | efree(var_value_str); | 86 | efree(var_value_str); |
| 87 | return true; | 87 | return true; |
| 88 | } | 88 | } |
| @@ -115,7 +115,7 @@ static bool is_param_matching(zend_execute_data* execute_data, | |||
| 115 | const char** arg_value_str) { | 115 | const char** arg_value_str) { |
| 116 | int nb_param = execute_data->func->common.num_args; | 116 | int nb_param = execute_data->func->common.num_args; |
| 117 | int i = 0; | 117 | int i = 0; |
| 118 | zval *arg_value; | 118 | zval* arg_value; |
| 119 | 119 | ||
| 120 | if (config_node->pos != -1) { | 120 | if (config_node->pos != -1) { |
| 121 | if (config_node->pos <= nb_param) { | 121 | if (config_node->pos <= nb_param) { |
| @@ -150,8 +150,9 @@ static bool is_param_matching(zend_execute_data* execute_data, | |||
| 150 | } else { | 150 | } else { |
| 151 | *arg_name = execute_data->func->internal_function.arg_info[i].name; | 151 | *arg_name = execute_data->func->internal_function.arg_info[i].name; |
| 152 | } | 152 | } |
| 153 | const bool pcre_matching = config_node->r_param | 153 | const bool pcre_matching = |
| 154 | && (true == is_regexp_matching(config_node->r_param, *arg_name)); | 154 | config_node->r_param && |
| 155 | (true == is_regexp_matching(config_node->r_param, *arg_name)); | ||
| 155 | 156 | ||
| 156 | /* This is the parameter name we're looking for. */ | 157 | /* This is the parameter name we're looking for. */ |
| 157 | if (true == pcre_matching || config_node->pos != -1) { | 158 | if (true == pcre_matching || config_node->pos != -1) { |
| @@ -159,23 +160,23 @@ static bool is_param_matching(zend_execute_data* execute_data, | |||
| 159 | 160 | ||
| 160 | if (config_node->param_type) { // Are we matching on the `type`? | 161 | if (config_node->param_type) { // Are we matching on the `type`? |
| 161 | if (config_node->param_type == Z_TYPE_P(arg_value)) { | 162 | if (config_node->param_type == Z_TYPE_P(arg_value)) { |
| 162 | return true; | 163 | return true; |
| 163 | } | 164 | } |
| 164 | } else if (Z_TYPE_P(arg_value) == IS_ARRAY) { | 165 | } else if (Z_TYPE_P(arg_value) == IS_ARRAY) { |
| 165 | *arg_value_str = sp_convert_to_string(arg_value); | 166 | *arg_value_str = sp_convert_to_string(arg_value); |
| 166 | if (config_node->key || config_node->r_key) { | 167 | if (config_node->key || config_node->r_key) { |
| 167 | if (sp_match_array_key(arg_value, config_node->key, | 168 | if (sp_match_array_key(arg_value, config_node->key, |
| 168 | config_node->r_key)) { | 169 | config_node->r_key)) { |
| 169 | return true; | 170 | return true; |
| 170 | } | 171 | } |
| 171 | } else if (sp_match_array_value(arg_value, config_node->value, | 172 | } else if (sp_match_array_value(arg_value, config_node->value, |
| 172 | config_node->value_r)) { | 173 | config_node->value_r)) { |
| 173 | return true; | 174 | return true; |
| 174 | } | 175 | } |
| 175 | } else { | 176 | } else { |
| 176 | *arg_value_str = sp_convert_to_string(arg_value); | 177 | *arg_value_str = sp_convert_to_string(arg_value); |
| 177 | if (sp_match_value(*arg_value_str, config_node->value, | 178 | if (sp_match_value(*arg_value_str, config_node->value, |
| 178 | config_node->value_r)) { | 179 | config_node->value_r)) { |
| 179 | return true; | 180 | return true; |
| 180 | } | 181 | } |
| 181 | } | 182 | } |
| @@ -188,23 +189,23 @@ static bool is_param_matching(zend_execute_data* execute_data, | |||
| 188 | if (arg_value) { | 189 | if (arg_value) { |
| 189 | *arg_value_str = sp_convert_to_string(arg_value); | 190 | *arg_value_str = sp_convert_to_string(arg_value); |
| 190 | if (config_node->param_type) { // Are we matching on the `type`? | 191 | if (config_node->param_type) { // Are we matching on the `type`? |
| 191 | if (config_node->param_type | 192 | if (config_node->param_type && |
| 192 | && config_node->param_type == Z_TYPE_P(arg_value)) { | 193 | config_node->param_type == Z_TYPE_P(arg_value)) { |
| 193 | return true; | 194 | return true; |
| 194 | } | 195 | } |
| 195 | } else if (Z_TYPE_P(arg_value) == IS_ARRAY) { | 196 | } else if (Z_TYPE_P(arg_value) == IS_ARRAY) { |
| 196 | if (config_node->key || config_node->r_key) { | 197 | if (config_node->key || config_node->r_key) { |
| 197 | if (sp_match_array_key(arg_value, config_node->key, | 198 | if (sp_match_array_key(arg_value, config_node->key, |
| 198 | config_node->r_key)) { | 199 | config_node->r_key)) { |
| 199 | return true; | 200 | return true; |
| 200 | } | 201 | } |
| 201 | } else if (sp_match_array_value(arg_value, config_node->value, | 202 | } else if (sp_match_array_value(arg_value, config_node->value, |
| 202 | config_node->value_r)) { | 203 | config_node->value_r)) { |
| 203 | return true; | 204 | return true; |
| 204 | } | 205 | } |
| 205 | } else if (sp_match_value(*arg_value_str, config_node->value, | 206 | } else if (sp_match_value(*arg_value_str, config_node->value, |
| 206 | config_node->value_r)) { | 207 | config_node->value_r)) { |
| 207 | return true; | 208 | return true; |
| 208 | } | 209 | } |
| 209 | } | 210 | } |
| 210 | } | 211 | } |
| @@ -340,7 +341,7 @@ allow: | |||
| 340 | } | 341 | } |
| 341 | 342 | ||
| 342 | bool should_drop_on_ret(zval* return_value, | 343 | bool should_drop_on_ret(zval* return_value, |
| 343 | const zend_execute_data* const execute_data) { | 344 | const zend_execute_data* const execute_data) { |
| 344 | const sp_list_node* config = | 345 | const sp_list_node* config = |
| 345 | SNUFFLEUPAGUS_G(config).config_disabled_functions_ret->disabled_functions; | 346 | SNUFFLEUPAGUS_G(config).config_disabled_functions_ret->disabled_functions; |
| 346 | char* complete_path_function = get_complete_function_path(execute_data); | 347 | char* complete_path_function = get_complete_function_path(execute_data); |
