From 759139184a4e322c561de889484f7de3d181756f Mon Sep 17 00:00:00 2001 From: Ben Fuhrmannek Date: Mon, 22 Feb 2016 13:23:16 +0100 Subject: removed TSRMLS --- aes.c | 6 ++-- config.m4 | 2 +- config.w32 | 2 +- execute.c | 84 +++++++++++++++++++++++++++---------------------------- execute_rnd.inc.c | 44 ++++++++++++++--------------- ifilter.c | 6 ++-- log.c | 19 ++++++------- php_suhosin7.h | 10 ++----- sha256.c | 8 +++--- suhosin7.c | 7 ++--- 10 files changed, 89 insertions(+), 99 deletions(-) diff --git a/aes.c b/aes.c index 65b6421..b44d88b 100644 --- a/aes.c +++ b/aes.c @@ -181,7 +181,7 @@ void suhosin_aes_gentables() } } -void suhosin_aes_gkey(int nb,int nk,char *key TSRMLS_DC) +void suhosin_aes_gkey(int nb,int nk,char *key) { /* blocksize=32*nb bits. Key=32*nk bits */ /* currently nb,bk = 4, 6 or 8 */ /* key comes as 4*Nk bytes */ @@ -253,7 +253,7 @@ void suhosin_aes_gkey(int nb,int nk,char *key TSRMLS_DC) * Instead of just one ftable[], I could have 4, the other * * 3 pre-rotated to save the ROTL8, ROTL16 and ROTL24 overhead */ -void suhosin_aes_encrypt(char *buff TSRMLS_DC) +void suhosin_aes_encrypt(char *buff) { int i,j,k,m; WORD a[8],b[8],*x,*y,*t; @@ -300,7 +300,7 @@ void suhosin_aes_encrypt(char *buff TSRMLS_DC) return; } -void suhosin_aes_decrypt(char *buff TSRMLS_DC) +void suhosin_aes_decrypt(char *buff) { int i,j,k,m; WORD a[8],b[8],*x,*y,*t; diff --git a/config.m4 b/config.m4 index 8f6d645..b5d8249 100644 --- a/config.m4 +++ b/config.m4 @@ -5,7 +5,7 @@ PHP_ARG_ENABLE(suhosin, whether to enable suhosin support, [ --enable-suhosin Enable suhosin support]) if test "$PHP_SUHOSIN" != "no"; then - PHP_NEW_EXTENSION(suhosin7, suhosin7.c aes.c ifilter.c memory_limit.c sha256.c treat_data.c log.c execute.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1) + PHP_NEW_EXTENSION(suhosin7, suhosin7.c aes.c ifilter.c memory_limit.c sha256.c treat_data.c log.c execute.c, $ext_shared,, -DZEND_ENABLE_STATIC_ACHE=1) fi PHP_ARG_ENABLE(suhosin7-experimental, whether to enable experimental suhosin7 features, diff --git a/config.w32 b/config.w32 index 686fe73..eefaedf 100644 --- a/config.w32 +++ b/config.w32 @@ -8,6 +8,6 @@ // ARG_ENABLE("suhosin7", "enable suhosin7 support", "no"); if (PHP_SUHOSIN7 != "no") { - EXTENSION("suhosin7", "suhosin7.c", PHP_EXTNAME_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"); + EXTENSION("suhosin7", "suhosin7.c", PHP_EXTNAME_SHARED, "/DZEND_ENABLE_STATIC_ACHE=1"); } diff --git a/execute.c b/execute.c index 1a7388b..4648b93 100644 --- a/execute.c +++ b/execute.c @@ -55,8 +55,8 @@ ZEND_API static void (*old_execute_internal)(zend_execute_data *execute_data, zv ZEND_API static void suhosin_execute_internal(zend_execute_data *execute_data, zval *return_value); ZEND_API static void (*old_execute)(zend_op_array *op_array, zval *return_value); ZEND_API static void suhosin_execute(zend_op_array *op_array, zval *return_value); -// static void (*old_execute_ZO)(zend_op_array *op_array, long dummy TSRMLS_DC); -// static void suhosin_execute_ZO(zend_op_array *op_array, long dummy TSRMLS_DC); +// static void (*old_execute_ZO)(zend_op_array *op_array, long dummy); +// static void suhosin_execute_ZO(zend_op_array *op_array, long dummy); // static void *(*zo_set_oe_ex)(void *ptr) = NULL; @@ -248,7 +248,7 @@ static int suhosin_check_filename(char *s, int len) // ZEND_API static int (*old_zend_stream_open)(const char *filename, zend_file_handle *handle); // -// static int suhosin_zend_stream_open(const char *filename, zend_file_handle *fh TSRMLS_DC) +// static int suhosin_zend_stream_open(const char *filename, zend_file_handle *fh) // { // zend_execute_data *exd; // exd=EG(current_execute_data); @@ -258,45 +258,45 @@ static int suhosin_check_filename(char *s, int len) // switch (filetype) { // case SUHOSIN_CODE_TYPE_LONGNAME: // suhosin_log(S_INCLUDE, "Include filename ('%s') is too long", filename); -// suhosin_bailout(TSRMLS_C); +// suhosin_bailout(); // break; // // case SUHOSIN_CODE_TYPE_UPLOADED: // suhosin_log(S_INCLUDE, "Include filename is an uploaded file"); -// suhosin_bailout(TSRMLS_C); +// suhosin_bailout(); // break; // // case SUHOSIN_CODE_TYPE_0FILE: // suhosin_log(S_INCLUDE, "Include filename contains an ASCIIZ character"); -// suhosin_bailout(TSRMLS_C); +// suhosin_bailout(); // break; // // case SUHOSIN_CODE_TYPE_WRITABLE: // suhosin_log(S_INCLUDE, "Include filename ('%s') is writable by PHP process", filename); -// suhosin_bailout(TSRMLS_C); +// suhosin_bailout(); // break; // // case SUHOSIN_CODE_TYPE_BLACKURL: // suhosin_log(S_INCLUDE, "Include filename ('%s') is a URL that is forbidden by the blacklist", filename); -// suhosin_bailout(TSRMLS_C); +// suhosin_bailout(); // break; // // case SUHOSIN_CODE_TYPE_BADURL: // suhosin_log(S_INCLUDE, "Include filename ('%s') is a URL that is not allowed", filename); -// suhosin_bailout(TSRMLS_C); +// suhosin_bailout(); // break; // // case SUHOSIN_CODE_TYPE_MANYDOTS: // suhosin_log(S_INCLUDE, "Include filename ('%s') contains too many '../'", filename); -// suhosin_bailout(TSRMLS_C); +// suhosin_bailout(); // break; // } // } -// return old_zend_stream_open(filename, fh TSRMLS_CC); +// return old_zend_stream_open(filename, fh); // } -static int suhosin_detect_codetype(zend_op_array *op_array TSRMLS_DC) +static int suhosin_detect_codetype(zend_op_array *op_array) { if (op_array->filename == NULL) { return SUHOSIN_CODE_TYPE_UNKNOWN; @@ -353,7 +353,7 @@ static int suhosin_detect_codetype(zend_op_array *op_array TSRMLS_DC) } else { - return suhosin_check_filename(s, strlen(s) TSRMLS_CC); + return suhosin_check_filename(s, strlen(s)); } @@ -414,7 +414,7 @@ ZEND_API static void suhosin_execute_ex(zend_execute_data *execute_data) // // ctr.line_len = spprintf(&ctr.line, 0, "Location: %s", action); // ctr.response_code = code; - // sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC); + // sapi_header_op(SAPI_HEADER_REPLACE, &ctr); // efree(ctr.line); // } else { // zend_file_handle file_handle; @@ -425,17 +425,17 @@ ZEND_API static void suhosin_execute_ex(zend_execute_data *execute_data) // code = 200; // } // - // if (zend_stream_open(action, &file_handle TSRMLS_CC) == SUCCESS) { + // if (zend_stream_open(action, &file_handle) == SUCCESS) { // if (!file_handle.opened_path) { // file_handle.opened_path = estrndup(action, strlen(action)); // } - // new_op_array = zend_compile_file(&file_handle, ZEND_REQUIRE TSRMLS_CC); - // zend_destroy_file_handle(&file_handle TSRMLS_CC); + // new_op_array = zend_compile_file(&file_handle, ZEND_REQUIRE); + // zend_destroy_file_handle(&file_handle); // if (new_op_array) { // EG(return_value_ptr_ptr) = &result; // EG(active_op_array) = new_op_array; - // zend_execute(new_op_array TSRMLS_CC); - // destroy_op_array(new_op_array TSRMLS_CC); + // zend_execute(new_op_array); + // destroy_op_array(new_op_array); // efree(new_op_array); // // if (!EG(exception)) @@ -454,7 +454,7 @@ ZEND_API static void suhosin_execute_ex(zend_execute_data *execute_data) // } // } // - // sapi_header_op(SAPI_HEADER_SET_STATUS, (void *)code TSRMLS_CC); + // sapi_header_op(SAPI_HEADER_SET_STATUS, (void *)code); // zend_bailout(); // } } @@ -465,7 +465,7 @@ ZEND_API static void suhosin_execute_ex(zend_execute_data *execute_data) if (SUHOSIN7_G(max_execution_depth) && SUHOSIN7_G(execution_depth) > SUHOSIN7_G(max_execution_depth)) { suhosin_log(S_EXECUTOR|S_GETCALLER, "maximum execution depth reached - script terminated"); - suhosin_bailout(TSRMLS_C); + suhosin_bailout(); } // fn = (char *)execute_data->func->op_array.filename; @@ -539,37 +539,37 @@ not_evaled_code: case SUHOSIN_CODE_TYPE_LONGNAME: suhosin_log(S_INCLUDE|S_GETCALLER, "Include filename ('%s') is too long", ZSTR_VAL(execute_data->func->op_array.filename)); - suhosin_bailout(TSRMLS_C); + suhosin_bailout(); break; case SUHOSIN_CODE_TYPE_MANYDOTS: suhosin_log(S_INCLUDE|S_GETCALLER, "Include filename ('%s') contains too many '../'", ZSTR_VAL(execute_data->func->op_array.filename)); - suhosin_bailout(TSRMLS_C); + suhosin_bailout(); break; case SUHOSIN_CODE_TYPE_UPLOADED: suhosin_log(S_INCLUDE|S_GETCALLER, "Include filename is an uploaded file"); - suhosin_bailout(TSRMLS_C); + suhosin_bailout(); break; case SUHOSIN_CODE_TYPE_0FILE: suhosin_log(S_INCLUDE|S_GETCALLER, "Include filename contains an ASCIIZ character"); - suhosin_bailout(TSRMLS_C); + suhosin_bailout(); break; case SUHOSIN_CODE_TYPE_WRITABLE: suhosin_log(S_INCLUDE|S_GETCALLER, "Include filename ('%s') is writable by PHP process", ZSTR_VAL(execute_data->func->op_array.filename)); - suhosin_bailout(TSRMLS_C); + suhosin_bailout(); break; case SUHOSIN_CODE_TYPE_BLACKURL: suhosin_log(S_INCLUDE|S_GETCALLER, "Include filename ('%s') is a URL that is forbidden by the blacklist", ZSTR_VAL(execute_data->func->op_array.filename)); - suhosin_bailout(TSRMLS_C); + suhosin_bailout(); break; case SUHOSIN_CODE_TYPE_BADURL: suhosin_log(S_INCLUDE|S_GETCALLER, "Include filename ('%s') is a URL that is not allowed", ZSTR_VAL(execute_data->func->op_array.filename)); - suhosin_bailout(TSRMLS_C); + suhosin_bailout(); break; case SUHOSIN_CODE_TYPE_BADFILE: @@ -577,12 +577,12 @@ not_evaled_code: // #define DIE_WITH_MSG "die('disallowed_file'.chr(10).chr(10));" // cs.value.str.val = estrndup(DIE_WITH_MSG, sizeof(DIE_WITH_MSG)-1); // cs.value.str.len = sizeof(DIE_WITH_MSG)-1; -// new_op_array = compile_string(&cs, "suhosin internal code" TSRMLS_CC); +// new_op_array = compile_string(&cs, "suhosin internal code"); // if (new_op_array) { // op_array = new_op_array; // goto continue_execution; // } - suhosin_bailout(TSRMLS_C); + suhosin_bailout(); break; case SUHOSIN_CODE_TYPE_COMMANDLINE: @@ -626,7 +626,7 @@ typedef struct _internal_function_handler { // **subject, // **limit, **zcount; // -// if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZZ|ZZ", ®ex, &replace, &subject, &limit, &zcount) == FAILURE) { +// if (zend_parse_parameters(ZEND_NUM_ARGS(), "ZZZ|ZZ", ®ex, &replace, &subject, &limit, &zcount) == FAILURE) { // return(0); // } // @@ -693,7 +693,7 @@ typedef struct _internal_function_handler { // return (0); // } // -// if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|ss", +// if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss|ss", // &to, &to_len, // &subject, &subject_len, // &message, &message_len, @@ -790,7 +790,7 @@ typedef struct _internal_function_handler { // // int ih_querycheck(IH_HANDLER_PARAMS) // { -// void **p = zend_vm_stack_top(TSRMLS_C) - 1; +// void **p = zend_vm_stack_top() - 1; // unsigned long arg_count; // zval **arg; // char *query, *s, *e; @@ -916,28 +916,28 @@ typedef struct _internal_function_handler { // if (cnt_opencomment && SUHOSIN7_G(sql_opencomment)>0) { // suhosin_log(S_SQL, "Open comment in SQL query: '%*s'", len, query); // if (SUHOSIN7_G(sql_opencomment)>1) { -// suhosin_bailout(TSRMLS_C); +// suhosin_bailout(); // } // } // // if (cnt_comment && SUHOSIN7_G(sql_comment)>0) { // suhosin_log(S_SQL, "Comment in SQL query: '%*s'", len, query); // if (SUHOSIN7_G(sql_comment)>1) { -// suhosin_bailout(TSRMLS_C); +// suhosin_bailout(); // } // } // // if (cnt_union && SUHOSIN7_G(sql_union)>0) { // suhosin_log(S_SQL, "UNION in SQL query: '%*s'", len, query); // if (SUHOSIN7_G(sql_union)>1) { -// suhosin_bailout(TSRMLS_C); +// suhosin_bailout(); // } // } // // if (cnt_select>1 && SUHOSIN7_G(sql_mselect)>0) { // suhosin_log(S_SQL, "Multiple SELECT in SQL query: '%*s'", len, query); // if (SUHOSIN7_G(sql_mselect)>1) { -// suhosin_bailout(TSRMLS_C); +// suhosin_bailout(); // } // } // @@ -947,7 +947,7 @@ typedef struct _internal_function_handler { // // int ih_fixusername(IH_HANDLER_PARAMS) // { -// void **p = zend_vm_stack_top(TSRMLS_C) - 1; +// void **p = zend_vm_stack_top() - 1; // unsigned long arg_count; // zval **arg; // char *prefix, *postfix, *user, *user_match, *cp; @@ -1197,8 +1197,8 @@ internal_function_handler ihandlers[] = { { NULL, NULL, NULL, NULL, NULL } }; -#define FUNCTION_WARNING() zend_error(E_WARNING, "%s() has been disabled for security reasons", get_active_function_name(TSRMLS_C)); -#define FUNCTION_SIMULATE_WARNING() zend_error(E_WARNING, "SIMULATION - %s() has been disabled for security reasons", get_active_function_name(TSRMLS_C)); +#define FUNCTION_WARNING() zend_error(E_WARNING, "%s() has been disabled for security reasons", get_active_function_name()); +#define FUNCTION_SIMULATE_WARNING() zend_error(E_WARNING, "SIMULATION - %s() has been disabled for security reasons", get_active_function_name()); /* {{{ void suhosin_execute_internal * This function provides a hook for internal execution */ @@ -1324,7 +1324,7 @@ execute_internal_bailout: // efree(lcname); // } FUNCTION_WARNING() - suhosin_bailout(TSRMLS_C); + suhosin_bailout(); } /* }}} */ @@ -1365,7 +1365,7 @@ void suhosin_hook_execute() zo_set_oe_ex = (void *)DL_FETCH_SYMBOL(NULL, "zend_optimizer_set_oe_ex"); } if (zo_set_oe_ex == NULL) { - zend_llist_apply(&zend_extensions, (llist_apply_func_t)function_lookup TSRMLS_CC); + zend_llist_apply(&zend_extensions, (llist_apply_func_t)function_lookup); } if (zo_set_oe_ex != NULL) { diff --git a/execute_rnd.inc.c b/execute_rnd.inc.c index c09c467..9647b63 100644 --- a/execute_rnd.inc.c +++ b/execute_rnd.inc.c @@ -134,7 +134,7 @@ static inline void suhosin_mt_reload(php_uint32 *state, php_uint32 **next, int * /* {{{ suhosin_mt_srand */ -static void suhosin_mt_srand(php_uint32 seed TSRMLS_DC) +static void suhosin_mt_srand(php_uint32 seed) { /* Seed the generator with a simple uint32 */ suhosin_mt_initialize(seed, SUHOSIN7_G(mt_state)); @@ -147,7 +147,7 @@ static void suhosin_mt_srand(php_uint32 seed TSRMLS_DC) /* {{{ suhosin_mt_rand */ -static php_uint32 suhosin_mt_rand(TSRMLS_D) +static php_uint32 suhosin_mt_rand() { /* Pull a 32-bit integer from the generator state Every other access function simply transforms the numbers extracted here */ @@ -169,7 +169,7 @@ static php_uint32 suhosin_mt_rand(TSRMLS_D) /* {{{ SUHOSIN7_Gen_entropy */ -static void SUHOSIN7_Gen_entropy(php_uint32 *entropybuf TSRMLS_DC) +static void SUHOSIN7_Gen_entropy(php_uint32 *entropybuf) { php_uint32 seedbuf[20]; /* On a modern OS code, stack and heap base are randomized */ @@ -192,7 +192,7 @@ static void SUHOSIN7_Gen_entropy(php_uint32 *entropybuf TSRMLS_DC) #else seedbuf[4] = getpid(); #endif - seedbuf[5] = (php_uint32) 0x7fffffff * php_combined_lcg(TSRMLS_C); + seedbuf[5] = (php_uint32) 0x7fffffff * php_combined_lcg(); #ifndef PHP_WIN32 fd = VCWD_OPEN("/dev/urandom", O_RDONLY); @@ -219,10 +219,10 @@ static void SUHOSIN7_Gen_entropy(php_uint32 *entropybuf TSRMLS_DC) /* {{{ suhosin_srand_auto */ -static void suhosin_srand_auto(TSRMLS_D) +static void suhosin_srand_auto() { php_uint32 seed[8]; - SUHOSIN7_Gen_entropy(&seed[0] TSRMLS_CC); + SUHOSIN7_Gen_entropy(&seed[0]); suhosin_mt_init_by_array(seed, 8, SUHOSIN7_G(r_state)); suhosin_mt_reload(SUHOSIN7_G(r_state), &SUHOSIN7_G(r_next), &SUHOSIN7_G(r_left)); @@ -234,10 +234,10 @@ static void suhosin_srand_auto(TSRMLS_D) /* {{{ suhosin_mt_srand_auto */ -static void suhosin_mt_srand_auto(TSRMLS_D) +static void suhosin_mt_srand_auto() { php_uint32 seed[8]; - SUHOSIN7_Gen_entropy(&seed[0] TSRMLS_CC); + SUHOSIN7_Gen_entropy(&seed[0]); suhosin_mt_init_by_array(seed, 8, SUHOSIN7_G(mt_state)); suhosin_mt_reload(SUHOSIN7_G(mt_state), &SUHOSIN7_G(mt_next), &SUHOSIN7_G(mt_left)); @@ -250,7 +250,7 @@ static void suhosin_mt_srand_auto(TSRMLS_D) /* {{{ suhosin_srand */ -static void suhosin_srand(php_uint32 seed TSRMLS_DC) +static void suhosin_srand(php_uint32 seed) { /* Seed the generator with a simple uint32 */ suhosin_mt_initialize(seed+0x12345, SUHOSIN7_G(r_state)); @@ -263,7 +263,7 @@ static void suhosin_srand(php_uint32 seed TSRMLS_DC) /* {{{ suhosin_mt_rand */ -static php_uint32 suhosin_rand(TSRMLS_D) +static php_uint32 suhosin_rand() { /* Pull a 32-bit integer from the generator state Every other access function simply transforms the numbers extracted here */ @@ -293,14 +293,14 @@ static int ih_srand(IH_HANDLER_PARAMS) return 1; } - if (zend_parse_parameters(argc TSRMLS_CC, "|l", &seed) == FAILURE) { + if (zend_parse_parameters(argc, "|l", &seed) == FAILURE) { return 1; } if (argc) { - suhosin_srand(seed TSRMLS_CC); + suhosin_srand(seed); } else { - suhosin_srand_auto(TSRMLS_C); + suhosin_srand_auto(); } return (1); } @@ -315,14 +315,14 @@ static int ih_mt_srand(IH_HANDLER_PARAMS) return 1; } - if (zend_parse_parameters(argc TSRMLS_CC, "|l", &seed) == FAILURE) { + if (zend_parse_parameters(argc, "|l", &seed) == FAILURE) { return 1; } if (argc) { - suhosin_mt_srand(seed TSRMLS_CC); + suhosin_mt_srand(seed); } else { - suhosin_mt_srand_auto(TSRMLS_C); + suhosin_mt_srand_auto(); } return 1; } @@ -334,15 +334,15 @@ static int ih_mt_rand(IH_HANDLER_PARAMS) long max; long number; - if (argc != 0 && zend_parse_parameters(argc TSRMLS_CC, "ll", &min, &max) == FAILURE) { + if (argc != 0 && zend_parse_parameters(argc, "ll", &min, &max) == FAILURE) { return (1); } if (!SUHOSIN7_G(mt_is_seeded)) { - suhosin_mt_srand_auto(TSRMLS_C); + suhosin_mt_srand_auto(); } - number = (long) (suhosin_mt_rand(TSRMLS_C) >> 1); + number = (long) (suhosin_mt_rand() >> 1); if (argc == 2) { RAND_RANGE(number, min, max, PHP_MT_RAND_MAX); } @@ -358,15 +358,15 @@ static int ih_rand(IH_HANDLER_PARAMS) long max; long number; - if (argc != 0 && zend_parse_parameters(argc TSRMLS_CC, "ll", &min, &max) == FAILURE) { + if (argc != 0 && zend_parse_parameters(argc, "ll", &min, &max) == FAILURE) { return (1); } if (!SUHOSIN7_G(r_is_seeded)) { - suhosin_srand_auto(TSRMLS_C); + suhosin_srand_auto(); } - number = (long) (suhosin_rand(TSRMLS_C) >> 1); + number = (long) (suhosin_rand() >> 1); if (argc == 2) { RAND_RANGE(number, min, max, PHP_MT_RAND_MAX); } diff --git a/ifilter.c b/ifilter.c index c75abe8..5f9e0db 100644 --- a/ifilter.c +++ b/ifilter.c @@ -216,12 +216,12 @@ static void suhosin_server_encode(HashTable *arr, char *key, int klen) /* {{{ suhosin_register_server_variables */ -void suhosin_register_server_variables(zval *track_vars_array TSRMLS_DC) +void suhosin_register_server_variables(zval *track_vars_array) { HashTable *svars; int retval = 0, failure = 0; - orig_register_server_variables(track_vars_array TSRMLS_CC); + orig_register_server_variables(track_vars_array); svars = Z_ARRVAL_P(track_vars_array); if (!SUHOSIN7_G(simulation)) { @@ -285,7 +285,7 @@ void suhosin_register_server_variables(zval *track_vars_array TSRMLS_DC) /* Old Input filter */ -// unsigned int (*old_input_filter)(int arg, char *var, char **val, unsigned int val_len, unsigned int *new_val_len TSRMLS_DC) = NULL; +// unsigned int (*old_input_filter)(int arg, char *var, char **val, unsigned int val_len, unsigned int *new_val_len) = NULL; unsigned int (*old_input_filter)(int arg, char *var, char **val, size_t val_len, size_t *new_val_len); /* {{{ suhosin_input_filter_wrapper diff --git a/log.c b/log.c index 50cd0f8..905108d 100644 --- a/log.c +++ b/log.c @@ -114,7 +114,6 @@ PHP_SUHOSIN7_API void suhosin_log(int loglevel, char *fmt, ...) char *alertstring; int lineno = 0; va_list ap; - // TSRMLS_FETCH(); getcaller = (loglevel & S_GETCALLER) == S_GETCALLER; @@ -157,7 +156,7 @@ PHP_SUHOSIN7_API void suhosin_log(int loglevel, char *fmt, ...) alertstring = "ALERT"; } - if (zend_is_executing(TSRMLS_C)) { + if (zend_is_executing()) { zend_execute_data *exdata = EG(current_execute_data); if (exdata) { if (getcaller && exdata->prev_execute_data && exdata->prev_execute_data->opline && exdata->prev_execute_data->func) { @@ -171,8 +170,8 @@ PHP_SUHOSIN7_API void suhosin_log(int loglevel, char *fmt, ...) fname = "[unknown filename]"; } } else { - lineno = zend_get_executed_lineno(TSRMLS_C); - fname = (char *)zend_get_executed_filename(TSRMLS_C); + lineno = zend_get_executed_lineno(); + fname = (char *)zend_get_executed_filename(); } ap_php_snprintf(buf, sizeof(buf), "%s - %s (attacker '%s', file '%s', line %u)", alertstring, error, ip_address, fname, lineno); } else { @@ -287,7 +286,7 @@ log_sapi: /* SAPI Logging activated? */ // SDEBUG("(suhosin_log) log_syslog: %ld - log_sapi: %ld - log_script: %ld - log_phpscript: %ld", SUHOSIN7_G(log_syslog), SUHOSIN7_G(log_sapi), SUHOSIN7_G(log_script), SUHOSIN7_G(log_phpscript)); if (sapi_module.log_message && ((SUHOSIN7_G(log_sapi)|S_INTERNAL) & loglevel)!=0) { - sapi_module.log_message(buf TSRMLS_CC); + sapi_module.log_message(buf); } if ((SUHOSIN7_G(log_stdout) & loglevel)!=0) { fprintf(stdout, "%s\n", buf); @@ -372,12 +371,12 @@ log_sapi: // // char *phpscript = SUHOSIN7_G(log_phpscriptname); // SDEBUG("scriptname %s", SUHOSIN7_G(log_phpscriptname)); -// if (zend_stream_open(phpscript, &file_handle TSRMLS_CC) == SUCCESS) { +// if (zend_stream_open(phpscript, &file_handle) == SUCCESS) { // if (!file_handle.opened_path) { // file_handle.opened_path = estrndup(phpscript, strlen(phpscript)); // } -// new_op_array = zend_compile_file(&file_handle, ZEND_REQUIRE TSRMLS_CC); -// zend_destroy_file_handle(&file_handle TSRMLS_CC); +// new_op_array = zend_compile_file(&file_handle, ZEND_REQUIRE); +// zend_destroy_file_handle(&file_handle); // if (new_op_array) { // HashTable *active_symbol_table = EG(active_symbol_table); // zval *zerror, *zerror_class; @@ -401,12 +400,12 @@ log_sapi: // PG(open_basedir) = NULL; // } // -// zend_execute(new_op_array TSRMLS_CC); +// zend_execute(new_op_array); // // SUHOSIN7_G(execution_depth) = orig_execution_depth; // PG(open_basedir) = orig_basedir; // -// destroy_op_array(new_op_array TSRMLS_CC); +// destroy_op_array(new_op_array); // efree(new_op_array); // // if (!EG(exception)) diff --git a/php_suhosin7.h b/php_suhosin7.h index 8c10df9..3af6de6 100644 --- a/php_suhosin7.h +++ b/php_suhosin7.h @@ -38,9 +38,6 @@ extern zend_module_entry suhosin7_module_entry; # define PHP_SUHOSIN7_API #endif -#ifdef ZTS -#include "TSRM.h" -#endif /* -------------- */ @@ -325,7 +322,7 @@ ZEND_BEGIN_MODULE_GLOBALS(suhosin7) // long sql_union; // long sql_mselect; - // int (*old_php_body_write)(const char *str, unsigned int str_length TSRMLS_DC); + // int (*old_php_body_write)(const char *str, unsigned int str_length); ZEND_END_MODULE_GLOBALS(suhosin7) @@ -335,9 +332,6 @@ ZEND_END_MODULE_GLOBALS(suhosin7) */ #define SUHOSIN7_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(suhosin7, v) -#if defined(ZTS) && defined(COMPILE_DL_SUHOSIN7) -ZEND_TSRMLS_CACHE_EXTERN(); -#endif /* Error Constants */ #ifndef S_MEMORY @@ -379,7 +373,7 @@ void suhosin_hook_treat_data(); void suhosin_hook_execute(); void suhosin_hook_register_server_variables(); -static inline void suhosin_bailout(TSRMLS_D) +static inline void suhosin_bailout() { if (!SUHOSIN7_G(simulation)) { zend_bailout(); diff --git a/sha256.c b/sha256.c index 2ab5a0e..15032cd 100644 --- a/sha256.c +++ b/sha256.c @@ -49,7 +49,7 @@ static PHP_FUNCTION(suhosin_sha256) suhosin_SHA256_CTX context; unsigned char digest[32]; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &arg, &arg_len, &raw_output) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|b", &arg, &arg_len, &raw_output) == FAILURE) { return; } @@ -82,7 +82,7 @@ static PHP_FUNCTION(suhosin_sha256_file) int n; php_stream *stream; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|b", &arg, &arg_len, &raw_output) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|b", &arg, &arg_len, &raw_output) == FAILURE) { return; } @@ -391,7 +391,7 @@ static zend_function_entry suhosin_sha256_functions[] = { /* }}} */ -void suhosin_hook_sha256(TSRMLS_D) +void suhosin_hook_sha256() { /* check if we already have sha256 support */ if (zend_hash_str_find(CG(function_table), ZEND_STRL("sha256"))) { @@ -399,7 +399,7 @@ void suhosin_hook_sha256(TSRMLS_D) } /* add the sha256 functions */ - zend_register_functions(NULL, suhosin_sha256_functions, NULL, MODULE_PERSISTENT TSRMLS_CC); + zend_register_functions(NULL, suhosin_sha256_functions, NULL, MODULE_PERSISTENT); } diff --git a/suhosin7.c b/suhosin7.c index b2484a3..3923b57 100644 --- a/suhosin7.c +++ b/suhosin7.c @@ -229,7 +229,7 @@ static ZEND_INI_MH(OnUpdateSuhosin_cookie_plainlist) } else { \ if (is_numeric_string(ZSTR_VAL(new_value), ZSTR_LEN(new_value), NULL, NULL, 0) != IS_LONG) { \ SUHOSIN7_G(varname) = S_ALL & ~S_MEMORY; \ - php_error_docref(NULL TSRMLS_CC, E_WARNING, "unknown constant in %s=%s", inistr, new_value); \ + php_error_docref(NULL, E_WARNING, "unknown constant in %s=%s", inistr, new_value); \ return FAILURE; \ } \ SUHOSIN7_G(varname) = zend_atoi(ZSTR_VAL(new_value), ZSTR_LEN(new_value)) & (~S_MEMORY) & (~S_INTERNAL); \ @@ -457,7 +457,7 @@ PHP_MINIT_FUNCTION(suhosin7) REGISTER_INI_ENTRIES(); #if !defined(HAVE_PHP_SESSION) && !defined(SUHOSIN_NO_SESSION_WARNING) - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Suhosin was compiled without session support, which is probably not what you want. All session related features will not be available, e.g. session encryption. If session support is really not needed, recompile Suhosin with -DSUHOSIN_NO_SESSION_WARNING=1 to suppress this warning."); + php_error_docref(NULL, E_WARNING, "Suhosin was compiled without session support, which is probably not what you want. All session related features will not be available, e.g. session encryption. If session support is really not needed, recompile Suhosin with -DSUHOSIN_NO_SESSION_WARNING=1 to suppress this warning."); #endif // TODO: stealth loading @@ -488,9 +488,6 @@ PHP_MSHUTDOWN_FUNCTION(suhosin7) PHP_RINIT_FUNCTION(suhosin7) { SDEBUG("(RINIT)"); -#if defined(COMPILE_DL_SUHOSIN7) && defined(ZTS) - ZEND_TSRMLS_CACHE_UPDATE(); -#endif return SUCCESS; } /* }}} */ -- cgit v1.3