|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-09-21 23:50 UTC] lists+php at box dot cz
Description:
------------
My setup:
document root is: "/home/wejn/x/docs/html/".
While "/home/wejn/x/docs/html/" is symlink to: "/home/wejn/x/docs1/html/".
I have safe_mode enabled and open_basedir set to "/home/wejn/x/docs/html:/home/wejn/x/docs1/html".
With this setup I'm unable to perform:
copy("/home/wejn/x/docs/html/x", "/home/wejn/x/docs/html/y");
when "y" doesn't exist. If I touch "y" prior running the
script, everything runs just fine.
IMO, there is problem with symlink resolving code somewhere under
php_check_specific_open_basedir().
It seems to me that more precise location of the bug is somewhere in virtual_file_ex() regarding the realpath() call.
Maybe it would be better to perform open_basedir check just on dirs instead of files (in various filesystem functions)?
Btw, this problem exists also in 4.3.8, which makes me think that it's there for a LONG time ... unnoticed.
W.
Reproduce code:
---------------
// when all conditions described above are met, this fails:
copy('/home/wejn/x/docs/html/x', '/home/wejn/x/docs/html/y');
Expected result:
----------------
no error.
Actual result:
--------------
Warning: copy() [function.copy]: open_basedir restriction in effect. File(/home/wejn/x/docs/html/y) is not within the allowed path(s): (/home/wejn/x/docs/html:/home/wejn/x/docs1/html) in /home/wejn/x/docs1/html/index.html on line 2
Warning: copy(/home/wejn/x/docs/html/y) [function.copy]: failed to open stream: Operation not permitted in /home/wejn/x/docs1/html/index.html on line 2
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 08:00:02 2025 UTC |
No, you're simply WRONG: "->All symbolic links are resolved, so it's not possible to avoid this restriction with a symlink.<-" because my open_basedir is set to: "/home/wejn/x/docs/html:/home/wejn/x/docs1/html" therefore the file lies in basedir either way, when I call: copy("/home/wejn/x/docs/html/x", "/home/wejn/x/docs/html/y"); It's a bug and I would expect someone with email "@php.net" to at least READ MY BUGREPORT. I feel a bit stupid when I have to repeat myself over and over again, because you simply assume from beginning that I'm wrong (and the only action you do is actually telling me bullshit about RTFM). I did RTFM, but your implementation simply doesn't correspond with the things written in TFM. [offensive] Anyway, I don't care about PHP anymore - I have better things to do than pushing you to at least read what you're responding to ... btw, responding to bugreports after 2 months is really, really wonderful. Better than never, though. [/offensive]