diff options
| author | Ben Fuhrmannek | 2016-02-22 13:23:16 +0100 |
|---|---|---|
| committer | Ben Fuhrmannek | 2016-02-22 13:23:16 +0100 |
| commit | 759139184a4e322c561de889484f7de3d181756f (patch) | |
| tree | 34f0ceac20058b7f96c003be588c5c7c40bade75 | |
| parent | e668d3495dce6e33855266fc830fc27b1a003689 (diff) | |
removed TSRMLS
| -rw-r--r-- | aes.c | 6 | ||||
| -rw-r--r-- | config.m4 | 2 | ||||
| -rw-r--r-- | config.w32 | 2 | ||||
| -rw-r--r-- | execute.c | 84 | ||||
| -rw-r--r-- | execute_rnd.inc.c | 44 | ||||
| -rw-r--r-- | ifilter.c | 6 | ||||
| -rw-r--r-- | log.c | 19 | ||||
| -rw-r--r-- | php_suhosin7.h | 10 | ||||
| -rw-r--r-- | sha256.c | 8 | ||||
| -rw-r--r-- | suhosin7.c | 7 |
10 files changed, 89 insertions, 99 deletions
| @@ -181,7 +181,7 @@ void suhosin_aes_gentables() | |||
| 181 | } | 181 | } |
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | void suhosin_aes_gkey(int nb,int nk,char *key TSRMLS_DC) | 184 | void suhosin_aes_gkey(int nb,int nk,char *key) |
| 185 | { /* blocksize=32*nb bits. Key=32*nk bits */ | 185 | { /* blocksize=32*nb bits. Key=32*nk bits */ |
| 186 | /* currently nb,bk = 4, 6 or 8 */ | 186 | /* currently nb,bk = 4, 6 or 8 */ |
| 187 | /* key comes as 4*Nk bytes */ | 187 | /* key comes as 4*Nk bytes */ |
| @@ -253,7 +253,7 @@ void suhosin_aes_gkey(int nb,int nk,char *key TSRMLS_DC) | |||
| 253 | * Instead of just one ftable[], I could have 4, the other * | 253 | * Instead of just one ftable[], I could have 4, the other * |
| 254 | * 3 pre-rotated to save the ROTL8, ROTL16 and ROTL24 overhead */ | 254 | * 3 pre-rotated to save the ROTL8, ROTL16 and ROTL24 overhead */ |
| 255 | 255 | ||
| 256 | void suhosin_aes_encrypt(char *buff TSRMLS_DC) | 256 | void suhosin_aes_encrypt(char *buff) |
| 257 | { | 257 | { |
| 258 | int i,j,k,m; | 258 | int i,j,k,m; |
| 259 | WORD a[8],b[8],*x,*y,*t; | 259 | WORD a[8],b[8],*x,*y,*t; |
| @@ -300,7 +300,7 @@ void suhosin_aes_encrypt(char *buff TSRMLS_DC) | |||
| 300 | return; | 300 | return; |
| 301 | } | 301 | } |
| 302 | 302 | ||
| 303 | void suhosin_aes_decrypt(char *buff TSRMLS_DC) | 303 | void suhosin_aes_decrypt(char *buff) |
| 304 | { | 304 | { |
| 305 | int i,j,k,m; | 305 | int i,j,k,m; |
| 306 | WORD a[8],b[8],*x,*y,*t; | 306 | WORD a[8],b[8],*x,*y,*t; |
| @@ -5,7 +5,7 @@ PHP_ARG_ENABLE(suhosin, whether to enable suhosin support, | |||
| 5 | [ --enable-suhosin Enable suhosin support]) | 5 | [ --enable-suhosin Enable suhosin support]) |
| 6 | 6 | ||
| 7 | if test "$PHP_SUHOSIN" != "no"; then | 7 | if test "$PHP_SUHOSIN" != "no"; then |
| 8 | 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) | 8 | 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) |
| 9 | fi | 9 | fi |
| 10 | 10 | ||
| 11 | PHP_ARG_ENABLE(suhosin7-experimental, whether to enable experimental suhosin7 features, | 11 | PHP_ARG_ENABLE(suhosin7-experimental, whether to enable experimental suhosin7 features, |
| @@ -8,6 +8,6 @@ | |||
| 8 | // ARG_ENABLE("suhosin7", "enable suhosin7 support", "no"); | 8 | // ARG_ENABLE("suhosin7", "enable suhosin7 support", "no"); |
| 9 | 9 | ||
| 10 | if (PHP_SUHOSIN7 != "no") { | 10 | if (PHP_SUHOSIN7 != "no") { |
| 11 | EXTENSION("suhosin7", "suhosin7.c", PHP_EXTNAME_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"); | 11 | EXTENSION("suhosin7", "suhosin7.c", PHP_EXTNAME_SHARED, "/DZEND_ENABLE_STATIC_ACHE=1"); |
| 12 | } | 12 | } |
| 13 | 13 | ||
| @@ -55,8 +55,8 @@ ZEND_API static void (*old_execute_internal)(zend_execute_data *execute_data, zv | |||
| 55 | ZEND_API static void suhosin_execute_internal(zend_execute_data *execute_data, zval *return_value); | 55 | ZEND_API static void suhosin_execute_internal(zend_execute_data *execute_data, zval *return_value); |
| 56 | ZEND_API static void (*old_execute)(zend_op_array *op_array, zval *return_value); | 56 | ZEND_API static void (*old_execute)(zend_op_array *op_array, zval *return_value); |
| 57 | ZEND_API static void suhosin_execute(zend_op_array *op_array, zval *return_value); | 57 | ZEND_API static void suhosin_execute(zend_op_array *op_array, zval *return_value); |
| 58 | // static void (*old_execute_ZO)(zend_op_array *op_array, long dummy TSRMLS_DC); | 58 | // static void (*old_execute_ZO)(zend_op_array *op_array, long dummy); |
| 59 | // static void suhosin_execute_ZO(zend_op_array *op_array, long dummy TSRMLS_DC); | 59 | // static void suhosin_execute_ZO(zend_op_array *op_array, long dummy); |
| 60 | // static void *(*zo_set_oe_ex)(void *ptr) = NULL; | 60 | // static void *(*zo_set_oe_ex)(void *ptr) = NULL; |
| 61 | 61 | ||
| 62 | 62 | ||
| @@ -248,7 +248,7 @@ static int suhosin_check_filename(char *s, int len) | |||
| 248 | 248 | ||
| 249 | // ZEND_API static int (*old_zend_stream_open)(const char *filename, zend_file_handle *handle); | 249 | // ZEND_API static int (*old_zend_stream_open)(const char *filename, zend_file_handle *handle); |
| 250 | // | 250 | // |
| 251 | // static int suhosin_zend_stream_open(const char *filename, zend_file_handle *fh TSRMLS_DC) | 251 | // static int suhosin_zend_stream_open(const char *filename, zend_file_handle *fh) |
| 252 | // { | 252 | // { |
| 253 | // zend_execute_data *exd; | 253 | // zend_execute_data *exd; |
| 254 | // exd=EG(current_execute_data); | 254 | // exd=EG(current_execute_data); |
| @@ -258,45 +258,45 @@ static int suhosin_check_filename(char *s, int len) | |||
| 258 | // switch (filetype) { | 258 | // switch (filetype) { |
| 259 | // case SUHOSIN_CODE_TYPE_LONGNAME: | 259 | // case SUHOSIN_CODE_TYPE_LONGNAME: |
| 260 | // suhosin_log(S_INCLUDE, "Include filename ('%s') is too long", filename); | 260 | // suhosin_log(S_INCLUDE, "Include filename ('%s') is too long", filename); |
| 261 | // suhosin_bailout(TSRMLS_C); | 261 | // suhosin_bailout(); |
| 262 | // break; | 262 | // break; |
| 263 | // | 263 | // |
| 264 | // case SUHOSIN_CODE_TYPE_UPLOADED: | 264 | // case SUHOSIN_CODE_TYPE_UPLOADED: |
| 265 | // suhosin_log(S_INCLUDE, "Include filename is an uploaded file"); | 265 | // suhosin_log(S_INCLUDE, "Include filename is an uploaded file"); |
| 266 | // suhosin_bailout(TSRMLS_C); | 266 | // suhosin_bailout(); |
| 267 | // break; | 267 | // break; |
| 268 | // | 268 | // |
| 269 | // case SUHOSIN_CODE_TYPE_0FILE: | 269 | // case SUHOSIN_CODE_TYPE_0FILE: |
| 270 | // suhosin_log(S_INCLUDE, "Include filename contains an ASCIIZ character"); | 270 | // suhosin_log(S_INCLUDE, "Include filename contains an ASCIIZ character"); |
| 271 | // suhosin_bailout(TSRMLS_C); | 271 | // suhosin_bailout(); |
| 272 | // break; | 272 | // break; |
| 273 | // | 273 | // |
| 274 | // case SUHOSIN_CODE_TYPE_WRITABLE: | 274 | // case SUHOSIN_CODE_TYPE_WRITABLE: |
| 275 | // suhosin_log(S_INCLUDE, "Include filename ('%s') is writable by PHP process", filename); | 275 | // suhosin_log(S_INCLUDE, "Include filename ('%s') is writable by PHP process", filename); |
| 276 | // suhosin_bailout(TSRMLS_C); | 276 | // suhosin_bailout(); |
| 277 | // break; | 277 | // break; |
| 278 | // | 278 | // |
| 279 | // case SUHOSIN_CODE_TYPE_BLACKURL: | 279 | // case SUHOSIN_CODE_TYPE_BLACKURL: |
| 280 | // suhosin_log(S_INCLUDE, "Include filename ('%s') is a URL that is forbidden by the blacklist", filename); | 280 | // suhosin_log(S_INCLUDE, "Include filename ('%s') is a URL that is forbidden by the blacklist", filename); |
| 281 | // suhosin_bailout(TSRMLS_C); | 281 | // suhosin_bailout(); |
| 282 | // break; | 282 | // break; |
| 283 | // | 283 | // |
| 284 | // case SUHOSIN_CODE_TYPE_BADURL: | 284 | // case SUHOSIN_CODE_TYPE_BADURL: |
| 285 | // suhosin_log(S_INCLUDE, "Include filename ('%s') is a URL that is not allowed", filename); | 285 | // suhosin_log(S_INCLUDE, "Include filename ('%s') is a URL that is not allowed", filename); |
| 286 | // suhosin_bailout(TSRMLS_C); | 286 | // suhosin_bailout(); |
| 287 | // break; | 287 | // break; |
| 288 | // | 288 | // |
| 289 | // case SUHOSIN_CODE_TYPE_MANYDOTS: | 289 | // case SUHOSIN_CODE_TYPE_MANYDOTS: |
| 290 | // suhosin_log(S_INCLUDE, "Include filename ('%s') contains too many '../'", filename); | 290 | // suhosin_log(S_INCLUDE, "Include filename ('%s') contains too many '../'", filename); |
| 291 | // suhosin_bailout(TSRMLS_C); | 291 | // suhosin_bailout(); |
| 292 | // break; | 292 | // break; |
| 293 | // } | 293 | // } |
| 294 | // } | 294 | // } |
| 295 | // return old_zend_stream_open(filename, fh TSRMLS_CC); | 295 | // return old_zend_stream_open(filename, fh); |
| 296 | // } | 296 | // } |
| 297 | 297 | ||
| 298 | 298 | ||
| 299 | static int suhosin_detect_codetype(zend_op_array *op_array TSRMLS_DC) | 299 | static int suhosin_detect_codetype(zend_op_array *op_array) |
| 300 | { | 300 | { |
| 301 | if (op_array->filename == NULL) { | 301 | if (op_array->filename == NULL) { |
| 302 | return SUHOSIN_CODE_TYPE_UNKNOWN; | 302 | return SUHOSIN_CODE_TYPE_UNKNOWN; |
| @@ -353,7 +353,7 @@ static int suhosin_detect_codetype(zend_op_array *op_array TSRMLS_DC) | |||
| 353 | 353 | ||
| 354 | } else { | 354 | } else { |
| 355 | 355 | ||
| 356 | return suhosin_check_filename(s, strlen(s) TSRMLS_CC); | 356 | return suhosin_check_filename(s, strlen(s)); |
| 357 | 357 | ||
| 358 | } | 358 | } |
| 359 | 359 | ||
| @@ -414,7 +414,7 @@ ZEND_API static void suhosin_execute_ex(zend_execute_data *execute_data) | |||
| 414 | // | 414 | // |
| 415 | // ctr.line_len = spprintf(&ctr.line, 0, "Location: %s", action); | 415 | // ctr.line_len = spprintf(&ctr.line, 0, "Location: %s", action); |
| 416 | // ctr.response_code = code; | 416 | // ctr.response_code = code; |
| 417 | // sapi_header_op(SAPI_HEADER_REPLACE, &ctr TSRMLS_CC); | 417 | // sapi_header_op(SAPI_HEADER_REPLACE, &ctr); |
| 418 | // efree(ctr.line); | 418 | // efree(ctr.line); |
| 419 | // } else { | 419 | // } else { |
| 420 | // zend_file_handle file_handle; | 420 | // zend_file_handle file_handle; |
| @@ -425,17 +425,17 @@ ZEND_API static void suhosin_execute_ex(zend_execute_data *execute_data) | |||
| 425 | // code = 200; | 425 | // code = 200; |
| 426 | // } | 426 | // } |
| 427 | // | 427 | // |
| 428 | // if (zend_stream_open(action, &file_handle TSRMLS_CC) == SUCCESS) { | 428 | // if (zend_stream_open(action, &file_handle) == SUCCESS) { |
| 429 | // if (!file_handle.opened_path) { | 429 | // if (!file_handle.opened_path) { |
| 430 | // file_handle.opened_path = estrndup(action, strlen(action)); | 430 | // file_handle.opened_path = estrndup(action, strlen(action)); |
| 431 | // } | 431 | // } |
| 432 | // new_op_array = zend_compile_file(&file_handle, ZEND_REQUIRE TSRMLS_CC); | 432 | // new_op_array = zend_compile_file(&file_handle, ZEND_REQUIRE); |
| 433 | // zend_destroy_file_handle(&file_handle TSRMLS_CC); | 433 | // zend_destroy_file_handle(&file_handle); |
| 434 | // if (new_op_array) { | 434 | // if (new_op_array) { |
| 435 | // EG(return_value_ptr_ptr) = &result; | 435 | // EG(return_value_ptr_ptr) = &result; |
| 436 | // EG(active_op_array) = new_op_array; | 436 | // EG(active_op_array) = new_op_array; |
| 437 | // zend_execute(new_op_array TSRMLS_CC); | 437 | // zend_execute(new_op_array); |
| 438 | // destroy_op_array(new_op_array TSRMLS_CC); | 438 | // destroy_op_array(new_op_array); |
| 439 | // efree(new_op_array); | 439 | // efree(new_op_array); |
| 440 | // | 440 | // |
| 441 | // if (!EG(exception)) | 441 | // if (!EG(exception)) |
| @@ -454,7 +454,7 @@ ZEND_API static void suhosin_execute_ex(zend_execute_data *execute_data) | |||
| 454 | // } | 454 | // } |
| 455 | // } | 455 | // } |
| 456 | // | 456 | // |
| 457 | // sapi_header_op(SAPI_HEADER_SET_STATUS, (void *)code TSRMLS_CC); | 457 | // sapi_header_op(SAPI_HEADER_SET_STATUS, (void *)code); |
| 458 | // zend_bailout(); | 458 | // zend_bailout(); |
| 459 | // } | 459 | // } |
| 460 | } | 460 | } |
| @@ -465,7 +465,7 @@ ZEND_API static void suhosin_execute_ex(zend_execute_data *execute_data) | |||
| 465 | 465 | ||
| 466 | if (SUHOSIN7_G(max_execution_depth) && SUHOSIN7_G(execution_depth) > SUHOSIN7_G(max_execution_depth)) { | 466 | if (SUHOSIN7_G(max_execution_depth) && SUHOSIN7_G(execution_depth) > SUHOSIN7_G(max_execution_depth)) { |
| 467 | suhosin_log(S_EXECUTOR|S_GETCALLER, "maximum execution depth reached - script terminated"); | 467 | suhosin_log(S_EXECUTOR|S_GETCALLER, "maximum execution depth reached - script terminated"); |
| 468 | suhosin_bailout(TSRMLS_C); | 468 | suhosin_bailout(); |
| 469 | } | 469 | } |
| 470 | 470 | ||
| 471 | // fn = (char *)execute_data->func->op_array.filename; | 471 | // fn = (char *)execute_data->func->op_array.filename; |
| @@ -539,37 +539,37 @@ not_evaled_code: | |||
| 539 | 539 | ||
| 540 | case SUHOSIN_CODE_TYPE_LONGNAME: | 540 | case SUHOSIN_CODE_TYPE_LONGNAME: |
| 541 | suhosin_log(S_INCLUDE|S_GETCALLER, "Include filename ('%s') is too long", ZSTR_VAL(execute_data->func->op_array.filename)); | 541 | suhosin_log(S_INCLUDE|S_GETCALLER, "Include filename ('%s') is too long", ZSTR_VAL(execute_data->func->op_array.filename)); |
| 542 | suhosin_bailout(TSRMLS_C); | 542 | suhosin_bailout(); |
| 543 | break; | 543 | break; |
| 544 | 544 | ||
| 545 | case SUHOSIN_CODE_TYPE_MANYDOTS: | 545 | case SUHOSIN_CODE_TYPE_MANYDOTS: |
| 546 | suhosin_log(S_INCLUDE|S_GETCALLER, "Include filename ('%s') contains too many '../'", ZSTR_VAL(execute_data->func->op_array.filename)); | 546 | suhosin_log(S_INCLUDE|S_GETCALLER, "Include filename ('%s') contains too many '../'", ZSTR_VAL(execute_data->func->op_array.filename)); |
| 547 | suhosin_bailout(TSRMLS_C); | 547 | suhosin_bailout(); |
| 548 | break; | 548 | break; |
| 549 | 549 | ||
| 550 | case SUHOSIN_CODE_TYPE_UPLOADED: | 550 | case SUHOSIN_CODE_TYPE_UPLOADED: |
| 551 | suhosin_log(S_INCLUDE|S_GETCALLER, "Include filename is an uploaded file"); | 551 | suhosin_log(S_INCLUDE|S_GETCALLER, "Include filename is an uploaded file"); |
| 552 | suhosin_bailout(TSRMLS_C); | 552 | suhosin_bailout(); |
| 553 | break; | 553 | break; |
| 554 | 554 | ||
| 555 | case SUHOSIN_CODE_TYPE_0FILE: | 555 | case SUHOSIN_CODE_TYPE_0FILE: |
| 556 | suhosin_log(S_INCLUDE|S_GETCALLER, "Include filename contains an ASCIIZ character"); | 556 | suhosin_log(S_INCLUDE|S_GETCALLER, "Include filename contains an ASCIIZ character"); |
| 557 | suhosin_bailout(TSRMLS_C); | 557 | suhosin_bailout(); |
| 558 | break; | 558 | break; |
| 559 | 559 | ||
| 560 | case SUHOSIN_CODE_TYPE_WRITABLE: | 560 | case SUHOSIN_CODE_TYPE_WRITABLE: |
| 561 | suhosin_log(S_INCLUDE|S_GETCALLER, "Include filename ('%s') is writable by PHP process", ZSTR_VAL(execute_data->func->op_array.filename)); | 561 | suhosin_log(S_INCLUDE|S_GETCALLER, "Include filename ('%s') is writable by PHP process", ZSTR_VAL(execute_data->func->op_array.filename)); |
| 562 | suhosin_bailout(TSRMLS_C); | 562 | suhosin_bailout(); |
| 563 | break; | 563 | break; |
| 564 | 564 | ||
| 565 | case SUHOSIN_CODE_TYPE_BLACKURL: | 565 | case SUHOSIN_CODE_TYPE_BLACKURL: |
| 566 | 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)); | 566 | 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)); |
| 567 | suhosin_bailout(TSRMLS_C); | 567 | suhosin_bailout(); |
| 568 | break; | 568 | break; |
| 569 | 569 | ||
| 570 | case SUHOSIN_CODE_TYPE_BADURL: | 570 | case SUHOSIN_CODE_TYPE_BADURL: |
| 571 | suhosin_log(S_INCLUDE|S_GETCALLER, "Include filename ('%s') is a URL that is not allowed", ZSTR_VAL(execute_data->func->op_array.filename)); | 571 | suhosin_log(S_INCLUDE|S_GETCALLER, "Include filename ('%s') is a URL that is not allowed", ZSTR_VAL(execute_data->func->op_array.filename)); |
| 572 | suhosin_bailout(TSRMLS_C); | 572 | suhosin_bailout(); |
| 573 | break; | 573 | break; |
| 574 | 574 | ||
| 575 | case SUHOSIN_CODE_TYPE_BADFILE: | 575 | case SUHOSIN_CODE_TYPE_BADFILE: |
| @@ -577,12 +577,12 @@ not_evaled_code: | |||
| 577 | // #define DIE_WITH_MSG "die('disallowed_file'.chr(10).chr(10));" | 577 | // #define DIE_WITH_MSG "die('disallowed_file'.chr(10).chr(10));" |
| 578 | // cs.value.str.val = estrndup(DIE_WITH_MSG, sizeof(DIE_WITH_MSG)-1); | 578 | // cs.value.str.val = estrndup(DIE_WITH_MSG, sizeof(DIE_WITH_MSG)-1); |
| 579 | // cs.value.str.len = sizeof(DIE_WITH_MSG)-1; | 579 | // cs.value.str.len = sizeof(DIE_WITH_MSG)-1; |
| 580 | // new_op_array = compile_string(&cs, "suhosin internal code" TSRMLS_CC); | 580 | // new_op_array = compile_string(&cs, "suhosin internal code"); |
| 581 | // if (new_op_array) { | 581 | // if (new_op_array) { |
| 582 | // op_array = new_op_array; | 582 | // op_array = new_op_array; |
| 583 | // goto continue_execution; | 583 | // goto continue_execution; |
| 584 | // } | 584 | // } |
| 585 | suhosin_bailout(TSRMLS_C); | 585 | suhosin_bailout(); |
| 586 | break; | 586 | break; |
| 587 | 587 | ||
| 588 | case SUHOSIN_CODE_TYPE_COMMANDLINE: | 588 | case SUHOSIN_CODE_TYPE_COMMANDLINE: |
| @@ -626,7 +626,7 @@ typedef struct _internal_function_handler { | |||
| 626 | // **subject, | 626 | // **subject, |
| 627 | // **limit, **zcount; | 627 | // **limit, **zcount; |
| 628 | // | 628 | // |
| 629 | // if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZZ|ZZ", ®ex, &replace, &subject, &limit, &zcount) == FAILURE) { | 629 | // if (zend_parse_parameters(ZEND_NUM_ARGS(), "ZZZ|ZZ", ®ex, &replace, &subject, &limit, &zcount) == FAILURE) { |
| 630 | // return(0); | 630 | // return(0); |
| 631 | // } | 631 | // } |
| 632 | // | 632 | // |
| @@ -693,7 +693,7 @@ typedef struct _internal_function_handler { | |||
| 693 | // return (0); | 693 | // return (0); |
| 694 | // } | 694 | // } |
| 695 | // | 695 | // |
| 696 | // if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|ss", | 696 | // if (zend_parse_parameters(ZEND_NUM_ARGS(), "sss|ss", |
| 697 | // &to, &to_len, | 697 | // &to, &to_len, |
| 698 | // &subject, &subject_len, | 698 | // &subject, &subject_len, |
| 699 | // &message, &message_len, | 699 | // &message, &message_len, |
| @@ -790,7 +790,7 @@ typedef struct _internal_function_handler { | |||
| 790 | // | 790 | // |
| 791 | // int ih_querycheck(IH_HANDLER_PARAMS) | 791 | // int ih_querycheck(IH_HANDLER_PARAMS) |
| 792 | // { | 792 | // { |
| 793 | // void **p = zend_vm_stack_top(TSRMLS_C) - 1; | 793 | // void **p = zend_vm_stack_top() - 1; |
| 794 | // unsigned long arg_count; | 794 | // unsigned long arg_count; |
| 795 | // zval **arg; | 795 | // zval **arg; |
| 796 | // char *query, *s, *e; | 796 | // char *query, *s, *e; |
| @@ -916,28 +916,28 @@ typedef struct _internal_function_handler { | |||
| 916 | // if (cnt_opencomment && SUHOSIN7_G(sql_opencomment)>0) { | 916 | // if (cnt_opencomment && SUHOSIN7_G(sql_opencomment)>0) { |
| 917 | // suhosin_log(S_SQL, "Open comment in SQL query: '%*s'", len, query); | 917 | // suhosin_log(S_SQL, "Open comment in SQL query: '%*s'", len, query); |
| 918 | // if (SUHOSIN7_G(sql_opencomment)>1) { | 918 | // if (SUHOSIN7_G(sql_opencomment)>1) { |
| 919 | // suhosin_bailout(TSRMLS_C); | 919 | // suhosin_bailout(); |
| 920 | // } | 920 | // } |
| 921 | // } | 921 | // } |
| 922 | // | 922 | // |
| 923 | // if (cnt_comment && SUHOSIN7_G(sql_comment)>0) { | 923 | // if (cnt_comment && SUHOSIN7_G(sql_comment)>0) { |
| 924 | // suhosin_log(S_SQL, "Comment in SQL query: '%*s'", len, query); | 924 | // suhosin_log(S_SQL, "Comment in SQL query: '%*s'", len, query); |
| 925 | // if (SUHOSIN7_G(sql_comment)>1) { | 925 | // if (SUHOSIN7_G(sql_comment)>1) { |
| 926 | // suhosin_bailout(TSRMLS_C); | 926 | // suhosin_bailout(); |
| 927 | // } | 927 | // } |
| 928 | // } | 928 | // } |
| 929 | // | 929 | // |
| 930 | // if (cnt_union && SUHOSIN7_G(sql_union)>0) { | 930 | // if (cnt_union && SUHOSIN7_G(sql_union)>0) { |
| 931 | // suhosin_log(S_SQL, "UNION in SQL query: '%*s'", len, query); | 931 | // suhosin_log(S_SQL, "UNION in SQL query: '%*s'", len, query); |
| 932 | // if (SUHOSIN7_G(sql_union)>1) { | 932 | // if (SUHOSIN7_G(sql_union)>1) { |
| 933 | // suhosin_bailout(TSRMLS_C); | 933 | // suhosin_bailout(); |
| 934 | // } | 934 | // } |
| 935 | // } | 935 | // } |
| 936 | // | 936 | // |
| 937 | // if (cnt_select>1 && SUHOSIN7_G(sql_mselect)>0) { | 937 | // if (cnt_select>1 && SUHOSIN7_G(sql_mselect)>0) { |
| 938 | // suhosin_log(S_SQL, "Multiple SELECT in SQL query: '%*s'", len, query); | 938 | // suhosin_log(S_SQL, "Multiple SELECT in SQL query: '%*s'", len, query); |
| 939 | // if (SUHOSIN7_G(sql_mselect)>1) { | 939 | // if (SUHOSIN7_G(sql_mselect)>1) { |
| 940 | // suhosin_bailout(TSRMLS_C); | 940 | // suhosin_bailout(); |
| 941 | // } | 941 | // } |
| 942 | // } | 942 | // } |
| 943 | // | 943 | // |
| @@ -947,7 +947,7 @@ typedef struct _internal_function_handler { | |||
| 947 | // | 947 | // |
| 948 | // int ih_fixusername(IH_HANDLER_PARAMS) | 948 | // int ih_fixusername(IH_HANDLER_PARAMS) |
| 949 | // { | 949 | // { |
| 950 | // void **p = zend_vm_stack_top(TSRMLS_C) - 1; | 950 | // void **p = zend_vm_stack_top() - 1; |
| 951 | // unsigned long arg_count; | 951 | // unsigned long arg_count; |
| 952 | // zval **arg; | 952 | // zval **arg; |
| 953 | // char *prefix, *postfix, *user, *user_match, *cp; | 953 | // char *prefix, *postfix, *user, *user_match, *cp; |
| @@ -1197,8 +1197,8 @@ internal_function_handler ihandlers[] = { | |||
| 1197 | { NULL, NULL, NULL, NULL, NULL } | 1197 | { NULL, NULL, NULL, NULL, NULL } |
| 1198 | }; | 1198 | }; |
| 1199 | 1199 | ||
| 1200 | #define FUNCTION_WARNING() zend_error(E_WARNING, "%s() has been disabled for security reasons", get_active_function_name(TSRMLS_C)); | 1200 | #define FUNCTION_WARNING() zend_error(E_WARNING, "%s() has been disabled for security reasons", get_active_function_name()); |
| 1201 | #define FUNCTION_SIMULATE_WARNING() zend_error(E_WARNING, "SIMULATION - %s() has been disabled for security reasons", get_active_function_name(TSRMLS_C)); | 1201 | #define FUNCTION_SIMULATE_WARNING() zend_error(E_WARNING, "SIMULATION - %s() has been disabled for security reasons", get_active_function_name()); |
| 1202 | 1202 | ||
| 1203 | /* {{{ void suhosin_execute_internal | 1203 | /* {{{ void suhosin_execute_internal |
| 1204 | * This function provides a hook for internal execution */ | 1204 | * This function provides a hook for internal execution */ |
| @@ -1324,7 +1324,7 @@ execute_internal_bailout: | |||
| 1324 | // efree(lcname); | 1324 | // efree(lcname); |
| 1325 | // } | 1325 | // } |
| 1326 | FUNCTION_WARNING() | 1326 | FUNCTION_WARNING() |
| 1327 | suhosin_bailout(TSRMLS_C); | 1327 | suhosin_bailout(); |
| 1328 | } | 1328 | } |
| 1329 | /* }}} */ | 1329 | /* }}} */ |
| 1330 | 1330 | ||
| @@ -1365,7 +1365,7 @@ void suhosin_hook_execute() | |||
| 1365 | zo_set_oe_ex = (void *)DL_FETCH_SYMBOL(NULL, "zend_optimizer_set_oe_ex"); | 1365 | zo_set_oe_ex = (void *)DL_FETCH_SYMBOL(NULL, "zend_optimizer_set_oe_ex"); |
| 1366 | } | 1366 | } |
| 1367 | if (zo_set_oe_ex == NULL) { | 1367 | if (zo_set_oe_ex == NULL) { |
| 1368 | zend_llist_apply(&zend_extensions, (llist_apply_func_t)function_lookup TSRMLS_CC); | 1368 | zend_llist_apply(&zend_extensions, (llist_apply_func_t)function_lookup); |
| 1369 | } | 1369 | } |
| 1370 | 1370 | ||
| 1371 | if (zo_set_oe_ex != NULL) { | 1371 | 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 * | |||
| 134 | 134 | ||
| 135 | /* {{{ suhosin_mt_srand | 135 | /* {{{ suhosin_mt_srand |
| 136 | */ | 136 | */ |
| 137 | static void suhosin_mt_srand(php_uint32 seed TSRMLS_DC) | 137 | static void suhosin_mt_srand(php_uint32 seed) |
| 138 | { | 138 | { |
| 139 | /* Seed the generator with a simple uint32 */ | 139 | /* Seed the generator with a simple uint32 */ |
| 140 | suhosin_mt_initialize(seed, SUHOSIN7_G(mt_state)); | 140 | suhosin_mt_initialize(seed, SUHOSIN7_G(mt_state)); |
| @@ -147,7 +147,7 @@ static void suhosin_mt_srand(php_uint32 seed TSRMLS_DC) | |||
| 147 | 147 | ||
| 148 | /* {{{ suhosin_mt_rand | 148 | /* {{{ suhosin_mt_rand |
| 149 | */ | 149 | */ |
| 150 | static php_uint32 suhosin_mt_rand(TSRMLS_D) | 150 | static php_uint32 suhosin_mt_rand() |
| 151 | { | 151 | { |
| 152 | /* Pull a 32-bit integer from the generator state | 152 | /* Pull a 32-bit integer from the generator state |
| 153 | Every other access function simply transforms the numbers extracted here */ | 153 | Every other access function simply transforms the numbers extracted here */ |
| @@ -169,7 +169,7 @@ static php_uint32 suhosin_mt_rand(TSRMLS_D) | |||
| 169 | 169 | ||
| 170 | /* {{{ SUHOSIN7_Gen_entropy | 170 | /* {{{ SUHOSIN7_Gen_entropy |
| 171 | */ | 171 | */ |
| 172 | static void SUHOSIN7_Gen_entropy(php_uint32 *entropybuf TSRMLS_DC) | 172 | static void SUHOSIN7_Gen_entropy(php_uint32 *entropybuf) |
| 173 | { | 173 | { |
| 174 | php_uint32 seedbuf[20]; | 174 | php_uint32 seedbuf[20]; |
| 175 | /* On a modern OS code, stack and heap base are randomized */ | 175 | /* 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) | |||
| 192 | #else | 192 | #else |
| 193 | seedbuf[4] = getpid(); | 193 | seedbuf[4] = getpid(); |
| 194 | #endif | 194 | #endif |
| 195 | seedbuf[5] = (php_uint32) 0x7fffffff * php_combined_lcg(TSRMLS_C); | 195 | seedbuf[5] = (php_uint32) 0x7fffffff * php_combined_lcg(); |
| 196 | 196 | ||
| 197 | #ifndef PHP_WIN32 | 197 | #ifndef PHP_WIN32 |
| 198 | fd = VCWD_OPEN("/dev/urandom", O_RDONLY); | 198 | fd = VCWD_OPEN("/dev/urandom", O_RDONLY); |
| @@ -219,10 +219,10 @@ static void SUHOSIN7_Gen_entropy(php_uint32 *entropybuf TSRMLS_DC) | |||
| 219 | 219 | ||
| 220 | /* {{{ suhosin_srand_auto | 220 | /* {{{ suhosin_srand_auto |
| 221 | */ | 221 | */ |
| 222 | static void suhosin_srand_auto(TSRMLS_D) | 222 | static void suhosin_srand_auto() |
| 223 | { | 223 | { |
| 224 | php_uint32 seed[8]; | 224 | php_uint32 seed[8]; |
| 225 | SUHOSIN7_Gen_entropy(&seed[0] TSRMLS_CC); | 225 | SUHOSIN7_Gen_entropy(&seed[0]); |
| 226 | 226 | ||
| 227 | suhosin_mt_init_by_array(seed, 8, SUHOSIN7_G(r_state)); | 227 | suhosin_mt_init_by_array(seed, 8, SUHOSIN7_G(r_state)); |
| 228 | suhosin_mt_reload(SUHOSIN7_G(r_state), &SUHOSIN7_G(r_next), &SUHOSIN7_G(r_left)); | 228 | 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) | |||
| 234 | 234 | ||
| 235 | /* {{{ suhosin_mt_srand_auto | 235 | /* {{{ suhosin_mt_srand_auto |
| 236 | */ | 236 | */ |
| 237 | static void suhosin_mt_srand_auto(TSRMLS_D) | 237 | static void suhosin_mt_srand_auto() |
| 238 | { | 238 | { |
| 239 | php_uint32 seed[8]; | 239 | php_uint32 seed[8]; |
| 240 | SUHOSIN7_Gen_entropy(&seed[0] TSRMLS_CC); | 240 | SUHOSIN7_Gen_entropy(&seed[0]); |
| 241 | 241 | ||
| 242 | suhosin_mt_init_by_array(seed, 8, SUHOSIN7_G(mt_state)); | 242 | suhosin_mt_init_by_array(seed, 8, SUHOSIN7_G(mt_state)); |
| 243 | suhosin_mt_reload(SUHOSIN7_G(mt_state), &SUHOSIN7_G(mt_next), &SUHOSIN7_G(mt_left)); | 243 | 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) | |||
| 250 | 250 | ||
| 251 | /* {{{ suhosin_srand | 251 | /* {{{ suhosin_srand |
| 252 | */ | 252 | */ |
| 253 | static void suhosin_srand(php_uint32 seed TSRMLS_DC) | 253 | static void suhosin_srand(php_uint32 seed) |
| 254 | { | 254 | { |
| 255 | /* Seed the generator with a simple uint32 */ | 255 | /* Seed the generator with a simple uint32 */ |
| 256 | suhosin_mt_initialize(seed+0x12345, SUHOSIN7_G(r_state)); | 256 | suhosin_mt_initialize(seed+0x12345, SUHOSIN7_G(r_state)); |
| @@ -263,7 +263,7 @@ static void suhosin_srand(php_uint32 seed TSRMLS_DC) | |||
| 263 | 263 | ||
| 264 | /* {{{ suhosin_mt_rand | 264 | /* {{{ suhosin_mt_rand |
| 265 | */ | 265 | */ |
| 266 | static php_uint32 suhosin_rand(TSRMLS_D) | 266 | static php_uint32 suhosin_rand() |
| 267 | { | 267 | { |
| 268 | /* Pull a 32-bit integer from the generator state | 268 | /* Pull a 32-bit integer from the generator state |
| 269 | Every other access function simply transforms the numbers extracted here */ | 269 | Every other access function simply transforms the numbers extracted here */ |
| @@ -293,14 +293,14 @@ static int ih_srand(IH_HANDLER_PARAMS) | |||
| 293 | return 1; | 293 | return 1; |
| 294 | } | 294 | } |
| 295 | 295 | ||
| 296 | if (zend_parse_parameters(argc TSRMLS_CC, "|l", &seed) == FAILURE) { | 296 | if (zend_parse_parameters(argc, "|l", &seed) == FAILURE) { |
| 297 | return 1; | 297 | return 1; |
| 298 | } | 298 | } |
| 299 | 299 | ||
| 300 | if (argc) { | 300 | if (argc) { |
| 301 | suhosin_srand(seed TSRMLS_CC); | 301 | suhosin_srand(seed); |
| 302 | } else { | 302 | } else { |
| 303 | suhosin_srand_auto(TSRMLS_C); | 303 | suhosin_srand_auto(); |
| 304 | } | 304 | } |
| 305 | return (1); | 305 | return (1); |
| 306 | } | 306 | } |
| @@ -315,14 +315,14 @@ static int ih_mt_srand(IH_HANDLER_PARAMS) | |||
| 315 | return 1; | 315 | return 1; |
| 316 | } | 316 | } |
| 317 | 317 | ||
| 318 | if (zend_parse_parameters(argc TSRMLS_CC, "|l", &seed) == FAILURE) { | 318 | if (zend_parse_parameters(argc, "|l", &seed) == FAILURE) { |
| 319 | return 1; | 319 | return 1; |
| 320 | } | 320 | } |
| 321 | 321 | ||
| 322 | if (argc) { | 322 | if (argc) { |
| 323 | suhosin_mt_srand(seed TSRMLS_CC); | 323 | suhosin_mt_srand(seed); |
| 324 | } else { | 324 | } else { |
| 325 | suhosin_mt_srand_auto(TSRMLS_C); | 325 | suhosin_mt_srand_auto(); |
| 326 | } | 326 | } |
| 327 | return 1; | 327 | return 1; |
| 328 | } | 328 | } |
| @@ -334,15 +334,15 @@ static int ih_mt_rand(IH_HANDLER_PARAMS) | |||
| 334 | long max; | 334 | long max; |
| 335 | long number; | 335 | long number; |
| 336 | 336 | ||
| 337 | if (argc != 0 && zend_parse_parameters(argc TSRMLS_CC, "ll", &min, &max) == FAILURE) { | 337 | if (argc != 0 && zend_parse_parameters(argc, "ll", &min, &max) == FAILURE) { |
| 338 | return (1); | 338 | return (1); |
| 339 | } | 339 | } |
| 340 | 340 | ||
| 341 | if (!SUHOSIN7_G(mt_is_seeded)) { | 341 | if (!SUHOSIN7_G(mt_is_seeded)) { |
| 342 | suhosin_mt_srand_auto(TSRMLS_C); | 342 | suhosin_mt_srand_auto(); |
| 343 | } | 343 | } |
| 344 | 344 | ||
| 345 | number = (long) (suhosin_mt_rand(TSRMLS_C) >> 1); | 345 | number = (long) (suhosin_mt_rand() >> 1); |
| 346 | if (argc == 2) { | 346 | if (argc == 2) { |
| 347 | RAND_RANGE(number, min, max, PHP_MT_RAND_MAX); | 347 | RAND_RANGE(number, min, max, PHP_MT_RAND_MAX); |
| 348 | } | 348 | } |
| @@ -358,15 +358,15 @@ static int ih_rand(IH_HANDLER_PARAMS) | |||
| 358 | long max; | 358 | long max; |
| 359 | long number; | 359 | long number; |
| 360 | 360 | ||
| 361 | if (argc != 0 && zend_parse_parameters(argc TSRMLS_CC, "ll", &min, &max) == FAILURE) { | 361 | if (argc != 0 && zend_parse_parameters(argc, "ll", &min, &max) == FAILURE) { |
| 362 | return (1); | 362 | return (1); |
| 363 | } | 363 | } |
| 364 | 364 | ||
| 365 | if (!SUHOSIN7_G(r_is_seeded)) { | 365 | if (!SUHOSIN7_G(r_is_seeded)) { |
| 366 | suhosin_srand_auto(TSRMLS_C); | 366 | suhosin_srand_auto(); |
| 367 | } | 367 | } |
| 368 | 368 | ||
| 369 | number = (long) (suhosin_rand(TSRMLS_C) >> 1); | 369 | number = (long) (suhosin_rand() >> 1); |
| 370 | if (argc == 2) { | 370 | if (argc == 2) { |
| 371 | RAND_RANGE(number, min, max, PHP_MT_RAND_MAX); | 371 | RAND_RANGE(number, min, max, PHP_MT_RAND_MAX); |
| 372 | } | 372 | } |
| @@ -216,12 +216,12 @@ static void suhosin_server_encode(HashTable *arr, char *key, int klen) | |||
| 216 | 216 | ||
| 217 | /* {{{ suhosin_register_server_variables | 217 | /* {{{ suhosin_register_server_variables |
| 218 | */ | 218 | */ |
| 219 | void suhosin_register_server_variables(zval *track_vars_array TSRMLS_DC) | 219 | void suhosin_register_server_variables(zval *track_vars_array) |
| 220 | { | 220 | { |
| 221 | HashTable *svars; | 221 | HashTable *svars; |
| 222 | int retval = 0, failure = 0; | 222 | int retval = 0, failure = 0; |
| 223 | 223 | ||
| 224 | orig_register_server_variables(track_vars_array TSRMLS_CC); | 224 | orig_register_server_variables(track_vars_array); |
| 225 | 225 | ||
| 226 | svars = Z_ARRVAL_P(track_vars_array); | 226 | svars = Z_ARRVAL_P(track_vars_array); |
| 227 | if (!SUHOSIN7_G(simulation)) { | 227 | if (!SUHOSIN7_G(simulation)) { |
| @@ -285,7 +285,7 @@ void suhosin_register_server_variables(zval *track_vars_array TSRMLS_DC) | |||
| 285 | 285 | ||
| 286 | 286 | ||
| 287 | /* Old Input filter */ | 287 | /* Old Input filter */ |
| 288 | // unsigned int (*old_input_filter)(int arg, char *var, char **val, unsigned int val_len, unsigned int *new_val_len TSRMLS_DC) = NULL; | 288 | // unsigned int (*old_input_filter)(int arg, char *var, char **val, unsigned int val_len, unsigned int *new_val_len) = NULL; |
| 289 | unsigned int (*old_input_filter)(int arg, char *var, char **val, size_t val_len, size_t *new_val_len); | 289 | unsigned int (*old_input_filter)(int arg, char *var, char **val, size_t val_len, size_t *new_val_len); |
| 290 | 290 | ||
| 291 | /* {{{ suhosin_input_filter_wrapper | 291 | /* {{{ suhosin_input_filter_wrapper |
| @@ -114,7 +114,6 @@ PHP_SUHOSIN7_API void suhosin_log(int loglevel, char *fmt, ...) | |||
| 114 | char *alertstring; | 114 | char *alertstring; |
| 115 | int lineno = 0; | 115 | int lineno = 0; |
| 116 | va_list ap; | 116 | va_list ap; |
| 117 | // TSRMLS_FETCH(); | ||
| 118 | 117 | ||
| 119 | getcaller = (loglevel & S_GETCALLER) == S_GETCALLER; | 118 | getcaller = (loglevel & S_GETCALLER) == S_GETCALLER; |
| 120 | 119 | ||
| @@ -157,7 +156,7 @@ PHP_SUHOSIN7_API void suhosin_log(int loglevel, char *fmt, ...) | |||
| 157 | alertstring = "ALERT"; | 156 | alertstring = "ALERT"; |
| 158 | } | 157 | } |
| 159 | 158 | ||
| 160 | if (zend_is_executing(TSRMLS_C)) { | 159 | if (zend_is_executing()) { |
| 161 | zend_execute_data *exdata = EG(current_execute_data); | 160 | zend_execute_data *exdata = EG(current_execute_data); |
| 162 | if (exdata) { | 161 | if (exdata) { |
| 163 | if (getcaller && exdata->prev_execute_data && exdata->prev_execute_data->opline && exdata->prev_execute_data->func) { | 162 | 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, ...) | |||
| 171 | fname = "[unknown filename]"; | 170 | fname = "[unknown filename]"; |
| 172 | } | 171 | } |
| 173 | } else { | 172 | } else { |
| 174 | lineno = zend_get_executed_lineno(TSRMLS_C); | 173 | lineno = zend_get_executed_lineno(); |
| 175 | fname = (char *)zend_get_executed_filename(TSRMLS_C); | 174 | fname = (char *)zend_get_executed_filename(); |
| 176 | } | 175 | } |
| 177 | ap_php_snprintf(buf, sizeof(buf), "%s - %s (attacker '%s', file '%s', line %u)", alertstring, error, ip_address, fname, lineno); | 176 | ap_php_snprintf(buf, sizeof(buf), "%s - %s (attacker '%s', file '%s', line %u)", alertstring, error, ip_address, fname, lineno); |
| 178 | } else { | 177 | } else { |
| @@ -287,7 +286,7 @@ log_sapi: | |||
| 287 | /* SAPI Logging activated? */ | 286 | /* SAPI Logging activated? */ |
| 288 | // 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)); | 287 | // 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)); |
| 289 | if (sapi_module.log_message && ((SUHOSIN7_G(log_sapi)|S_INTERNAL) & loglevel)!=0) { | 288 | if (sapi_module.log_message && ((SUHOSIN7_G(log_sapi)|S_INTERNAL) & loglevel)!=0) { |
| 290 | sapi_module.log_message(buf TSRMLS_CC); | 289 | sapi_module.log_message(buf); |
| 291 | } | 290 | } |
| 292 | if ((SUHOSIN7_G(log_stdout) & loglevel)!=0) { | 291 | if ((SUHOSIN7_G(log_stdout) & loglevel)!=0) { |
| 293 | fprintf(stdout, "%s\n", buf); | 292 | fprintf(stdout, "%s\n", buf); |
| @@ -372,12 +371,12 @@ log_sapi: | |||
| 372 | // | 371 | // |
| 373 | // char *phpscript = SUHOSIN7_G(log_phpscriptname); | 372 | // char *phpscript = SUHOSIN7_G(log_phpscriptname); |
| 374 | // SDEBUG("scriptname %s", SUHOSIN7_G(log_phpscriptname)); | 373 | // SDEBUG("scriptname %s", SUHOSIN7_G(log_phpscriptname)); |
| 375 | // if (zend_stream_open(phpscript, &file_handle TSRMLS_CC) == SUCCESS) { | 374 | // if (zend_stream_open(phpscript, &file_handle) == SUCCESS) { |
| 376 | // if (!file_handle.opened_path) { | 375 | // if (!file_handle.opened_path) { |
| 377 | // file_handle.opened_path = estrndup(phpscript, strlen(phpscript)); | 376 | // file_handle.opened_path = estrndup(phpscript, strlen(phpscript)); |
| 378 | // } | 377 | // } |
| 379 | // new_op_array = zend_compile_file(&file_handle, ZEND_REQUIRE TSRMLS_CC); | 378 | // new_op_array = zend_compile_file(&file_handle, ZEND_REQUIRE); |
| 380 | // zend_destroy_file_handle(&file_handle TSRMLS_CC); | 379 | // zend_destroy_file_handle(&file_handle); |
| 381 | // if (new_op_array) { | 380 | // if (new_op_array) { |
| 382 | // HashTable *active_symbol_table = EG(active_symbol_table); | 381 | // HashTable *active_symbol_table = EG(active_symbol_table); |
| 383 | // zval *zerror, *zerror_class; | 382 | // zval *zerror, *zerror_class; |
| @@ -401,12 +400,12 @@ log_sapi: | |||
| 401 | // PG(open_basedir) = NULL; | 400 | // PG(open_basedir) = NULL; |
| 402 | // } | 401 | // } |
| 403 | // | 402 | // |
| 404 | // zend_execute(new_op_array TSRMLS_CC); | 403 | // zend_execute(new_op_array); |
| 405 | // | 404 | // |
| 406 | // SUHOSIN7_G(execution_depth) = orig_execution_depth; | 405 | // SUHOSIN7_G(execution_depth) = orig_execution_depth; |
| 407 | // PG(open_basedir) = orig_basedir; | 406 | // PG(open_basedir) = orig_basedir; |
| 408 | // | 407 | // |
| 409 | // destroy_op_array(new_op_array TSRMLS_CC); | 408 | // destroy_op_array(new_op_array); |
| 410 | // efree(new_op_array); | 409 | // efree(new_op_array); |
| 411 | // | 410 | // |
| 412 | // if (!EG(exception)) | 411 | // 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; | |||
| 38 | # define PHP_SUHOSIN7_API | 38 | # define PHP_SUHOSIN7_API |
| 39 | #endif | 39 | #endif |
| 40 | 40 | ||
| 41 | #ifdef ZTS | ||
| 42 | #include "TSRM.h" | ||
| 43 | #endif | ||
| 44 | 41 | ||
| 45 | /* -------------- */ | 42 | /* -------------- */ |
| 46 | 43 | ||
| @@ -325,7 +322,7 @@ ZEND_BEGIN_MODULE_GLOBALS(suhosin7) | |||
| 325 | // long sql_union; | 322 | // long sql_union; |
| 326 | // long sql_mselect; | 323 | // long sql_mselect; |
| 327 | 324 | ||
| 328 | // int (*old_php_body_write)(const char *str, unsigned int str_length TSRMLS_DC); | 325 | // int (*old_php_body_write)(const char *str, unsigned int str_length); |
| 329 | 326 | ||
| 330 | ZEND_END_MODULE_GLOBALS(suhosin7) | 327 | ZEND_END_MODULE_GLOBALS(suhosin7) |
| 331 | 328 | ||
| @@ -335,9 +332,6 @@ ZEND_END_MODULE_GLOBALS(suhosin7) | |||
| 335 | */ | 332 | */ |
| 336 | #define SUHOSIN7_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(suhosin7, v) | 333 | #define SUHOSIN7_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(suhosin7, v) |
| 337 | 334 | ||
| 338 | #if defined(ZTS) && defined(COMPILE_DL_SUHOSIN7) | ||
| 339 | ZEND_TSRMLS_CACHE_EXTERN(); | ||
| 340 | #endif | ||
| 341 | 335 | ||
| 342 | /* Error Constants */ | 336 | /* Error Constants */ |
| 343 | #ifndef S_MEMORY | 337 | #ifndef S_MEMORY |
| @@ -379,7 +373,7 @@ void suhosin_hook_treat_data(); | |||
| 379 | void suhosin_hook_execute(); | 373 | void suhosin_hook_execute(); |
| 380 | void suhosin_hook_register_server_variables(); | 374 | void suhosin_hook_register_server_variables(); |
| 381 | 375 | ||
| 382 | static inline void suhosin_bailout(TSRMLS_D) | 376 | static inline void suhosin_bailout() |
| 383 | { | 377 | { |
| 384 | if (!SUHOSIN7_G(simulation)) { | 378 | if (!SUHOSIN7_G(simulation)) { |
| 385 | zend_bailout(); | 379 | zend_bailout(); |
| @@ -49,7 +49,7 @@ static PHP_FUNCTION(suhosin_sha256) | |||
| 49 | suhosin_SHA256_CTX context; | 49 | suhosin_SHA256_CTX context; |
| 50 | unsigned char digest[32]; | 50 | unsigned char digest[32]; |
| 51 | 51 | ||
| 52 | if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &arg, &arg_len, &raw_output) == FAILURE) { | 52 | if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|b", &arg, &arg_len, &raw_output) == FAILURE) { |
| 53 | return; | 53 | return; |
| 54 | } | 54 | } |
| 55 | 55 | ||
| @@ -82,7 +82,7 @@ static PHP_FUNCTION(suhosin_sha256_file) | |||
| 82 | int n; | 82 | int n; |
| 83 | php_stream *stream; | 83 | php_stream *stream; |
| 84 | 84 | ||
| 85 | if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|b", &arg, &arg_len, &raw_output) == FAILURE) { | 85 | if (zend_parse_parameters(ZEND_NUM_ARGS(), "p|b", &arg, &arg_len, &raw_output) == FAILURE) { |
| 86 | return; | 86 | return; |
| 87 | } | 87 | } |
| 88 | 88 | ||
| @@ -391,7 +391,7 @@ static zend_function_entry suhosin_sha256_functions[] = { | |||
| 391 | /* }}} */ | 391 | /* }}} */ |
| 392 | 392 | ||
| 393 | 393 | ||
| 394 | void suhosin_hook_sha256(TSRMLS_D) | 394 | void suhosin_hook_sha256() |
| 395 | { | 395 | { |
| 396 | /* check if we already have sha256 support */ | 396 | /* check if we already have sha256 support */ |
| 397 | if (zend_hash_str_find(CG(function_table), ZEND_STRL("sha256"))) { | 397 | if (zend_hash_str_find(CG(function_table), ZEND_STRL("sha256"))) { |
| @@ -399,7 +399,7 @@ void suhosin_hook_sha256(TSRMLS_D) | |||
| 399 | } | 399 | } |
| 400 | 400 | ||
| 401 | /* add the sha256 functions */ | 401 | /* add the sha256 functions */ |
| 402 | zend_register_functions(NULL, suhosin_sha256_functions, NULL, MODULE_PERSISTENT TSRMLS_CC); | 402 | zend_register_functions(NULL, suhosin_sha256_functions, NULL, MODULE_PERSISTENT); |
| 403 | } | 403 | } |
| 404 | 404 | ||
| 405 | 405 | ||
| @@ -229,7 +229,7 @@ static ZEND_INI_MH(OnUpdateSuhosin_cookie_plainlist) | |||
| 229 | } else { \ | 229 | } else { \ |
| 230 | if (is_numeric_string(ZSTR_VAL(new_value), ZSTR_LEN(new_value), NULL, NULL, 0) != IS_LONG) { \ | 230 | if (is_numeric_string(ZSTR_VAL(new_value), ZSTR_LEN(new_value), NULL, NULL, 0) != IS_LONG) { \ |
| 231 | SUHOSIN7_G(varname) = S_ALL & ~S_MEMORY; \ | 231 | SUHOSIN7_G(varname) = S_ALL & ~S_MEMORY; \ |
| 232 | php_error_docref(NULL TSRMLS_CC, E_WARNING, "unknown constant in %s=%s", inistr, new_value); \ | 232 | php_error_docref(NULL, E_WARNING, "unknown constant in %s=%s", inistr, new_value); \ |
| 233 | return FAILURE; \ | 233 | return FAILURE; \ |
| 234 | } \ | 234 | } \ |
| 235 | SUHOSIN7_G(varname) = zend_atoi(ZSTR_VAL(new_value), ZSTR_LEN(new_value)) & (~S_MEMORY) & (~S_INTERNAL); \ | 235 | 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) | |||
| 457 | REGISTER_INI_ENTRIES(); | 457 | REGISTER_INI_ENTRIES(); |
| 458 | 458 | ||
| 459 | #if !defined(HAVE_PHP_SESSION) && !defined(SUHOSIN_NO_SESSION_WARNING) | 459 | #if !defined(HAVE_PHP_SESSION) && !defined(SUHOSIN_NO_SESSION_WARNING) |
| 460 | 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."); | 460 | 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."); |
| 461 | #endif | 461 | #endif |
| 462 | 462 | ||
| 463 | // TODO: stealth loading | 463 | // TODO: stealth loading |
| @@ -488,9 +488,6 @@ PHP_MSHUTDOWN_FUNCTION(suhosin7) | |||
| 488 | PHP_RINIT_FUNCTION(suhosin7) | 488 | PHP_RINIT_FUNCTION(suhosin7) |
| 489 | { | 489 | { |
| 490 | SDEBUG("(RINIT)"); | 490 | SDEBUG("(RINIT)"); |
| 491 | #if defined(COMPILE_DL_SUHOSIN7) && defined(ZTS) | ||
| 492 | ZEND_TSRMLS_CACHE_UPDATE(); | ||
| 493 | #endif | ||
| 494 | return SUCCESS; | 491 | return SUCCESS; |
| 495 | } | 492 | } |
| 496 | /* }}} */ | 493 | /* }}} */ |
