| 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> |
+----------------------------------------------------------------------+
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;
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);
}
/* 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;
/* 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);
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();
typedef unsigned int socklen_t;
#endif
-#include "request_info.h"
-
#define CREATE_MUTEX(a,b)
#define SET_MUTEX(a)
#define FREE_MUTEX(a)
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
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;
}
+++ /dev/null
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_0.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Jim Winstead (jimw@php.net) |
- +----------------------------------------------------------------------+
- */
-
-#include "php.h"
-#include "SAPI.h"
-
-PHPAPI php_request_info request_info;
-
-int php_destroy_request_info(void *conf)
-{
- STR_FREE(request_info.current_user);
- return SUCCESS;
-}
-
-int php_init_request_info(void *conf)
-{
- request_info.current_user = NULL;
- request_info.current_user_length = 0;
- return SUCCESS;
-}
-
-
-
-/* * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
+++ /dev/null
-/*
- +----------------------------------------------------------------------+
- | PHP version 4.0 |
- +----------------------------------------------------------------------+
- | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
- +----------------------------------------------------------------------+
- | This source file is subject to version 2.0 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.php.net/license/2_0.txt. |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Author: Jim Winstead (jimw@php.net) |
- +----------------------------------------------------------------------+
- */
-
-#ifndef _REQUEST_INFO_H_
-#define _REQUEST_INFO_H_
-
-typedef struct {
- char *current_user;
- int current_user_length;
- const char *script_filename;
-} php_request_info;
-
-#ifndef THREAD_SAFE
-PHPAPI extern php_request_info request_info;
-#endif
-
-extern int php_init_request_info(void *conf);
-extern int php_destroy_request_info(void *conf);
-
-#endif
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */