Commit 5271568c authored by Sebastian Kummer's avatar Sebastian Kummer

ZP-686 Add check also to z-push-top. Don't expose additional information

about the system configuration to a potential attacker. Released under
the Affero GNU General Public License (AGPL) version 3.
parent fb91416a
......@@ -10,7 +10,7 @@
*
* Created : 06.05.2011
*
* Copyright 2007 - 2013 Zarafa Deutschland GmbH
* Copyright 2007 - 2013, 2015 Zarafa Deutschland GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
......@@ -68,7 +68,7 @@ function main() {
function listfolders_configure() {
if (php_sapi_name() != "cli") {
printf("This script should not be called in a browser. Called from: %s\n", php_sapi_name());
fwrite(STDERR, "This script can only be called from the CLI.\n");
exit(1);
}
......
......@@ -9,7 +9,7 @@
*
* Created : 14.05.2010
*
* Copyright 2007 - 2013 Zarafa Deutschland GmbH
* Copyright 2007 - 2015 Zarafa Deutschland GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
......@@ -112,7 +112,7 @@ include('version.php');
if (! ZPushAdminCLI::SureWhatToDo()) {
// show error message if available
if (ZPushAdminCLI::GetErrorMessage())
echo "ERROR: ". ZPushAdminCLI::GetErrorMessage() . "\n";
fwrite(STDERR, ZPushAdminCLI::GetErrorMessage() . "\n");
echo ZPushAdminCLI::UsageInstructions();
exit(1);
......@@ -192,7 +192,7 @@ class ZPushAdminCLI {
*/
static public function CheckEnv() {
if (php_sapi_name() != "cli")
self::$errormessage = sprintf("This script should not be called in a browser. Called from: %s", php_sapi_name());
self::$errormessage = "This script can only be called from the CLI.";
if (!function_exists("getopt"))
self::$errormessage = "PHP Function getopt not found. Please check your PHP version and settings.";
......
......@@ -67,6 +67,9 @@ include('version.php');
if (!function_exists("pcntl_signal"))
throw new FatalException("Function pcntl_signal() is not available. Please install package 'php5-pcntl' (or similar) on your system.");
if (php_sapi_name() != "cli")
throw new FatalException("This script can only be called from the CLI.");
$zpt = new ZPushTop();
// check if help was requested from CLI
......@@ -85,7 +88,8 @@ include('version.php');
echo "Z-Push shared memory interprocess communication is not available.\n";
}
catch (ZPushException $zpe) {
die(get_class($zpe) . ": ". $zpe->getMessage() . "\n");
fwrite(STDERR, get_class($zpe) . ": ". $zpe->getMessage() . "\n");
exit(1);
}
echo "terminated\n";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment