functions that were checked for are present since PHP 5.4, supported is >=/
* so the check from older days is really not necessary anymore * resolves #10923 Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
parent
6ad7f32938
commit
2048872f9e
|
@ -1855,15 +1855,15 @@ class Access extends LDAPUtility implements IUserTools {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* resets a running Paged Search operation
|
* resets a running Paged Search operation
|
||||||
|
*
|
||||||
|
* @throws ServerNotAvailableException
|
||||||
*/
|
*/
|
||||||
private function abandonPagedSearch() {
|
private function abandonPagedSearch() {
|
||||||
if($this->connection->hasPagedResultSupport) {
|
|
||||||
$cr = $this->connection->getConnectionResource();
|
$cr = $this->connection->getConnectionResource();
|
||||||
$this->invokeLDAPMethod('controlPagedResult', $cr, 0, false, $this->lastCookie);
|
$this->invokeLDAPMethod('controlPagedResult', $cr, 0, false, $this->lastCookie);
|
||||||
$this->getPagedSearchResultState();
|
$this->getPagedSearchResultState();
|
||||||
$this->lastCookie = '';
|
$this->lastCookie = '';
|
||||||
$this->cookies = array();
|
$this->cookies = [];
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1902,10 +1902,6 @@ class Access extends LDAPUtility implements IUserTools {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function hasMoreResults() {
|
public function hasMoreResults() {
|
||||||
if(!$this->connection->hasPagedResultSupport) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(empty($this->lastCookie) && $this->lastCookie !== '0') {
|
if(empty($this->lastCookie) && $this->lastCookie !== '0') {
|
||||||
// as in RFC 2696, when all results are returned, the cookie will
|
// as in RFC 2696, when all results are returned, the cookie will
|
||||||
// be empty.
|
// be empty.
|
||||||
|
@ -1954,7 +1950,7 @@ class Access extends LDAPUtility implements IUserTools {
|
||||||
*/
|
*/
|
||||||
private function initPagedSearch($filter, $bases, $attr, $limit, $offset) {
|
private function initPagedSearch($filter, $bases, $attr, $limit, $offset) {
|
||||||
$pagedSearchOK = false;
|
$pagedSearchOK = false;
|
||||||
if($this->connection->hasPagedResultSupport && ($limit !== 0)) {
|
if ($limit !== 0) {
|
||||||
$offset = (int)$offset; //can be null
|
$offset = (int)$offset; //can be null
|
||||||
\OCP\Util::writeLog('user_ldap',
|
\OCP\Util::writeLog('user_ldap',
|
||||||
'initializing paged search for Filter '.$filter.' base '.print_r($bases, true)
|
'initializing paged search for Filter '.$filter.' base '.print_r($bases, true)
|
||||||
|
@ -2000,7 +1996,7 @@ class Access extends LDAPUtility implements IUserTools {
|
||||||
* So we added "&& !empty($this->lastCookie)" to this test to ignore pagination
|
* So we added "&& !empty($this->lastCookie)" to this test to ignore pagination
|
||||||
* if we don't have a previous paged search.
|
* if we don't have a previous paged search.
|
||||||
*/
|
*/
|
||||||
} else if($this->connection->hasPagedResultSupport && $limit === 0 && !empty($this->lastCookie)) {
|
} else if ($limit === 0 && !empty($this->lastCookie)) {
|
||||||
// a search without limit was requested. However, if we do use
|
// a search without limit was requested. However, if we do use
|
||||||
// Paged Search once, we always must do it. This requires us to
|
// Paged Search once, we always must do it. This requires us to
|
||||||
// initialize it with the configured page size.
|
// initialize it with the configured page size.
|
||||||
|
|
|
@ -95,7 +95,6 @@ class Configuration {
|
||||||
'ldapAttributesForGroupSearch' => null,
|
'ldapAttributesForGroupSearch' => null,
|
||||||
'ldapExperiencedAdmin' => false,
|
'ldapExperiencedAdmin' => false,
|
||||||
'homeFolderNamingRule' => null,
|
'homeFolderNamingRule' => null,
|
||||||
'hasPagedResultSupport' => false,
|
|
||||||
'hasMemberOfFilterSupport' => false,
|
'hasMemberOfFilterSupport' => false,
|
||||||
'useMemberOfToDetectMembership' => true,
|
'useMemberOfToDetectMembership' => true,
|
||||||
'ldapExpertUsernameAttr' => null,
|
'ldapExpertUsernameAttr' => null,
|
||||||
|
@ -278,7 +277,6 @@ class Configuration {
|
||||||
break;
|
break;
|
||||||
//following options are not stored but detected, skip them
|
//following options are not stored but detected, skip them
|
||||||
case 'ldapIgnoreNamingRules':
|
case 'ldapIgnoreNamingRules':
|
||||||
case 'hasPagedResultSupport':
|
|
||||||
case 'ldapUuidUserAttribute':
|
case 'ldapUuidUserAttribute':
|
||||||
case 'ldapUuidGroupAttribute':
|
case 'ldapUuidGroupAttribute':
|
||||||
continue 2;
|
continue 2;
|
||||||
|
|
|
@ -50,7 +50,6 @@ use OCP\ILogger;
|
||||||
* @property string ldapUserDisplayName2
|
* @property string ldapUserDisplayName2
|
||||||
* @property string ldapUserAvatarRule
|
* @property string ldapUserAvatarRule
|
||||||
* @property boolean turnOnPasswordChange
|
* @property boolean turnOnPasswordChange
|
||||||
* @property boolean hasPagedResultSupport
|
|
||||||
* @property string[] ldapBaseUsers
|
* @property string[] ldapBaseUsers
|
||||||
* @property int|null ldapPagingSize holds an integer
|
* @property int|null ldapPagingSize holds an integer
|
||||||
* @property bool|mixed|void ldapGroupMemberAssocAttr
|
* @property bool|mixed|void ldapGroupMemberAssocAttr
|
||||||
|
@ -67,7 +66,6 @@ class Connection extends LDAPUtility {
|
||||||
private $configPrefix;
|
private $configPrefix;
|
||||||
private $configID;
|
private $configID;
|
||||||
private $configured = false;
|
private $configured = false;
|
||||||
private $hasPagedResultSupport = true;
|
|
||||||
//whether connection should be kept on __destruct
|
//whether connection should be kept on __destruct
|
||||||
private $dontDestruct = false;
|
private $dontDestruct = false;
|
||||||
|
|
||||||
|
@ -112,9 +110,6 @@ class Connection extends LDAPUtility {
|
||||||
$helper = new Helper(\OC::$server->getConfig());
|
$helper = new Helper(\OC::$server->getConfig());
|
||||||
$this->doNotValidate = !in_array($this->configPrefix,
|
$this->doNotValidate = !in_array($this->configPrefix,
|
||||||
$helper->getServerConfigurationPrefixes());
|
$helper->getServerConfigurationPrefixes());
|
||||||
$this->hasPagedResultSupport =
|
|
||||||
(int)$this->configuration->ldapPagingSize !== 0
|
|
||||||
|| $this->ldap->hasPagedResultSupport();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __destruct() {
|
public function __destruct() {
|
||||||
|
@ -146,10 +141,6 @@ class Connection extends LDAPUtility {
|
||||||
$this->readConfiguration();
|
$this->readConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
if($name === 'hasPagedResultSupport') {
|
|
||||||
return $this->hasPagedResultSupport;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->configuration->$name;
|
return $this->configuration->$name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -260,7 +260,6 @@ class ConfigAPIController extends OCSController {
|
||||||
* <ldapAttributesForGroupSearch></ldapAttributesForGroupSearch>
|
* <ldapAttributesForGroupSearch></ldapAttributesForGroupSearch>
|
||||||
* <ldapExperiencedAdmin>0</ldapExperiencedAdmin>
|
* <ldapExperiencedAdmin>0</ldapExperiencedAdmin>
|
||||||
* <homeFolderNamingRule></homeFolderNamingRule>
|
* <homeFolderNamingRule></homeFolderNamingRule>
|
||||||
* <hasPagedResultSupport></hasPagedResultSupport>
|
|
||||||
* <hasMemberOfFilterSupport></hasMemberOfFilterSupport>
|
* <hasMemberOfFilterSupport></hasMemberOfFilterSupport>
|
||||||
* <useMemberOfToDetectMembership>1</useMemberOfToDetectMembership>
|
* <useMemberOfToDetectMembership>1</useMemberOfToDetectMembership>
|
||||||
* <ldapExpertUsernameAttr>uid</ldapExpertUsernameAttr>
|
* <ldapExpertUsernameAttr>uid</ldapExpertUsernameAttr>
|
||||||
|
|
|
@ -1007,7 +1007,7 @@ class Group_LDAP extends BackendUtility implements \OCP\GroupInterface, IGroupLD
|
||||||
}
|
}
|
||||||
$search = $this->access->escapeFilterPart($search, true);
|
$search = $this->access->escapeFilterPart($search, true);
|
||||||
$pagingSize = (int)$this->access->connection->ldapPagingSize;
|
$pagingSize = (int)$this->access->connection->ldapPagingSize;
|
||||||
if (!$this->access->connection->hasPagedResultSupport || $pagingSize <= 0) {
|
if ($pagingSize <= 0) {
|
||||||
return $this->getGroupsChunk($search, $limit, $offset);
|
return $this->getGroupsChunk($search, $limit, $offset);
|
||||||
}
|
}
|
||||||
$maxGroups = 100000; // limit max results (just for safety reasons)
|
$maxGroups = 100000; // limit max results (just for safety reasons)
|
||||||
|
|
|
@ -206,12 +206,6 @@ interface ILDAPWrapper {
|
||||||
* */
|
* */
|
||||||
public function areLDAPFunctionsAvailable();
|
public function areLDAPFunctionsAvailable();
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks whether PHP supports LDAP Paged Results
|
|
||||||
* @return bool true if it the case, false otherwise
|
|
||||||
* */
|
|
||||||
public function hasPagedResultSupport();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether the submitted parameter is a resource
|
* Checks whether the submitted parameter is a resource
|
||||||
* @param resource $resource the resource variable to check
|
* @param resource $resource the resource variable to check
|
||||||
|
|
|
@ -238,16 +238,6 @@ class LDAP implements ILDAPWrapper {
|
||||||
return function_exists('ldap_connect');
|
return function_exists('ldap_connect');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks whether PHP supports LDAP Paged Results
|
|
||||||
* @return boolean if it the case, false otherwise
|
|
||||||
* */
|
|
||||||
public function hasPagedResultSupport() {
|
|
||||||
$hasSupport = function_exists('ldap_control_paged_result')
|
|
||||||
&& function_exists('ldap_control_paged_result_response');
|
|
||||||
return $hasSupport;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether the submitted parameter is a resource
|
* Checks whether the submitted parameter is a resource
|
||||||
* @param Resource $resource the resource variable to check
|
* @param Resource $resource the resource variable to check
|
||||||
|
|
Loading…
Reference in New Issue