diff options
Diffstat (limited to 'ext/standard/exec.c')
-rw-r--r-- | ext/standard/exec.c | 42 |
1 files changed, 3 insertions, 39 deletions
diff --git a/ext/standard/exec.c b/ext/standard/exec.c index 5850026e17..5bca15d229 100644 --- a/ext/standard/exec.c +++ b/ext/standard/exec.c @@ -22,7 +22,6 @@ #include "php.h" #include <ctype.h> #include "php_string.h" -#include "safe_mode.h" #include "ext/standard/head.h" #include "ext/standard/file.h" #include "basic_functions.h" @@ -63,51 +62,21 @@ PHPAPI int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_ FILE *fp; char *buf, *tmp=NULL; int l = 0, pclose_return; - char *cmd_p, *b, *c, *d=NULL; + char *b, *c, *d=NULL; php_stream *stream; size_t buflen, bufl = 0; #if PHP_SIGCHILD void (*sig_handler)() = NULL; #endif - if (PG(safe_mode)) { - if ((c = strchr(cmd, ' '))) { - *c = '\0'; - c++; - } - if (strstr(cmd, "..")) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "No '..' components allowed in path"); - goto err; - } - - b = strrchr(cmd, PHP_DIR_SEPARATOR); - -#ifdef PHP_WIN32 - if (b && *b == '\\' && b == cmd) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid absolute path."); - goto err; - } -#endif - - spprintf(&d, 0, "%s%s%s%s%s", PG(safe_mode_exec_dir), (b ? "" : "/"), (b ? b : cmd), (c ? " " : ""), (c ? c : "")); - if (c) { - *(c - 1) = ' '; - } - cmd_p = php_escape_shell_cmd(d); - efree(d); - d = cmd_p; - } else { - cmd_p = cmd; - } - #if PHP_SIGCHILD sig_handler = signal (SIGCHLD, SIG_DFL); #endif #ifdef PHP_WIN32 - fp = VCWD_POPEN(cmd_p, "rb"); + fp = VCWD_POPEN(cmd, "rb"); #else - fp = VCWD_POPEN(cmd_p, "r"); + fp = VCWD_POPEN(cmd, "r"); #endif if (!fp) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to fork [%s]", cmd); @@ -484,11 +453,6 @@ PHP_FUNCTION(shell_exec) return; } - if (PG(safe_mode)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot execute using backquotes in Safe Mode"); - RETURN_FALSE; - } - #ifdef PHP_WIN32 if ((in=VCWD_POPEN(command, "rt"))==NULL) { #else |