summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/php_snuffleupagus.h1
-rw-r--r--src/sp_config.c2
-rw-r--r--src/sp_config_keywords.c2
-rw-r--r--src/sp_config_utils.c2
-rw-r--r--src/sp_cookie_encryption.c2
-rw-r--r--src/sp_crypt.c2
-rw-r--r--src/sp_disable_xxe.c2
-rw-r--r--src/sp_disabled_functions.c2
-rw-r--r--src/sp_execute.c2
-rw-r--r--src/sp_harden_rand.c2
-rw-r--r--src/sp_network_utils.c4
-rw-r--r--src/sp_session.c2
-rw-r--r--src/sp_sloppy.c2
-rw-r--r--src/sp_unserialize.c1
-rw-r--r--src/sp_upload_validation.c2
-rw-r--r--src/sp_utils.c2
-rw-r--r--src/sp_wrapper.c2
-rw-r--r--src/tweetnacl.c2
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;
99HashTable *sp_eval_blacklist_functions_hook; 99HashTable *sp_eval_blacklist_functions_hook;
100ZEND_END_MODULE_GLOBALS(snuffleupagus) 100ZEND_END_MODULE_GLOBALS(snuffleupagus)
101 101
102ZEND_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
7ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus)
8
9size_t sp_line_no; 7size_t sp_line_no;
10 8
11sp_config_tokens const sp_func[] = { 9sp_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
3ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus)
4
5static int parse_enable(char *line, bool *restrict retval, 3static 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
3size_t sp_line_no;
4
5int parse_keywords(sp_config_functions *funcs, char *line) { 3int 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
3ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus)
4
5static inline const sp_cookie *sp_lookup_cookie_config(const zend_string *key) { 3static 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
3ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus)
4
5void generate_key(unsigned char *key) { 3void 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
3ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus)
4
5PHP_FUNCTION(sp_libxml_disable_entity_loader) { RETURN_TRUE; } 3PHP_FUNCTION(sp_libxml_disable_entity_loader) { RETURN_TRUE; }
6 4
7int hook_libxml_disable_entity_loader() { 5int 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
3ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus)
4
5static void should_disable(zend_execute_data* execute_data, 3static 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
3ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus)
4
5static void (*orig_execute_ex)(zend_execute_data *execute_data) = NULL; 3static void (*orig_execute_ex)(zend_execute_data *execute_data) = NULL;
6static void (*orig_zend_execute_internal)(zend_execute_data *execute_data, 4static 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
3extern ZEND_API zend_class_entry *zend_ce_error; 3extern ZEND_API zend_class_entry *zend_ce_error;
4 4
5ZEND_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. */
9static void random_int_wrapper(INTERNAL_FUNCTION_PARAMETERS) { 7static 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
3ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus)
4
5static inline bool cidr4_match(const struct in_addr addr, 3static 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);
7static inline bool cidr6_match(const struct in6_addr address, 5static 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
20static inline bool cidr6_match(const struct in6_addr address, 18static 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
3ZEND_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
3ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus)
4
5ZEND_API zend_op_array* (*orig_zend_compile_file)(zend_file_handle* file_handle, 3ZEND_API zend_op_array* (*orig_zend_compile_file)(zend_file_handle* file_handle,
6 int type) = NULL; 4 int type) = NULL;
7ZEND_API zend_op_array* (*orig_zend_compile_string)(zval* source_string, 5ZEND_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
3ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus)
4 3
5PHP_FUNCTION(sp_serialize) { 4PHP_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
3ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus)
4
5int (*sp_rfc1867_orig_callback)(unsigned int event, void *event_data, 3int (*sp_rfc1867_orig_callback)(unsigned int event, void *event_data,
6 void **extra); 4 void **extra);
7int sp_rfc1867_callback(unsigned int event, void *event_data, void **extra); 5int 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
3ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus)
4
5bool sp_zend_string_equals(const zend_string* s1, const zend_string* s2) { 3bool 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
3ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus)
4
5static bool wrapper_is_whitelisted(const zend_string *zs) { 3static 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
6ZEND_DECLARE_MODULE_GLOBALS(snuffleupagus)
7
8void randombytes(unsigned char *x, unsigned long long xlen) { 6void 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);