summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorczaks <marcin@6irc.net>2014-01-31 23:37:55 +0100
committerczaks <marcin@6irc.net>2014-01-31 23:37:55 +0100
commit87677f7ed4d33ae1dd2ac219f06e284e1d10f8ad (patch)
treea1bcc5cc1a7b3afc1dd1f0ef3c3328ed3b5b9983 /tools
parent858db1ccf9a33074ae7b9a793f5bf1f11daed183 (diff)
SECURITY: disallow execution of cli scripts from webserver context
Diffstat (limited to 'tools')
-rw-r--r--tools/inc/cli.php4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/inc/cli.php b/tools/inc/cli.php
index 5f78dba1..cff17e34 100644
--- a/tools/inc/cli.php
+++ b/tools/inc/cli.php
@@ -13,6 +13,10 @@ error_reporting(E_ALL);
set_time_limit(0);
$shell_path = getcwd();
+if (isset ($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] != '127.0.0.1' && $_SERVER['REMOTE_ADDR'] != '::1') {
+ die("This script is executable only from Command Line Interface.");
+}
+
if(getenv('TINYBOARD_PATH') !== false)
$dir = getenv('TINYBOARD_PATH');
elseif(file_exists('inc/functions.php'))