From: Ludovico M. <lu...@as...> - 2003-03-23 19:14:21
|
As suggested by Michael Ströder, I am expanding a bit on my RFE for adding ldap_count_entries support. I am working for a large Italian bank (don't look at my email, I'm posting from my personal address from home), and we have all our organizational units (a few thousands) and employees (around 60k) on a few OpenLDAP servers. We have the need to extract data from OpenLDAP and manipulate it to create sets of xml files representing a hierarchical view of our organization. We are currently doing this with a set of C programs developed in house, but due to the number of rules we have to apply and the rate at which they change I'm trying to switch the processing from C to Python (the fact that I love Python and the other people working on this project do not is important too, I'm trying to convince them to learn it =)). 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. Retrieving employees for every ou takes too long, I only need a count. Our current C programs use ldap_count_entries. My current options are staying with C, or using PHP which imho is a very poor choice compared to Python. Unfortunately I don't know C/C++ enough to help, and as I said the other developers don't consider Python a choice and won't help (yes, I tried asking.....). Thanks for any help Ludovico Magnocavallo |
From: <mi...@st...> - 2003-03-23 19:42:44
|
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. |
From: <mi...@st...> - 2003-03-23 19:58:02
|
Michael Str=F6der wrote: >=20 > From the examples I saw OpenLDAP's ldap_count_entries() is typically=20 > used right before ldap_first_entry(). Is that right? Does=20 > ldap_count_entries() consume anything from the results returned? >=20 > Unfortunately the call of ldap_first_entry() in python-ldap is hidden i= n=20 > LDAPmessage_to_python() (see Modules/message.c) which in turn is called= =20 > by the already overloaded l_ldap_result() (see Modules/LDAPObject.c).=20 > Changing anything here would result in a incompatible API change. To rephrase my answer: Unfortunately ldap_count_entries() has to be calle= d=20 *after* ldap_result() and *before* ldap_first_entry(). > Now if ldap_count_entries() does not consume anything from the results = > returned we could try to implement a solution for the following=20 > (fictious) Python code using async search: Forget about that. Ciao, Michael. |
From: <mi...@st...> - 2003-03-24 01:46:54
|
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. Retrieving employees > for every ou takes too long, I only need a count. Our current C programs use > ldap_count_entries. After looking into RFC 2251, man-page of ldap_count_entries and draft-ietf-ldapext-ldap-c-api I have some doubts that ldap_count_entries() can count *all* results of search without actually receiving *all* the results. I'd really like to see some snippets of your C code. Especially the parameters you pass to ldap_result(). Ciao, Michael. |