diff options
author | Morris Jobke <hey@morrisjobke.de> | 2016-04-18 10:32:15 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2016-04-20 21:50:28 +0200 |
commit | 62a59854f0478130c23bc7b8bbf4064b38bbeaf8 (patch) | |
tree | 0d2101e019491d560560d36ca9700e2e016801e8 /apps/user_ldap/lib/connection.php | |
parent | 85d809c0d3cda16e9ef12f57c4225c868b17915b (diff) | |
download | nextcloud-server-62a59854f0478130c23bc7b8bbf4064b38bbeaf8.tar.gz nextcloud-server-62a59854f0478130c23bc7b8bbf4064b38bbeaf8.zip |
Fix LDAP race conditions
* getFromCache is wrapped in isCached
* inbetween the two calls the cache entry hits it's TTL
* getFromCache returns null
* this fix only checkes if the returned value is null and
return only non-null values
Diffstat (limited to 'apps/user_ldap/lib/connection.php')
-rw-r--r-- | apps/user_ldap/lib/connection.php | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/apps/user_ldap/lib/connection.php b/apps/user_ldap/lib/connection.php index 53c9b3790a7..974cad6dc02 100644 --- a/apps/user_ldap/lib/connection.php +++ b/apps/user_ldap/lib/connection.php @@ -213,10 +213,6 @@ class Connection extends LDAPUtility { if(is_null($this->cache) || !$this->configuration->ldapCacheTTL) { return null; } - if(!$this->isCached($key)) { - return null; - - } $key = $this->getCacheKey($key); return json_decode(base64_decode($this->cache->get($key)), true); @@ -224,21 +220,6 @@ class Connection extends LDAPUtility { /** * @param string $key - * @return bool - */ - public function isCached($key) { - if(!$this->configured) { - $this->readConfiguration(); - } - if(is_null($this->cache) || !$this->configuration->ldapCacheTTL) { - return false; - } - $key = $this->getCacheKey($key); - return $this->cache->hasKey($key); - } - - /** - * @param string $key * @param mixed $value * * @return string |