Opened 3 years ago

Closed 3 years ago

#1486544 closed Feature Patches (fixed)

Enable sizelimit and timelimit in LDAP

Reported by: jarbas.junior Owned by:
Priority: 5 Milestone: 0.4-beta
Component: LDAP connection Version: 0.3.1
Severity: major Keywords: OpenLDAP
Cc:

Description

My organization have a OpenLDAP with severals entries (80,000) and a search in OpenLDAP must have a limit for performance.

Its easy.

In the config/main.inc.php add the following lines:

  'sizelimit'     => '0',     // Enables you to limit the count of entries fetched. Setting this to 0 means no limit.
  'timelimit'     => '0',     // Sets the number of seconds how long is spend on the search. Setting this to 0 means no limit. 

In then program/include/rcube_ldap.php alter the following line:

if ($this->ldap_result = @$function($this->conn, $this->prop['base_dn'], $filter, array_values($this->fieldmap), 0, 0 )) {

with the line:

if ($this->ldap_result = @$function($this->conn, $this->prop['base_dn'], $filter, array_values($this->fieldmap), 0, $this->prop['sizelimit'], $this->prop['timelimit'] )) {

Change History (3)

comment:1 Changed 3 years ago by jarbas.junior

  • Milestone changed from later to 0.4-beta
  • Severity changed from normal to major

The diffs are:

Index: config/main.inc.php.dist
===================================================================
--- config/main.inc.php.dist    (revisão 3417)
+++ config/main.inc.php.dist    (cópia de trabalho)
@@ -379,6 +379,8 @@
   'firstname_field' => 'gn',  // this field represents the contact's first name
   'sort'          => 'cn',    // The field to sort the listing by.
   'scope'         => 'sub',   // search mode: sub|base|list
+  'sizelimit'     => '100',   // Enables you to limit the count of entries fetched. Setting this to 0 means no limit.
+  'timelimit'     => '0',     // Sets the number of seconds how long is spend on the search. Setting this to 0 means no limit.
   'filter'        => '',      // used for basic listing (if not empty) and will be &'d with search queries. example: status=act
   'fuzzy_search'  => true);   // server allows wildcard search
 */

and

Index: program/include/rcube_ldap.php
===================================================================
--- program/include/rcube_ldap.php      (revisão 3417)
+++ program/include/rcube_ldap.php      (cópia de trabalho)
@@ -627,7 +627,7 @@
 
       $this->_debug("C: Search [".$filter."]");
 
-      if ($this->ldap_result = @$function($this->conn, $this->prop['base_dn'], $filter, array_values($this->fieldmap), 0, 0)) {
+      if ($this->ldap_result = @$function($this->conn, $this->prop['base_dn'], $filter, array_values($this->fieldmap), 0, $this->prop['sizelimit'], $this->prop['timelimit'] )) {
         $this->_debug("S: ".ldap_count_entries($this->conn, $this->ldap_result)." record(s)");
         return true;
       } else

comment:2 Changed 3 years ago by jarbas.junior

Have a similar ticket at #1486428

comment:3 Changed 3 years ago by alec

  • Resolution set to fixed
  • Status changed from new to closed

Applied in [93c01888].

Note: See TracTickets for help on using tickets.