summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/lib/Group_LDAP.php
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2021-09-21 11:47:00 +0200
committerArthur Schiwon <blizzz@arthur-schiwon.de>2021-09-21 13:32:42 +0200
commit71781941984b75e12366fe87bb3d2f92f3dbf2ff (patch)
treeb719bfdc0fa9728d52bb2052e0f9ba836b426ad0 /apps/user_ldap/lib/Group_LDAP.php
parentdbf7905149222115a2cd0334efcf8c93afa8683e (diff)
downloadnextcloud-server-71781941984b75e12366fe87bb3d2f92f3dbf2ff.tar.gz
nextcloud-server-71781941984b75e12366fe87bb3d2f92f3dbf2ff.zip
fix caching of objectsid searches
- store result when no name could be retrieved, too - cached value is not an array, was treated wrongly Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/user_ldap/lib/Group_LDAP.php')
-rw-r--r--apps/user_ldap/lib/Group_LDAP.php9
1 files changed, 5 insertions, 4 deletions
diff --git a/apps/user_ldap/lib/Group_LDAP.php b/apps/user_ldap/lib/Group_LDAP.php
index ac77dcc930e..891995d885d 100644
--- a/apps/user_ldap/lib/Group_LDAP.php
+++ b/apps/user_ldap/lib/Group_LDAP.php
@@ -409,6 +409,7 @@ class Group_LDAP extends BackendUtility implements GroupInterface, IGroupLDAP, I
private function getNameOfGroup(string $filter, string $cacheKey) {
$result = $this->access->searchGroups($filter, ['dn'], 1);
if (empty($result)) {
+ $this->access->connection->writeToCache($cacheKey, false);
return null;
}
$dn = $result[0]['dn'][0];
@@ -533,10 +534,10 @@ class Group_LDAP extends BackendUtility implements GroupInterface, IGroupLDAP, I
* @throws ServerNotAvailableException
*/
public function primaryGroupID2Name(string $gid, string $dn) {
- $cacheKey = 'primaryGroupIDtoName';
- $groupNames = $this->access->connection->getFromCache($cacheKey);
- if (!is_null($groupNames) && isset($groupNames[$gid])) {
- return $groupNames[$gid];
+ $cacheKey = 'primaryGroupIDtoName_' . $gid;
+ $groupName = $this->access->connection->getFromCache($cacheKey);
+ if (!is_null($groupName)) {
+ return $groupName;
}
$domainObjectSid = $this->access->getSID($dn);