From:             randy at rcs-comp dot com
Operating system: Linux
PHP version:      5.2.4
PHP Bug Type:     Session related
Bug description:  session.save_path MODE option will not set "write" bit for 
group or world

Description:
------------
When using the mode parameter in session_save_path (or presumably
session.save_path) it will not set the "write" bit correctly for anyone but
the owner of the file.  Read and execute bits are set correctly.

This is important b/c I would like to setguid on the session directory so
that a non-priveleged user (the website reseller) can clean it out.  That
way, all I have to do is add apache to the user's group, and no more
problems with clearing out sessions.

Reproduce code:
---------------
<?php
$pm = '0;0600;'.dirname(__FILE__).'/sessions';
session_save_path($pm);
session_start();
die('hello world');
?>

// delete the session file just created

<?php
$pm = '0;0660;'.dirname(__FILE__).'/sessions';
session_save_path($pm);
session_start();
die('hello world');
?>

// delete the session file just created

<?php
$pm = '0;0777;'.dirname(__FILE__).'/sessions';
session_save_path($pm);
session_start();
die('hello world');
?>



Expected result:
----------------
[EMAIL PROTECTED] sessions]# ls -l
total 0
-rw-------  1 apache apache 0 Sep  7 23:30 sess_b1fb...

[EMAIL PROTECTED] sessions]# ls -l
total 0
-rw-rw----  1 apache apache 0 Sep  7 23:31 sess_b1fb...

[EMAIL PROTECTED] sessions]# ls -l
total 0
-rwxrwxrwx  1 apache apache 0 Sep  7 23:40 sess_b1fb...

Actual result:
--------------
[EMAIL PROTECTED] sessions]# ls -l
total 0
-rw-------  1 apache apache 0 Sep  7 23:30 sess_b1fb...

[EMAIL PROTECTED] sessions]# ls -l
total 0
-rw-r-----  1 apache apache 0 Sep  7 23:31 sess_b1fb...
^^^^^^^^^^ <----------------  Permission does not have write bit

[EMAIL PROTECTED] sessions]# ls -l
total 0
-rwxr-xr-x  1 apache apache 0 Sep  7 23:40 sess_b1fb...
^^^^^^^^^^ <----------------  Permission does not have write bits

-- 
Edit bug report at http://bugs.php.net/?id=42596&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=42596&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=42596&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=42596&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=42596&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=42596&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=42596&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=42596&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=42596&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=42596&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=42596&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=42596&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=42596&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=42596&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=42596&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=42596&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=42596&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=42596&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=42596&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=42596&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=42596&r=mysqlcfg

Reply via email to