summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2008-02-28 20:01:57 +0000
committerthomascube <thomas@roundcube.net>2008-02-28 20:01:57 +0000
commit72c7226558c954e5bdac0ab363d7b3f4542a5296 (patch)
treee44aa1323b9f43b015277cceec66c4852bd21770
parente01cfe970857c7db03fe5f331b0b782a72f20735 (diff)
Applied patch by Emanuele Rocca to make LDAP filters work with or without brackets
-rw-r--r--program/include/rcube_ldap.inc5
1 files changed, 4 insertions, 1 deletions
diff --git a/program/include/rcube_ldap.inc b/program/include/rcube_ldap.inc
index 608365269..29e7faa6b 100644
--- a/program/include/rcube_ldap.inc
+++ b/program/include/rcube_ldap.inc
@@ -285,9 +285,12 @@ class rcube_ldap
}
$filter .= ')';
+ // avoid double-wildcard if $value is empty
+ $filter = preg_replace('/\*+/', '*', $filter);
+
// add general filter to query
if (!empty($this->prop['filter']))
- $filter = '(&('.$this->prop['filter'] .')' . $filter . ')';
+ $filter = '(&(' . preg_replace('/^\(|\)$/', '', $this->prop['filter']) . ')' . $filter . ')';
// set filter string and execute search
$this->set_search_set($filter);