summaryrefslogtreecommitdiff
path: root/src/php_snuffleupagus.h
diff options
context:
space:
mode:
authorBen Fuhrmannek2021-09-23 12:23:40 +0200
committerBen Fuhrmannek2021-09-23 12:23:40 +0200
commit54c352c1b5aa08b187dd1e52e544709cad2b0fee (patch)
treed15bf0f484c6baa1f2718e625e0d49f6fb488507 /src/php_snuffleupagus.h
parent887e1c9d44fbcf5f23a928269034593b8521aaba (diff)
config is stack allocated now + some code improvements (see details)
* for easier memory manegement, the entire sp_config struct was merged into snuffleupagus_globals and allocated on stack where possible * SNUFFLEUPAGUS_G() can be written as SPG(), which is faster to type and easier to read * execution_depth is re-initialized to 0 for each request * function calls with inline string and length parameters consistently use ZEND_STRL instead of sizeof()-1 * execution is actually hooked if recursion protection is enabled * some line breaks were removed to make the code more readable
Diffstat (limited to 'src/php_snuffleupagus.h')
-rw-r--r--src/php_snuffleupagus.h41
1 files changed, 38 insertions, 3 deletions
diff --git a/src/php_snuffleupagus.h b/src/php_snuffleupagus.h
index bcb613c..308031b 100644
--- a/src/php_snuffleupagus.h
+++ b/src/php_snuffleupagus.h
@@ -106,11 +106,44 @@ extern zend_module_entry snuffleupagus_module_entry;
106#endif 106#endif
107 107
108ZEND_BEGIN_MODULE_GLOBALS(snuffleupagus) 108ZEND_BEGIN_MODULE_GLOBALS(snuffleupagus)
109size_t in_eval; 109// sp_config config;
110sp_config config; 110// --- snuffleupagus config
111sp_config_random config_random;
112sp_config_sloppy config_sloppy;
113sp_config_unserialize config_unserialize;
114sp_config_readonly_exec config_readonly_exec;
115sp_config_upload_validation config_upload_validation;
116sp_config_cookie config_cookie;
117sp_config_auto_cookie_secure config_auto_cookie_secure;
118sp_config_global_strict config_global_strict;
119sp_config_disable_xxe config_disable_xxe;
120sp_config_eval config_eval;
121sp_config_wrapper config_wrapper;
122sp_config_session config_session;
123sp_config_ini config_ini;
124char config_log_media;
125u_long config_max_execution_depth;
126bool config_server_encode;
127bool config_server_strip;
128zend_string *config_encryption_key;
129zend_string *config_cookies_env_var;
130
131HashTable *config_disabled_functions;
132HashTable *config_disabled_functions_hooked;
133HashTable *config_disabled_functions_ret;
134HashTable *config_disabled_functions_ret_hooked;
135sp_config_disabled_functions config_disabled_functions_reg;
136sp_config_disabled_functions config_disabled_functions_reg_ret;
137
138bool hook_execute;
139
140// --- ini options
141bool allow_broken_configuration;
142
143// --- runtime/state variables
111int is_config_valid; // 1 = valid, 0 = invalid, -1 = none 144int is_config_valid; // 1 = valid, 0 = invalid, -1 = none
145size_t in_eval;
112u_long execution_depth; 146u_long execution_depth;
113bool allow_broken_configuration;
114HashTable *disabled_functions_hook; 147HashTable *disabled_functions_hook;
115HashTable *sp_internal_functions_hook; 148HashTable *sp_internal_functions_hook;
116HashTable *sp_eval_blacklist_functions_hook; 149HashTable *sp_eval_blacklist_functions_hook;
@@ -118,6 +151,8 @@ ZEND_END_MODULE_GLOBALS(snuffleupagus)
118 151
119ZEND_EXTERN_MODULE_GLOBALS(snuffleupagus) 152ZEND_EXTERN_MODULE_GLOBALS(snuffleupagus)
120#define SNUFFLEUPAGUS_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(snuffleupagus, v) 153#define SNUFFLEUPAGUS_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(snuffleupagus, v)
154#define SPG(v) SNUFFLEUPAGUS_G(v)
155#define SPCFG(v) SPG(config_##v)
121 156
122#if defined(ZTS) && defined(COMPILE_DL_SNUFFLEUPAGUS) 157#if defined(ZTS) && defined(COMPILE_DL_SNUFFLEUPAGUS)
123ZEND_TSRMLS_CACHE_EXTERN() 158ZEND_TSRMLS_CACHE_EXTERN()