[TYPO3-core] RFC #11386: t3lib_cache_backend_FileBacked violates open_basedir_restrictions
Rupert Germann
rupi at gmx.li
Thu Nov 5 15:43:24 CET 2009
Hi,
this is a SVN patch request.
Type: Bugfix
Bugtracker references:
http://bugs.typo3.org/view.php?id=11386
Branches: Trunk
Problem:
function t3lib_cache_backend_FileBacked::set() violates
open_basedir_restrictions due to the fact that it tries to travers the
cacheEntryPath from the very beginning using t3lib_div::mkdir_deep.
Mkdir checks every part of the whole path for existens (is_dir) which
obviosly fails when open_basedir restrictions take place.
Solution:
Detect open_basedir settings and change the internal vars for
"destination" ($this->root) and "directory to be written"
($this->cacheDirectory) according to the open_basedir restrictions if
they are set.
The patch also introduces a new exception which is thrown when the
configured cache directory is not in "open_basedir".
patch was tested with PHP 5.2 and PHP 5.3 under Linux and Windows, with
"open_basedir" in php.ini set and not set and with absolute and relative
paths for the cache. And also with pathes with blakslashes and normal
slashes under Windows.
My test configuration:
$TYPO3_CONF_VARS['SYS']['useCachingFramework'] = '1';
$options = array();
### Linux (open_basedir set to /srv/www)
// $options = array('cacheDirectory' => '/srv/www/cftemp/');
### Windows (open_basedir set to C:\xampp\xampp\htdocs\typo3)
// $options = array('cacheDirectory' =>
'C:\xampp\xampp\htdocs\typo3\cache');
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_pages']['backend']
= 't3lib_cache_backend_FileBackend';
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_pages']['options']
= $options;
greets
rupert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 11386_v2.diff
Type: text/x-diff
Size: 7836 bytes
Desc: not available
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20091105/00b46a4b/attachment.diff>
More information about the TYPO3-team-core
mailing list