ID:               21958
 Comment by:       ohp at pyrenet dot fr
 Reported By:      ct at swin dot edu dot au
 Status:           Verified
 Bug Type:         Filesystem function related
 Operating System: Tru64 UNIX 5.1A
 PHP Version:      4.3.2-dev 5.0.0-dev
 Assigned To:      wez
 New Comment:

after 2 strggling, I came with the following path on 
safe_mode.c against 4.3.2RC4.
Not sure it's the right thing to do.
could someone have a look?
Regards

*** main/safe_mode.c.orig       lun mrs 17 14:50:23 2003
--- main/safe_mode.c    mar mai 27 15:06:30 2003
***************
*** 66,71 ****
--- 66,72 ----
                        mode = CHECKUID_DISALLOW_FILE_NOT_EXISTS;
                } else {
                        mode = CHECKUID_CHECK_FILE_AND_DIR;
+                       flags=1;
                }
        }
  
***************
*** 81,86 ****
--- 82,88 ----
         * If that fails, passthrough and check 
directory...
         */
        if (mode != CHECKUID_ALLOW_ONLY_DIR) {
+               strcpy(path,filename);
                VCWD_REALPATH(filename, path);
                ret = VCWD_STAT(path, &sb);
                if (ret < 0) {

this works on Unixware 713


Previous Comments:
------------------------------------------------------------------------

[2003-05-27 06:29:50] ohp at pyrenet dot fr

I have made tons of research on this since yesterday.
It appears that realpath (at least on UW 713) set path to NULLL,
returns NULL with errno=2 in case of a non existing file on line 86 in
safe_mode.c then function proceeds to line  116 with a NULL path, all
functions fail and the file cannot be created.

Hope this help to create a patch (I'm trying to but don't know the code
enough too) Please someone help.

[EMAIL PROTECTED]

------------------------------------------------------------------------

[2003-05-26 09:34:28] ohp at pyrenet dot fr

The bug is still there with php-4.3.2RC4 as an apache 1.3.27 module.
This is on Unixware 7.

with safe_mode=Off, file creation succeeds,
with safe_mode=On, file creattion fails with "failed to open stream: no
such file or directory ..."

I've tried setting the dir 777, make it owned by apache UID.. Nothing
worked.

A truss of the apache server showed that the last syscall before failed
was a pathconf(filename,...) returning ENOENT
File didn't exist so it's normal.

Please help

------------------------------------------------------------------------

[2003-04-23 13:57:22] patrick_cossette1 at uqtr dot ca

With AIX 4.3.3 and PHP 4.3.1.

With safe_mode on , I cannot create a file with neither touch nor fopen
nor mkdir. (With safe_mode off, the creation works).

Apache is running under user "web" and group "web".
I have the directory /web/hee_dev whose owner is web.web with
permissions rwxr-s---

I have the script testing.php located in that directory:

   <?
     $fp=fopen("filetocreate","w+");
   ?>

If the file "filetocreate" does not already exist, I get the following
error while executing the script:
 
           Warning: Unable to access filetocreate  
           in /web/hee_dev/testing.php on line 2

           Warning: fopen("filetocreate", "w+") - No such 
           file or directory in /web/hee_dev/testing.php on 
           line 2

If the file already exists, I can open it without any problem.


I had read somewhere in the bug database that this should be solved by
now, but with 4.3.1, it still produces this error.

------------------------------------------------------------------------

[2003-04-01 11:29:19] ohp at pyrenet dot fr

I have the same problem on 4.2.3 and 4.3.1.
I noticed that making touch before fopen("xxx","w") creates the file so
fopen succeeds.

------------------------------------------------------------------------

[2003-02-26 20:44:34] [EMAIL PROTECTED]

Using Tru64 UNIX 5.1.
Both 4.3.2-dev and 5.0.0-dev.

Tested with safe_mode on and trying to create a file in /tmp

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/21958

-- 
Edit this bug report at http://bugs.php.net/?id=21958&edit=1

Reply via email to