Opened 5 years ago

Closed 5 years ago

#1484823 closed Bugs (fixed)

LDAP patch to remove double wildcards

Reported by: till Owned by:
Priority: 5 Milestone: 0.1-stable
Component: PHP backend Version: git-master
Severity: normal Keywords: ldap
Cc:

Description

--- program/include/rcube_ldap.inc      (revision 1141)
+++ program/include/rcube_ldap.inc      (working copy)
@@ -284,10 +284,16 @@
          $filter .= "($f=$wc" . rcube_ldap::quote_string($value) . "$wc)";
    }
    $filter .= ')';
+
+    // avoid double-wildcard if $values is empty
+    $filter = preg_replace('/\*+/', '*', $filter);

    // add general filter to query
-    if (!empty($this->prop['filter']))
+    if (!empty($this->prop['filter'])) {
+      // remove trailing brackets
+      $this->prop['filter'] = preg_replace('/^\(|\)$/', '', $this->prop['filter']);
      $filter = '(&('.$this->prop['filter'] .')' . $filter . ')';
+    }

    // set filter string and execute search
    $this->set_search_set($filter);

Patch by Roy McMorran?, revised by Emanuele Rocca,

Change History (1)

comment:1 Changed 5 years ago by thomasb

  • Component changed from Client to PHP backend
  • Resolution set to fixed
  • Status changed from new to closed

Already committed to trunk in [72c72265]

Note: See TracTickets for help on using tickets.