Commit a1f7aae8 authored by mku's avatar mku

ZP-523 #comment always check if the policy key was sent (ping & heartbear sync relevant)

git-svn-id: https://z-push.org/svn/z-push/trunk@1882 b7dd7b3b-3a3c-0410-9da9-bee62a6cc5b5
parent 03bb20e1
......@@ -449,6 +449,13 @@ class SyncCollections implements Iterator {
// wait for changes
$started = time();
$endat = time() + $lifetime;
// always use policy key from the request if it was sent
$policyKey = $this->GetReferencePolicyKey();
if (Request::WasPolicyKeySent() && Request::GetPolicyKey() != 0) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("refpolkey:'%s', sent polkey:'%s'", $policyKey, Request::GetPolicyKey()));
$policyKey = Request::GetPolicyKey();
}
while(($now = time()) < $endat) {
// how long are we waiting for changes
$this->waitingTime = $now-$started;
......@@ -460,7 +467,7 @@ class SyncCollections implements Iterator {
// Check if provisioning is necessary
// if a PolicyKey was sent use it. If not, compare with the ReferencePolicyKey
if (PROVISIONING === true && $this->GetReferencePolicyKey() !== false && ZPush::GetDeviceManager()->ProvisioningRequired($this->GetReferencePolicyKey(), true))
if (PROVISIONING === true && $policyKey !== false && ZPush::GetDeviceManager()->ProvisioningRequired($policyKey, true))
// the hierarchysync forces provisioning
throw new StatusException("SyncCollections->CheckForChanges(): PolicyKey changed. Provisioning required.", self::ERROR_WRONG_HIERARCHY);
......
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