Feature Requests item #707547 (ldap_count_entries)

Michael Ströder michael at stroeder.com
Sun Mar 23 20:42:32 CET 2003


Ludovico,

1. as I said on this list many times C programmers are needed for 
python-ldap to extend the C extension stuff under Modules/. Are you willing 
to contribute?

2. If you are willing to contribute to python-ldap please bring your local 
CVS tree in sync.

Ludovico Magnocavallo wrote:
> 
> I'm stuck at trying to generate employee count for each ou, and here's where
> I got to asking to add support for ldap_count_entries.

 From the examples I saw OpenLDAP's ldap_count_entries() is typically used 
right before ldap_first_entry(). Is that right? Does ldap_count_entries() 
consume anything from the results returned?

Unfortunately the call of ldap_first_entry() in python-ldap is hidden in 
LDAPmessage_to_python() (see Modules/message.c) which in turn is called by 
the already overloaded l_ldap_result() (see Modules/LDAPObject.c). Changing 
anything here would result in a incompatible API change.

Now if ldap_count_entries() does not consume anything from the results 
returned we could try to implement a solution for the following (fictious) 
Python code using async search:

# Start async search, save message ID returned by OpenLDAP API
msgid = l.search(...)
# Get number of entries in search result
entry_count = l.count_entries(msgid)
# Get number of search continuations in search result
ref_count = l.count_references(msgid)
# Get the search results
res = l.result(msgid)

Does that look sensible to you?

> Unfortunately I don't know C/C++ enough to help,

Welcome to the club... :-(

Ciao, Michael.






More information about the python-ldap mailing list