cvs: smarty /libs/core core.is_secure.php core.is_trusted.php
"Messju Mohr" <[email protected]>
| Newsgroups | gmane.comp.php.cvs.smarty |
|---|---|
| Message-ID | <cvsmessju1060418830@cvsserver> |
messju Sat Aug 9 04:47:10 2003 EDT
Modified files:
/smarty/libs/core core.is_secure.php core.is_trusted.php
Log:
synced secure_dir-checking with trusted_dir-checking
Index: smarty/libs/core/core.is_secure.php
diff -u smarty/libs/core/core.is_secure.php:1.3 smarty/libs/core/core.is_secure.php:1.4
--- smarty/libs/core/core.is_secure.php:1.3 Sat Aug 9 04:08:39 2003
+++ smarty/libs/core/core.is_secure.php Sat Aug 9 04:47:10 2003
@@ -23,8 +23,8 @@
$_smarty_secure = false;
if ($params['resource_type'] == 'file') {
- $_rp = realpath($params['resource_name']);
if (!empty($smarty->secure_dir)) {
+ $_rp = realpath($params['resource_name']);
foreach ((array)$smarty->secure_dir as $curr_dir) {
if ( !empty($curr_dir) && is_readable ($curr_dir)) {
$_cd = realpath($curr_dir);
Index: smarty/libs/core/core.is_trusted.php
diff -u smarty/libs/core/core.is_trusted.php:1.2 smarty/libs/core/core.is_trusted.php:1.3
--- smarty/libs/core/core.is_trusted.php:1.2 Sat Jun 21 23:13:25 2003
+++ smarty/libs/core/core.is_trusted.php Sat Aug 9 04:47:10 2003
@@ -23,20 +23,19 @@
$_smarty_trusted = false;
if ($params['resource_type'] == 'file') {
if (!empty($smarty->trusted_dir)) {
- // see if template file is within a trusted directory. If so,
- // disable security during the execution of the template.
-
- if (!empty($smarty->trusted_dir)) {
- foreach ((array)$smarty->trusted_dir as $curr_dir) {
- if (!empty($curr_dir) && is_readable ($curr_dir)) {
- if (substr(realpath($params['resource_name']),0, strlen(realpath($curr_dir))) == realpath($curr_dir)) {
- $_smarty_trusted = true;
- break;
- }
+ $_rp = realpath($params['resource_name']);
+ foreach ((array)$smarty->trusted_dir as $curr_dir) {
+ if (!empty($curr_dir) && is_readable ($curr_dir)) {
+ $_cd = realpath($curr_dir);
+ if (strncmp($_rp, $_cd, strlen($_cd)) == 0
+ && $_rp{strlen($_cd)} == DIRECTORY_SEPARATOR ) {
+ $_smarty_trusted = true;
+ break;
}
}
}
}
+
} else {
// resource is not on local file system
$_smarty_trusted = call_user_func_array($smarty->_plugins['resource'][$params['resource_type']][0][3],
--
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php