summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjvoisin2018-07-16 11:24:22 +0200
committerjvoisin2018-07-16 11:24:22 +0200
commitb19b50dd519c5731ea95aae4515c07353aa087c3 (patch)
treeed5f7fabd4d525f379999b321da2bbbbaf4a3b9b
parent02afd6c84f5e4f11b1de054f36d7d1da87206def (diff)
Yet an other clang-format pass
-rw-r--r--src/php_snuffleupagus.h1
-rw-r--r--src/snuffleupagus.c46
2 files changed, 28 insertions, 19 deletions
diff --git a/src/php_snuffleupagus.h b/src/php_snuffleupagus.h
index 008a480..b35b730 100644
--- a/src/php_snuffleupagus.h
+++ b/src/php_snuffleupagus.h
@@ -45,7 +45,6 @@
45#include "sp_session.h" 45#include "sp_session.h"
46#include "sp_sloppy.h" 46#include "sp_sloppy.h"
47 47
48
49extern zend_module_entry snuffleupagus_module_entry; 48extern zend_module_entry snuffleupagus_module_entry;
50#define phpext_snuffleupagus_ptr &snuffleupagus_module_entry 49#define phpext_snuffleupagus_ptr &snuffleupagus_module_entry
51 50
diff --git a/src/snuffleupagus.c b/src/snuffleupagus.c
index ad1d0a9..3f9e1eb 100644
--- a/src/snuffleupagus.c
+++ b/src/snuffleupagus.c
@@ -40,10 +40,8 @@ PHP_INI_ENTRY("sp.configuration_file", "", PHP_INI_SYSTEM,
40PHP_INI_END() 40PHP_INI_END()
41 41
42void free_disabled_functions_hashtable(HashTable *ht) { 42void free_disabled_functions_hashtable(HashTable *ht) {
43 void* ptr = NULL; 43 void *ptr = NULL;
44 ZEND_HASH_FOREACH_PTR(ht, ptr) { 44 ZEND_HASH_FOREACH_PTR(ht, ptr) { sp_list_free(ptr); }
45 sp_list_free(ptr);
46 }
47 ZEND_HASH_FOREACH_END(); 45 ZEND_HASH_FOREACH_END();
48} 46}
49 47
@@ -80,7 +78,8 @@ PHP_GINIT_FUNCTION(snuffleupagus) {
80 SP_INIT_HT(snuffleupagus_globals->config.config_disabled_functions); 78 SP_INIT_HT(snuffleupagus_globals->config.config_disabled_functions);
81 SP_INIT_HT(snuffleupagus_globals->config.config_disabled_functions_hooked); 79 SP_INIT_HT(snuffleupagus_globals->config.config_disabled_functions_hooked);
82 SP_INIT_HT(snuffleupagus_globals->config.config_disabled_functions_ret); 80 SP_INIT_HT(snuffleupagus_globals->config.config_disabled_functions_ret);
83 SP_INIT_HT(snuffleupagus_globals->config.config_disabled_functions_ret_hooked); 81 SP_INIT_HT(
82 snuffleupagus_globals->config.config_disabled_functions_ret_hooked);
84 83
85 SP_INIT(snuffleupagus_globals->config.config_unserialize); 84 SP_INIT(snuffleupagus_globals->config.config_unserialize);
86 SP_INIT(snuffleupagus_globals->config.config_random); 85 SP_INIT(snuffleupagus_globals->config.config_random);
@@ -116,10 +115,14 @@ PHP_MINIT_FUNCTION(snuffleupagus) {
116} 115}
117 116
118PHP_MSHUTDOWN_FUNCTION(snuffleupagus) { 117PHP_MSHUTDOWN_FUNCTION(snuffleupagus) {
119 free_disabled_functions_hashtable(SNUFFLEUPAGUS_G(config).config_disabled_functions); 118 free_disabled_functions_hashtable(
120 free_disabled_functions_hashtable(SNUFFLEUPAGUS_G(config).config_disabled_functions_hooked); 119 SNUFFLEUPAGUS_G(config).config_disabled_functions);
121 free_disabled_functions_hashtable(SNUFFLEUPAGUS_G(config).config_disabled_functions_ret); 120 free_disabled_functions_hashtable(
122 free_disabled_functions_hashtable(SNUFFLEUPAGUS_G(config).config_disabled_functions_ret_hooked); 121 SNUFFLEUPAGUS_G(config).config_disabled_functions_hooked);
122 free_disabled_functions_hashtable(
123 SNUFFLEUPAGUS_G(config).config_disabled_functions_ret);
124 free_disabled_functions_hashtable(
125 SNUFFLEUPAGUS_G(config).config_disabled_functions_ret_hooked);
123 126
124#define FREE_HT(F) \ 127#define FREE_HT(F) \
125 zend_hash_destroy(SNUFFLEUPAGUS_G(F)); \ 128 zend_hash_destroy(SNUFFLEUPAGUS_G(F)); \
@@ -152,7 +155,8 @@ PHP_MSHUTDOWN_FUNCTION(snuffleupagus) {
152 } while (0) 155 } while (0)
153 156
154 FREE_LST_DISABLE(config.config_disabled_functions_reg->disabled_functions); 157 FREE_LST_DISABLE(config.config_disabled_functions_reg->disabled_functions);
155 FREE_LST_DISABLE(config.config_disabled_functions_reg_ret->disabled_functions); 158 FREE_LST_DISABLE(
159 config.config_disabled_functions_reg_ret->disabled_functions);
156 sp_list_free(SNUFFLEUPAGUS_G(config).config_cookie->cookies); 160 sp_list_free(SNUFFLEUPAGUS_G(config).config_cookie->cookies);
157 sp_list_free(SNUFFLEUPAGUS_G(config).config_eval->blacklist); 161 sp_list_free(SNUFFLEUPAGUS_G(config).config_eval->blacklist);
158 sp_list_free(SNUFFLEUPAGUS_G(config).config_eval->whitelist); 162 sp_list_free(SNUFFLEUPAGUS_G(config).config_eval->whitelist);
@@ -261,19 +265,25 @@ static PHP_INI_MH(OnUpdateConfiguration) {
261 // This is needed to implement the global strict mode 265 // This is needed to implement the global strict mode
262 CG(compiler_options) |= ZEND_COMPILE_HANDLE_OP_ARRAY; 266 CG(compiler_options) |= ZEND_COMPILE_HANDLE_OP_ARRAY;
263 } 267 }
264 if (zend_hash_str_find(SNUFFLEUPAGUS_G(config).config_disabled_functions_hooked, 268 if (zend_hash_str_find(
265 "echo", strlen("echo")) || 269 SNUFFLEUPAGUS_G(config).config_disabled_functions_hooked, "echo",
266 zend_hash_str_find(SNUFFLEUPAGUS_G(config).config_disabled_functions_ret_hooked, 270 strlen("echo")) ||
267 "echo", strlen("echo"))) { 271 zend_hash_str_find(
272 SNUFFLEUPAGUS_G(config).config_disabled_functions_ret_hooked, "echo",
273 strlen("echo"))) {
268 zend_write_default = zend_write; 274 zend_write_default = zend_write;
269 zend_write = hook_echo; 275 zend_write = hook_echo;
270 } 276 }
271 277
272 SNUFFLEUPAGUS_G(config).hook_execute = 278 SNUFFLEUPAGUS_G(config).hook_execute =
273 SNUFFLEUPAGUS_G(config).config_disabled_functions_reg->disabled_functions || 279 SNUFFLEUPAGUS_G(config)
274 SNUFFLEUPAGUS_G(config).config_disabled_functions_reg_ret->disabled_functions || 280 .config_disabled_functions_reg->disabled_functions ||
275 zend_hash_num_elements(SNUFFLEUPAGUS_G(config).config_disabled_functions) || 281 SNUFFLEUPAGUS_G(config)
276 zend_hash_num_elements(SNUFFLEUPAGUS_G(config).config_disabled_functions_ret); 282 .config_disabled_functions_reg_ret->disabled_functions ||
283 zend_hash_num_elements(
284 SNUFFLEUPAGUS_G(config).config_disabled_functions) ||
285 zend_hash_num_elements(
286 SNUFFLEUPAGUS_G(config).config_disabled_functions_ret);
277 287
278 return SUCCESS; 288 return SUCCESS;
279} 289}