CVS update: php3
| From: | steffann | Date: | Fri, 14 Aug 1998 23:47:13 +0000 |
| Subject: | CVS update: php3 | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-248@lists.php.net to get a copy of this message | ||
Date: Friday August 14, 1998 @ 19:47
Author: steffann
Update of /repository/php3
In directory asf:/tmp/cvs-serv13204
Modified Files:
ChangeLog fopen-wrappers.c fopen-wrappers.h main.c mod_php3.c
mod_php3.h
Log Message:
Changed the name of fopen_basedir to open_basedir to be a little more
accurate.
Index: php3/ChangeLog
diff -c php3/ChangeLog:1.445 php3/ChangeLog:1.446
*** php3/ChangeLog:1.445 Fri Aug 14 16:03:48 1998
--- php3/ChangeLog Fri Aug 14 19:47:11 1998
***************
*** 1,6 ****
--- 1,8 ----
PHP 3.0 CHANGE LOG ChangeLog
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
August 15, 1998 Version 3.0.3
+ - Changed the name of fopen_basedir to open_basedir, to be a little more
+ accurate about what it does.
- Added Hyperwave module
- Added config-option (php3_)enable_dl <on/off>. This enables/disables the
dl() function. In safe-mode dl() is always disabled.
Index: php3/fopen-wrappers.c
diff -c php3/fopen-wrappers.c:1.43 php3/fopen-wrappers.c:1.44
*** php3/fopen-wrappers.c:1.43 Fri Aug 14 16:33:52 1998
--- php3/fopen-wrappers.c Fri Aug 14 19:47:11 1998
***************
*** 27,33 ****
| Jim Winstead <jimw@php.net> |
+----------------------------------------------------------------------+
*/
! /* $Id: fopen-wrappers.c,v 1.43 1998/08/14 20:33:52 shane Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
--- 27,33 ----
| Jim Winstead <jimw@php.net> |
+----------------------------------------------------------------------+
*/
! /* $Id: fopen-wrappers.c,v 1.44 1998/08/14 23:47:11 steffann Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
***************
*** 99,136 ****
int _php3_getftpresult(int socketd);
/*
! When fopen_basedir is not NULL, check if the given filename is located in
! fopen_basedir. Returns -1 if error or not in the fopen_basedir, else 0
! When fopen_basedir is NULL, always return 0
*/
! PHPAPI int _php3_check_fopen_basedir(char *path)
{
char resolved_name[MAXPATHLEN];
! /* Only check when fopen_basedir is available */
! if (php3_ini.fopen_basedir && *php3_ini.fopen_basedir) {
/* Resolve the real path into resolved_name */
if (_php3_realpath(path, resolved_name) != NULL) {
/* Check the path */
#if WIN32|WINNT
! if (strncmp(php3_ini.fopen_basedir, resolved_name, strlen(php3_ini.fopen_basedir)) == 0) {
#else
! if (strncasecmp(php3_ini.fopen_basedir, resolved_name, strlen(php3_ini.fopen_basedir)) == 0) {
#endif
/* File is in the right directory */
return 0;
} else {
! php3_error(E_WARNING, "fopen_basedir restriction in effect. File is in wrong
directory.");
return -1;
}
} else {
/* Unable to resolve the real path, return -1 */
! php3_error(E_WARNING, "fopen_basedir restriction in effect. Unable to verify location of
file.");
return -1;
}
} else {
! /* fopen_basedir is not available, return 0 */
return 0;
}
}
--- 99,136 ----
int _php3_getftpresult(int socketd);
/*
! When open_basedir is not NULL, check if the given filename is located in
! open_basedir. Returns -1 if error or not in the open_basedir, else 0
! When open_basedir is NULL, always return 0
*/
! PHPAPI int _php3_check_open_basedir(char *path)
{
char resolved_name[MAXPATHLEN];
! /* Only check when open_basedir is available */
! if (php3_ini.open_basedir && *php3_ini.open_basedir) {
/* Resolve the real path into resolved_name */
if (_php3_realpath(path, resolved_name) != NULL) {
/* Check the path */
#if WIN32|WINNT
! if (strncmp(php3_ini.open_basedir, resolved_name, strlen(php3_ini.open_basedir)) == 0) {
#else
! if (strncasecmp(php3_ini.open_basedir, resolved_name, strlen(php3_ini.open_basedir)) == 0) {
#endif
/* File is in the right directory */
return 0;
} else {
! php3_error(E_WARNING, "open_basedir restriction in effect. File is in wrong
directory.");
return -1;
}
} else {
/* Unable to resolve the real path, return -1 */
! php3_error(E_WARNING, "open_basedir restriction in effect. Unable to verify location of
file.");
return -1;
}
} else {
! /* open_basedir is not available, return 0 */
return 0;
}
}
***************
*** 150,156 ****
php3_error(E_WARNING, "SAFE MODE Restriction in effect. Invalid owner of file to be
read.");
return NULL;
}
! if (_php3_check_fopen_basedir(path)) return NULL;
return fopen(path, mode);
}
}
--- 150,156 ----
php3_error(E_WARNING, "SAFE MODE Restriction in effect. Invalid owner of file to be
read.");
return NULL;
}
! if (_php3_check_open_basedir(path)) return NULL;
return fopen(path, mode);
}
}
***************
*** 271,277 ****
php3_error(E_WARNING, "SAFE MODE Restriction in effect. Invalid owner.");
return NULL;
}
! if (_php3_check_fopen_basedir(filename)) return NULL;
fp = fopen(filename, mode);
if (fp && opened_path) {
*opened_path = expand_filepath(filename);
--- 271,277 ----
php3_error(E_WARNING, "SAFE MODE Restriction in effect. Invalid owner.");
return NULL;
}
! if (_php3_check_open_basedir(filename)) return NULL;
fp = fopen(filename, mode);
if (fp && opened_path) {
*opened_path = expand_filepath(filename);
***************
*** 290,303 ****
php3_error(E_WARNING, "SAFE MODE Restriction in effect. Invalid owner.");
return NULL;
}
! if (_php3_check_fopen_basedir(trypath)) return NULL;
fp = fopen(trypath, mode);
if (fp && opened_path) {
*opened_path = expand_filepath(trypath);
}
return fp;
} else {
! if (_php3_check_fopen_basedir(filename)) return NULL;
return fopen(filename, mode);
}
}
--- 290,303 ----
php3_error(E_WARNING, "SAFE MODE Restriction in effect. Invalid owner.");
return NULL;
}
! if (_php3_check_open_basedir(trypath)) return NULL;
fp = fopen(trypath, mode);
if (fp && opened_path) {
*opened_path = expand_filepath(trypath);
}
return fp;
} else {
! if (_php3_check_open_basedir(filename)) return NULL;
return fopen(filename, mode);
}
}
***************
*** 306,312 ****
php3_error(E_WARNING, "SAFE MODE Restriction in effect. Invalid owner.");
return NULL;
}
! if (_php3_check_fopen_basedir(filename)) return NULL;
fp = fopen(filename, mode);
if (fp && opened_path) {
*opened_path = strdup(filename);
--- 306,312 ----
php3_error(E_WARNING, "SAFE MODE Restriction in effect. Invalid owner.");
return NULL;
}
! if (_php3_check_open_basedir(filename)) return NULL;
fp = fopen(filename, mode);
if (fp && opened_path) {
*opened_path = strdup(filename);
***************
*** 336,342 ****
}
}
if ((fp = fopen(trypath, mode)) != NULL) {
! if (_php3_check_fopen_basedir(trypath)) {
fclose(fp);
efree(pathbuf);
return NULL;
--- 336,342 ----
}
}
if ((fp = fopen(trypath, mode)) != NULL) {
! if (_php3_check_open_basedir(trypath)) {
fclose(fp);
efree(pathbuf);
return NULL;
***************
*** 837,843 ****
php3_error(E_WARNING, "SAFE MODE Restriction in effect. Invalid owner of file to be
read.");
fp = NULL;
} else {
! if (_php3_check_fopen_basedir(path)) {
fp = NULL;
} else {
fp = fopen(path, mode);
--- 837,843 ----
php3_error(E_WARNING, "SAFE MODE Restriction in effect. Invalid owner of file to be
read.");
fp = NULL;
} else {
! if (_php3_check_open_basedir(path)) {
fp = NULL;
} else {
fp = fopen(path, mode);
Index: php3/fopen-wrappers.h
diff -c php3/fopen-wrappers.h:1.19 php3/fopen-wrappers.h:1.20
*** php3/fopen-wrappers.h:1.19 Fri Aug 14 16:33:52 1998
--- php3/fopen-wrappers.h Fri Aug 14 19:47:12 1998
***************
*** 26,32 ****
| Authors: Jim Winstead <jimw@php.net> |
+----------------------------------------------------------------------+
*/
! /* $Id: fopen-wrappers.h,v 1.19 1998/08/14 20:33:52 shane Exp $ */
#ifndef _FOPEN_WRAPPERS_H
#define _FOPEN_WRAPPERS_H
--- 26,32 ----
| Authors: Jim Winstead <jimw@php.net> |
+----------------------------------------------------------------------+
*/
! /* $Id: fopen-wrappers.h,v 1.20 1998/08/14 23:47:12 steffann Exp $ */
#ifndef _FOPEN_WRAPPERS_H
#define _FOPEN_WRAPPERS_H
***************
*** 71,77 ****
extern FILE *php3_fopen_for_parser(void);
! extern PHPAPI int _php3_check_fopen_basedir(char *path);
extern PHPAPI FILE *php3_fopen_with_path(char *filename, char *mode, char *path, char
**opened_path);
--- 71,77 ----
extern FILE *php3_fopen_for_parser(void);
! extern PHPAPI int _php3_check_open_basedir(char *path);
extern PHPAPI FILE *php3_fopen_with_path(char *filename, char *mode, char *path, char
**opened_path);
Index: php3/main.c
diff -c php3/main.c:1.461 php3/main.c:1.462
*** php3/main.c:1.461 Thu Aug 13 17:33:10 1998
--- php3/main.c Fri Aug 14 19:47:12 1998
***************
*** 29,35 ****
+----------------------------------------------------------------------+
*/
! /* $Id: main.c,v 1.461 1998/08/13 21:33:10 zeev Exp $ */
/* #define CRASH_DETECTION */
--- 29,35 ----
+----------------------------------------------------------------------+
*/
! /* $Id: main.c,v 1.462 1998/08/14 23:47:12 steffann Exp $ */
/* #define CRASH_DETECTION */
***************
*** 1052,1059 ****
if (cfg_get_string("error_append_string", &php3_ini.error_append_string) ==
FAILURE) {
php3_ini.error_append_string = NULL;
}
! if (cfg_get_string("fopen_basedir", &php3_ini.fopen_basedir) == FAILURE) {
! php3_ini.fopen_basedir = NULL;
}
if (cfg_get_long("enable_dl", &php3_ini.enable_dl) == FAILURE) {
php3_ini.enable_dl = 1;
--- 1052,1059 ----
if (cfg_get_string("error_append_string", &php3_ini.error_append_string) ==
FAILURE) {
php3_ini.error_append_string = NULL;
}
! if (cfg_get_string("open_basedir", &php3_ini.open_basedir) == FAILURE) {
! php3_ini.open_basedir = NULL;
}
if (cfg_get_long("enable_dl", &php3_ini.enable_dl) == FAILURE) {
php3_ini.enable_dl = 1;
Index: php3/mod_php3.c
diff -c php3/mod_php3.c:1.79 php3/mod_php3.c:1.80
*** php3/mod_php3.c:1.79 Wed Aug 12 00:56:28 1998
--- php3/mod_php3.c Fri Aug 14 19:47:12 1998
***************
*** 27,33 ****
| (with helpful hints from Dean Gaudet <dgaudet@arctic.org> |
+----------------------------------------------------------------------+
*/
! /* $Id: mod_php3.c,v 1.79 1998/08/12 04:56:28 steffann Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
--- 27,33 ----
| (with helpful hints from Dean Gaudet <dgaudet@arctic.org> |
+----------------------------------------------------------------------+
*/
! /* $Id: mod_php3.c,v 1.80 1998/08/14 23:47:12 steffann Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
***************
*** 319,325 ****
if (add->gpc_order != orig.gpc_order) new->gpc_order = add->gpc_order;
if (add->error_prepend_string != orig.error_prepend_string) new->error_prepend_string =
add->error_prepend_string;
if (add->error_append_string != orig.error_append_string) new->error_append_string =
add->error_append_string;
! if (add->fopen_basedir != orig.fopen_basedir) new->fopen_basedir = add->fopen_basedir;
if (add->enable_dl != orig.enable_dl) new->enable_dl = add->enable_dl;
return new;
--- 319,325 ----
if (add->gpc_order != orig.gpc_order) new->gpc_order = add->gpc_order;
if (add->error_prepend_string != orig.error_prepend_string) new->error_prepend_string =
add->error_prepend_string;
if (add->error_append_string != orig.error_append_string) new->error_append_string =
add->error_append_string;
! if (add->open_basedir != orig.open_basedir) new->open_basedir = add->open_basedir;
if (add->enable_dl != orig.enable_dl) new->enable_dl = add->enable_dl;
return new;
***************
*** 454,460 ****
conf->error_append_string = pstrdup(cmd->pool, arg);
break;
case 18:
! conf->fopen_basedir = pstrdup(cmd->pool, arg);
break;
}
return NULL;
--- 454,460 ----
conf->error_append_string = pstrdup(cmd->pool, arg);
break;
case 18:
! conf->open_basedir = pstrdup(cmd->pool, arg);
break;
}
return NULL;
***************
*** 514,520 ****
{"php3_gpc_order", php3take1handler, (void *)15, OR_OPTIONS, TAKE1, "Set
GET-COOKIE-POST order [default is GPC]"},
{"php3_error_prepend_string", php3take1handler, (void *)16, OR_OPTIONS, TAKE1,
"String to add before an error message from PHP"},
{"php3_error_append_string", php3take1handler, (void *)17, OR_OPTIONS, TAKE1,
"String to add after an error message from PHP"},
! {"php3_fopen_basedir", php3take1handler, (void *)18, OR_OPTIONS|RSRC_CONF, TAKE1,
"Limit fopen to files in this directory"},
{"php3_track_errors", php3flaghandler, (void *)0, OR_OPTIONS, FLAG,
"on|off"},
{"php3_magic_quotes_gpc", php3flaghandler, (void *)1, OR_OPTIONS, FLAG,
"on|off"},
--- 514,520 ----
{"php3_gpc_order", php3take1handler, (void *)15, OR_OPTIONS, TAKE1, "Set
GET-COOKIE-POST order [default is GPC]"},
{"php3_error_prepend_string", php3take1handler, (void *)16, OR_OPTIONS, TAKE1,
"String to add before an error message from PHP"},
{"php3_error_append_string", php3take1handler, (void *)17, OR_OPTIONS, TAKE1,
"String to add after an error message from PHP"},
! {"php3_open_basedir", php3take1handler, (void *)18, OR_OPTIONS|RSRC_CONF, TAKE1,
"Limit opening of files to this directory"},
{"php3_track_errors", php3flaghandler, (void *)0, OR_OPTIONS, FLAG,
"on|off"},
{"php3_magic_quotes_gpc", php3flaghandler, (void *)1, OR_OPTIONS, FLAG,
"on|off"},
Index: php3/mod_php3.h
diff -c php3/mod_php3.h:1.42 php3/mod_php3.h:1.43
*** php3/mod_php3.h:1.42 Wed Aug 12 00:56:28 1998
--- php3/mod_php3.h Fri Aug 14 19:47:12 1998
***************
*** 26,32 ****
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+----------------------------------------------------------------------+
*/
! /* $Id: mod_php3.h,v 1.42 1998/08/12 04:56:28 steffann Exp $ */
#ifndef _MOD_PHP3_H
#define _MOD_PHP3_H
--- 26,32 ----
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+----------------------------------------------------------------------+
*/
! /* $Id: mod_php3.h,v 1.43 1998/08/14 23:47:12 steffann Exp $ */
#ifndef _MOD_PHP3_H
#define _MOD_PHP3_H
***************
*** 86,92 ****
long define_syslog_variables;
char *error_prepend_string;
char *error_append_string;
! char *fopen_basedir;
long enable_dl;
} php3_ini_structure;
--- 86,92 ----
long define_syslog_variables;
char *error_prepend_string;
char *error_append_string;
! char *open_basedir;
long enable_dl;
} php3_ini_structure;
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net