summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorPytal <24800714+Pytal@users.noreply.github.com>2021-08-18 12:48:24 -0700
committerGitHub <noreply@github.com>2021-08-18 12:48:24 -0700
commitf3f1c826be26f97b022843b850fe65393c31360b (patch)
tree080724b93c99f5148d39abe59d2b197eb1b729ea /lib/private
parente1d9a45c6d5d68f8ea97cbdc6a8e23403d795c25 (diff)
parent79b5421425b8b61c63593978b4a198a53e387c86 (diff)
downloadnextcloud-server-f3f1c826be26f97b022843b850fe65393c31360b.tar.gz
nextcloud-server-f3f1c826be26f97b022843b850fe65393c31360b.zip
Merge pull request #28494 from nextcloud/backport/28481/stable22
[stable22] Hash cache key
Diffstat (limited to 'lib/private')
-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 07a599cf017..0d340ad356e 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);
}
}