From: Michael J. Rubinsky Date: Sat, 10 Apr 2010 14:53:04 +0000 (-0400) Subject: When performing remotewipe, only send and X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=acdc1a0d2b640fa3db92e01f5f34c7a9643293cc;p=horde.git When performing remotewipe, only send and We were sending the entire provision section - it should be ignored by clients...but the spec clearly states it should only contain --- diff --git a/framework/ActiveSync/lib/Horde/ActiveSync/Request/Provision.php b/framework/ActiveSync/lib/Horde/ActiveSync/Request/Provision.php index b7ecfdb69..cd1e0d0e8 100644 --- a/framework/ActiveSync/lib/Horde/ActiveSync/Request/Provision.php +++ b/framework/ActiveSync/lib/Horde/ActiveSync/Request/Provision.php @@ -73,17 +73,23 @@ class Horde_ActiveSync_Request_Provision extends Horde_ActiveSync_Request_Base return $this->_globalError(self::STATUS_PROTERROR); } + /* Get state object */ + $state = $this->_driver->getStateObject(); + /* Handle android remote wipe */ if ($this->_decoder->getElementStartTag(Horde_ActiveSync::PROVISION_REMOTEWIPE)) { if (!$this->_decoder->getElementStartTag(Horde_ActiveSync::PROVISION_STATUS)) { return $this->_globalError(self::STATUS_PROTERROR); } - // TODO: Look at $status here... $status = $this->_decoder->getElementContent(); if (!$this->_decoder->getElementEndTag() || !$this->_decoder->getElementEndTag()) { return $this->_globalError(self::STATUS_PROTERROR); } + if ($status == self::STATUS_CLIENT_SUCCESS) { + $state->setDeviceRWStatus($this->_devId, self::RWSTATUS_WIPED); + } + /* Need to send *something* in the policytype field even if wiping */ $policytype = self::POLICYTYPE_XML; } else { @@ -141,9 +147,11 @@ class Horde_ActiveSync_Request_Provision extends Horde_ActiveSync_Request_Base $status = $this->_decoder->getElementContent(); if (!$this->_decoder->getElementEndTag() || !$this->_decoder->getElementEndTag()) { - return $this->_globalError(self::STATUS_PROTERROR); } + if ($status == self::STATUS_CLIENT_SUCCESS) { + $state->setDeviceRWStatus($this->_devId, self::RWSTATUS_WIPED); + } } } @@ -154,9 +162,8 @@ class Horde_ActiveSync_Request_Provision extends Horde_ActiveSync_Request_Base /* Start handling request and sending output */ $this->_encoder->StartWBXML(); - // End of Phase 3 - We create the "final" policy key, store it, then - // send it to the client. - $state = $this->_driver->getStateObject(); + /* End of Phase 3 - We create the "final" policy key, store it, then + send it to the client. */ if (!$phase2) { /* Verify intermediate key */ if ($state->getPolicyKey($this->_devId) != $policykey) { @@ -177,38 +184,37 @@ class Horde_ActiveSync_Request_Provision extends Horde_ActiveSync_Request_Base $this->_encoder->content($status); $this->_encoder->endTag(); - $this->_encoder->startTag(Horde_ActiveSync::PROVISION_POLICIES); - $this->_encoder->startTag(Horde_ActiveSync::PROVISION_POLICY); - $this->_encoder->startTag(Horde_ActiveSync::PROVISION_POLICYTYPE); - $this->_encoder->content($policytype); - $this->_encoder->endTag(); - $this->_encoder->startTag(Horde_ActiveSync::PROVISION_STATUS); - $this->_encoder->content($policyStatus); - $this->_encoder->endTag(); - $this->_encoder->startTag(Horde_ActiveSync::PROVISION_POLICYKEY); - $this->_encoder->content($policykey); - $this->_encoder->endTag(); - - /* Send security policies - configure this/move to it's own method...*/ - if ($phase2 && $status == self::STATUS_SUCCESS && $policyStatus == self::STATUS_SUCCESS) { - $this->_encoder->startTag(Horde_ActiveSync::PROVISION_DATA); - if ($policytype == self::POLICYTYPE_XML) { - $this->_encoder->content($this->_driver->getCurrentPolicy(self::POLICYTYPE_XML)); - } else { - // TODO wbxml for 12.0 - } - $this->_encoder->endTag();//data - } - $this->_encoder->endTag();//policy - $this->_encoder->endTag(); //policies + /* Wipe data if status is pending or wiped */ $rwstatus = $state->getDeviceRWStatus($this->_devId); - - //wipe data if status is pending or wiped if ($rwstatus == self::RWSTATUS_PENDING || $rwstatus == self::RWSTATUS_WIPED) { $this->_encoder->startTag(Horde_ActiveSync::PROVISION_REMOTEWIPE, false, true); $state->setDeviceRWStatus($this->_devId, self::RWSTATUS_WIPED); + } else { + $this->_encoder->startTag(Horde_ActiveSync::PROVISION_POLICIES); + $this->_encoder->startTag(Horde_ActiveSync::PROVISION_POLICY); + $this->_encoder->startTag(Horde_ActiveSync::PROVISION_POLICYTYPE); + $this->_encoder->content($policytype); + $this->_encoder->endTag(); + $this->_encoder->startTag(Horde_ActiveSync::PROVISION_STATUS); + $this->_encoder->content($policyStatus); + $this->_encoder->endTag(); + $this->_encoder->startTag(Horde_ActiveSync::PROVISION_POLICYKEY); + $this->_encoder->content($policykey); + $this->_encoder->endTag(); + + /* Send security policies - configure this/move to it's own method...*/ + if ($phase2 && $status == self::STATUS_SUCCESS && $policyStatus == self::STATUS_SUCCESS) { + $this->_encoder->startTag(Horde_ActiveSync::PROVISION_DATA); + if ($policytype == self::POLICYTYPE_XML) { + $this->_encoder->content($this->_driver->getCurrentPolicy(self::POLICYTYPE_XML)); + } else { + // TODO wbxml for 12.0 + } + $this->_encoder->endTag();//data + } + $this->_encoder->endTag();//policy + $this->_encoder->endTag(); //policies } - $this->_encoder->endTag();//provision return true;