diff options
| author | bef | 2019-06-20 12:40:07 +0200 |
|---|---|---|
| committer | jvoisin | 2019-06-20 10:40:07 +0000 |
| commit | 1b52614c06b60ced6caecd8dcaa0911ed3aa72e2 (patch) | |
| tree | f9090e36de2a1788ae07da04e859ec3666600827 /src | |
| parent | db20c8ddf4d5c068e20bbce1f6d283c9eb06119a (diff) | |
Fix snufflepagus_globals linking issues and one mac compatibility issue
Diffstat (limited to 'src')
| -rw-r--r-- | src/php_snuffleupagus.h | 1 | ||||
| -rw-r--r-- | src/sp_config.c | 2 | ||||
| -rw-r--r-- | src/sp_config_keywords.c | 2 | ||||
| -rw-r--r-- | src/sp_config_utils.c | 2 | ||||
| -rw-r--r-- | src/sp_cookie_encryption.c | 2 | ||||
| -rw-r--r-- | src/sp_crypt.c | 2 | ||||
| -rw-r--r-- | src/sp_disable_xxe.c | 2 | ||||
| -rw-r--r-- | src/sp_disabled_functions.c | 2 | ||||
| -rw-r--r-- | src/sp_execute.c | 2 | ||||
| -rw-r--r-- | src/sp_harden_rand.c | 2 | ||||
| -rw-r--r-- | src/sp_network_utils.c | 4 | ||||
| -rw-r--r-- | src/sp_session.c | 2 | ||||
| -rw-r--r-- | src/sp_sloppy.c | 2 | ||||
| -rw-r--r-- | src/sp_unserialize.c | 1 | ||||
| -rw-r--r-- | src/sp_upload_validation.c | 2 | ||||
| -rw-r--r-- | src/sp_utils.c | 2 | ||||
| -rw-r--r-- | src/sp_wrapper.c | 2 | ||||
| -rw-r--r-- | src/tweetnacl.c | 2 |
18 files changed, 2 insertions, 34 deletions
diff --git a/src/php_snuffleupagus.h b/src/php_snuffleupagus.h index c9313f8..43131fe 100644 --- a/src/php_snuffleupagus.h +++ b/src/php_snuffleupagus.h | |||
| @@ -99,6 +99,7 @@ HashTable *sp_internal_functions_hook; | |||
| 99 | HashTable *sp_eval_blacklist_functions_hook; | 99 | HashTable *sp_eval_blacklist_functions_hook; |
| 100 | ZEND_END_MODULE_GLOBALS(snuffleupagus) | 100 | ZEND_END_MODULE_GLOBALS(snuffleupagus) |
| 101 | 101 | ||
| 102 | ZEND_EXTERN_MODULE_GLOBALS(snuffleupagus) | ||
| 102 | #define SNUFFLEUPAGUS_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(snuffleupagus, v) | 103 | #define SNUFFLEUPAGUS_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(snuffleupagus, v) |
| 103 | 104 | ||
| 104 | #if defined(ZTS) && defined(COMPILE_DL_SNUFFLEUPAGUS) | 105 | #if defined(ZTS) && defined(COMPILE_DL_SNUFFLEUPAGUS) |
diff --git a/src/sp_config.c b/src/sp_config.c index 915c8a1..25223f2 100644 --- a/src/sp_config.c +++ b/src/sp_config.c | |||
| @@ -4,8 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | #include "php_snuffleupagus.h" | 5 | #include "php_snuffleupagus.h" |
| 6 | 6 | ||
| 7 | ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus) | ||
| 8 | |||
| 9 | size_t sp_line_no; | 7 | size_t sp_line_no; |
| 10 | 8 | ||
| 11 | sp_config_tokens const sp_func[] = { | 9 | sp_config_tokens const sp_func[] = { |
diff --git a/src/sp_config_keywords.c b/src/sp_config_keywords.c index a13aed2..abb3110 100644 --- a/src/sp_config_keywords.c +++ b/src/sp_config_keywords.c | |||
| @@ -1,7 +1,5 @@ | |||
| 1 | #include "php_snuffleupagus.h" | 1 | #include "php_snuffleupagus.h" |
| 2 | 2 | ||
| 3 | ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus) | ||
| 4 | |||
| 5 | static int parse_enable(char *line, bool *restrict retval, | 3 | static int parse_enable(char *line, bool *restrict retval, |
| 6 | bool *restrict simulation) { | 4 | bool *restrict simulation) { |
| 7 | bool enable = false, disable = false; | 5 | bool enable = false, disable = false; |
diff --git a/src/sp_config_utils.c b/src/sp_config_utils.c index 71c9071..dbe6793 100644 --- a/src/sp_config_utils.c +++ b/src/sp_config_utils.c | |||
| @@ -1,7 +1,5 @@ | |||
| 1 | #include "php_snuffleupagus.h" | 1 | #include "php_snuffleupagus.h" |
| 2 | 2 | ||
| 3 | size_t sp_line_no; | ||
| 4 | |||
| 5 | int parse_keywords(sp_config_functions *funcs, char *line) { | 3 | int parse_keywords(sp_config_functions *funcs, char *line) { |
| 6 | int value_len = 0; | 4 | int value_len = 0; |
| 7 | const char *original_line = line; | 5 | const char *original_line = line; |
diff --git a/src/sp_cookie_encryption.c b/src/sp_cookie_encryption.c index 249de2d..92a056b 100644 --- a/src/sp_cookie_encryption.c +++ b/src/sp_cookie_encryption.c | |||
| @@ -1,7 +1,5 @@ | |||
| 1 | #include "php_snuffleupagus.h" | 1 | #include "php_snuffleupagus.h" |
| 2 | 2 | ||
| 3 | ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus) | ||
| 4 | |||
| 5 | static inline const sp_cookie *sp_lookup_cookie_config(const zend_string *key) { | 3 | static inline const sp_cookie *sp_lookup_cookie_config(const zend_string *key) { |
| 6 | const sp_list_node *it = SNUFFLEUPAGUS_G(config).config_cookie->cookies; | 4 | const sp_list_node *it = SNUFFLEUPAGUS_G(config).config_cookie->cookies; |
| 7 | 5 | ||
diff --git a/src/sp_crypt.c b/src/sp_crypt.c index da0e2fe..42c1510 100644 --- a/src/sp_crypt.c +++ b/src/sp_crypt.c | |||
| @@ -1,7 +1,5 @@ | |||
| 1 | #include "php_snuffleupagus.h" | 1 | #include "php_snuffleupagus.h" |
| 2 | 2 | ||
| 3 | ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus) | ||
| 4 | |||
| 5 | void generate_key(unsigned char *key) { | 3 | void generate_key(unsigned char *key) { |
| 6 | PHP_SHA256_CTX ctx; | 4 | PHP_SHA256_CTX ctx; |
| 7 | const char *user_agent = getenv("HTTP_USER_AGENT"); | 5 | const char *user_agent = getenv("HTTP_USER_AGENT"); |
diff --git a/src/sp_disable_xxe.c b/src/sp_disable_xxe.c index df00dbd..53148c8 100644 --- a/src/sp_disable_xxe.c +++ b/src/sp_disable_xxe.c | |||
| @@ -1,7 +1,5 @@ | |||
| 1 | #include "php_snuffleupagus.h" | 1 | #include "php_snuffleupagus.h" |
| 2 | 2 | ||
| 3 | ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus) | ||
| 4 | |||
| 5 | PHP_FUNCTION(sp_libxml_disable_entity_loader) { RETURN_TRUE; } | 3 | PHP_FUNCTION(sp_libxml_disable_entity_loader) { RETURN_TRUE; } |
| 6 | 4 | ||
| 7 | int hook_libxml_disable_entity_loader() { | 5 | int hook_libxml_disable_entity_loader() { |
diff --git a/src/sp_disabled_functions.c b/src/sp_disabled_functions.c index 8177ce1..c088f20 100644 --- a/src/sp_disabled_functions.c +++ b/src/sp_disabled_functions.c | |||
| @@ -1,7 +1,5 @@ | |||
| 1 | #include "php_snuffleupagus.h" | 1 | #include "php_snuffleupagus.h" |
| 2 | 2 | ||
| 3 | ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus) | ||
| 4 | |||
| 5 | static void should_disable(zend_execute_data* execute_data, | 3 | static void should_disable(zend_execute_data* execute_data, |
| 6 | const char* complete_function_path, | 4 | const char* complete_function_path, |
| 7 | const zend_string* builtin_param, | 5 | const zend_string* builtin_param, |
diff --git a/src/sp_execute.c b/src/sp_execute.c index b4f2595..4eae874 100644 --- a/src/sp_execute.c +++ b/src/sp_execute.c | |||
| @@ -1,7 +1,5 @@ | |||
| 1 | #include "php_snuffleupagus.h" | 1 | #include "php_snuffleupagus.h" |
| 2 | 2 | ||
| 3 | ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus) | ||
| 4 | |||
| 5 | static void (*orig_execute_ex)(zend_execute_data *execute_data) = NULL; | 3 | static void (*orig_execute_ex)(zend_execute_data *execute_data) = NULL; |
| 6 | static void (*orig_zend_execute_internal)(zend_execute_data *execute_data, | 4 | static void (*orig_zend_execute_internal)(zend_execute_data *execute_data, |
| 7 | zval *return_value) = NULL; | 5 | zval *return_value) = NULL; |
diff --git a/src/sp_harden_rand.c b/src/sp_harden_rand.c index 7ab798e..43c2a5b 100644 --- a/src/sp_harden_rand.c +++ b/src/sp_harden_rand.c | |||
| @@ -2,8 +2,6 @@ | |||
| 2 | 2 | ||
| 3 | extern ZEND_API zend_class_entry *zend_ce_error; | 3 | extern ZEND_API zend_class_entry *zend_ce_error; |
| 4 | 4 | ||
| 5 | ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus) | ||
| 6 | |||
| 7 | /* This function is needed because `rand` and `mt_rand` parameters | 5 | /* This function is needed because `rand` and `mt_rand` parameters |
| 8 | * are optional, while the ones from `random_int` aren't. */ | 6 | * are optional, while the ones from `random_int` aren't. */ |
| 9 | static void random_int_wrapper(INTERNAL_FUNCTION_PARAMETERS) { | 7 | static void random_int_wrapper(INTERNAL_FUNCTION_PARAMETERS) { |
diff --git a/src/sp_network_utils.c b/src/sp_network_utils.c index c444c1e..1811d98 100644 --- a/src/sp_network_utils.c +++ b/src/sp_network_utils.c | |||
| @@ -1,7 +1,5 @@ | |||
| 1 | #include "php_snuffleupagus.h" | 1 | #include "php_snuffleupagus.h" |
| 2 | 2 | ||
| 3 | ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus) | ||
| 4 | |||
| 5 | static inline bool cidr4_match(const struct in_addr addr, | 3 | static inline bool cidr4_match(const struct in_addr addr, |
| 6 | const struct in_addr net, uint8_t bits); | 4 | const struct in_addr net, uint8_t bits); |
| 7 | static inline bool cidr6_match(const struct in6_addr address, | 5 | static inline bool cidr6_match(const struct in6_addr address, |
| @@ -19,7 +17,7 @@ static inline bool cidr4_match(const struct in_addr addr, | |||
| 19 | 17 | ||
| 20 | static inline bool cidr6_match(const struct in6_addr address, | 18 | static inline bool cidr6_match(const struct in6_addr address, |
| 21 | const struct in6_addr network, uint8_t bits) { | 19 | const struct in6_addr network, uint8_t bits) { |
| 22 | #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) | 20 | #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__) |
| 23 | const uint32_t *a = address.__u6_addr.__u6_addr32; | 21 | const uint32_t *a = address.__u6_addr.__u6_addr32; |
| 24 | const uint32_t *n = network.__u6_addr.__u6_addr32; | 22 | const uint32_t *n = network.__u6_addr.__u6_addr32; |
| 25 | #else | 23 | #else |
diff --git a/src/sp_session.c b/src/sp_session.c index 596eae9..1064fe6 100644 --- a/src/sp_session.c +++ b/src/sp_session.c | |||
| @@ -1,7 +1,5 @@ | |||
| 1 | #include "php_snuffleupagus.h" | 1 | #include "php_snuffleupagus.h" |
| 2 | 2 | ||
| 3 | ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus) | ||
| 4 | |||
| 5 | #if (HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION)) | 3 | #if (HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION)) |
| 6 | 4 | ||
| 7 | #ifdef ZTS | 5 | #ifdef ZTS |
diff --git a/src/sp_sloppy.c b/src/sp_sloppy.c index d3678db..5837783 100644 --- a/src/sp_sloppy.c +++ b/src/sp_sloppy.c | |||
| @@ -1,7 +1,5 @@ | |||
| 1 | #include "php_snuffleupagus.h" | 1 | #include "php_snuffleupagus.h" |
| 2 | 2 | ||
| 3 | ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus) | ||
| 4 | |||
| 5 | ZEND_API zend_op_array* (*orig_zend_compile_file)(zend_file_handle* file_handle, | 3 | ZEND_API zend_op_array* (*orig_zend_compile_file)(zend_file_handle* file_handle, |
| 6 | int type) = NULL; | 4 | int type) = NULL; |
| 7 | ZEND_API zend_op_array* (*orig_zend_compile_string)(zval* source_string, | 5 | ZEND_API zend_op_array* (*orig_zend_compile_string)(zval* source_string, |
diff --git a/src/sp_unserialize.c b/src/sp_unserialize.c index 5e21d6a..f265ce6 100644 --- a/src/sp_unserialize.c +++ b/src/sp_unserialize.c | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | #include "php_snuffleupagus.h" | 1 | #include "php_snuffleupagus.h" |
| 2 | 2 | ||
| 3 | ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus) | ||
| 4 | 3 | ||
| 5 | PHP_FUNCTION(sp_serialize) { | 4 | PHP_FUNCTION(sp_serialize) { |
| 6 | zif_handler orig_handler; | 5 | zif_handler orig_handler; |
diff --git a/src/sp_upload_validation.c b/src/sp_upload_validation.c index fe16a46..ee19df9 100644 --- a/src/sp_upload_validation.c +++ b/src/sp_upload_validation.c | |||
| @@ -1,7 +1,5 @@ | |||
| 1 | #include "php_snuffleupagus.h" | 1 | #include "php_snuffleupagus.h" |
| 2 | 2 | ||
| 3 | ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus) | ||
| 4 | |||
| 5 | int (*sp_rfc1867_orig_callback)(unsigned int event, void *event_data, | 3 | int (*sp_rfc1867_orig_callback)(unsigned int event, void *event_data, |
| 6 | void **extra); | 4 | void **extra); |
| 7 | int sp_rfc1867_callback(unsigned int event, void *event_data, void **extra); | 5 | int sp_rfc1867_callback(unsigned int event, void *event_data, void **extra); |
diff --git a/src/sp_utils.c b/src/sp_utils.c index 475d552..7641808 100644 --- a/src/sp_utils.c +++ b/src/sp_utils.c | |||
| @@ -1,7 +1,5 @@ | |||
| 1 | #include "php_snuffleupagus.h" | 1 | #include "php_snuffleupagus.h" |
| 2 | 2 | ||
| 3 | ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus) | ||
| 4 | |||
| 5 | bool sp_zend_string_equals(const zend_string* s1, const zend_string* s2) { | 3 | bool sp_zend_string_equals(const zend_string* s1, const zend_string* s2) { |
| 6 | // We can't use `zend_string_equals` here because it doesn't work on | 4 | // We can't use `zend_string_equals` here because it doesn't work on |
| 7 | // `const` zend_string. | 5 | // `const` zend_string. |
diff --git a/src/sp_wrapper.c b/src/sp_wrapper.c index 1618a4f..277f23a 100644 --- a/src/sp_wrapper.c +++ b/src/sp_wrapper.c | |||
| @@ -1,7 +1,5 @@ | |||
| 1 | #include "php_snuffleupagus.h" | 1 | #include "php_snuffleupagus.h" |
| 2 | 2 | ||
| 3 | ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus) | ||
| 4 | |||
| 5 | static bool wrapper_is_whitelisted(const zend_string *zs) { | 3 | static bool wrapper_is_whitelisted(const zend_string *zs) { |
| 6 | const sp_list_node *list = SNUFFLEUPAGUS_G(config).config_wrapper->whitelist; | 4 | const sp_list_node *list = SNUFFLEUPAGUS_G(config).config_wrapper->whitelist; |
| 7 | 5 | ||
diff --git a/src/tweetnacl.c b/src/tweetnacl.c index ad5dae5..9f66546 100644 --- a/src/tweetnacl.c +++ b/src/tweetnacl.c | |||
| @@ -3,8 +3,6 @@ we're using the one from PHP.*/ | |||
| 3 | #include "php_snuffleupagus.h" | 3 | #include "php_snuffleupagus.h" |
| 4 | #include "ext/standard/php_random.h" | 4 | #include "ext/standard/php_random.h" |
| 5 | 5 | ||
| 6 | ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus) | ||
| 7 | |||
| 8 | void randombytes(unsigned char *x, unsigned long long xlen) { | 6 | void randombytes(unsigned char *x, unsigned long long xlen) { |
| 9 | assert(SIZE_MAX >= ULLONG_MAX); // max(size_t) > max(ull) ? | 7 | assert(SIZE_MAX >= ULLONG_MAX); // max(size_t) > max(ull) ? |
| 10 | php_random_bytes(x, xlen, 1); | 8 | php_random_bytes(x, xlen, 1); |
