Port PR #5457 to master
This commit is contained in:
parent
3fc232370e
commit
81dbe7dab7
|
@ -28,6 +28,8 @@ class Access extends LDAPUtility {
|
||||||
//never ever check this var directly, always use getPagedSearchResultState
|
//never ever check this var directly, always use getPagedSearchResultState
|
||||||
protected $pagedSearchedSuccessful;
|
protected $pagedSearchedSuccessful;
|
||||||
|
|
||||||
|
protected $cookies = array();
|
||||||
|
|
||||||
public function __construct(Connection $connection, ILDAPWrapper $ldap) {
|
public function __construct(Connection $connection, ILDAPWrapper $ldap) {
|
||||||
parent::__construct($ldap);
|
parent::__construct($ldap);
|
||||||
$this->connection = $connection;
|
$this->connection = $connection;
|
||||||
|
@ -60,6 +62,8 @@ class Access extends LDAPUtility {
|
||||||
\OCP\Util::writeLog('user_ldap', 'LDAP resource not available.', \OCP\Util::DEBUG);
|
\OCP\Util::writeLog('user_ldap', 'LDAP resource not available.', \OCP\Util::DEBUG);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
//all or nothing! otherwise we get in trouble with.
|
||||||
|
$this->initPagedSearch($filter, array($dn), $attr, 99999, 0);
|
||||||
$dn = $this->DNasBaseParameter($dn);
|
$dn = $this->DNasBaseParameter($dn);
|
||||||
$rr = @$this->ldap->read($cr, $dn, $filter, array($attr));
|
$rr = @$this->ldap->read($cr, $dn, $filter, array($attr));
|
||||||
if(!$this->ldap->isResource($rr)) {
|
if(!$this->ldap->isResource($rr)) {
|
||||||
|
@ -1048,9 +1052,12 @@ class Access extends LDAPUtility {
|
||||||
$offset -= $limit;
|
$offset -= $limit;
|
||||||
//we work with cache here
|
//we work with cache here
|
||||||
$cachekey = 'lc' . crc32($base) . '-' . crc32($filter) . '-' . $limit . '-' . $offset;
|
$cachekey = 'lc' . crc32($base) . '-' . crc32($filter) . '-' . $limit . '-' . $offset;
|
||||||
$cookie = $this->connection->getFromCache($cachekey);
|
$cookie = '';
|
||||||
if(is_null($cookie)) {
|
if(isset($this->cookies[$cachekey])) {
|
||||||
$cookie = '';
|
$cookie = $this->cookies[$cachekey];
|
||||||
|
if(is_null($cookie)) {
|
||||||
|
$cookie = '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $cookie;
|
return $cookie;
|
||||||
}
|
}
|
||||||
|
@ -1067,7 +1074,7 @@ class Access extends LDAPUtility {
|
||||||
private function setPagedResultCookie($base, $filter, $limit, $offset, $cookie) {
|
private function setPagedResultCookie($base, $filter, $limit, $offset, $cookie) {
|
||||||
if(!empty($cookie)) {
|
if(!empty($cookie)) {
|
||||||
$cachekey = 'lc' . crc32($base) . '-' . crc32($filter) . '-' .$limit . '-' . $offset;
|
$cachekey = 'lc' . crc32($base) . '-' . crc32($filter) . '-' .$limit . '-' . $offset;
|
||||||
$cookie = $this->connection->writeToCache($cachekey, $cookie);
|
$this->cookies[$cachekey] = $cookie;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue