diff options
Diffstat (limited to 'execute.c')
| -rw-r--r-- | execute.c | 49 |
1 files changed, 4 insertions, 45 deletions
| @@ -1031,50 +1031,6 @@ int ih_fixusername(IH_HANDLER_PARAMS) | |||
| 1031 | return (0); | 1031 | return (0); |
| 1032 | } | 1032 | } |
| 1033 | 1033 | ||
| 1034 | static int suhosin_php_body_write(const char *str, uint str_length TSRMLS_DC) | ||
| 1035 | { | ||
| 1036 | #define P_META_ROBOTS "<meta name=\"ROBOTS\" content=\"NOINDEX,NOFOLLOW,NOARCHIVE\" />" | ||
| 1037 | #define S_META_ROBOTS "<meta name=\"ROBOTS\" content=\"NOINDEX,FOLLOW,NOARCHIVE\" />" | ||
| 1038 | |||
| 1039 | SDEBUG("bw: %s", str); | ||
| 1040 | |||
| 1041 | if ((str_length == sizeof("</head>\n")-1) && (strcmp(str, "</head>\n")==0)) { | ||
| 1042 | SUHOSIN_G(old_php_body_write)(S_META_ROBOTS, sizeof(S_META_ROBOTS)-1 TSRMLS_CC); | ||
| 1043 | OG(php_body_write) = SUHOSIN_G(old_php_body_write); | ||
| 1044 | return SUHOSIN_G(old_php_body_write)(str, str_length TSRMLS_CC); | ||
| 1045 | } else if ((str_length == sizeof(P_META_ROBOTS)-1) && (strcmp(str, P_META_ROBOTS)==0)) { | ||
| 1046 | return str_length; | ||
| 1047 | } | ||
| 1048 | return SUHOSIN_G(old_php_body_write)(str, str_length TSRMLS_CC); | ||
| 1049 | } | ||
| 1050 | |||
| 1051 | static int ih_phpinfo(IH_HANDLER_PARAMS) | ||
| 1052 | { | ||
| 1053 | int argc = ZEND_NUM_ARGS(); | ||
| 1054 | long flag; | ||
| 1055 | |||
| 1056 | if (zend_parse_parameters(argc TSRMLS_CC, "|l", &flag) == FAILURE) { | ||
| 1057 | RETVAL_FALSE; | ||
| 1058 | return (1); | ||
| 1059 | } | ||
| 1060 | |||
| 1061 | if(!argc) { | ||
| 1062 | flag = PHP_INFO_ALL; | ||
| 1063 | } | ||
| 1064 | |||
| 1065 | /* Andale! Andale! Yee-Hah! */ | ||
| 1066 | php_start_ob_buffer(NULL, 4096, 0 TSRMLS_CC); | ||
| 1067 | if (!sapi_module.phpinfo_as_text) { | ||
| 1068 | SUHOSIN_G(old_php_body_write) = OG(php_body_write); | ||
| 1069 | OG(php_body_write) = suhosin_php_body_write; | ||
| 1070 | } | ||
| 1071 | php_print_info(flag TSRMLS_CC); | ||
| 1072 | php_end_ob_buffer(1, 0 TSRMLS_CC); | ||
| 1073 | |||
| 1074 | RETVAL_TRUE; | ||
| 1075 | return (1); | ||
| 1076 | } | ||
| 1077 | |||
| 1078 | 1034 | ||
| 1079 | static int ih_function_exists(IH_HANDLER_PARAMS) | 1035 | static int ih_function_exists(IH_HANDLER_PARAMS) |
| 1080 | { | 1036 | { |
| @@ -1527,7 +1483,6 @@ internal_function_handler ihandlers[] = { | |||
| 1527 | { "preg_replace", ih_preg_replace, NULL, NULL, NULL }, | 1483 | { "preg_replace", ih_preg_replace, NULL, NULL, NULL }, |
| 1528 | { "mail", ih_mail, NULL, NULL, NULL }, | 1484 | { "mail", ih_mail, NULL, NULL, NULL }, |
| 1529 | { "symlink", ih_symlink, NULL, NULL, NULL }, | 1485 | { "symlink", ih_symlink, NULL, NULL, NULL }, |
| 1530 | { "phpinfo", ih_phpinfo, NULL, NULL, NULL }, | ||
| 1531 | 1486 | ||
| 1532 | { "srand", ih_srand, NULL, NULL, NULL }, | 1487 | { "srand", ih_srand, NULL, NULL, NULL }, |
| 1533 | { "mt_srand", ih_mt_srand, NULL, NULL, NULL }, | 1488 | { "mt_srand", ih_mt_srand, NULL, NULL, NULL }, |
| @@ -1615,7 +1570,11 @@ static void suhosin_execute_internal(zend_execute_data *execute_data_ptr, int re | |||
| 1615 | } | 1570 | } |
| 1616 | 1571 | ||
| 1617 | #ifdef ZEND_ENGINE_2 | 1572 | #ifdef ZEND_ENGINE_2 |
| 1573 | # if PHP_VERSION_ID < 50400 | ||
| 1618 | return_value = (*(temp_variable *)((char *) execute_data_ptr->Ts + execute_data_ptr->opline->result.u.var)).var.ptr; | 1574 | return_value = (*(temp_variable *)((char *) execute_data_ptr->Ts + execute_data_ptr->opline->result.u.var)).var.ptr; |
| 1575 | # else | ||
| 1576 | return_value = (*(temp_variable *)((char *) execute_data_ptr->Ts + execute_data_ptr->opline->result.var)).var.ptr; | ||
| 1577 | # endif | ||
| 1619 | #else | 1578 | #else |
| 1620 | return_value = execute_data_ptr->Ts[execute_data_ptr->opline->result.u.var].var.ptr; | 1579 | return_value = execute_data_ptr->Ts[execute_data_ptr->opline->result.u.var].var.ptr; |
| 1621 | #endif | 1580 | #endif |
