diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2013-10-25 14:15:05 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2013-10-25 14:15:05 +0200 |
commit | 81dbe7dab7bdc5cc94f582ae49dc852e63ba0a6c (patch) | |
tree | 19de84d37aaff65ec4bd5ad70e8a8c3b8c6b8011 /apps/user_ldap/lib/access.php | |
parent | 3fc232370e00df1d39638697daf8e8c1af8fe8dc (diff) | |
download | nextcloud-server-81dbe7dab7bdc5cc94f582ae49dc852e63ba0a6c.tar.gz nextcloud-server-81dbe7dab7bdc5cc94f582ae49dc852e63ba0a6c.zip |
Port PR #5457 to master
Diffstat (limited to 'apps/user_ldap/lib/access.php')
-rw-r--r-- | apps/user_ldap/lib/access.php | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php index 97e44fdcb21..f133260383c 100644 --- a/apps/user_ldap/lib/access.php +++ b/apps/user_ldap/lib/access.php @@ -28,6 +28,8 @@ class Access extends LDAPUtility { //never ever check this var directly, always use getPagedSearchResultState protected $pagedSearchedSuccessful; + protected $cookies = array(); + public function __construct(Connection $connection, ILDAPWrapper $ldap) { parent::__construct($ldap); $this->connection = $connection; @@ -60,6 +62,8 @@ class Access extends LDAPUtility { \OCP\Util::writeLog('user_ldap', 'LDAP resource not available.', \OCP\Util::DEBUG); return false; } + //all or nothing! otherwise we get in trouble with. + $this->initPagedSearch($filter, array($dn), $attr, 99999, 0); $dn = $this->DNasBaseParameter($dn); $rr = @$this->ldap->read($cr, $dn, $filter, array($attr)); if(!$this->ldap->isResource($rr)) { @@ -1048,9 +1052,12 @@ class Access extends LDAPUtility { $offset -= $limit; //we work with cache here $cachekey = 'lc' . crc32($base) . '-' . crc32($filter) . '-' . $limit . '-' . $offset; - $cookie = $this->connection->getFromCache($cachekey); - if(is_null($cookie)) { - $cookie = ''; + $cookie = ''; + if(isset($this->cookies[$cachekey])) { + $cookie = $this->cookies[$cachekey]; + if(is_null($cookie)) { + $cookie = ''; + } } return $cookie; } @@ -1067,7 +1074,7 @@ class Access extends LDAPUtility { private function setPagedResultCookie($base, $filter, $limit, $offset, $cookie) { if(!empty($cookie)) { $cachekey = 'lc' . crc32($base) . '-' . crc32($filter) . '-' .$limit . '-' . $offset; - $cookie = $this->connection->writeToCache($cachekey, $cookie); + $this->cookies[$cachekey] = $cookie; } } |