From: Antony Dovgal Date: Mon, 4 Jun 2007 15:37:38 +0000 (+0000) Subject: add missing open_basedir checks to CGI X-Git-Tag: BEFORE_IMPORT_OF_MYSQLND~539 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5697a11dd032f8477fc326a4c39982df717fd71f;p=php add missing open_basedir checks to CGI --- diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index 9f271a5534..81f9b2743a 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -1603,7 +1603,9 @@ consult the installation file that came with this distribution, or visit \n\ */ retval = FAILURE; if (cgi || SG(request_info).path_translated) { - retval = php_fopen_primary_script(&file_handle TSRMLS_CC); + if (!php_check_open_basedir(SG(request_info).path_translated TSRMLS_CC)) { + retval = php_fopen_primary_script(&file_handle TSRMLS_CC); + } } /* if we are unable to open path_translated and we are not @@ -1623,9 +1625,21 @@ consult the installation file that came with this distribution, or visit \n\ if (fastcgi) { goto fastcgi_request_done; } + + STR_FREE(SG(request_info).path_translated); + + if (free_query_string && SG(request_info).query_string) { + free(SG(request_info).query_string); + SG(request_info).query_string = NULL; + } + php_request_shutdown((void *) 0); SG(server_context) = NULL; php_module_shutdown(TSRMLS_C); + sapi_shutdown(); +#ifdef ZTS + tsrm_shutdown(); +#endif return FAILURE; }