Search sizelimit not working?

Ed . epo001 at hotmail.com
Tue Jun 3 16:06:37 CEST 2003


I want to run a query which will return more results than the server 
permits. If I specify sizelimit to get a fixed and (smaller than server 
limit) amount I get an exception.

Here is a sample program:
import ldap

l = ldap.initialize("ldap://foo.com:389")

l.simple_bind_s(",")

res = "No results"
try:
    res = l.search_ext_s("o=foo.com", ldap.SCOPE_SUBTREE, "sn=jones*", 
sizelimit=5)
    # This prints all results the server permits
    #res = l.search_s("o=foo.com", ldap.SCOPE_SUBTREE, "sn=jones*")
except ldap.LDAPError, e:
    print e
print res


Running this what I'd expect is to get back 5 results, what I get is a size 
limit exceeded exception. If I run the other form of search then I get back 
some 150 results.

What am I doing wrong?

Ed




More information about the python-ldap mailing list