diff options
author | Morris Jobke <hey@morrisjobke.de> | 2016-04-18 11:32:15 +0300 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2016-04-25 14:44:22 +0300 |
commit | 80052995d50596ee9d07a6f242e3ed61359e867a (patch) | |
tree | 5dc00b70ec394e9840da22d82fc33b125208f3eb /apps/user_ldap/lib/user/user.php | |
parent | 505e2b35b05856613a422ce2cb3b8cd3cf70de93 (diff) |
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/user.php')
-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 4707f0d0dd2..c47cbf3a523 100644 --- a/apps/user_ldap/lib/user/user.php +++ b/apps/user_ldap/lib/user/user.php @@ -287,8 +287,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); |