Skip to content

Commit

Permalink
Treat permission errors as folder vanished errors when checking for c…
Browse files Browse the repository at this point in the history
…hanges.

From the perspective of the client, at this point, both of these
cases are the same - the folder is no longer available, so we need
to perform a resync.

For Horde 6, this should be handled by having application APIs
be responsible for returning more explicit errors in these
cases.
  • Loading branch information
mrubinsk committed Nov 13, 2017
1 parent 8ebbf40 commit 24fdfb4
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions lib/Horde/ActiveSync/State/Base.php
Expand Up @@ -381,6 +381,7 @@ public function getFolderUidForBackendId($serverid)
* being the result of a client originated change.
*
* @throws Horde_ActiveSync_Exception_StaleState
* @throws Horde_ActiveSync_Exception_FolderGone
*/
public function getChanges(array $options = array())
{
Expand Down Expand Up @@ -421,16 +422,27 @@ public function getChanges(array $options = array())
);

// No existing changes, poll the backend
$changes = $this->_backend->getServerChanges(
$this->_folder,
(int)$this->_lastSyncStamp,
(int)$this->_thisSyncStamp,
$cutoffdate,
!empty($options['ping']),
$this->_folder->haveInitialSync,
!empty($options['maxitems']) ? $options['maxitems'] : 100,
!empty($this->_collection['forcerefresh'])
);
try {
$changes = $this->_backend->getServerChanges(
$this->_folder,
(int)$this->_lastSyncStamp,
(int)$this->_thisSyncStamp,
$cutoffdate,
!empty($options['ping']),
$this->_folder->haveInitialSync,
!empty($options['maxitems']) ? $options['maxitems'] : 100,
!empty($this->_collection['forcerefresh'])
);
} catch (Horde_Exception_AuthenticationFailure $e) {
// @todo For BC reasons, we need to treat AuthenticationFailure
// here as a need to resync folders since to the backend, the
// end result is the same, the folder is "missing".
$this->_logger->meta(sprintf(
'STATE: Unable to find folder %s. Could be vanished, or permissions denied.',
$this->_folder->serverId())
);
throw new Horde_ActiveSync_Exception_FolderGone($e->getMessage());
}

// Only update the folderstate if we are not PINGing.
if (empty($options['ping'])) {
Expand Down

0 comments on commit 24fdfb4

Please sign in to comment.