diff options
| author | jvoisin | 2017-10-10 13:22:27 +0200 |
|---|---|---|
| committer | jvoisin | 2017-10-10 13:22:27 +0200 |
| commit | 630c5ad199069b32aae5e7b15223bd10f6986504 (patch) | |
| tree | 3927bd41351453687ce9cc7f35a6b95071769aa6 | |
| parent | 18711c04c9e6fc6056f79f05598719a112ecbba5 (diff) | |
Remove a useless ile for now
This should close #31
| -rw-r--r-- | src/config.m4 | 2 | ||||
| -rw-r--r-- | src/php_snuffleupagus.h | 1 | ||||
| -rw-r--r-- | src/snuffleupagus.c | 1 | ||||
| -rw-r--r-- | src/sp_compile.c | 53 | ||||
| -rw-r--r-- | src/sp_compile.h | 6 |
5 files changed, 1 insertions, 62 deletions
diff --git a/src/config.m4 b/src/config.m4 index a0409de..8fa22c5 100644 --- a/src/config.m4 +++ b/src/config.m4 | |||
| @@ -5,7 +5,7 @@ sources="snuffleupagus.c sp_config.c sp_config_utils.c sp_harden_rand.c" | |||
| 5 | sources="$sources sp_unserialize.c sp_utils.c sp_disable_xxe.c sp_list.c" | 5 | sources="$sources sp_unserialize.c sp_utils.c sp_disable_xxe.c sp_list.c" |
| 6 | sources="$sources sp_disabled_functions.c sp_execute.c sp_upload_validation.c" | 6 | sources="$sources sp_disabled_functions.c sp_execute.c sp_upload_validation.c" |
| 7 | sources="$sources sp_cookie_encryption.c sp_network_utils.c tweetnacl.c" | 7 | sources="$sources sp_cookie_encryption.c sp_network_utils.c tweetnacl.c" |
| 8 | sources="$sources sp_config_keywords.c sp_compile.c" | 8 | sources="$sources sp_config_keywords.c" |
| 9 | 9 | ||
| 10 | PHP_ARG_ENABLE(snuffleupagus, whether to enable snuffleupagus support, | 10 | PHP_ARG_ENABLE(snuffleupagus, whether to enable snuffleupagus support, |
| 11 | [ --enable-snuffleupagus Enable snuffleupagus support]) | 11 | [ --enable-snuffleupagus Enable snuffleupagus support]) |
diff --git a/src/php_snuffleupagus.h b/src/php_snuffleupagus.h index 9f85cc1..bf2031b 100644 --- a/src/php_snuffleupagus.h +++ b/src/php_snuffleupagus.h | |||
| @@ -24,7 +24,6 @@ | |||
| 24 | #include "zend_extensions.h" | 24 | #include "zend_extensions.h" |
| 25 | 25 | ||
| 26 | #include "sp_list.h" | 26 | #include "sp_list.h" |
| 27 | #include "sp_compile.h" | ||
| 28 | #include "sp_config.h" | 27 | #include "sp_config.h" |
| 29 | #include "sp_config_utils.h" | 28 | #include "sp_config_utils.h" |
| 30 | #include "sp_config_keywords.h" | 29 | #include "sp_config_keywords.h" |
diff --git a/src/snuffleupagus.c b/src/snuffleupagus.c index 98649d6..b5f92c4 100644 --- a/src/snuffleupagus.c +++ b/src/snuffleupagus.c | |||
| @@ -9,7 +9,6 @@ | |||
| 9 | #endif | 9 | #endif |
| 10 | 10 | ||
| 11 | static PHP_INI_MH(OnUpdateConfiguration); | 11 | static PHP_INI_MH(OnUpdateConfiguration); |
| 12 | static inline int zend_auto_start(zend_extension *extension); | ||
| 13 | static inline void sp_op_array_handler(zend_op_array *op); | 12 | static inline void sp_op_array_handler(zend_op_array *op); |
| 14 | 13 | ||
| 15 | ZEND_EXTENSION(); | 14 | ZEND_EXTENSION(); |
diff --git a/src/sp_compile.c b/src/sp_compile.c deleted file mode 100644 index 2902377..0000000 --- a/src/sp_compile.c +++ /dev/null | |||
| @@ -1,53 +0,0 @@ | |||
| 1 | #include "php_snuffleupagus.h" | ||
| 2 | |||
| 3 | ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus); | ||
| 4 | |||
| 5 | static zend_op_array *(*orig_compile_file)(zend_file_handle *, int); | ||
| 6 | static zend_op_array *(*orig_compile_string)(zval *, char *); | ||
| 7 | |||
| 8 | zend_op_array *sp_compile_file(zend_file_handle *file_handle, int type) { | ||
| 9 | zend_op_array *ret = orig_compile_file(file_handle, type); | ||
| 10 | |||
| 11 | const sp_node_t* config = SNUFFLEUPAGUS_G(config).config_disabled_functions->disabled_functions; | ||
| 12 | |||
| 13 | while (config && config->data) { | ||
| 14 | const char* function_name = ((sp_disabled_function*)config->data)->function; | ||
| 15 | const pcre* function_name_regexp = ((sp_disabled_function*)config->data)->r_function; | ||
| 16 | |||
| 17 | sp_log_err("checking for %s", function_name); | ||
| 18 | // EG(function_table)->arData[count - 1].val.value.func->internal_function.handler = PHP_FN(check_disabled_function); | ||
| 19 | |||
| 20 | if (function_name) { | ||
| 21 | if (HOOK_FUNCTION(function_name, disabled_functions_hook, PHP_FN(check_disabled_function), true) == SUCCESS) { | ||
| 22 | sp_log_err("Successfully hooked %s", function_name); | ||
| 23 | } | ||
| 24 | break; | ||
| 25 | } else if (function_name_regexp) { | ||
| 26 | sp_log_err("error", "We'll hook regard later."); | ||
| 27 | } | ||
| 28 | config = config->next; | ||
| 29 | } | ||
| 30 | |||
| 31 | return ret; | ||
| 32 | } | ||
| 33 | |||
| 34 | zend_op_array *sp_compile_string(zval *source_string, char *filename) { | ||
| 35 | zend_op_array *ret = orig_compile_string(source_string, filename); | ||
| 36 | sp_log_err("in compile_string : filename is :%s", filename); | ||
| 37 | return ret; | ||
| 38 | } | ||
| 39 | |||
| 40 | |||
| 41 | int hook_compile(void) { | ||
| 42 | TSRMLS_FETCH(); | ||
| 43 | |||
| 44 | /* zend_compile_file is used to compile php file */ | ||
| 45 | orig_compile_file = zend_compile_file; | ||
| 46 | zend_compile_file = sp_compile_file; | ||
| 47 | |||
| 48 | /* zend_compile_string is used to compile php string */ | ||
| 49 | orig_compile_string = zend_compile_string; | ||
| 50 | zend_compile_string = sp_compile_string; | ||
| 51 | |||
| 52 | return SUCCESS; | ||
| 53 | } \ No newline at end of file | ||
diff --git a/src/sp_compile.h b/src/sp_compile.h deleted file mode 100644 index 538ff52..0000000 --- a/src/sp_compile.h +++ /dev/null | |||
| @@ -1,6 +0,0 @@ | |||
| 1 | #ifndef SP_COMPILE_H | ||
| 2 | #define SP_COMPILE_H | ||
| 3 | |||
| 4 | int hook_compile(void); | ||
| 5 | |||
| 6 | #endif /* SP_COMPILE_H */ \ No newline at end of file | ||
