diff options
| author | Zeev Suraski <zeev@php.net> | 2000-02-10 20:13:08 +0000 |
|---|---|---|
| committer | Zeev Suraski <zeev@php.net> | 2000-02-10 20:13:08 +0000 |
| commit | 49e98c3ddd49d36aa364299254849e70309559f8 (patch) | |
| tree | bc14a058245456715533616653a2649580c0860c /main | |
| parent | 6723bdd9202964ff163fe22883e382cda6f547ba (diff) | |
| download | php-git-49e98c3ddd49d36aa364299254849e70309559f8.tar.gz | |
request_info.c is dead! long live SAPI
@- Finished the server abstraction layer; All of the PHP code is now shared
@ across different servers (Apache, CGI, IIS, etc.), except for thin
@ interface modules (Zeev)
Diffstat (limited to 'main')
| -rw-r--r-- | main/SAPI.c | 7 | ||||
| -rw-r--r-- | main/SAPI.h | 4 | ||||
| -rw-r--r-- | main/main.c | 6 | ||||
| -rw-r--r-- | main/php.h | 2 | ||||
| -rw-r--r-- | main/safe_mode.c | 10 |
5 files changed, 15 insertions, 14 deletions
diff --git a/main/SAPI.c b/main/SAPI.c index 006789a474..04000a8bb4 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -12,7 +12,7 @@ | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ - | Design: Shane Caraveo <shane@caraveo.com> | + | Original design: Shane Caraveo <shane@caraveo.com> | | Authors: Andi Gutmans <andi@zend.com> | | Zeev Suraski <zeev@zend.com> | +----------------------------------------------------------------------+ @@ -176,6 +176,8 @@ SAPI_API void sapi_activate(SLS_D) SG(headers_sent) = 0; SG(read_post_bytes) = 0; SG(request_info).post_data = NULL; + SG(request_info).current_user = NULL; + SG(request_info).current_user_length = 0; if (SG(request_info).request_method && !strcmp(SG(request_info).request_method, "HEAD")) { SG(request_info).headers_only = 1; @@ -205,6 +207,9 @@ SAPI_API void sapi_deactivate(SLS_D) if (SG(request_info).post_data) { efree(SG(request_info).post_data); } + if (SG(request_info).current_user) { + efree(SG(request_info).current_user); + } if (sapi_module.deactivate) { sapi_module.deactivate(SLS_C); } diff --git a/main/SAPI.h b/main/SAPI.h index 8b773e7e03..bb42da48e1 100644 --- a/main/SAPI.h +++ b/main/SAPI.h @@ -79,6 +79,10 @@ typedef struct { /* this is necessary for the CGI SAPI module */ char *argv0; + + /* this is necessary for Safe Mode */ + char *current_user; + int current_user_length; } sapi_request_info; diff --git a/main/main.c b/main/main.c index 558bae1e3a..03ee7ca637 100644 --- a/main/main.c +++ b/main/main.c @@ -625,11 +625,6 @@ int php_request_startup(CLS_D ELS_DC PLS_DC SLS_DC) /* initialize global variables */ PG(header_is_being_sent)=0; - - if (php_init_request_info(NULL)) { - php_printf("Unable to initialize request info.\n"); - return FAILURE; - } zend_activate(CLS_C ELS_CC); sapi_activate(SLS_C); @@ -674,7 +669,6 @@ void php_request_shutdown(void *dummy) zend_deactivate(CLS_C ELS_CC); sapi_deactivate(SLS_C); - php_destroy_request_info(NULL); shutdown_memory_manager(CG(unclean_shutdown), 0); php_unset_timeout(); diff --git a/main/php.h b/main/php.h index ff8c3c8c43..9d710dbac1 100644 --- a/main/php.h +++ b/main/php.h @@ -114,8 +114,6 @@ char *strtok_r(char *s, const char *delim, char **last); typedef unsigned int socklen_t; #endif -#include "request_info.h" - #define CREATE_MUTEX(a,b) #define SET_MUTEX(a) #define FREE_MUTEX(a) diff --git a/main/safe_mode.c b/main/safe_mode.c index f274d23da8..c022d600da 100644 --- a/main/safe_mode.c +++ b/main/safe_mode.c @@ -114,8 +114,8 @@ PHPAPI char *php_get_current_user() struct stat *pstat; SLS_FETCH(); - if (request_info.current_user) { - return request_info.current_user; + if (SG(request_info).current_user) { + return SG(request_info).current_user; } /* FIXME: I need to have this somehow handled if @@ -131,8 +131,8 @@ PHPAPI char *php_get_current_user() if ((pwd=getpwuid(pstat->st_uid))==NULL) { return empty_string; } - request_info.current_user_length = strlen(pwd->pw_name); - request_info.current_user = estrndup(pwd->pw_name,request_info.current_user_length); + SG(request_info).current_user_length = strlen(pwd->pw_name); + SG(request_info).current_user = estrndup(pwd->pw_name, SG(request_info).current_user_length); - return request_info.current_user; + return SG(request_info).current_user; } |
