[PHP-DEV] memory allocation for PG() variables.
I see that PG(open_basdir) holds the value of open_basedir. I need to make a local hack to alter that value, adding a path from an Apache environment variable. After browsing the source for a while, I'm still uncertain on how memory is allocated for those PG() string variables. How should I alter a PG() variable? With some function like emalloc? TIA Egan -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DEV] mass virtual hosting
In the archives I found just a few posts about patches for setting open_basedir and other core globals dynamically, as needed in a mass virtual hosting environment with Apache. Have any of these patches been applied, or is anyone working on this? -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DEV] Bug #10960: coding error in fopen_wrappers.c
From: [EMAIL PROTECTED] Operating system: Linux PHP version: 4.0.5 PHP Bug Type: PHP options/info functions Bug description: coding error in fopen_wrappers.c From previous bug report 10322 submitted by Paul Gregg: In main/fopen_wrappers.c I see that there is a function: PHPAPI int php_check_specific_open_basedir(char *basedir, char *path PLS_DC) However basedir is never used in this function at all, only PG(open_basedir). Surely this negates the point of the function being called individually for each tokenised entry on open_basedir/php.ini? --- end of bug report 10322 Although Paul was correct, Jason Greene [EMAIL PROTECTED] marked his report as bogus, apparently because it was included as part of a larger patch which Jason claimed was plagarizing his (Jason's) earlier patch, and Jason did not notice the one-line correction dealing with the logical error. Paul's report of the logical error was not bogus, and his one-line correction was obviously correct. Here it is again: --- fopen_wrappers.c.orig Mon Feb 26 00:07:31 2001 +++ fopen_wrappers.cFri May 18 12:40:54 2001 @@ -147,7 +147,7 @@ SLS_FETCH(); /* Special case basedir==.: Use script-directory */ - if ((strcmp(PG(open_basedir), .) == 0) + if ((strcmp(basedir), .) == 0) SG(request_info).path_translated *SG(request_info).path_translated ) { -- Edit Bug report at: http://bugs.php.net/?id=10960edit=1 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DEV] Bug #10960: coding error in fopen_wrappers.c
On 18 May 2001 18:12:38 -, [EMAIL PROTECTED] wrote: --- fopen_wrappers.c.orig Mon Feb 26 00:07:31 2001 +++ fopen_wrappers.c Fri May 18 12:40:54 2001 @@ -147,7 +147,7 @@ SLS_FETCH(); /* Special case basedir==.: Use script-directory */ - if ((strcmp(PG(open_basedir), .) == 0) + if ((strcmp(basedir), .) == 0) SG(request_info).path_translated *SG(request_info).path_translated ) { Whoops! Left in an extra paren. The fix should be: + if ((strcmp(basedir, .) == 0) -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DEV] Bug #10960 Updated: coding error in fopen_wrappers.c
ID: 10960 User Update by: [EMAIL PROTECTED] Status: Open Bug Type: PHP options/info functions Operating system: Linux PHP Version: 4.0.5 Description: coding error in fopen_wrappers.c Sorry, left in an extra paren. The fix should be: + if ((strcmp(basedir, .) == 0) Previous Comments: --- [2001-05-18 14:12:38] [EMAIL PROTECTED] From previous bug report 10322 submitted by Paul Gregg: In main/fopen_wrappers.c I see that there is a function: PHPAPI int php_check_specific_open_basedir(char *basedir, char *path PLS_DC) However basedir is never used in this function at all, only PG(open_basedir). Surely this negates the point of the function being called individually for each tokenised entry on open_basedir/php.ini? --- end of bug report 10322 Although Paul was correct, Jason Greene [EMAIL PROTECTED] marked his report as bogus, apparently because it was included as part of a larger patch which Jason claimed was plagarizing his (Jason's) earlier patch, and Jason did not notice the one-line correction dealing with the logical error. Paul's report of the logical error was not bogus, and his one-line correction was obviously correct. Here it is again: --- fopen_wrappers.c.orig Mon Feb 26 00:07:31 2001 +++ fopen_wrappers.cFri May 18 12:40:54 2001 @@ -147,7 +147,7 @@ SLS_FETCH(); /* Special case basedir==.: Use script-directory */ - if ((strcmp(PG(open_basedir), .) == 0) + if ((strcmp(basedir), .) == 0) SG(request_info).path_translated *SG(request_info).path_translated ) { --- Full Bug description available at: http://bugs.php.net/?id=10960 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DEV] setting open_basedir and include_path from environment variables
Hi, In main.c there are some comments about setting include_path from an environment variable called PHP_INCLUDE_PATH, but it appears this is a future todo. I need to patch my local source to do that, but I don't see in the source where the values are being read from the .ini file; presumably I need to read my environment variable and override the .ini values immediately after that. Can anyone tell me where to look in the source to find the values being set from the .ini file? -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DEV] RE: [PHP] PHP / NSAPI / Web server support
The change from request_translate_uri to rq-vars "path" also fixes the use of PATH_INFO and PHP as a default index. Without this, PHP halts without error on URI's like /app (with /app/index.php) or /script.php/commit. The same problems with PATH_INFO default index occur when running PHP as a CGI. I've made a few changes to cgi_main.c to fix this but havn't tested on anything but NES 362. I've been encountering quite a few bus error seg faults when using the NSAPI plugin (up to 5 a day) - these are usually caught by uxwdog. Anybody else found the same? I noticed also that the latest snapshot now includes the check for ieeefp.h. *** sapi/cgi/cgi_main.c.origSat Jan 20 00:09:12 2001 --- sapi/cgi/cgi_main.c Sat Jan 20 00:08:42 2001 *** *** 168,174 l += strlen(sn); if (pi) l += strlen(pi); ! if (pi sn !strcmp(pi, sn)) { l -= strlen(pi); pi = NULL; } --- 168,174 l += strlen(sn); if (pi) l += strlen(pi); ! if (pi sn !strncmp(pi, sn, strlen(sn))) { l -= strlen(pi); pi = NULL; } *** *** 314,323 --- 314,337 SG(request_info).request_method = getenv("REQUEST_METHOD"); SG(request_info).query_string = getenv("QUERY_STRING"); + /* SG(request_info).request_uri = getenv("PATH_INFO"); if (!SG(request_info).request_uri) { SG(request_info).request_uri = getenv("SCRIPT_NAME"); } + */ + + SG(request_info).request_uri = getenv("SCRIPT_NAME"); + if (SG(request_info).request_uri SG(request_info).argv0 +IS_SLASH(SG(request_info).request_uri[strlen(SG(request_info).request_uri)-1])) { + char *arg_file = strrchr(SG(request_info).argv0,DEFAULT_SLASH); + if (arg_file) { + char *script_name = +emalloc(strlen(SG(request_info).request_uri)+strlen(arg_file)+1); + strcpy(script_name,SG(request_info).request_uri); + strcat(script_name,arg_file+1); + SG(request_info).request_uri = script_name; + } + } + SG(request_info).path_translated = NULL; /* we have to update it later, when we have that information */ SG(request_info).content_type = getenv("CONTENT_TYPE"); SG(request_info).content_length = (content_length?atoi(content_length):0); *** *** 507,518 ap_php_optarg = orig_optarg; } init_request_info(SLS_C); SG(server_context) = (void *) 1; /* avoid server_context==NULL checks */ CG(extended_info) = 0; - SG(request_info).argv0 = argv0; - zend_llist_init(global_vars, sizeof(char *), NULL, 0); if (!cgi) { /* never execute the arguments if you are a CGI */ --- 521,532 ap_php_optarg = orig_optarg; } + SG(request_info).argv0 = argv0; + init_request_info(SLS_C); SG(server_context) = (void *) 1; /* avoid server_context==NULL checks */ CG(extended_info) = 0; zend_llist_init(global_vars, sizeof(char *), NULL, 0); if (!cgi) { /* never execute the arguments if you are a CGI */ *** sapi/nsapi/nsapi.c.orig Sat Jan 20 15:11:01 2001 --- sapi/nsapi/nsapi.c Sat Jan 20 15:31:34 2001 *** *** 101,106 --- 101,107 { "HTTP_ACCEPT_LANGUAGE", "accept-language" }, { "HTTP_AUTHORIZATION", "authorization" }, { "HTTP_COOKIE","cookie" }, + { "HTTP_CLIENT_IP", "client-ip" }, { "HTTP_IF_MODIFIED_SINCE", "if-modified-since" }, { "HTTP_REFERER", "referer" }, { "HTTP_USER_AGENT","user-agent" }, *** *** 445,457 char *query_string = pblock_findval("query", NSG(rq)-reqpb); char *uri = pblock_findval("uri", NSG(rq)-reqpb); char *path_info = pblock_findval("path-info", NSG(rq)-vars); ! char *path_translated = NULL; char *request_method = pblock_findval("method", NSG(rq)-reqpb); char *content_type = pblock_findval("content-type", NSG(rq)-headers); char *content_length = pblock_findval("content-length", NSG(rq)-headers); if (uri != NULL) path_translated = request_translate_uri(uri, NSG(sn)); #if defined(NSAPI_DEBUG) log_error(LOG_INFORM, "nsapi_request_ctor", NSG(sn), NSG(rq), --- 446,460 char *query_string = pblock_findval("query", NSG(rq)-reqpb); char *uri = pblock_findval("uri", NSG(rq)-reqpb); char *path_info = pblock_findval("path-info", NSG(rq)-vars); !