summaryrefslogtreecommitdiff
path: root/ex_imp.c
diff options
context:
space:
mode:
authorStefan2010-03-24 15:41:38 +0100
committerStefan2010-03-24 15:41:38 +0100
commit25c7cc00c9bc3f7127c638dd48e1f25be17fca69 (patch)
tree77a2b0112158091353486a26b7315b266ef6dcee /ex_imp.c
parent29e8badaeb13eaff46c00a8b543ce21710f2ac10 (diff)
More merges...
Diffstat (limited to 'ex_imp.c')
-rw-r--r--ex_imp.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/ex_imp.c b/ex_imp.c
index a6fd0c3..5aa8df4 100644
--- a/ex_imp.c
+++ b/ex_imp.c
@@ -442,9 +442,9 @@ PHP_FUNCTION(suhosin_extract)
442/* }}} */ 442/* }}} */
443 443
444 444
445static int copy_request_variable(void *pDest, int num_args, va_list args, zend_hash_key *hash_key)
446{
447#if PHP_VERSION_ID >= 50300 445#if PHP_VERSION_ID >= 50300
446static int copy_request_variable(void *pDest TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
447{
448 zval *prefix, new_key; 448 zval *prefix, new_key;
449 int prefix_len; 449 int prefix_len;
450 zval **var = (zval **) pDest; 450 zval **var = (zval **) pDest;
@@ -511,7 +511,10 @@ static int copy_request_variable(void *pDest, int num_args, va_list args, zend_h
511 511
512 zval_dtor(&new_key); 512 zval_dtor(&new_key);
513 return 0; 513 return 0;
514}
514#else 515#else
516static int copy_request_variable(void *pDest, int num_args, va_list args, zend_hash_key *hash_key)
517{
515 char *prefix, *new_key; 518 char *prefix, *new_key;
516 uint prefix_len, new_key_len; 519 uint prefix_len, new_key_len;
517 zval **var = (zval **) pDest; 520 zval **var = (zval **) pDest;
@@ -545,6 +548,11 @@ static int copy_request_variable(void *pDest, int num_args, va_list args, zend_h
545 new_key_len++; 548 new_key_len++;
546 } 549 }
547 550
551 if (php_varname_check(new_key, new_key_len-1, 0 TSRMLS_CC) == FAILURE) {
552 zval_dtor(&new_key);
553 return 0;
554 }
555
548 if (new_key[0] == 'H') { 556 if (new_key[0] == 'H') {
549 if ((strcmp(new_key, "HTTP_GET_VARS")==0)|| 557 if ((strcmp(new_key, "HTTP_GET_VARS")==0)||
550 (strcmp(new_key, "HTTP_POST_VARS")==0)|| 558 (strcmp(new_key, "HTTP_POST_VARS")==0)||
@@ -583,8 +591,8 @@ static int copy_request_variable(void *pDest, int num_args, va_list args, zend_h
583 591
584 efree(new_key); 592 efree(new_key);
585 return 0; 593 return 0;
586#endif
587} 594}
595#endif
588 596
589/* {{{ proto bool import_request_variables(string types [, string prefix]) 597/* {{{ proto bool import_request_variables(string types [, string prefix])
590 Import GET/POST/Cookie variables into the global scope */ 598 Import GET/POST/Cookie variables into the global scope */
@@ -705,12 +713,22 @@ PHP_FUNCTION(suhosin_import_request_variables)
705} 713}
706/* }}} */ 714/* }}} */
707 715
716ZEND_BEGIN_ARG_INFO_EX(suhosin_arginfo_extract, 0, 0, 1)
717 ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, arg) /* ARRAY_INFO(0, arg, 0) */
718 ZEND_ARG_INFO(0, extract_type)
719 ZEND_ARG_INFO(0, prefix)
720ZEND_END_ARG_INFO()
721
722ZEND_BEGIN_ARG_INFO_EX(suhosin_arginfo_import_request_variables, 0, 0, 1)
723 ZEND_ARG_INFO(0, types)
724 ZEND_ARG_INFO(0, prefix)
725ZEND_END_ARG_INFO()
708 726
709/* {{{ suhosin_ex_imp_functions[] 727/* {{{ suhosin_ex_imp_functions[]
710 */ 728 */
711function_entry suhosin_ex_imp_functions[] = { 729function_entry suhosin_ex_imp_functions[] = {
712 PHP_NAMED_FE(extract, PHP_FN(suhosin_extract), NULL) 730 PHP_NAMED_FE(extract, PHP_FN(suhosin_extract), suhosin_arginfo_extract)
713 PHP_NAMED_FE(import_request_variables, PHP_FN(suhosin_import_request_variables), NULL) 731 PHP_NAMED_FE(import_request_variables, PHP_FN(suhosin_import_request_variables), suhosin_arginfo_import_request_variables)
714 {NULL, NULL, NULL} 732 {NULL, NULL, NULL}
715}; 733};
716/* }}} */ 734/* }}} */