diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2016-02-26 17:02:13 +0100 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2016-02-26 20:00:13 +0100 |
commit | eccd7cf6548e1ea639aea48cbf7e52e95dc98c11 (patch) | |
tree | 68c58394c820e1ce6bc8eee07e4747875da08be0 /apps/federation/lib | |
parent | 62d7885c3b13d7d2acf33f80e91016a82cc8a7c0 (diff) | |
download | nextcloud-server-eccd7cf6548e1ea639aea48cbf7e52e95dc98c11.tar.gz nextcloud-server-eccd7cf6548e1ea639aea48cbf7e52e95dc98c11.zip |
reuse the url_hash instead of calculating a new hash for the address book
Diffstat (limited to 'apps/federation/lib')
-rw-r--r-- | apps/federation/lib/dbhandler.php | 6 | ||||
-rw-r--r-- | apps/federation/lib/syncfederationaddressbooks.php | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/apps/federation/lib/dbhandler.php b/apps/federation/lib/dbhandler.php index 3ea84baa3eb..df36228c760 100644 --- a/apps/federation/lib/dbhandler.php +++ b/apps/federation/lib/dbhandler.php @@ -112,7 +112,7 @@ class DbHandler { */ public function getAllServer() { $query = $this->connection->getQueryBuilder(); - $query->select(['url', 'id', 'status', 'shared_secret', 'sync_token'])->from($this->dbTable); + $query->select(['url', 'url_hash', 'id', 'status', 'shared_secret', 'sync_token'])->from($this->dbTable); $result = $query->execute()->fetchAll(); return $result; } @@ -252,11 +252,11 @@ class DbHandler { */ protected function hash($url) { $normalized = $this->normalizeUrl($url); - return md5($normalized); + return sha1($normalized); } /** - * normalize URL, used to create the md5 hash + * normalize URL, used to create the sha1 hash * * @param string $url * @return string diff --git a/apps/federation/lib/syncfederationaddressbooks.php b/apps/federation/lib/syncfederationaddressbooks.php index 6419fdddf8e..886f6505b20 100644 --- a/apps/federation/lib/syncfederationaddressbooks.php +++ b/apps/federation/lib/syncfederationaddressbooks.php @@ -40,7 +40,7 @@ class SyncFederationAddressBooks { if (is_null($sharedSecret)) { continue; } - $targetBookId = sha1($url); + $targetBookId = $trustedServer['url_hash']; $targetPrincipal = "principals/system/system"; $targetBookProperties = [ '{DAV:}displayname' => $url |