# LDAP search filter for Thunderbird and Zimbra

When configuring an LDAP addressbook, one thing that has given me a lot of trouble, is the LDAP filter. Here are two I use.

For thunderbird:

(|(cn=%v*)(mail=%v*)(sn=%v*)(displayName=%v*)(givenName=%v*))

For Zimbra:

(|(cn=%s*)(mail=%s*)(sn=%s*)(displayName=%s*)(givenName=%s*))

In Zimbra, I had to configure our ruby-ldapserver to never return more than 50 results, because in the configuration panel, it runs a test based on a search query which goes fine, but it does another query with the %s literally repeated. This causes the SQL condition that is generated to be %s% and that gives a whole lot of results, hanging Zimbra. It is beyond me why Zimbra runs this second query, but I guess it’s a bug.