From 72c7226558c954e5bdac0ab363d7b3f4542a5296 Mon Sep 17 00:00:00 2001 From: thomascube Date: Thu, 28 Feb 2008 20:01:57 +0000 Subject: Applied patch by Emanuele Rocca to make LDAP filters work with or without brackets --- program/include/rcube_ldap.inc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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); -- cgit v1.2.3