summaryrefslogtreecommitdiff
path: root/main/safe_mode.c
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>2000-06-25 17:02:59 +0000
committerZeev Suraski <zeev@php.net>2000-06-25 17:02:59 +0000
commit6614e8edb43e8f38394bf25cf26399fab1cbf6b2 (patch)
tree522028c934a1656eaab4d07103a93e01e63cf734 /main/safe_mode.c
parentba69d9958d23a12e3b962a81ab773d4bb1cc6813 (diff)
downloadphp-git-6614e8edb43e8f38394bf25cf26399fab1cbf6b2.tar.gz
- I wrote a long msg but the commit didn't go through.
- So here is the short version: - a) Start moving to binary opens in Windows - b) Give checkuid_mode() a small face lift including the fopen-wrappers.c - The mode to this function should at least be a #define but that is for - another day. Anyway this whole stuff should be given more face lifts in - the future.
Diffstat (limited to 'main/safe_mode.c')
-rw-r--r--main/safe_mode.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/main/safe_mode.c b/main/safe_mode.c
index e7bb879362..f545f4d4a8 100644
--- a/main/safe_mode.c
+++ b/main/safe_mode.c
@@ -40,7 +40,7 @@
* 2 - if file does not exist, check directory
* 3 - only check directory (needed for mkdir)
*/
-PHPAPI int php_checkuid(const char *fn, int mode) {
+PHPAPI int php_checkuid(const char *fn, char *fopen_mode, int mode) {
struct stat sb;
int ret;
long uid=0L, duid=0L;
@@ -48,6 +48,14 @@ PHPAPI int php_checkuid(const char *fn, int mode) {
if (!fn) return(0); /* path must be provided */
+ if (fopen_mode) {
+ if (fopen_mode[0] == 'r') {
+ mode = 0;
+ } else {
+ mode = 2;
+ }
+ }
+
/*
* If given filepath is a URL, allow - safe mode stuff
* related to URL's is checked in individual functions