diff options
author | Christopher Ng <chrng8@gmail.com> | 2021-08-17 17:57:21 +0000 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2021-08-18 13:21:22 +0000 |
commit | 79b5421425b8b61c63593978b4a198a53e387c86 (patch) | |
tree | abeaa43baba906f19bdf5c8800daeaf6baa013a0 /lib | |
parent | 7879484950c3ca2eb8aaba772137cf378784371f (diff) | |
download | nextcloud-server-79b5421425b8b61c63593978b4a198a53e387c86.tar.gz nextcloud-server-79b5421425b8b61c63593978b4a198a53e387c86.zip |
Hash cache key
Signed-off-by: Christopher Ng <chrng8@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/User/Manager.php | 5 |
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); } } |