summaryrefslogtreecommitdiff
path: root/src/sp_disabled_functions.c
diff options
context:
space:
mode:
authorjvoisin2017-10-24 00:16:30 +0200
committerjvoisin2017-10-24 00:16:30 +0200
commit92a4b93c4d420fefe590bd88521ec76d8bebd3fe (patch)
treec817f0cff179136fb4321822198481d05dde2c6c /src/sp_disabled_functions.c
parentca51803abbe0b5605f936f5676d9c1a528713033 (diff)
Remove the `enable` member from the disable function structure
Also add some more tests
Diffstat (limited to 'src/sp_disabled_functions.c')
-rw-r--r--src/sp_disabled_functions.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/sp_disabled_functions.c b/src/sp_disabled_functions.c
index f089c25..f0b785c 100644
--- a/src/sp_disabled_functions.c
+++ b/src/sp_disabled_functions.c
@@ -124,10 +124,6 @@ bool should_disable(zend_execute_data* execute_data) {
124 const char* arg_name = NULL; 124 const char* arg_name = NULL;
125 const char* arg_value_str = NULL; 125 const char* arg_value_str = NULL;
126 126
127 if (false == config_node->enable) {
128 goto next;
129 }
130
131 /* The order matters, since when we have `config_node->functions_list`, 127 /* The order matters, since when we have `config_node->functions_list`,
132 we also do have `config_node->function` */ 128 we also do have `config_node->function` */
133 if (config_node->functions_list) { 129 if (config_node->functions_list) {
@@ -189,9 +185,18 @@ bool should_disable(zend_execute_data* execute_data) {
189 bool arg_matched = false; 185 bool arg_matched = false;
190 int i = 0; 186 int i = 0;
191 187
192 if ((config_node->pos != -1) && (config_node->pos <= nb_param)) { 188 if (config_node->pos != -1) {
193 i = config_node->pos; 189 if (config_node->pos <= nb_param) {
194 nb_param = (config_node->pos) + 1; 190 sp_log_err("config", "It seems that you wrote a rule filtering on the "
191 "%d%s argument of the function '%s', but it takes only %d arguments. "
192 "Matching on _all_ arguments instead.",
193 config_node->pos,
194 (config_node->pos == 1)?"st":(config_node->pos)?"nd":"th",
195 complete_path_function, nb_param);
196 } else {
197 i = config_node->pos;
198 nb_param = (config_node->pos) + 1;
199 }
195 } 200 }
196 201
197 for (; i < nb_param; i++) { 202 for (; i < nb_param; i++) {
@@ -301,10 +306,6 @@ static bool should_drop_on_ret(zval* return_value,
301 sp_disabled_function const* const config_node = 306 sp_disabled_function const* const config_node =
302 (sp_disabled_function*)(config->data); 307 (sp_disabled_function*)(config->data);
303 308
304 if (false == config_node->enable) {
305 goto next;
306 }
307
308 if (config_node->function) { 309 if (config_node->function) {
309 if (0 != strcmp(config_node->function, complete_path_function)) { 310 if (0 != strcmp(config_node->function, complete_path_function)) {
310 goto next; 311 goto next;