Commit a25e6e44 authored by Sebastian Kummer's avatar Sebastian Kummer

ZP-882 Make sure $policyfile is always set. parse_ini_file() returns an

empty array if the file is not found.

Released under the Affero GNU General Public License (AGPL) version 3.
parent a249ef2d
...@@ -288,15 +288,15 @@ class ZPush { ...@@ -288,15 +288,15 @@ class ZPush {
// check if Provisioning is enabled and the default policies are available // check if Provisioning is enabled and the default policies are available
if (PROVISIONING) { if (PROVISIONING) {
if (file_exists(PROVISIONING_POLICYFILE)) { if (file_exists(REAL_BASE_PATH . PROVISIONING_POLICYFILE)) {
$policyfile = PROVISIONING_POLICYFILE;
}
else if (file_exists(REAL_BASE_PATH . PROVISIONING_POLICYFILE)) {
$policyfile = REAL_BASE_PATH . PROVISIONING_POLICYFILE; $policyfile = REAL_BASE_PATH . PROVISIONING_POLICYFILE;
} }
else {
$policyfile = PROVISIONING_POLICYFILE;
}
ZPush::$policies = parse_ini_file($policyfile, true); ZPush::$policies = parse_ini_file($policyfile, true);
if (!isset(ZPush::$policies['default'])) { if (!isset(ZPush::$policies['default'])) {
throw new FatalMisconfigurationException(sprintf("Your policies' configuration file doesn't contain the required [default] section. Please check the %s file.", $policyfile)); throw new FatalMisconfigurationException(sprintf("Your policies' configuration file doesn't contain the required [default] section. Please check the '%s' file.", $policyfile));
} }
} }
return true; return true;
......
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