CVS update: php3
| From: | rasmus | Date: | Sat, 19 Sep 1998 20:17:06 +0000 |
| Subject: | CVS update: php3 | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-1277@lists.php.net to get a copy of this message | ||
Date: Saturday September 19, 1998 @ 16:17
Author: rasmus
Update of /repository/php3
In directory asf:/export/home/rasmus/php3
Modified Files:
fopen-wrappers.c safe_mode.c
Log Message:
safe mode message cleanup
Index: php3/fopen-wrappers.c
diff -c php3/fopen-wrappers.c:1.48 php3/fopen-wrappers.c:1.49
*** php3/fopen-wrappers.c:1.48 Sun Sep 13 18:29:37 1998
--- php3/fopen-wrappers.c Sat Sep 19 16:17:04 1998
***************
*** 27,33 ****
| Jim Winstead <jimw@php.net> |
+----------------------------------------------------------------------+
*/
! /* $Id: fopen-wrappers.c,v 1.48 1998/09/13 22:29:37 steffann Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
--- 27,33 ----
| Jim Winstead <jimw@php.net> |
+----------------------------------------------------------------------+
*/
! /* $Id: fopen-wrappers.c,v 1.49 1998/09/19 20:17:04 rasmus Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
***************
*** 189,195 ****
return php3_fopen_with_path(path, mode, php3_ini.include_path, NULL);
} else {
if (options & ENFORCE_SAFE_MODE && php3_ini.safe_mode &&
(!_php3_checkuid(path, 1))) {
- 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;
--- 189,194 ----
***************
*** 310,316 ****
/* Relative path open */
if (*filename == '.') {
if (php3_ini.safe_mode && (!_php3_checkuid(filename, 2))) {
- php3_error(E_WARNING, "SAFE MODE Restriction in effect. Invalid owner.");
return NULL;
}
if (_php3_check_open_basedir(filename)) return NULL;
--- 309,314 ----
***************
*** 327,335 ****
if (*filename == '/') {
#endif
if (php3_ini.safe_mode) {
! snprintf(trypath, MAXPATHLEN, "%s%s", php3_ini.doc_root, filename);
if (!_php3_checkuid(trypath, 2)) {
- php3_error(E_WARNING, "SAFE MODE Restriction in effect. Invalid owner.");
return NULL;
}
if (_php3_check_open_basedir(trypath)) return NULL;
--- 325,336 ----
if (*filename == '/') {
#endif
if (php3_ini.safe_mode) {
! if(php3_ini.doc_root) {
! snprintf(trypath, MAXPATHLEN, "%s%s", php3_ini.doc_root, filename);
! } else {
! strncpy(trypath,filename,MAXPATHLEN);
! }
if (!_php3_checkuid(trypath, 2)) {
return NULL;
}
if (_php3_check_open_basedir(trypath)) return NULL;
***************
*** 345,351 ****
}
if (!path || (path && !*path)) {
if (php3_ini.safe_mode && (!_php3_checkuid(filename, 2))) {
- php3_error(E_WARNING, "SAFE MODE Restriction in effect. Invalid owner.");
return NULL;
}
if (_php3_check_open_basedir(filename)) return NULL;
--- 346,351 ----
***************
*** 372,378 ****
snprintf(trypath, MAXPATHLEN, "%s/%s", ptr, filename);
if (php3_ini.safe_mode) {
if (stat(trypath, &sb) == 0 && (!_php3_checkuid(trypath, 2))) {
- php3_error(E_WARNING, "SAFE MODE Restriction in effect. Invalid owner.");
efree(pathbuf);
return NULL;
}
--- 372,377 ----
***************
*** 881,887 ****
fp = php3_fopen_with_path(path, mode, php3_ini.include_path, NULL);
} else {
if (options & ENFORCE_SAFE_MODE && php3_ini.safe_mode &&
(!_php3_checkuid(path, 1))) {
- 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)) {
--- 880,885 ----
Index: php3/safe_mode.c
diff -c php3/safe_mode.c:1.25 php3/safe_mode.c:1.26
*** php3/safe_mode.c:1.25 Sat May 23 13:18:44 1998
--- php3/safe_mode.c Sat Sep 19 16:17:05 1998
***************
*** 26,32 ****
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+----------------------------------------------------------------------+
*/
! /* $Id: safe_mode.c,v 1.25 1998/05/23 17:18:44 shane Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
#endif
--- 26,32 ----
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+----------------------------------------------------------------------+
*/
! /* $Id: safe_mode.c,v 1.26 1998/09/19 20:17:05 rasmus Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
#endif
***************
*** 70,76 ****
if (mode<3) {
ret = stat(fn,&sb);
! if (ret<0 && mode < 2) return(mode);
if (ret>-1) {
uid=sb.st_uid;
if (uid==_php3_getuid()) return(1);
--- 70,79 ----
if (mode<3) {
ret = stat(fn,&sb);
! if (ret<0 && mode < 2) {
! php3_error(E_WARNING,"Unable to access %s",fn);
! return(mode);
! }
if (ret>-1) {
uid=sb.st_uid;
if (uid==_php3_getuid()) return(1);
***************
*** 90,107 ****
*s='\0';
ret = stat(fn,&sb);
*s='/';
! if (ret<0) return(0);
duid = sb.st_uid;
} else {
s = emalloc(MAXPATHLEN+1);
! if (!getcwd(s,MAXPATHLEN)) return(0);
ret = stat(s,&sb);
efree(s);
! if (ret<0) return(0);
duid = sb.st_uid;
}
- if (duid == _php3_getuid()) return(1);
- else return(0);
}
--- 93,122 ----
*s='\0';
ret = stat(fn,&sb);
*s='/';
! if (ret<0) {
! php3_error(E_WARNING, "Unable to access %s",fn);
! return(0);
! }
duid = sb.st_uid;
} else {
s = emalloc(MAXPATHLEN+1);
! if (!getcwd(s,MAXPATHLEN)) {
! php3_error(E_WARNING, "Unable to access current working directory");
! return(0);
! }
ret = stat(s,&sb);
efree(s);
! if (ret<0) {
! php3_error(E_WARNING, "Unable to access %s",s);
! return(0);
! }
duid = sb.st_uid;
+ }
+ if (duid == (uid=_php3_getuid())) return(1);
+ else {
+ php3_error(E_WARNING, "SAFE MODE Restriction in effect. The script whose uid is %ld is not
allowed to access %s owned by uid %ld",uid,fn,duid);
+ return(0);
}
}
--
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