Projects
Kolab:16:Testing:Candidate
kolab-syncroton
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 55
View file
kolab-syncroton.spec
Changed
@@ -37,7 +37,7 @@ %global upstream_version 2.4.2 Name: kolab-syncroton -Version: 2.4.2.28 +Version: 2.4.2.29 Release: 1%{?dist} Summary: ActiveSync for Kolab Groupware
View file
debian.changelog
Changed
@@ -1,4 +1,4 @@ -kolab-syncroton (2.4.2.28-0~kolab1) unstable; urgency=low +kolab-syncroton (2.4.2.29-0~kolab1) unstable; urgency=low * Release version 2.4.2
View file
kolab-syncroton-2.4.2.tar.gz/lib/ext/Syncroton/Server.php
Changed
@@ -52,7 +52,10 @@ $this->_request = $request instanceof Zend_Controller_Request_Http ? $request : new Zend_Controller_Request_Http(); $this->_body = $body !== null ? $body : fopen('php://input', 'r'); - $this->_deviceBackend = Syncroton_Registry::getDeviceBackend(); + // Not available on unauthenticated OPTIONS request + if (!empty($this->_userId)) { + $this->_deviceBackend = Syncroton_Registry::getDeviceBackend(); + } } @@ -62,6 +65,13 @@ $this->_logger->debug(__METHOD__ . '::' . __LINE__ . ' REQUEST METHOD: ' . $this->_request->getMethod()); } + if ($this->_request->getMethod() != "OPTIONS" && empty($this->_userId)) { + $this->_logger->warn(__METHOD__ . '::' . __LINE__ . ' Not authenticated'); + header('WWW-Authenticate: Basic realm="ActiveSync for Kolab"'); + header('HTTP/1.1 401 Unauthorized'); + exit; + } + switch($this->_request->getMethod()) { case 'OPTIONS': $this->_handleOptions();
View file
kolab-syncroton-2.4.2.tar.gz/lib/kolab_sync.php
Changed
@@ -135,12 +135,6 @@ $userid = $this->authenticate($_SERVER'PHP_AUTH_USER', $_SERVER'PHP_AUTH_PW'); } - if (empty($userid)) { - header('WWW-Authenticate: Basic realm="' . $this->app_name . '"'); - header('HTTP/1.1 401 Unauthorized'); - exit; - } - $this->plugins->exec_hook('ready', 'task' => 'syncroton'); // Set log directory per-user (again, in case the username changed above) @@ -153,12 +147,15 @@ Syncroton_Registry::set(Syncroton_Registry::LOGGERBACKEND, $this->logger); Syncroton_Registry::set(Syncroton_Registry::DATABASE, $this->get_dbh()); Syncroton_Registry::set(Syncroton_Registry::TRANSACTIONMANAGER, kolab_sync_transaction_manager::getInstance()); - Syncroton_Registry::set(Syncroton_Registry::DEVICEBACKEND, new kolab_sync_backend_device()); - Syncroton_Registry::set(Syncroton_Registry::FOLDERBACKEND, new kolab_sync_backend_folder()); - Syncroton_Registry::set(Syncroton_Registry::SYNCSTATEBACKEND, new kolab_sync_backend_state()); - Syncroton_Registry::set(Syncroton_Registry::CONTENTSTATEBACKEND, new kolab_sync_backend_content()); - Syncroton_Registry::set(Syncroton_Registry::POLICYBACKEND, new kolab_sync_backend_policy()); - Syncroton_Registry::set(Syncroton_Registry::SLEEP_CALLBACK, $this, 'sleep'); + // The unauthenticated OPTIONS request doesn't require these backends and we can't instantiate them without credentials for the underlying storage backend + if (!empty($userid)) { + Syncroton_Registry::set(Syncroton_Registry::DEVICEBACKEND, new kolab_sync_backend_device()); + Syncroton_Registry::set(Syncroton_Registry::FOLDERBACKEND, new kolab_sync_backend_folder()); + Syncroton_Registry::set(Syncroton_Registry::SYNCSTATEBACKEND, new kolab_sync_backend_state()); + Syncroton_Registry::set(Syncroton_Registry::CONTENTSTATEBACKEND, new kolab_sync_backend_content()); + Syncroton_Registry::set(Syncroton_Registry::POLICYBACKEND, new kolab_sync_backend_policy()); + Syncroton_Registry::set(Syncroton_Registry::SLEEP_CALLBACK, $this, 'sleep'); + } Syncroton_Registry::setContactsDataClass('kolab_sync_data_contacts'); Syncroton_Registry::setCalendarDataClass('kolab_sync_data_calendar');
View file
kolab-syncroton-2.4.2.tar.gz/lib/kolab_sync_storage.php
Changed
@@ -1572,7 +1572,7 @@ // FIXME: The one caveat is that we will still update the database and thus overwrite the old entry. // That means if we rerun the same request, the changes will not be detected // => We should not be dealing with timestamps really. - $this->relations$folderid$sinceFormatted . "-1" = $this->relations$folderid$sinceFormatted; + $this->relations$folderid$sinceFormatted . "-1" = $this->relations$folderid$sinceFormatted ?? null; $this->relations$folderid$sinceFormatted = null; } @@ -1968,7 +1968,7 @@ $db->limitquery( "SELECT `data`, `synctime` FROM `syncroton_relations_state`" - . " WHERE `device_id` = ? AND `folder_id` = ? AND `synctime` <= ?" + . " WHERE `device_id` = ? AND `folder_id` = ? AND `synctime` < ?" . " ORDER BY `synctime` DESC", 0, 1, @@ -1986,9 +1986,13 @@ // Cleanup: remove all records older than the current one. // We must use the row's synctime, otherwise we would delete the record we just loaded + // We must delete all entries that are before the synctime to clean up old entries, + // but we must also delete all entries that are more recent in case the sync gets rerun + // with the same timestamp (e.g. when rerunning the same sync request). + // Otherwise the number of entries will start to grow with every sync. $db->query( "DELETE FROM `syncroton_relations_state`" - . " WHERE `device_id` = ? AND `folder_id` = ? AND `synctime` < ?", + . " WHERE `device_id` = ? AND `folder_id` = ? AND `synctime` <> ?", $device_key, $folderid, $row'synctime'
View file
kolab-syncroton-2.4.2.tar.gz/tests/Sync/OptionsTest.php
Changed
@@ -7,7 +7,7 @@ */ public function testOptions() { - $response = self::$client->request('OPTIONS', ''); + $response = self::$client->request('OPTIONS', '', 'auth' => null); $this->assertEquals(200, $response->getStatusCode()); $this->assertStringContainsString('14', $response->getHeader('MS-Server-ActiveSync')0); $this->assertStringContainsString('14.1', $response->getHeader('MS-ASProtocolVersions')0);
View file
kolab-syncroton-2.4.2.tar.gz/tests/Sync/Sync/RelationsTest.php
Changed
@@ -125,35 +125,45 @@ //FIXME not sure what I'm doing wrong, but the xml looks ok $this->assertSame("test1test2", $xpath->query("{$root}/ns:ApplicationData/Email:Categories")->item(0)->nodeValue); - //Rerun the same command and make sure we get the same result + $retries = 2; $syncKey--; - $root = "//ns:Sync/ns:Collections/ns:Collection"; - $this->assertSame('1', $xpath->query("{$root}/ns:Status")->item(0)->nodeValue); - $this->assertSame(strval(++$syncKey), $xpath->query("{$root}/ns:SyncKey")->item(0)->nodeValue); - $this->assertSame($folderId, $xpath->query("{$root}/ns:CollectionId")->item(0)->nodeValue); - $this->assertSame(0, $xpath->query("{$root}/ns:Commands/ns:Add")->count()); - $this->assertSame(1, $xpath->query("{$root}/ns:Commands/ns:Change")->count()); - $root .= "/ns:Commands/ns:Change"; - $this->assertSame(1, $xpath->query("{$root}/ns:ApplicationData/Email:Categories")->count()); - //FIXME not sure what I'm doing wrong, but the xml looks ok - $this->assertSame("test1test2", $xpath->query("{$root}/ns:ApplicationData/Email:Categories")->item(0)->nodeValue); - - - // Assert the db state - $rcube = \rcube::get_instance(); - $db = $rcube->get_dbh(); - $result = $db->query( - "SELECT `data`, `synctime` FROM `syncroton_relations_state`" - . " WHERE `device_id` = ? AND `folder_id` = ?" - . " ORDER BY `synctime` DESC", - $device'ID', - $folderId - ); - $data = ; - while ($state = $db->fetch_assoc($result)) { - $data = $state; + // Rerun the same command and make sure we get the same result + for ($i = 0; $i < $retries; $i++) { + $response = $this->syncRequest($syncKey, $folderId, 10); + $this->assertEquals(200, $response->getStatusCode()); + $dom = $this->fromWbxml($response->getBody()); + $xpath = $this->xpath($dom); + + $root = "//ns:Sync/ns:Collections/ns:Collection"; + $this->assertSame('1', $xpath->query("{$root}/ns:Status")->item(0)->nodeValue); + $this->assertSame($folderId, $xpath->query("{$root}/ns:CollectionId")->item(0)->nodeValue); + $this->assertSame(0, $xpath->query("{$root}/ns:Commands/ns:Add")->count()); + $this->assertSame(1, $xpath->query("{$root}/ns:Commands/ns:Change")->count()); + $root .= "/ns:Commands/ns:Change"; + $this->assertSame(1, $xpath->query("{$root}/ns:ApplicationData/Email:Categories")->count()); + //FIXME not sure what I'm doing wrong, but the xml looks ok + $this->assertSame("test1test2", $xpath->query("{$root}/ns:ApplicationData/Email:Categories")->item(0)->nodeValue); + + // Assert the db state + $rcube = \rcube::get_instance(); + $db = $rcube->get_dbh(); + $result = $db->query( + "SELECT `data`, `synctime` FROM `syncroton_relations_state`" + . " WHERE `device_id` = ? AND `folder_id` = ?" + . " ORDER BY `synctime` DESC", + $device'ID', + $folderId + ); + $data = ; + while ($state = $db->fetch_assoc($result)) { + $data = $state; + } + $this->assertSame(2, count($data)); + // Make sure we have a new timestamp after the first iteration. + // This way we can potentially catch errors when we end up using the same or a different timestamp. + sleep(1); } - $this->assertSame(2, count($data)); + $syncKey += ($retries + 1); // Reset to no tags $sync->storage()->updateItem($folderId, $device'ID', \kolab_sync_storage::MODEL_EMAIL, $uid1, null, 'categories' => );
View file
kolab-syncroton.dsc
Changed
@@ -2,7 +2,7 @@ Source: kolab-syncroton Binary: kolab-syncroton Architecture: all -Version: 1:2.4.2.28-1~kolab1 +Version: 1:2.4.2.29-1~kolab1 Maintainer: Jeroen van Meeuwen <vanmeeuwen@kolabsys.com> Uploaders: Jeroen van Meeuwen <vanmeeuwen@kolabsys.com> Homepage: http://www.kolab.org/
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.