From 3785bbf9201d52379987b5444967286d2d3e8adc Mon Sep 17 00:00:00 2001 From: Ben Fuhrmannek Date: Fri, 4 Mar 2016 10:01:31 +0100 Subject: . --- execute.c | 7 +------ execute.h | 1 + execute_ih.c | 32 ++++++++++++++++---------------- php_suhosin7.h | 2 +- suhosin7.c | 2 +- 5 files changed, 20 insertions(+), 24 deletions(-) diff --git a/execute.c b/execute.c index 65dec2e..125dc70 100644 --- a/execute.c +++ b/execute.c @@ -552,6 +552,7 @@ static suhosin_internal_function_handler ihandlers[] = { // { "preg_replace", ih_preg_replace, NULL, NULL, NULL }, // { "mail", ih_mail, NULL, NULL, NULL }, // { "symlink", ih_symlink, NULL, NULL, NULL }, + S7_IH_ENTRY0i(symlink) // random number functions S7_IH_ENTRY0i(srand) @@ -560,12 +561,6 @@ static suhosin_internal_function_handler ihandlers[] = { S7_IH_ENTRY0i(mt_rand) S7_IH_ENTRY0i(getrandmax) S7_IH_ENTRY0("mt_getrandmax", getrandmax) - // { "srand", ih_srand, NULL, NULL, NULL }, - // { "mt_srand", ih_mt_srand, NULL, NULL, NULL }, - // { "rand", ih_rand, NULL, NULL, NULL }, - // { "mt_rand", ih_mt_rand, NULL, NULL, NULL }, - // { "getrandmax", ih_getrandmax, NULL, NULL, NULL }, - // { "mt_getrandmax", ih_getrandmax, NULL, NULL, NULL }, // { "function_exists", ih_function_exists, NULL, NULL, NULL }, diff --git a/execute.h b/execute.h index e4eca98..4e237b6 100644 --- a/execute.h +++ b/execute.h @@ -20,6 +20,7 @@ typedef struct _suhosin_internal_function_handler { // execute_ih.c S7_IH_FUNCTION(preg_replace); +S7_IH_FUNCTION(symlink); // execute_rnd.c S7_IH_FUNCTION(srand); diff --git a/execute_ih.c b/execute_ih.c index fa511b9..a59e6c5 100644 --- a/execute_ih.c +++ b/execute_ih.c @@ -66,22 +66,22 @@ S7_IH_FUNCTION(preg_replace) // #endif /* SUHOSIN7_PREG_REPLACE_NULL */ -// int ih_symlink(IH_HANDLER_PARAMS) -// { -// if (SUHOSIN7_G(executor_allow_symlink)) { -// return (0); -// } -// -// if (PG(open_basedir) && PG(open_basedir)[0]) { -// suhosin_log(S_EXECUTOR, "symlink called during open_basedir"); -// if (!SUHOSIN7_G(simulation)) { -// RETVAL_FALSE; -// return (1); -// } -// } -// -// return (0); -// } +S7_IH_FUNCTION(symlink) +{ + if (SUHOSIN7_G(executor_allow_symlink)) { + return (0); + } + + if (PG(open_basedir) && PG(open_basedir)[0]) { + suhosin_log(S_EXECUTOR, "symlink called during open_basedir"); + if (!SUHOSIN7_G(simulation)) { + RETVAL_FALSE; + return (1); + } + } + + return (0); +} // int ih_mail(IH_HANDLER_PARAMS) // { diff --git a/php_suhosin7.h b/php_suhosin7.h index 7a57fe1..5024790 100644 --- a/php_suhosin7.h +++ b/php_suhosin7.h @@ -131,7 +131,7 @@ ZEND_BEGIN_MODULE_GLOBALS(suhosin7) /* executor */ zend_ulong in_code_type; - // zend_bool executor_allow_symlink; + zend_bool executor_allow_symlink; long execution_depth; long max_execution_depth; long executor_include_max_traversal; diff --git a/suhosin7.c b/suhosin7.c index a282cda..42a058f 100644 --- a/suhosin7.c +++ b/suhosin7.c @@ -303,7 +303,7 @@ PHP_INI_BEGIN() // STD_S7_INI_BOOLEAN("suhosin.executor.disable_eval", "0", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateExecBool, executor_disable_eval) STD_S7_INI_BOOLEAN("suhosin.executor.disable_emodifier", "0", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateExecBool, executor_disable_emod) // - // STD_S7_INI_BOOLEAN("suhosin.executor.allow_symlink", "0", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateExecBool, executor_allow_symlink) + STD_S7_INI_BOOLEAN("suhosin.executor.allow_symlink", "0", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateExecBool, executor_allow_symlink) STD_S7_INI_ENTRY("suhosin.executor.max_depth", "750", PHP_INI_PERDIR|PHP_INI_SYSTEM, OnUpdateExecLong, max_execution_depth) // // -- cgit v1.3