async.LDIFWriter

Michael Ströder michael at stroeder.com
Mon May 26 07:50:55 CEST 2003


Andrew Thomson wrote:
 > It's great to be able to crank out the ldiff data from a running tree
 > using async.LDIFWriter
 >
 > When we do this,
 >
 > s = ldap.async.LDIFWriter(
 >    ldap.initialize('ldap://localhost:389'),
 >
 > is it possible to incorporate bind details??

import ldap,ldap.async

f = open('results.ldif','w')
l = ldap.initialize('ldap://localhost:389')
l.protocol_version = ldap.VERSION3
l.simple_bind_s('cn=Directory Manager','top secret')
s = ldap.async.LDIFWriter(l,f)
s.startSearch('dc=example,dc=com',ldap.SCOPE_SUBTREE,'(objectClass=*)')
s.processResults()

Note that this will write the entries in the order they are returned from 
the server. This is not necessarily the right tree order.

 > ie, so I can log in as the
 > directory manager and not be restricted by the SIZELIMIT_EXCEEDED

This is a matter of the LDAP server implementation. If the server does not 
impose any search limits for 'cn=Directory Manager' in the example above you 
will be able to retrieve all results.

Ciao, Michael.



More information about the python-ldap mailing list