summaryrefslogtreecommitdiff
path: root/roundcubemail/program/include/rcube_ldap.php
diff options
context:
space:
mode:
authorthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-10-19 15:56:20 +0000
committerthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-10-19 15:56:20 +0000
commit62f44725a8b0a91dc37eb8e76ed3017fc2ca41de (patch)
treec9b1bb6aaacceff38b7102fbfab55b7f084178b2 /roundcubemail/program/include/rcube_ldap.php
parente4c46b31c8ebbb0297634687d5658c32b40344ee (diff)
Add (experimental) support for some extendted PHP LDAP functions when querying VLV enabled directories
git-svn-id: https://svn.roundcube.net/trunk@5356 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include/rcube_ldap.php')
-rw-r--r--roundcubemail/program/include/rcube_ldap.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/roundcubemail/program/include/rcube_ldap.php b/roundcubemail/program/include/rcube_ldap.php
index 1f03e1500..21fd6013c 100644
--- a/roundcubemail/program/include/rcube_ldap.php
+++ b/roundcubemail/program/include/rcube_ldap.php
@@ -1151,7 +1151,7 @@ class rcube_ldap extends rcube_addressbook
$this->vlv_count += $counts[$j]['numsubordinates'][0];
$this->_debug("D: total numsubordinates = " . $this->vlv_count);
}
- else // ...or by fetching all records dn and count them
+ else if (!function_exists('ldap_parse_virtuallist_control')) // ...or by fetching all records dn and count them
$this->vlv_count = $this->_exec_search(true);
$this->vlv_active = $this->_vlv_set_controls($this->prop, $this->list_page, $this->page_size);
@@ -1162,9 +1162,17 @@ class rcube_ldap extends rcube_addressbook
if ($this->ldap_result = @$function($this->conn, $this->base_dn, $filter,
$attrs, 0, (int)$this->prop['sizelimit'], (int)$this->prop['timelimit']))
{
+ // when running on a patched PHP we can use the extended functions to retrieve the total count from the LDAP search result
+ if ($this->vlv_active && function_exists('ldap_parse_virtuallist_control') &&
+ ldap_parse_result($this->conn, $this->ldap_result, $errcode, $matcheddn, $errmsg, $referrals, $serverctrls)) {
+ ldap_parse_virtuallist_control($this->conn, $serverctrls, $last_offset, $this->vlv_count, $vresult);
+ $this->_debug("S: VLV result: last_offset=$last_offset; content_count=$this->vlv_count");
+ }
+
$this->_debug("S: ".ldap_count_entries($this->conn, $this->ldap_result)." record(s)");
if ($err = ldap_errno($this->conn))
$this->_debug("S: Error: " .ldap_err2str($err));
+
return $count ? ldap_count_entries($this->conn, $this->ldap_result) : true;
}
else