LDAP filter boolean expression maximum number of arguments

1k views Asked by At

I was writing a small test case to see what's more efficient, multiple small queries or a single big query, when I encountered this limitation.

The query looks like this:

(| (clientid=1) (clientid=2) (clientid=3) ...)

When the number of clients goes beyond 2103 ?! the LDAP server throws an error:

error code 1 - Operations Error

As far as I can tell the actual filter string length does not matter ~69KB (at least for Microsoft AD the length limit is 10MB). I tried with longer attribute names and got the same strange limit: 2103 operands

  1. Does anyone have more information about this limitation?
  2. Is this something specified in the LDAP protocol specification or is it implementation specific?
  3. Is it configurable?

I tested this against IBM Tivoli Directory Server V6.2 using both the UnboundID and JNDI Java libraries.

1

There are 1 answers

0
Bora On

It cannot be more than 8099 characters. See http://www-01.ibm.com/support/docview.wss?uid=swg21295980

Also, what you are doing is not a good practice. If there are common attributes these entries share (e.g., country code, department number, location, etc.), try to retrieve the results using common criteria given you by those attributes. If not, divide your search filter into smaller ones each of which is with few predicates and execute multiple searches. It depends the programming language you're using to do this, but try to execute each search in a separate thread to speed up your data retrieval process.