php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45383 Database create function ignores umask
Submitted: 2008-06-27 21:04 UTC Modified: 2009-03-21 01:00 UTC
From: beckera at softrends dot com Assigned:
Status: No Feedback Package: dBase related
PHP Version: 5.2.6 OS: Linux (CentOS 5.1)
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: beckera at softrends dot com
New email:
PHP Version: OS:

 

 [2008-06-27 21:04 UTC] 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.



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-03-13 13:34 UTC] jani@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2009-03-21 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 00:01:29 2024 UTC