From 630c5ad199069b32aae5e7b15223bd10f6986504 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Tue, 10 Oct 2017 13:22:27 +0200 Subject: Remove a useless ile for now This should close #31 --- src/config.m4 | 2 +- src/php_snuffleupagus.h | 1 - src/snuffleupagus.c | 1 - src/sp_compile.c | 53 ------------------------------------------------- src/sp_compile.h | 6 ------ 5 files changed, 1 insertion(+), 62 deletions(-) delete mode 100644 src/sp_compile.c delete mode 100644 src/sp_compile.h (limited to 'src') 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" sources="$sources sp_unserialize.c sp_utils.c sp_disable_xxe.c sp_list.c" sources="$sources sp_disabled_functions.c sp_execute.c sp_upload_validation.c" sources="$sources sp_cookie_encryption.c sp_network_utils.c tweetnacl.c" -sources="$sources sp_config_keywords.c sp_compile.c" +sources="$sources sp_config_keywords.c" PHP_ARG_ENABLE(snuffleupagus, whether to enable snuffleupagus support, [ --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 @@ #include "zend_extensions.h" #include "sp_list.h" -#include "sp_compile.h" #include "sp_config.h" #include "sp_config_utils.h" #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 @@ #endif static PHP_INI_MH(OnUpdateConfiguration); -static inline int zend_auto_start(zend_extension *extension); static inline void sp_op_array_handler(zend_op_array *op); 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 @@ -#include "php_snuffleupagus.h" - -ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus); - -static zend_op_array *(*orig_compile_file)(zend_file_handle *, int); -static zend_op_array *(*orig_compile_string)(zval *, char *); - -zend_op_array *sp_compile_file(zend_file_handle *file_handle, int type) { - zend_op_array *ret = orig_compile_file(file_handle, type); - - const sp_node_t* config = SNUFFLEUPAGUS_G(config).config_disabled_functions->disabled_functions; - - while (config && config->data) { - const char* function_name = ((sp_disabled_function*)config->data)->function; - const pcre* function_name_regexp = ((sp_disabled_function*)config->data)->r_function; - - sp_log_err("checking for %s", function_name); - // EG(function_table)->arData[count - 1].val.value.func->internal_function.handler = PHP_FN(check_disabled_function); - - if (function_name) { - if (HOOK_FUNCTION(function_name, disabled_functions_hook, PHP_FN(check_disabled_function), true) == SUCCESS) { - sp_log_err("Successfully hooked %s", function_name); - } - break; - } else if (function_name_regexp) { - sp_log_err("error", "We'll hook regard later."); - } - config = config->next; - } - - return ret; -} - -zend_op_array *sp_compile_string(zval *source_string, char *filename) { - zend_op_array *ret = orig_compile_string(source_string, filename); - sp_log_err("in compile_string : filename is :%s", filename); - return ret; -} - - -int hook_compile(void) { - TSRMLS_FETCH(); - - /* zend_compile_file is used to compile php file */ - orig_compile_file = zend_compile_file; - zend_compile_file = sp_compile_file; - - /* zend_compile_string is used to compile php string */ - orig_compile_string = zend_compile_string; - zend_compile_string = sp_compile_string; - - return SUCCESS; -} \ 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 @@ -#ifndef SP_COMPILE_H -#define SP_COMPILE_H - -int hook_compile(void); - -#endif /* SP_COMPILE_H */ \ No newline at end of file -- cgit v1.3