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/user | |
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/user')
-rw-r--r-- | apps/user_ldap/lib/user/user.php | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/apps/user_ldap/lib/user/user.php b/apps/user_ldap/lib/user/user.php index 23aba0e0d85..4da8ae5f098 100644 --- a/apps/user_ldap/lib/user/user.php +++ b/apps/user_ldap/lib/user/user.php @@ -297,8 +297,9 @@ class User { public function getMemberOfGroups() { $cacheKey = 'getMemberOf'.$this->getUsername(); - if($this->connection->isCached($cacheKey)) { - return $this->connection->getFromCache($cacheKey); + $memberOfGroups = $this->connection->getFromCache($cacheKey); + if(!is_null($memberOfGroups)) { + return $memberOfGroups; } $groupDNs = $this->access->readAttribute($this->getDN(), 'memberOf'); $this->connection->writeToCache($cacheKey, $groupDNs); |