[PHPBB3-9533] phpbb_own_realpath() doesn't always replicate realpath() behaviour Created: 11/Apr/10  Updated: 09/Sep/17  Resolved: 09/Sep/17

Status: Closed
Project: phpBB3
Component/s: Other
Affects Version/s: 3.0.7-PL1
Fix Version/s: 3.0.15-RC1, 3.1.12-RC1

Type: Bug Priority: Minor
Reporter: Chris Smith [X] (Inactive) Assignee: CHItA
Resolution: Fixed Votes: 0
Labels: None
Environment:

NIX


Sub-Tasks:
Key
Summary
Type
Status
Assignee
PHPBB3-9539 Symlink targets aren't resolved Sub-task Closed CHItA  
PHPBB3-9540 Resolved path of / is truncated to em... Sub-task Closed CHItA  
PHPBB3-9541 Traversing higher than the root direc... Sub-task Closed CHItA  
PHPBB3-9543 Resolving /. results in an empty string Sub-task Closed CHItA  
PHPBB3-9544 Ensure path exists before traversing ... Sub-task Closed CHItA  
PHPBB3-9542 phpbb_realpath() wrapper can return e... Sub-task Closed CHItA  

 Description   
File: t/ta
Target: /
php realpath: /
phpbb realpath:
os realpath: /

File: t/tb
Target: .
php realpath: /home/pie/apps/rcf/webroot/forums/t
phpbb realpath: .
os realpath: /home/pie/apps/rcf/webroot/forums/t

File: t/tc
Target: ..
php realpath: /home/pie/apps/rcf/webroot/forums
phpbb realpath: ..
os realpath: /home/pie/apps/rcf/webroot/forums

File: t/td
Target: d
php realpath: /home/pie/apps/rcf/webroot/forums/t/d
phpbb realpath:
os realpath: /home/pie/apps/rcf/webroot/forums/t/d

File: t/te
Target: ./d
php realpath: /home/pie/apps/rcf/webroot/forums/t/d
phpbb realpath:
os realpath: /home/pie/apps/rcf/webroot/forums/t/d

File: t/tf
Target: ../t/d
php realpath: /home/pie/apps/rcf/webroot/forums/t/d
phpbb realpath:
os realpath: /home/pie/apps/rcf/webroot/forums/t/d

pie@snap forums % ls -l t
-rw-r--r--  1 pie  pie    0 Apr 10 23:36 d
lrwxr-xr-x  1 pie  pie    1 Apr 10 23:36 ta -> /
lrwxr-xr-x  1 pie  pie    1 Apr 10 23:36 tb -> .
lrwxr-xr-x  1 pie  pie    2 Apr 10 23:36 tc -> ..
lrwxr-xr-x  1 pie  pie    1 Apr 10 23:36 td -> d
lrwxr-xr-x  1 pie  pie    3 Apr 10 23:36 te -> ./d
lrwxr-xr-x  1 pie  pie    6 Apr 10 23:36 tf -> ../t/d


 Comments   
Comment by Chris Smith [X] (Inactive) [ 13/Apr/10 ]

Current progress: http://github.com/cs278/phpbb3/compare/bug/9533

Comment by Chris Smith [X] (Inactive) [ 13/Apr/10 ]

Tests http://github.com/cs278/phpbb3/compare/bug/9533...bug/9533-tests

Comment by Oleg [X] (Inactive) [ 13/Apr/10 ]

Comments on the tests:

1. /home can be a symbolic link on some systems. On freebsd if /home is not given a partition it is a symlink to /usr/home. I think some other unices make /home a symlink as well. /var, /etc or /dev are perhaps better choices than /home.

2. $this->requires('symlink', 'posix', 'realpath');

Realpath requirement can be omitted with another directory created under the test directory.

3. symlink('/', 'link');

Perhaps it would be better to use different file names?

4. A depth test is missing:

symlink('.', 'link1');
symlink('link1', 'link2');
$this->assertEquals(getcwd(), phpbb_own_realpath('link2'), 'Correctly resolve symlinks pointing to .');

Generated at Wed Dec 19 03:46:52 UTC 2018 using Jira 7.12.3#712004-sha1:5ef91d760d7124da5ebec5c16a948a4a807698df.