#45383 [Opn->Fbk]: Database create function ignores umask
| From: | jani@php.net | Date: | Fri, 13 Mar 2009 13:34:50 +0000 |
| Subject: | #45383 [Opn->Fbk]: Database create function ignores umask | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-134668@lists.php.net to get a copy of this message | ||
ID: 45383
Updated by: jani@php.net
Reported By: beckera at softrends dot com
-Status: Open
+Status: Feedback
Bug Type: dBase related
Operating System: Linux (CentOS 5.1)
PHP Version: 5.2.6
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
Previous Comments:
------------------------------------------------------------------------
[2008-06-27 21:04:42] beckera at softrends dot com
Description:
------------
Running CentOS 5.1 w/ Apache 2.2.3. Set Apache's umask to 002, ran a
dbase create function to create a new dbase file. When finished, the
file permissions were 644 instead of 664. Initially found this under
version 5.1.6, tracked it down in source code, then checked 5.2.6 and
the problem is still there.
In the source file php-5.2.6/ext/dbase/dbase.c, find the function
"dbase_create". About 30 lines into the function there is a function
call VCWD_OPEN_MODE(Z_STRVAL_PP(filename), O_BINARY|O_RDWR|O_CREAT,
0644) which is responsible for creating the new file.
The error is in the hard-coded third parameter 0644. This will fail to
create the file with expected permissions unless umask is set to 022
(which is normally the default).
This code needs to obtain the umask in effect at the time of the
function call, compute the correct mode value, and use that in place of
the current hard value 0644.
CentOS 5 PHP is not compiled with dbase enabled by default. I obtained
and installed the source RPM, modified the spec file to
add " --enable-dbase" to the options used both for building the
command-line and Apache module forms of PHP.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45383&edit=1