cvs: /php4 SAPI.c SAPI.h safe_mode.c /php4/sapi/aolserver aolserver.c /php4/sapi/apache mod_php4.c /php4/sapi/cgi cgi_main.c /php4/sapi/isapi
php4isapi.c /php4/sapi/phttpd phttpd.c /php4/sapi/roxen roxen.c /php4/sapi/servlet servlet.c /php4/sapi/thttpd thttpd.c

From: Date: Thu, 10 Feb 2000 17:27:28 +0000
Subject: cvs: /php4 SAPI.c SAPI.h safe_mode.c /php4/sapi/aolserver aolserver.c /php4/sapi/apache mod_php4.c /php4/sapi/cgi cgi_main.c /php4/sapi/isapi
php4isapi.c /php4/sapi/phttpd phttpd.c /php4/sapi/roxen roxen.c /php4/sapi/servlet servlet.c /php4/sapi/thttpd thttpd.c
Groups: php.version4 
Request: Send a blank email to php-version4+get-10043@lists.php.net to get a copy of this message
zeev Thu Feb 10 09:27:28 2000 EDT Modified files: /php4 SAPI.c SAPI.h safe_mode.c /php4/sapi/aolserver aolserver.c /php4/sapi/apache mod_php4.c /php4/sapi/cgi cgi_main.c /php4/sapi/isapi php4isapi.c /php4/sapi/phttpd phttpd.c /php4/sapi/roxen roxen.c /php4/sapi/servlet servlet.c /php4/sapi/thttpd thttpd.c Log: More cleanup... Index: php4/SAPI.c diff -u php4/SAPI.c:1.44 php4/SAPI.c:1.45 --- php4/SAPI.c:1.44 Thu Feb 10 09:14:05 2000 +++ php4/SAPI.c Thu Feb 10 09:26:55 2000 @@ -19,6 +19,7 @@ */ #include <ctype.h> +#include <sys/stat.h> #include "php.h" #include "SAPI.h" @@ -381,5 +382,23 @@ return SUCCESS; } else { return FAILURE; + } +} + +SAPI_API int sapi_get_uid() +{ + SLS_FETCH(); + + if (sapi_module.get_uid) { + return sapi_module.get_uid(SLS_C); + } else { + struct stat statbuf; + + if (!SG(request_info).path_translated || (stat(SG(request_info).path_translated, &statbuf)==-1)) { + return -1; + } + + stat(SG(request_info).path_translated, &statbuf); + return statbuf.st_uid; } } Index: php4/SAPI.h diff -u php4/SAPI.h:1.30 php4/SAPI.h:1.31 --- php4/SAPI.h:1.30 Thu Feb 10 09:14:05 2000 +++ php4/SAPI.h Thu Feb 10 09:26:55 2000 @@ -127,8 +127,8 @@ SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(char *content_type_dup SLS_DC)); SAPI_API int sapi_flush(); +SAPI_API int sapi_get_uid(); - struct _sapi_module_struct { char *name; @@ -140,6 +140,7 @@ int (*ub_write)(const char *str, unsigned int str_length); void (*flush)(void *server_context); + int (*get_uid)(SLS_D); void (*sapi_error)(int type, const char *error_msg, ...); Index: php4/safe_mode.c diff -u php4/safe_mode.c:1.12 php4/safe_mode.c:1.13 --- php4/safe_mode.c:1.12 Sat Jan 8 06:36:12 2000 +++ php4/safe_mode.c Thu Feb 10 09:26:55 2000 @@ -15,7 +15,7 @@ | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> | +----------------------------------------------------------------------+ */ -/* $Id: safe_mode.c,v 1.12 2000/01/08 14:36:12 rasmus Exp $ */ +/* $Id: safe_mode.c,v 1.13 2000/02/10 17:26:55 zeev Exp $ */ #include "php.h" @@ -110,9 +110,6 @@ PHPAPI char *php_get_current_user() { -#if CGI_BINARY || USE_SAPI || FHTTPD - struct stat statbuf; -#endif struct passwd *pwd; int uid; SLS_FETCH(); @@ -124,15 +121,12 @@ /* FIXME: I need to have this somehow handled if USE_SAPI is defined, because cgi will also be interfaced in USE_SAPI */ -#if CGI_BINARY || USE_SAPI || FHTTPD - if (!SG(request_info).path_translated || (stat(SG(request_info).path_translated,&statbuf)==-1)) { + + uid = sapi_get_uid(); + + if (uid==-1) { return empty_string; } - uid = statbuf.st_uid; -#endif -#if APACHE - uid = ((request_rec *) SG(server_context))->finfo.st_uid; -#endif if ((pwd=getpwuid(uid))==NULL) { return empty_string; Index: php4/sapi/aolserver/aolserver.c diff -u php4/sapi/aolserver/aolserver.c:1.32 php4/sapi/aolserver/aolserver.c:1.33 --- php4/sapi/aolserver/aolserver.c:1.32 Thu Feb 10 08:44:58 2000 +++ php4/sapi/aolserver/aolserver.c Thu Feb 10 09:26:55 2000 @@ -22,7 +22,7 @@ * - CGI/1.1 conformance */ -/* $Id: aolserver.c,v 1.32 2000/02/10 16:44:58 zeev Exp $ */ +/* $Id: aolserver.c,v 1.33 2000/02/10 17:26:55 zeev Exp $ */ /* conflict between PHP and AOLserver headers */ #define Debug php_Debug @@ -206,7 +206,7 @@ NSLS_FETCH(); PUTS("<table border=5 width=600>\n"); - php_info_print_table_row(2, "SAPI module version", "$Id: aolserver.c,v 1.32 2000/02/10 16:44:58 zeev Exp $"); + php_info_print_table_row(2, "SAPI module version", "$Id: aolserver.c,v 1.33 2000/02/10 17:26:55 zeev Exp $"); php_info_print_table_row(2, "Build date", Ns_InfoBuildDate()); php_info_print_table_row(2, "Config file path", Ns_InfoConfigFile()); php_info_print_table_row(2, "Error Log path", Ns_InfoErrorLog()); @@ -302,6 +302,7 @@ php_ns_sapi_ub_write, /* unbuffered write */ NULL, /* flush */ + NULL, /* get uid */ php_error, /* error handler */ Index: php4/sapi/apache/mod_php4.c diff -u php4/sapi/apache/mod_php4.c:1.23 php4/sapi/apache/mod_php4.c:1.24 --- php4/sapi/apache/mod_php4.c:1.23 Thu Feb 10 08:44:58 2000 +++ php4/sapi/apache/mod_php4.c Thu Feb 10 09:26:55 2000 @@ -17,7 +17,7 @@ | PHP 4.0 patches by Zeev Suraski <zeev@zend.com> | +----------------------------------------------------------------------+ */ -/* $Id: mod_php4.c,v 1.23 2000/02/10 16:44:58 zeev Exp $ */ +/* $Id: mod_php4.c,v 1.24 2000/02/10 17:26:55 zeev Exp $ */ #include "zend.h" #include "php.h" @@ -300,6 +300,12 @@ } +static int php_apache_get_uid(SLS_D) +{ + return ((request_rec *) SG(server_context))->finfo.st_uid; +} + + static sapi_module_struct sapi_module = { "Apache", /* name */ @@ -311,6 +317,7 @@ sapi_apache_ub_write, /* unbuffered write */ sapi_apache_flush, /* flush */ + php_apache_get_uid, /* get uid */ php_error, /* error handler */ Index: php4/sapi/cgi/cgi_main.c diff -u php4/sapi/cgi/cgi_main.c:1.22 php4/sapi/cgi/cgi_main.c:1.23 --- php4/sapi/cgi/cgi_main.c:1.22 Thu Feb 10 08:48:22 2000 +++ php4/sapi/cgi/cgi_main.c Thu Feb 10 09:26:55 2000 @@ -176,6 +176,7 @@ } + static sapi_module_struct sapi_module = { "CGI", /* name */ @@ -187,6 +188,7 @@ sapi_cgibin_ub_write, /* unbuffered write */ sapi_cgibin_flush, /* flush */ + NULL, /* get uid */ php_error, /* error handler */ Index: php4/sapi/isapi/php4isapi.c diff -u php4/sapi/isapi/php4isapi.c:1.18 php4/sapi/isapi/php4isapi.c:1.19 --- php4/sapi/isapi/php4isapi.c:1.18 Thu Feb 10 08:44:59 2000 +++ php4/sapi/isapi/php4isapi.c Thu Feb 10 09:26:55 2000 @@ -350,6 +350,7 @@ sapi_isapi_ub_write, /* unbuffered write */ NULL, /* flush */ + NULL, /* get uid */ php_error, /* error handler */ Index: php4/sapi/phttpd/phttpd.c diff -u php4/sapi/phttpd/phttpd.c:1.10 php4/sapi/phttpd/phttpd.c:1.11 --- php4/sapi/phttpd/phttpd.c:1.10 Thu Feb 10 08:44:59 2000 +++ php4/sapi/phttpd/phttpd.c Thu Feb 10 09:26:56 2000 @@ -172,6 +172,7 @@ php_phttpd_sapi_ub_write, /* unbuffered write */ NULL, /* flush */ + NULL, /* get uid */ php_error, /* error handler */ Index: php4/sapi/roxen/roxen.c diff -u php4/sapi/roxen/roxen.c:1.16 php4/sapi/roxen/roxen.c:1.17 --- php4/sapi/roxen/roxen.c:1.16 Thu Feb 10 08:44:59 2000 +++ php4/sapi/roxen/roxen.c Thu Feb 10 09:26:56 2000 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: roxen.c,v 1.16 2000/02/10 16:44:59 zeev Exp $ */ +/* $Id: roxen.c,v 1.17 2000/02/10 17:26:56 zeev Exp $ */ #include "php.h" #ifdef HAVE_ROXEN @@ -470,7 +470,7 @@ /* char buf[512]; */ PUTS("<table border=5 width=600>\n"); - php_info_print_table_row(2, "SAPI module version", "$Id: roxen.c,v 1.16 2000/02/10 16:44:59 zeev Exp $"); + php_info_print_table_row(2, "SAPI module version", "$Id: roxen.c,v 1.17 2000/02/10 17:26:56 zeev Exp $"); /* php_info_print_table_row(2, "Build date", Ns_InfoBuildDate()); php_info_print_table_row(2, "Config file path", Ns_InfoConfigFile()); php_info_print_table_row(2, "Error Log path", Ns_InfoErrorLog()); @@ -526,6 +526,7 @@ php_roxen_sapi_ub_write, /* unbuffered write */ NULL, /* flush */ + NULL, /* get uid */ php_error, /* error handler */ Index: php4/sapi/servlet/servlet.c diff -u php4/sapi/servlet/servlet.c:1.15 php4/sapi/servlet/servlet.c:1.16 --- php4/sapi/servlet/servlet.c:1.15 Thu Feb 10 08:44:59 2000 +++ php4/sapi/servlet/servlet.c Thu Feb 10 09:26:56 2000 @@ -221,6 +221,7 @@ sapi_servlet_ub_write, /* unbuffered write */ NULL, /* flush */ + NULL, /* get uid */ php_error, /* error handler */ Index: php4/sapi/thttpd/thttpd.c diff -u php4/sapi/thttpd/thttpd.c:1.7 php4/sapi/thttpd/thttpd.c:1.8 --- php4/sapi/thttpd/thttpd.c:1.7 Thu Feb 10 08:44:59 2000 +++ php4/sapi/thttpd/thttpd.c Thu Feb 10 09:26:57 2000 @@ -112,6 +112,7 @@ sapi_thttpd_ub_write, NULL, + NULL, /* get uid */ php_error,

« previous php.version4 (#10043) next »