summaryrefslogtreecommitdiffstats
path: root/lib/private/User
diff options
context:
space:
mode:
authorChristopher Ng <chrng8@gmail.com>2021-08-17 17:57:21 +0000
committerChristopher Ng <chrng8@gmail.com>2021-08-17 21:55:01 +0000
commit60ecc432a49e1a768e8f95024073a1607c99a43e (patch)
treefad041888ce41ff43d8ba53cbecb72b69bd769d3 /lib/private/User
parent0edfb24f143e666cf5a716e97bad2a82e67cc66b (diff)
downloadnextcloud-server-60ecc432a49e1a768e8f95024073a1607c99a43e.tar.gz
nextcloud-server-60ecc432a49e1a768e8f95024073a1607c99a43e.zip
Hash cache key
Signed-off-by: Christopher Ng <chrng8@gmail.com>
Diffstat (limited to 'lib/private/User')
-rw-r--r--lib/private/User/Manager.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/private/User/Manager.php b/lib/private/User/Manager.php
index 12c615d500b..1827be61a7a 100644
--- a/lib/private/User/Manager.php
+++ b/lib/private/User/Manager.php
@@ -158,7 +158,7 @@ class Manager extends PublicEmitter implements IUserManager {
return $this->cachedUsers[$uid];
}
- $cachedBackend = $this->cache->get($uid);
+ $cachedBackend = $this->cache->get(sha1($uid));
if ($cachedBackend !== null && isset($this->backends[$cachedBackend])) {
// Cache has the info of the user backend already, so ask that one directly
$backend = $this->backends[$cachedBackend];
@@ -174,7 +174,8 @@ class Manager extends PublicEmitter implements IUserManager {
}
if ($backend->userExists($uid)) {
- $this->cache->set($uid, $i, 300);
+ // Hash $uid to ensure that only valid characters are used for the cache key
+ $this->cache->set(sha1($uid), $i, 300);
return $this->getUserObject($uid, $backend);
}
}