diff options
author | Andrew Dolgov <[email protected]> | 2012-02-17 17:36:18 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2012-02-17 17:36:18 +0400 |
commit | 3854d15e12e588bd736f2952f9dbbd27ed560018 (patch) | |
tree | 1157fe8377292632ad2d7a996d50ee8ef505b14d /include | |
parent | 74eef4fca843321ac6a611140c536e3c5fd97a6f (diff) |
sanity check: prevent running tt-rss as root
Diffstat (limited to 'include')
-rw-r--r-- | include/sanity_check.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/sanity_check.php b/include/sanity_check.php index d1b2873ca..3de1593f3 100644 --- a/include/sanity_check.php +++ b/include/sanity_check.php @@ -11,6 +11,10 @@ require_once "config.php"; require_once "sanity_config.php"; + if (function_exists('posix_getuid') && posix_getuid() == 0) { + $err_msg = "Please don't run this script as root."; + } + if (CONFIG_VERSION != EXPECTED_CONFIG_VERSION) { $err_msg = "Configuration file (config.php) has incorrect version. Update it with new options from config.php-dist and set CONFIG_VERSION to the correct value."; } @@ -116,7 +120,7 @@ } } - if ($err_msg) { ?> + if ($err_msg && defined($_SERVER['REQUEST_URI'])) { ?> <html> <head> <title>Fatal error</title> @@ -142,6 +146,8 @@ <?php die; + } else if ($err_msg) { + die("[sanity_check] $err_msg\n"); } ?> |