* Roy McMorran <[EMAIL PROTECTED]>, [2008-02-22 16:30 -0500]:
> When compose calls the LDAP search function (to build the auto-complete
> list) it passes an empty '$value' parameter. In this case, when all the
> bits of the filter get concatenated you end up with something like this:
>
> (|(mail=**)(cn=**))
>
> which isn't valid syntax (at least it's not on my LDAP server).
>
> Here's a tiny patch to rcube_ldap.inc that eliminates the double
> wildcards. There may be a better way to do it, but this was simple.
I can confirm that your patch works properly.
I've extended it to also fix the general filter problem we discussed
some days ago:
--- 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);
ciao,
ema
_______________________________________________
List info: http://lists.roundcube.net/dev/