summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorMichael Hamann <michael@content-space.de>2012-07-08 19:21:37 +0200
committerMichael Hamann <michael@content-space.de>2012-07-08 19:21:37 +0200
commitd867cca366d1a7aa106bec98db52a2b416b10c26 (patch)
tree173ca2417ee6d011c378da5518f728abf2a1b83c /inc
parent0990161c720c6b5202a59a91e3b7aa172374f277 (diff)
downloadrpg-d867cca366d1a7aa106bec98db52a2b416b10c26.tar.gz
rpg-d867cca366d1a7aa106bec98db52a2b416b10c26.tar.bz2
Check that the animal is actually inside the farm
This makes sure that the animal that is specified in the URL is actually a subdirectory inside the farm and not somewhere else in the system. This allows that the animals are organized in different subdirectories for more complicated farm setups.
Diffstat (limited to 'inc')
-rw-r--r--inc/farm.php3
1 files changed, 3 insertions, 0 deletions
diff --git a/inc/farm.php b/inc/farm.php
index 8434e3067..51b0c0f78 100644
--- a/inc/farm.php
+++ b/inc/farm.php
@@ -46,6 +46,9 @@ function conf_path($farm) {
if(isset($_REQUEST['animal']) || ('cli' == php_sapi_name() && isset($_SERVER['animal']))) {
$mode = isset($_REQUEST['animal']) ? 'htaccess' : 'cli';
$animal = $mode == 'htaccess' ? $_REQUEST['animal'] : $_SERVER['animal'];
+ // check that $animal specifies a subdirectory of $farm
+ if (strpos(fullpath($farm.'/'.$animal), fullpath($farm).'/') !== 0)
+ nice_die('Sorry! Invalid Wiki name!');
if(!is_dir($farm.'/'.$animal))
nice_die("Sorry! This Wiki doesn't exist!");
if(!defined('DOKU_FARM')) define('DOKU_FARM', $mode);