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 {
$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);
+ }
}
}
/* 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) {
$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;