]> source.dussan.org Git - nextcloud-server.git/commitdiff
Hash cache key 28495/head
authorChristopher Ng <chrng8@gmail.com>
Tue, 17 Aug 2021 17:57:21 +0000 (17:57 +0000)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Wed, 18 Aug 2021 13:23:44 +0000 (13:23 +0000)
Signed-off-by: Christopher Ng <chrng8@gmail.com>
lib/private/User/Manager.php

index 59c007b6b59a36c02ad027155d6cdfb9cf35fca3..fca642473d9b14fd5b27899179206dd9529ae581 100644 (file)
@@ -159,7 +159,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];
@@ -175,7 +175,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);
                        }
                }