diff options
| -rw-r--r-- | ex_imp.c | 8 | ||||
| -rw-r--r-- | execute.c | 17 | ||||
| -rw-r--r-- | header.c | 8 | ||||
| -rw-r--r-- | log.c | 8 | ||||
| -rw-r--r-- | php_suhosin.h | 10 | ||||
| -rw-r--r-- | post_handler.c | 6 | ||||
| -rw-r--r-- | rfc1867.c | 2 | ||||
| -rw-r--r-- | rfc1867_new.c | 2 | ||||
| -rw-r--r-- | session.c | 16 | ||||
| -rw-r--r-- | sha256.c | 2 | ||||
| -rw-r--r-- | suhosin.c | 6 | ||||
| -rw-r--r-- | treat_data.c | 6 |
12 files changed, 48 insertions, 43 deletions
| @@ -86,7 +86,7 @@ static int php_valid_var_name(char *var_name, int len) /* {{{ */ | |||
| 86 | Imports variables into symbol table from an array */ | 86 | Imports variables into symbol table from an array */ |
| 87 | PHP_FUNCTION(suhosin_extract) | 87 | PHP_FUNCTION(suhosin_extract) |
| 88 | { | 88 | { |
| 89 | #if PHP_VERSION_ID >= 50300 | 89 | #if 1 //PHP_VERSION_ID >= 50300 |
| 90 | zval *var_array, *prefix = NULL; | 90 | zval *var_array, *prefix = NULL; |
| 91 | long extract_type = EXTR_OVERWRITE; | 91 | long extract_type = EXTR_OVERWRITE; |
| 92 | zval **entry, *data; | 92 | zval **entry, *data; |
| @@ -422,14 +422,14 @@ PHP_FUNCTION(suhosin_extract) | |||
| 422 | 422 | ||
| 423 | 423 | ||
| 424 | 424 | ||
| 425 | #if PHP_VERSION_ID < 50400 | 425 | #if 0 //PHP_VERSION_ID < 50400 |
| 426 | /* import_request_variables() has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0. */ | 426 | /* import_request_variables() has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0. */ |
| 427 | #define SUHOSIN_HAVE_IRV 1 | 427 | #define SUHOSIN_HAVE_IRV 1 |
| 428 | #endif | 428 | #endif |
| 429 | 429 | ||
| 430 | #ifdef SUHOSIN_HAVE_IRV | 430 | #ifdef SUHOSIN_HAVE_IRV |
| 431 | 431 | ||
| 432 | #if PHP_VERSION_ID >= 50300 | 432 | #if 1 //PHP_VERSION_ID >= 50300 |
| 433 | static int copy_request_variable(void *pDest TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) | 433 | static int copy_request_variable(void *pDest TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) |
| 434 | { | 434 | { |
| 435 | zval *prefix, new_key; | 435 | zval *prefix, new_key; |
| @@ -527,7 +527,7 @@ static int copy_request_variable(void *pDest, int num_args, va_list args, zend_h | |||
| 527 | Import GET/POST/Cookie variables into the global scope */ | 527 | Import GET/POST/Cookie variables into the global scope */ |
| 528 | PHP_FUNCTION(suhosin_import_request_variables) | 528 | PHP_FUNCTION(suhosin_import_request_variables) |
| 529 | { | 529 | { |
| 530 | #if PHP_VERSION_ID >= 50300 | 530 | #if 1 //PHP_VERSION_ID >= 50300 |
| 531 | char *types; | 531 | char *types; |
| 532 | int types_len; | 532 | int types_len; |
| 533 | zval *prefix = NULL; | 533 | zval *prefix = NULL; |
| @@ -859,7 +859,8 @@ int ih_mail(IH_HANDLER_PARAMS) | |||
| 859 | 859 | ||
| 860 | int ih_querycheck(IH_HANDLER_PARAMS) | 860 | int ih_querycheck(IH_HANDLER_PARAMS) |
| 861 | { | 861 | { |
| 862 | #ifdef PHP_ATLEAST_5_3 | 862 | // #ifdef PHP_ATLEAST_5_3 |
| 863 | #if 1 | ||
| 863 | void **p = zend_vm_stack_top(TSRMLS_C) - 1; | 864 | void **p = zend_vm_stack_top(TSRMLS_C) - 1; |
| 864 | #else | 865 | #else |
| 865 | void **p = EG(argument_stack).top_element-2; | 866 | void **p = EG(argument_stack).top_element-2; |
| @@ -1020,7 +1021,8 @@ int ih_querycheck(IH_HANDLER_PARAMS) | |||
| 1020 | 1021 | ||
| 1021 | int ih_fixusername(IH_HANDLER_PARAMS) | 1022 | int ih_fixusername(IH_HANDLER_PARAMS) |
| 1022 | { | 1023 | { |
| 1023 | #ifdef PHP_ATLEAST_5_3 | 1024 | // #ifdef PHP_ATLEAST_5_3 |
| 1025 | #if 1 | ||
| 1024 | void **p = zend_vm_stack_top(TSRMLS_C) - 1; | 1026 | void **p = zend_vm_stack_top(TSRMLS_C) - 1; |
| 1025 | #else | 1027 | #else |
| 1026 | void **p = EG(argument_stack).top_element-2; | 1028 | void **p = EG(argument_stack).top_element-2; |
| @@ -1115,7 +1117,8 @@ int ih_fixusername(IH_HANDLER_PARAMS) | |||
| 1115 | 1117 | ||
| 1116 | static int ih_function_exists(IH_HANDLER_PARAMS) | 1118 | static int ih_function_exists(IH_HANDLER_PARAMS) |
| 1117 | { | 1119 | { |
| 1118 | #ifndef PHP_ATLEAST_5_3 | 1120 | // #ifndef PHP_ATLEAST_5_3 |
| 1121 | #if 1 | ||
| 1119 | zval **function_name; | 1122 | zval **function_name; |
| 1120 | #endif | 1123 | #endif |
| 1121 | zend_function *func; | 1124 | zend_function *func; |
| @@ -1123,7 +1126,8 @@ static int ih_function_exists(IH_HANDLER_PARAMS) | |||
| 1123 | zend_bool retval; | 1126 | zend_bool retval; |
| 1124 | int func_name_len; | 1127 | int func_name_len; |
| 1125 | 1128 | ||
| 1126 | #ifndef PHP_ATLEAST_5_3 | 1129 | // #ifndef PHP_ATLEAST_5_3 |
| 1130 | #if 1 | ||
| 1127 | if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &function_name)==FAILURE) { | 1131 | if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &function_name)==FAILURE) { |
| 1128 | ZEND_WRONG_PARAM_COUNT_WITH_RETVAL(1); | 1132 | ZEND_WRONG_PARAM_COUNT_WITH_RETVAL(1); |
| 1129 | } | 1133 | } |
| @@ -1559,7 +1563,8 @@ static int ih_rand(IH_HANDLER_PARAMS) | |||
| 1559 | 1563 | ||
| 1560 | static int ih_getrandmax(IH_HANDLER_PARAMS) | 1564 | static int ih_getrandmax(IH_HANDLER_PARAMS) |
| 1561 | { | 1565 | { |
| 1562 | #ifdef PHP_ATLEAST_5_3 | 1566 | // #ifdef PHP_ATLEAST_5_3 |
| 1567 | #if 1 | ||
| 1563 | if (zend_parse_parameters_none() == FAILURE) { | 1568 | if (zend_parse_parameters_none() == FAILURE) { |
| 1564 | return(0); | 1569 | return(0); |
| 1565 | } | 1570 | } |
| @@ -1737,7 +1742,7 @@ static void suhosin_execute_internal(zend_execute_data *execute_data_ptr, int re | |||
| 1737 | 1742 | ||
| 1738 | #if PHP_VERSION_ID < 50500 | 1743 | #if PHP_VERSION_ID < 50500 |
| 1739 | #ifdef ZEND_ENGINE_2 | 1744 | #ifdef ZEND_ENGINE_2 |
| 1740 | # if PHP_VERSION_ID < 50400 | 1745 | # if 0 // PHP_VERSION_ID < 50400 |
| 1741 | return_value = (*(temp_variable *)((char *) execute_data_ptr->Ts + execute_data_ptr->opline->result.u.var)).var.ptr; | 1746 | return_value = (*(temp_variable *)((char *) execute_data_ptr->Ts + execute_data_ptr->opline->result.u.var)).var.ptr; |
| 1742 | # else | 1747 | # else |
| 1743 | return_value = (*(temp_variable *)((char *) execute_data_ptr->Ts + execute_data_ptr->opline->result.var)).var.ptr; | 1748 | return_value = (*(temp_variable *)((char *) execute_data_ptr->Ts + execute_data_ptr->opline->result.var)).var.ptr; |
| @@ -32,7 +32,7 @@ | |||
| 32 | #include "SAPI.h" | 32 | #include "SAPI.h" |
| 33 | #include "php_variables.h" | 33 | #include "php_variables.h" |
| 34 | 34 | ||
| 35 | #if PHP_VERSION_ID >= 50300 | 35 | #if 1 //PHP_VERSION_ID >= 50300 |
| 36 | static int (*orig_header_handler)(sapi_header_struct *sapi_header, sapi_header_op_enum op, sapi_headers_struct *sapi_headers TSRMLS_DC) = NULL; | 36 | static int (*orig_header_handler)(sapi_header_struct *sapi_header, sapi_header_op_enum op, sapi_headers_struct *sapi_headers TSRMLS_DC) = NULL; |
| 37 | #else | 37 | #else |
| 38 | static int (*orig_header_handler)(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC) = NULL; | 38 | static int (*orig_header_handler)(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC) = NULL; |
| @@ -190,7 +190,7 @@ char *suhosin_cookie_decryptor(TSRMLS_D) | |||
| 190 | 190 | ||
| 191 | /* {{{ suhosin_header_handler | 191 | /* {{{ suhosin_header_handler |
| 192 | */ | 192 | */ |
| 193 | #if PHP_VERSION_ID >= 50300 | 193 | #if 1 //PHP_VERSION_ID >= 50300 |
| 194 | int suhosin_header_handler(sapi_header_struct *sapi_header, sapi_header_op_enum op, sapi_headers_struct *sapi_headers TSRMLS_DC) | 194 | int suhosin_header_handler(sapi_header_struct *sapi_header, sapi_header_op_enum op, sapi_headers_struct *sapi_headers TSRMLS_DC) |
| 195 | #else | 195 | #else |
| 196 | int suhosin_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC) | 196 | int suhosin_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers TSRMLS_DC) |
| @@ -199,7 +199,7 @@ int suhosin_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct | |||
| 199 | int retval = SAPI_HEADER_ADD, i; | 199 | int retval = SAPI_HEADER_ADD, i; |
| 200 | char *tmp; | 200 | char *tmp; |
| 201 | 201 | ||
| 202 | #if PHP_VERSION_ID >= 50300 | 202 | #if 1 //PHP_VERSION_ID >= 50300 |
| 203 | if (op != SAPI_HEADER_ADD && op != SAPI_HEADER_REPLACE) { | 203 | if (op != SAPI_HEADER_ADD && op != SAPI_HEADER_REPLACE) { |
| 204 | goto suhosin_skip_header_handling; | 204 | goto suhosin_skip_header_handling; |
| 205 | } | 205 | } |
| @@ -294,7 +294,7 @@ int suhosin_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct | |||
| 294 | suhosin_skip_header_handling: | 294 | suhosin_skip_header_handling: |
| 295 | /* If existing call the sapi header handler */ | 295 | /* If existing call the sapi header handler */ |
| 296 | if (orig_header_handler) { | 296 | if (orig_header_handler) { |
| 297 | #if PHP_VERSION_ID >= 50300 | 297 | #if 1 //PHP_VERSION_ID >= 50300 |
| 298 | retval = orig_header_handler(sapi_header, op, sapi_headers TSRMLS_CC); | 298 | retval = orig_header_handler(sapi_header, op, sapi_headers TSRMLS_CC); |
| 299 | #else | 299 | #else |
| 300 | retval = orig_header_handler(sapi_header, sapi_headers TSRMLS_CC); | 300 | retval = orig_header_handler(sapi_header, sapi_headers TSRMLS_CC); |
| @@ -287,7 +287,7 @@ log_sapi: | |||
| 287 | /* SAPI Logging activated? */ | 287 | /* SAPI Logging activated? */ |
| 288 | SDEBUG("(suhosin_log) log_syslog: %ld - log_sapi: %ld - log_script: %ld - log_phpscript: %ld", SUHOSIN_G(log_syslog), SUHOSIN_G(log_sapi), SUHOSIN_G(log_script), SUHOSIN_G(log_phpscript)); | 288 | SDEBUG("(suhosin_log) log_syslog: %ld - log_sapi: %ld - log_script: %ld - log_phpscript: %ld", SUHOSIN_G(log_syslog), SUHOSIN_G(log_sapi), SUHOSIN_G(log_script), SUHOSIN_G(log_phpscript)); |
| 289 | if (((SUHOSIN_G(log_sapi)|S_INTERNAL) & loglevel)!=0) { | 289 | if (((SUHOSIN_G(log_sapi)|S_INTERNAL) & loglevel)!=0) { |
| 290 | #if PHP_VERSION_ID < 50400 | 290 | #if 0 //PHP_VERSION_ID < 50400 |
| 291 | sapi_module.log_message(buf); | 291 | sapi_module.log_message(buf); |
| 292 | #else | 292 | #else |
| 293 | sapi_module.log_message(buf TSRMLS_CC); | 293 | sapi_module.log_message(buf TSRMLS_CC); |
| @@ -372,7 +372,7 @@ log_phpscript: | |||
| 372 | zval *result = NULL; | 372 | zval *result = NULL; |
| 373 | 373 | ||
| 374 | long orig_execution_depth = SUHOSIN_G(execution_depth); | 374 | long orig_execution_depth = SUHOSIN_G(execution_depth); |
| 375 | #if PHP_VERSION_ID < 50400 | 375 | #if 0 //PHP_VERSION_ID < 50400 |
| 376 | zend_bool orig_safe_mode = PG(safe_mode); | 376 | zend_bool orig_safe_mode = PG(safe_mode); |
| 377 | #endif | 377 | #endif |
| 378 | char *orig_basedir = PG(open_basedir); | 378 | char *orig_basedir = PG(open_basedir); |
| @@ -411,7 +411,7 @@ SDEBUG("scriptname %s", SUHOSIN_G(log_phpscriptname)); | |||
| 411 | 411 | ||
| 412 | SUHOSIN_G(execution_depth) = 0; | 412 | SUHOSIN_G(execution_depth) = 0; |
| 413 | if (SUHOSIN_G(log_phpscript_is_safe)) { | 413 | if (SUHOSIN_G(log_phpscript_is_safe)) { |
| 414 | #if PHP_VERSION_ID < 50400 | 414 | #if 0 //PHP_VERSION_ID < 50400 |
| 415 | PG(safe_mode) = 0; | 415 | PG(safe_mode) = 0; |
| 416 | #endif | 416 | #endif |
| 417 | PG(open_basedir) = NULL; | 417 | PG(open_basedir) = NULL; |
| @@ -420,7 +420,7 @@ SDEBUG("scriptname %s", SUHOSIN_G(log_phpscriptname)); | |||
| 420 | zend_execute(new_op_array TSRMLS_CC); | 420 | zend_execute(new_op_array TSRMLS_CC); |
| 421 | 421 | ||
| 422 | SUHOSIN_G(execution_depth) = orig_execution_depth; | 422 | SUHOSIN_G(execution_depth) = orig_execution_depth; |
| 423 | #if PHP_VERSION_ID < 50400 | 423 | #if 0 //PHP_VERSION_ID < 50400 |
| 424 | PG(safe_mode) = orig_safe_mode; | 424 | PG(safe_mode) = orig_safe_mode; |
| 425 | #endif | 425 | #endif |
| 426 | PG(open_basedir) = orig_basedir; | 426 | PG(open_basedir) = orig_basedir; |
diff --git a/php_suhosin.h b/php_suhosin.h index 88890fb..ccf1a91 100644 --- a/php_suhosin.h +++ b/php_suhosin.h | |||
| @@ -120,7 +120,7 @@ protected_varname: | |||
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | 122 | ||
| 123 | #if PHP_VERSION_ID < 50203 | 123 | #if 0 //PHP_VERSION_ID < 50203 |
| 124 | static inline int php_varname_check(char *name, int name_len, zend_bool silent TSRMLS_DC) /* {{{ */ | 124 | static inline int php_varname_check(char *name, int name_len, zend_bool silent TSRMLS_DC) /* {{{ */ |
| 125 | { | 125 | { |
| 126 | if (name_len == sizeof("GLOBALS") - 1 && !memcmp(name, "GLOBALS", sizeof("GLOBALS") - 1)) { | 126 | if (name_len == sizeof("GLOBALS") - 1 && !memcmp(name, "GLOBALS", sizeof("GLOBALS") - 1)) { |
| @@ -453,8 +453,8 @@ size_t suhosin_strnspn(const char *input, size_t n, const char *accept); | |||
| 453 | size_t suhosin_strncspn(const char *input, size_t n, const char *reject); | 453 | size_t suhosin_strncspn(const char *input, size_t n, const char *reject); |
| 454 | 454 | ||
| 455 | /* Add pseudo refcount macros for PHP version < 5.3 */ | 455 | /* Add pseudo refcount macros for PHP version < 5.3 */ |
| 456 | #ifndef Z_REFCOUNT_PP | 456 | // #ifndef Z_REFCOUNT_PP |
| 457 | 457 | #if 0 | |
| 458 | #define Z_REFCOUNT_PP(ppz) Z_REFCOUNT_P(*(ppz)) | 458 | #define Z_REFCOUNT_PP(ppz) Z_REFCOUNT_P(*(ppz)) |
| 459 | #define Z_SET_REFCOUNT_PP(ppz, rc) Z_SET_REFCOUNT_P(*(ppz), rc) | 459 | #define Z_SET_REFCOUNT_PP(ppz, rc) Z_SET_REFCOUNT_P(*(ppz), rc) |
| 460 | #define Z_ADDREF_PP(ppz) Z_ADDREF_P(*(ppz)) | 460 | #define Z_ADDREF_PP(ppz) Z_ADDREF_P(*(ppz)) |
| @@ -522,9 +522,9 @@ static zend_always_inline zend_bool zval_set_isref_to_p(zval* pz, zend_bool isre | |||
| 522 | return pz->is_ref = isref; | 522 | return pz->is_ref = isref; |
| 523 | } | 523 | } |
| 524 | 524 | ||
| 525 | #else | 525 | // #else |
| 526 | 526 | ||
| 527 | #define PHP_ATLEAST_5_3 true | 527 | // #define PHP_ATLEAST_5_3 true |
| 528 | 528 | ||
| 529 | #endif | 529 | #endif |
| 530 | 530 | ||
diff --git a/post_handler.c b/post_handler.c index 737f33f..388a096 100644 --- a/post_handler.c +++ b/post_handler.c | |||
| @@ -46,7 +46,7 @@ SAPI_POST_HANDLER_FUNC(suhosin_std_post_handler) | |||
| 46 | { | 46 | { |
| 47 | char *var, *val, *e, *s, *p; | 47 | char *var, *val, *e, *s, *p; |
| 48 | zval *array_ptr = (zval *) arg; | 48 | zval *array_ptr = (zval *) arg; |
| 49 | #if PHP_VERSION_ID >= 50311 | 49 | #if 1 //PHP_VERSION_ID >= 50311 |
| 50 | long count = 0; | 50 | long count = 0; |
| 51 | #endif | 51 | #endif |
| 52 | if (SG(request_info).post_data == NULL) { | 52 | if (SG(request_info).post_data == NULL) { |
| @@ -61,7 +61,7 @@ last_value: | |||
| 61 | if ((val = memchr(s, '=', (p - s)))) { /* have a value */ | 61 | if ((val = memchr(s, '=', (p - s)))) { /* have a value */ |
| 62 | unsigned int val_len, new_val_len; | 62 | unsigned int val_len, new_val_len; |
| 63 | 63 | ||
| 64 | #if PHP_VERSION_ID >= 50311 | 64 | #if 1 //PHP_VERSION_ID >= 50311 |
| 65 | if (++count > PG(max_input_vars)) { | 65 | if (++count > PG(max_input_vars)) { |
| 66 | php_error_docref(NULL TSRMLS_CC, E_WARNING, "Input variables exceeded %ld. To increase the limit change max_input_vars in php.ini.", PG(max_input_vars)); | 66 | php_error_docref(NULL TSRMLS_CC, E_WARNING, "Input variables exceeded %ld. To increase the limit change max_input_vars in php.ini.", PG(max_input_vars)); |
| 67 | return; | 67 | return; |
| @@ -266,7 +266,7 @@ void suhosin_hook_post_handlers(TSRMLS_D) | |||
| 266 | HashTable tempht; | 266 | HashTable tempht; |
| 267 | zend_ini_entry *ini_entry; | 267 | zend_ini_entry *ini_entry; |
| 268 | 268 | ||
| 269 | #if PHP_MAJOR_VERSION > 5 || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 0) | 269 | #if 1 //PHP_MAJOR_VERSION > 5 || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 0) |
| 270 | sapi_unregister_post_entry(&suhosin_post_entries[0] TSRMLS_CC); | 270 | sapi_unregister_post_entry(&suhosin_post_entries[0] TSRMLS_CC); |
| 271 | sapi_unregister_post_entry(&suhosin_post_entries[1] TSRMLS_CC); | 271 | sapi_unregister_post_entry(&suhosin_post_entries[1] TSRMLS_CC); |
| 272 | sapi_register_post_entries(suhosin_post_entries TSRMLS_CC); | 272 | sapi_register_post_entries(suhosin_post_entries TSRMLS_CC); |
| @@ -36,7 +36,7 @@ | |||
| 36 | #include "php_ini.h" | 36 | #include "php_ini.h" |
| 37 | #include "ext/standard/php_string.h" | 37 | #include "ext/standard/php_string.h" |
| 38 | 38 | ||
| 39 | #if PHP_VERSION_ID < 50400 | 39 | #if 0 //PHP_VERSION_ID < 50400 |
| 40 | 40 | ||
| 41 | #define DEBUG_FILE_UPLOAD ZEND_DEBUG | 41 | #define DEBUG_FILE_UPLOAD ZEND_DEBUG |
| 42 | 42 | ||
diff --git a/rfc1867_new.c b/rfc1867_new.c index 720e3ff..9831e8a 100644 --- a/rfc1867_new.c +++ b/rfc1867_new.c | |||
| @@ -35,7 +35,7 @@ | |||
| 35 | #include "suhosin_rfc1867.h" | 35 | #include "suhosin_rfc1867.h" |
| 36 | #include "ext/standard/php_string.h" | 36 | #include "ext/standard/php_string.h" |
| 37 | 37 | ||
| 38 | #if PHP_VERSION_ID >= 50400 | 38 | #if 1 //PHP_VERSION_ID >= 50400 |
| 39 | 39 | ||
| 40 | #define DEBUG_FILE_UPLOAD ZEND_DEBUG | 40 | #define DEBUG_FILE_UPLOAD ZEND_DEBUG |
| 41 | 41 | ||
| @@ -59,7 +59,7 @@ static int suhosin_get_session_var(char *name, size_t namelen, zval ***state_var | |||
| 59 | if (SESSION_G(http_session_vars) && SESSION_G(http_session_vars)->type == IS_ARRAY) { | 59 | if (SESSION_G(http_session_vars) && SESSION_G(http_session_vars)->type == IS_ARRAY) { |
| 60 | ret = zend_hash_find(Z_ARRVAL_P(SESSION_G(http_session_vars)), name, namelen + 1, (void **) state_var); | 60 | ret = zend_hash_find(Z_ARRVAL_P(SESSION_G(http_session_vars)), name, namelen + 1, (void **) state_var); |
| 61 | 61 | ||
| 62 | #if PHP_VERSION_ID < 50400 | 62 | #if 0 //PHP_VERSION_ID < 50400 |
| 63 | /* If register_globals is enabled, and | 63 | /* If register_globals is enabled, and |
| 64 | * if there is an entry for the slot in $_SESSION, and | 64 | * if there is an entry for the slot in $_SESSION, and |
| 65 | * if that entry is still set to NULL, and | 65 | * if that entry is still set to NULL, and |
| @@ -123,7 +123,7 @@ static void suhosin_send_cookie(TSRMLS_D) | |||
| 123 | 123 | ||
| 124 | /* The following is requires to be 100% compatible to PHP | 124 | /* The following is requires to be 100% compatible to PHP |
| 125 | versions where the hash extension is not available by default */ | 125 | versions where the hash extension is not available by default */ |
| 126 | #if (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3) | 126 | #if 1 //(PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3) |
| 127 | if (zend_hash_find(EG(ini_directives), "session.hash_bits_per_character", sizeof("session.hash_bits_per_character"), (void **) &ini_entry) == SUCCESS) { | 127 | if (zend_hash_find(EG(ini_directives), "session.hash_bits_per_character", sizeof("session.hash_bits_per_character"), (void **) &ini_entry) == SUCCESS) { |
| 128 | #ifndef ZTS | 128 | #ifndef ZTS |
| 129 | base = (char *) ini_entry->mh_arg2; | 129 | base = (char *) ini_entry->mh_arg2; |
| @@ -155,7 +155,7 @@ static int suhosin_hook_s_read(void **mod_data, const char *key, char **val, int | |||
| 155 | /* protect dumb session handlers */ | 155 | /* protect dumb session handlers */ |
| 156 | if (key == NULL || !key[0] || | 156 | if (key == NULL || !key[0] || |
| 157 | (*mod_data == NULL | 157 | (*mod_data == NULL |
| 158 | #if PHP_VERSION_ID >= 50400 | 158 | #if 1 //PHP_VERSION_ID >= 50400 |
| 159 | && !SESSION_G(mod_user_implemented) | 159 | && !SESSION_G(mod_user_implemented) |
| 160 | #endif | 160 | #endif |
| 161 | )) { | 161 | )) { |
| @@ -169,7 +169,7 @@ regenerate: | |||
| 169 | goto regenerate; | 169 | goto regenerate; |
| 170 | } | 170 | } |
| 171 | } | 171 | } |
| 172 | #if (PHP_MAJOR_VERSION < 5) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 2) | 172 | #if 0 //(PHP_MAJOR_VERSION < 5) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 2) |
| 173 | else if (strpbrk(KEY, "\r\n\t <>'\"\\")) { | 173 | else if (strpbrk(KEY, "\r\n\t <>'\"\\")) { |
| 174 | suhosin_log(S_SESSION, "session id ('%s') contains invalid chars - regenerating", KEY); | 174 | suhosin_log(S_SESSION, "session id ('%s') contains invalid chars - regenerating", KEY); |
| 175 | if (!SUHOSIN_G(simulation)) { | 175 | if (!SUHOSIN_G(simulation)) { |
| @@ -209,7 +209,7 @@ static int suhosin_hook_s_write(void **mod_data, const char *key, const char *va | |||
| 209 | /* protect dumb session handlers */ | 209 | /* protect dumb session handlers */ |
| 210 | if (key == NULL || !key[0] || val == NULL || strlen(key) > SUHOSIN_G(session_max_id_length) || | 210 | if (key == NULL || !key[0] || val == NULL || strlen(key) > SUHOSIN_G(session_max_id_length) || |
| 211 | (*mod_data == NULL | 211 | (*mod_data == NULL |
| 212 | #if PHP_VERSION_ID >= 50400 | 212 | #if 1 //PHP_VERSION_ID >= 50400 |
| 213 | && !SESSION_G(mod_user_implemented) | 213 | && !SESSION_G(mod_user_implemented) |
| 214 | #endif | 214 | #endif |
| 215 | )) { | 215 | )) { |
| @@ -257,7 +257,7 @@ static int suhosin_hook_s_destroy(void **mod_data, const char *key TSRMLS_DC) | |||
| 257 | /* protect dumb session handlers */ | 257 | /* protect dumb session handlers */ |
| 258 | if (key == NULL || !key[0] || strlen(key) > SUHOSIN_G(session_max_id_length) || | 258 | if (key == NULL || !key[0] || strlen(key) > SUHOSIN_G(session_max_id_length) || |
| 259 | (*mod_data == NULL | 259 | (*mod_data == NULL |
| 260 | #if PHP_VERSION_ID >= 50400 | 260 | #if 1 //PHP_VERSION_ID >= 50400 |
| 261 | && !SESSION_G(mod_user_implemented) | 261 | && !SESSION_G(mod_user_implemented) |
| 262 | #endif | 262 | #endif |
| 263 | )) { | 263 | )) { |
| @@ -343,7 +343,7 @@ void suhosin_hook_session(TSRMLS_D) | |||
| 343 | return; | 343 | return; |
| 344 | } | 344 | } |
| 345 | /* retrieve globals from module entry struct if possible */ | 345 | /* retrieve globals from module entry struct if possible */ |
| 346 | #if PHP_VERSION_ID >= 50200 | 346 | #if 1 //PHP_VERSION_ID >= 50200 |
| 347 | #ifdef ZTS | 347 | #ifdef ZTS |
| 348 | if (session_globals_id == 0) { | 348 | if (session_globals_id == 0) { |
| 349 | session_globals_id = *module->globals_id_ptr; | 349 | session_globals_id = *module->globals_id_ptr; |
| @@ -401,7 +401,7 @@ void suhosin_hook_session(TSRMLS_D) | |||
| 401 | suhosin_hook_session_module(TSRMLS_C); | 401 | suhosin_hook_session_module(TSRMLS_C); |
| 402 | 402 | ||
| 403 | /* Protect the PHP serializer from ! attacks */ | 403 | /* Protect the PHP serializer from ! attacks */ |
| 404 | # if PHP_MAJOR_VERSION > 5 || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 2) | 404 | #if 1 //PHP_MAJOR_VERSION > 5 || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 2) |
| 405 | serializer = (ps_serializer *) SESSION_G(serializer); | 405 | serializer = (ps_serializer *) SESSION_G(serializer); |
| 406 | if (serializer != NULL && strcmp(serializer->name, "php")==0) { | 406 | if (serializer != NULL && strcmp(serializer->name, "php")==0) { |
| 407 | serializer->encode = suhosin_session_encode; | 407 | serializer->encode = suhosin_session_encode; |
| @@ -86,7 +86,7 @@ static PHP_FUNCTION(suhosin_sha256_file) | |||
| 86 | return; | 86 | return; |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | #if PHP_VERSION_ID < 50400 | 89 | #if 0 //PHP_VERSION_ID < 50400 |
| 90 | if (PG(safe_mode) && (!php_checkuid(arg, NULL, CHECKUID_CHECK_FILE_AND_DIR))) { | 90 | if (PG(safe_mode) && (!php_checkuid(arg, NULL, CHECKUID_CHECK_FILE_AND_DIR))) { |
| 91 | RETURN_FALSE; | 91 | RETURN_FALSE; |
| 92 | } | 92 | } |
| @@ -1058,10 +1058,10 @@ PHP_MINIT_FUNCTION(suhosin) | |||
| 1058 | php_register_info_logo(SUHOSIN_LOGO_GUID, "image/jpeg", suhosin_logo, sizeof(suhosin_logo)); | 1058 | php_register_info_logo(SUHOSIN_LOGO_GUID, "image/jpeg", suhosin_logo, sizeof(suhosin_logo)); |
| 1059 | #endif | 1059 | #endif |
| 1060 | 1060 | ||
| 1061 | #if PHP_MAJOR_VERSION < 5 | 1061 | #if PHP_VERSION_ID < 50400 //PHP_MAJOR_VERSION < 5 |
| 1062 | #error Suhosin Extension is not designed to run with PHP 4 and below. | 1062 | #error Suhosin Extension is not designed to run with PHP versions lower than 5.4. |
| 1063 | #endif | 1063 | #endif |
| 1064 | #if PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION <= 2 && !SUHOSIN_DEBUG | 1064 | #if 0 //PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION <= 2 && !SUHOSIN_DEBUG |
| 1065 | php_error_docref(NULL TSRMLS_CC, E_WARNING, "Suhosin Extension does not officially support PHP 5.2 and below anymore, because it is discontinued. Use it at your own risk."); | 1065 | php_error_docref(NULL TSRMLS_CC, E_WARNING, "Suhosin Extension does not officially support PHP 5.2 and below anymore, because it is discontinued. Use it at your own risk."); |
| 1066 | #endif | 1066 | #endif |
| 1067 | 1067 | ||
diff --git a/treat_data.c b/treat_data.c index 15e721d..9dc86d1 100644 --- a/treat_data.c +++ b/treat_data.c | |||
| @@ -39,7 +39,7 @@ SAPI_TREAT_DATA_FUNC(suhosin_treat_data) | |||
| 39 | int free_buffer = 0; | 39 | int free_buffer = 0; |
| 40 | char *strtok_buf = NULL; | 40 | char *strtok_buf = NULL; |
| 41 | 41 | ||
| 42 | #if PHP_VERSION_ID >= 50311 | 42 | #if 1 //PHP_VERSION_ID >= 50311 |
| 43 | long count = 0; | 43 | long count = 0; |
| 44 | #endif | 44 | #endif |
| 45 | 45 | ||
| @@ -148,7 +148,7 @@ SAPI_TREAT_DATA_FUNC(suhosin_treat_data) | |||
| 148 | } | 148 | } |
| 149 | val = strchr(var, '='); | 149 | val = strchr(var, '='); |
| 150 | 150 | ||
| 151 | #if PHP_VERSION_ID >= 50311 | 151 | #if 1 //PHP_VERSION_ID >= 50311 |
| 152 | if (++count > PG(max_input_vars)) { | 152 | if (++count > PG(max_input_vars)) { |
| 153 | php_error_docref(NULL TSRMLS_CC, E_WARNING, "Input variables exceeded %ld. To increase the limit change max_input_vars in php.ini.", PG(max_input_vars)); | 153 | php_error_docref(NULL TSRMLS_CC, E_WARNING, "Input variables exceeded %ld. To increase the limit change max_input_vars in php.ini.", PG(max_input_vars)); |
| 154 | break; | 154 | break; |
| @@ -210,7 +210,7 @@ SAPI_TREAT_DATA_FUNC(suhosin_treat_data) | |||
| 210 | 210 | ||
| 211 | void suhosin_hook_treat_data() | 211 | void suhosin_hook_treat_data() |
| 212 | { | 212 | { |
| 213 | #if PHP_VERSION_ID < 50400 | 213 | #if 0 //PHP_VERSION_ID < 50400 |
| 214 | sapi_register_treat_data(suhosin_treat_data); | 214 | sapi_register_treat_data(suhosin_treat_data); |
| 215 | #else | 215 | #else |
| 216 | TSRMLS_FETCH(); | 216 | TSRMLS_FETCH(); |
