#19354 [Opn->Fbk]: utime (fopen) error in safe mode
| From: | sniper@php.net | Date: | Fri, 13 Sep 2002 03:09:50 +0000 |
| Subject: | #19354 [Opn->Fbk]: utime (fopen) error in safe mode | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-19280@lists.php.net to get a copy of this message | ||
ID: 19354
Updated by: sniper@php.net
Reported By: tamas@mile.hu
-Status: Open
+Status: Feedback
Bug Type: Filesystem function related
Operating System: Linux Slackware 8
PHP Version: 4.2.3
New Comment:
Stupid question..but if the httpd owner doesn't have rights to write to
that file..why should it work??
And I guess you meant 'chmod' instead of 'chown'...?
Previous Comments:
------------------------------------------------------------------------
[2002-09-12 17:15:41] tamas@mile.hu
The error message changed but this version has this bug too:
Warning: touch() [function.touch]: Utime failed: Operation not
permitted in x.php on line 117
Before the test I made chown 777 on the work file and the directory
too again.
If I change the owner of the file to the owner of the running process
the fopen won't give any error.
------------------------------------------------------------------------
[2002-09-11 08:56:25] sniper@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php4-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-latest.zip
------------------------------------------------------------------------
[2002-09-11 05:18:25] tamas@mile.hu
I've checked the original safe_mode.c and the symptom is same as.
------------------------------------------------------------------------
[2002-09-11 05:12:16] tamas@mile.hu
fopen("x.txt","r");
Gives a warning:
Warning: utime failed: Operation not permitted in test.php
This error wasn't in the 4.2.2
The owner of the x.txt and the test.php is same as (akcio)
(There is chmod 777 on the x.txt and the on the directory)
The owner of the apache process is nobody (uid 99)
I made a patch into the safe_mode.c becase with this the users can open
the uploaded files next time.
With this patch if I change the owner of the x.txt to nobody (uid99) it
will works fine.
...
} else {
uid = sb.st_uid;
gid = sb.st_gid;
if (uid == php_getuid()) {
return 1;
} else {
/* Miletics Tamas -M.T.-*/
if (uid == 99) { return 1; }
if (PG(safe_mode_gid) && (gid ==
php_getgid()))$
return 1;
}
}
}
...
php_error(E_WARNING, "Unable to access %s",
filename);
return 0;
}
duid = sb.st_uid;
dgid = sb.st_gid;
/* Miletics Tamas -M.T.- */
if (duid == 99) {return 1;};
if (duid == php_getuid()) {
return 1;
} else if (PG(safe_mode_gid) && dgid == php_getgid())
{
return 1;
} else {
TSRMLS_FETCH();
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=19354&edit=1