From:
Operating system: Windows
PHP version: Irrelevant
Package: Filesystem function related
Bug Type: Bug
Bug description:tsrm_realpath_r and junction point with denied read access
Description:
------------
tsrm_realpath_r is having a problem if working with/inside a junction point
and
"read data/list directory" is denied on this junction point.
That's the implementation for many common directories on Windows7/Vista in
e.g. %USERPROFILE%, %ALLUSERSPROFILE% like "%USERPROFILE%\SendTo".
The problem is a call to CreateFile with GENERIC_READ access in
tsrm_realpath_r. Well, the MSDN is writing:
> If this parameter is zero, the application can query certain metadata
> such as file, directory, or device attributes without accessing that
> file or device, even if GENERIC_READ access would have been denied.
I think "zero" is save at this point and that's what I'm doing in my
patch.
Regards,
Carsten
Test script:
---------------
in the shell:
md test1
mklink /j test test1
icacls test /deny *S-1-1-0:(rd)
php -r "var_dump(realpath('test'));"
php -r "var_dump(fopen('test/test.txt', 'w'));"
Expected result:
----------------
string(31) "C:\Users\Public\Documents\test1"
resource(5) of type (stream)
Actual result:
--------------
bool(false)
Warning: fopen(test/test.txt): failed to open stream: No such file or
directory
in Command line code on line 1
--
Edit bug report at http://bugs.php.net/bug.php?id=54110&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=54110&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=54110&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=54110&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=54110&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=54110&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=54110&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=54110&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=54110&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=54110&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=54110&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=54110&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=54110&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=54110&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=54110&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54110&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=54110&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=54110&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=54110&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=54110&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=54110&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=54110&r=mysqlcfg