diff options
| author | jvoisin | 2018-02-05 18:13:57 +0100 |
|---|---|---|
| committer | jvoisin | 2018-02-05 18:13:57 +0100 |
| commit | 9d153cc185b4e2327a4aabe645cf1fabd3b4f21b (patch) | |
| tree | bfaf6ff5fa41098864d6b51ad1fa91304d8c32a6 /src/sp_config_keywords.c | |
| parent | 3ab41db5bb38ec534e96f89680e55becd758aa28 (diff) | |
Massive simplification of functions hooking
Diffstat (limited to 'src/sp_config_keywords.c')
| -rw-r--r-- | src/sp_config_keywords.c | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/src/sp_config_keywords.c b/src/sp_config_keywords.c index 5df3d97..959fa38 100644 --- a/src/sp_config_keywords.c +++ b/src/sp_config_keywords.c | |||
| @@ -24,8 +24,8 @@ static int get_construct_type(sp_disabled_function const *const df) { | |||
| 24 | return CONSTRUCTS_TYPES[i].type; | 24 | return CONSTRUCTS_TYPES[i].type; |
| 25 | } | 25 | } |
| 26 | } else { | 26 | } else { |
| 27 | if (true == | 27 | if (true == sp_is_regexp_matching(df->r_function, |
| 28 | sp_is_regexp_matching(df->r_function, CONSTRUCTS_TYPES[i].keys[j])) { | 28 | CONSTRUCTS_TYPES[i].keys[j])) { |
| 29 | return CONSTRUCTS_TYPES[i].type; | 29 | return CONSTRUCTS_TYPES[i].type; |
| 30 | } | 30 | } |
| 31 | } | 31 | } |
| @@ -122,13 +122,13 @@ static int parse_eval_filter_conf(char *line, sp_list_node **list) { | |||
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | int parse_eval_blacklist(char *line) { | 124 | int parse_eval_blacklist(char *line) { |
| 125 | return parse_eval_filter_conf(line, | 125 | return parse_eval_filter_conf( |
| 126 | &SNUFFLEUPAGUS_G(config).config_eval->blacklist); | 126 | line, &SNUFFLEUPAGUS_G(config).config_eval->blacklist); |
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | int parse_eval_whitelist(char *line) { | 129 | int parse_eval_whitelist(char *line) { |
| 130 | return parse_eval_filter_conf(line, | 130 | return parse_eval_filter_conf( |
| 131 | &SNUFFLEUPAGUS_G(config).config_eval->whitelist); | 131 | line, &SNUFFLEUPAGUS_G(config).config_eval->whitelist); |
| 132 | } | 132 | } |
| 133 | 133 | ||
| 134 | int parse_cookie(char *line) { | 134 | int parse_cookie(char *line) { |
| @@ -204,8 +204,8 @@ int parse_cookie(char *line) { | |||
| 204 | return -1; | 204 | return -1; |
| 205 | } | 205 | } |
| 206 | } | 206 | } |
| 207 | SNUFFLEUPAGUS_G(config).config_cookie->cookies = sp_list_insert( | 207 | SNUFFLEUPAGUS_G(config).config_cookie->cookies = |
| 208 | SNUFFLEUPAGUS_G(config).config_cookie->cookies, cookie); | 208 | sp_list_insert(SNUFFLEUPAGUS_G(config).config_cookie->cookies, cookie); |
| 209 | return SUCCESS; | 209 | return SUCCESS; |
| 210 | } | 210 | } |
| 211 | 211 | ||
| @@ -338,9 +338,9 @@ int parse_disabled_functions(char *line) { | |||
| 338 | 338 | ||
| 339 | if (param) { | 339 | if (param) { |
| 340 | if (strlen(param) > 0 && param[0] != '$') { | 340 | if (strlen(param) > 0 && param[0] != '$') { |
| 341 | /* This is an ugly hack. We're prefixing with a `$` because otherwise | 341 | /* This is an ugly hack. We're prefixing with a `$` because otherwise |
| 342 | * the parser treats this as a constant. | 342 | * the parser treats this as a constant. |
| 343 | * FIXME: Remove this, and improve our (weird) parser. */ | 343 | * FIXME: Remove this, and improve our (weird) parser. */ |
| 344 | char *new = pecalloc(strlen(param) + 2, 1, 1); | 344 | char *new = pecalloc(strlen(param) + 2, 1, 1); |
| 345 | new[0] = '$'; | 345 | new[0] = '$'; |
| 346 | memcpy(new + 1, param, strlen(param)); | 346 | memcpy(new + 1, param, strlen(param)); |
| @@ -372,12 +372,14 @@ int parse_disabled_functions(char *line) { | |||
| 372 | 372 | ||
| 373 | switch (get_construct_type(df)) { | 373 | switch (get_construct_type(df)) { |
| 374 | case ZEND_INCLUDE_OR_EVAL: | 374 | case ZEND_INCLUDE_OR_EVAL: |
| 375 | SNUFFLEUPAGUS_G(config).config_disabled_constructs->construct_include = sp_list_insert( | 375 | SNUFFLEUPAGUS_G(config) |
| 376 | .config_disabled_constructs->construct_include = sp_list_insert( | ||
| 376 | SNUFFLEUPAGUS_G(config).config_disabled_constructs->construct_include, | 377 | SNUFFLEUPAGUS_G(config).config_disabled_constructs->construct_include, |
| 377 | df); | 378 | df); |
| 378 | return ret; | 379 | return ret; |
| 379 | case ZEND_EVAL_CODE: | 380 | case ZEND_EVAL_CODE: |
| 380 | SNUFFLEUPAGUS_G(config).config_disabled_constructs->construct_eval = sp_list_insert( | 381 | SNUFFLEUPAGUS_G(config) |
| 382 | .config_disabled_constructs->construct_eval = sp_list_insert( | ||
| 381 | SNUFFLEUPAGUS_G(config).config_disabled_constructs->construct_eval, | 383 | SNUFFLEUPAGUS_G(config).config_disabled_constructs->construct_eval, |
| 382 | df); | 384 | df); |
| 383 | return ret; | 385 | return ret; |
| @@ -391,11 +393,13 @@ int parse_disabled_functions(char *line) { | |||
| 391 | } | 393 | } |
| 392 | 394 | ||
| 393 | if (df->ret || df->r_ret || df->ret_type) { | 395 | if (df->ret || df->r_ret || df->ret_type) { |
| 394 | SNUFFLEUPAGUS_G(config).config_disabled_functions_ret->disabled_functions = sp_list_insert( | 396 | SNUFFLEUPAGUS_G(config).config_disabled_functions_ret->disabled_functions = |
| 395 | SNUFFLEUPAGUS_G(config).config_disabled_functions_ret->disabled_functions, | 397 | sp_list_insert(SNUFFLEUPAGUS_G(config) |
| 396 | df); | 398 | .config_disabled_functions_ret->disabled_functions, |
| 399 | df); | ||
| 397 | } else { | 400 | } else { |
| 398 | SNUFFLEUPAGUS_G(config).config_disabled_functions->disabled_functions = sp_list_insert( | 401 | SNUFFLEUPAGUS_G(config) |
| 402 | .config_disabled_functions->disabled_functions = sp_list_insert( | ||
| 399 | SNUFFLEUPAGUS_G(config).config_disabled_functions->disabled_functions, | 403 | SNUFFLEUPAGUS_G(config).config_disabled_functions->disabled_functions, |
| 400 | df); | 404 | df); |
| 401 | } | 405 | } |
