Skip to content

Commit

Permalink
Add some simple validation for the EAS Recurrence message.
Browse files Browse the repository at this point in the history
dayofweek is a bitmask and must be greater than 0. At least one
instance in the wild of an incorrect value here causing havoc
on the sync.
  • Loading branch information
mrubinsk committed Oct 10, 2020
1 parent e7a82a0 commit 9f34648
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions lib/Horde/ActiveSync/Message/Recurrence.php
Expand Up @@ -129,4 +129,31 @@ public function __construct(array $options = array())
}
}

protected function _validateDecodedValues()
{
// Ensure the DOW setting is at least greater than 0.
if ($this->_properties['type'] == TYPE_WEEKLY && $this->_properties['dayofweek'] < 1) {
return false;
}

return true;
}

/**
* Give concrete classes the chance to enforce rules before encoding
* messages to send to the client.
*
* @return boolean True if values were valid (or could be made valid).
* False if values are unable to be validated.
* @since 2.31.0
*/
protected function _preEncodeValidation()
{
// Ensure the DOW setting is at least greater than 0.
if ($this->_properties['type'] == TYPE_WEEKLY && $this->_properties['dayofweek'] < 1) {
return false;
}

return true;
}
}

0 comments on commit 9f34648

Please sign in to comment.