diff options
author | Dmitry Stogov <dmitry@php.net> | 2007-09-10 10:55:26 +0000 |
---|---|---|
committer | Dmitry Stogov <dmitry@php.net> | 2007-09-10 10:55:26 +0000 |
commit | 96810f0ae60289b876ffbe8c39680910d6e82b1e (patch) | |
tree | 07fd79ac3a3f2fab6da4cc7b4cf95399de48f35c /sapi/cgi | |
parent | a09eadc95b0935493c1906459f4d6b59fdeec001 (diff) | |
download | php-git-96810f0ae60289b876ffbe8c39680910d6e82b1e.tar.gz |
Fixed bug #42587 (behaviour change regarding symlinked .php files)
Diffstat (limited to 'sapi/cgi')
-rw-r--r-- | sapi/cgi/cgi_main.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index 9034479997..21451cb0e6 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -777,6 +777,7 @@ static void init_request_info(TSRMLS_D) struct stat st; char *env_redirect_url = sapi_cgibin_getenv("REDIRECT_URL", sizeof("REDIRECT_URL")-1 TSRMLS_CC); char *env_document_root = sapi_cgibin_getenv("DOCUMENT_ROOT", sizeof("DOCUMENT_ROOT")-1 TSRMLS_CC); + int script_path_translated_len; /* Hack for buggy IIS that sets incorrect PATH_INFO */ char *env_server_software = sapi_cgibin_getenv("SERVER_SOFTWARE", sizeof("SERVER_SOFTWARE")-1 TSRMLS_CC); @@ -829,9 +830,11 @@ static void init_request_info(TSRMLS_D) * this fixes url's like /info.php/test */ if (script_path_translated && - (real_path = tsrm_realpath(script_path_translated, NULL TSRMLS_CC)) == NULL) { - char *pt = estrdup(script_path_translated); - int len = strlen(pt); + (script_path_translated_len = strlen(script_path_translated)) > 0 && + (script_path_translated[script_path_translated_len-1] == '/' || + (real_path = tsrm_realpath(script_path_translated, NULL TSRMLS_CC)) == NULL)) { + char *pt = estrndup(script_path_translated, script_path_translated_len); + int len = script_path_translated_len; char *ptr; while ((ptr = strrchr(pt, '/')) || (ptr = strrchr(pt, '\\'))) { @@ -971,9 +974,6 @@ static void init_request_info(TSRMLS_D) SG(request_info).path_translated = estrdup(script_path_translated); } } else { - if (real_path) { - script_path_translated = real_path; - } /* make sure path_info/translated are empty */ if (!orig_script_filename || (script_path_translated != orig_script_filename && @@ -1006,9 +1006,7 @@ static void init_request_info(TSRMLS_D) if (script_path_translated && !strstr(script_path_translated, "..")) { SG(request_info).path_translated = estrdup(script_path_translated); } - if (real_path) { - free(real_path); - } + free(real_path); } } else { #endif |