Hi Folks,
I'm currently making my first steps into overlay development using
OpenLDAP 2.4.15. Digging into some already existing overlays was very
helpful. Thanks to the nice work!
My sample overlay is just for personal testing to get some kind of
feeling how to handle the slapd(-overlay) API. All I want to do with my
testing-overlay is to get some kind of datastructure-list of the
attribute names used in the current search-filter.
For example processing the following filter
(&(objectClass=*)(ou=test)(hasSubordinates=TRUE)) my overlay's
_search-callback() should print out "objectClass, ou, hasSubordinates".
Of course I could (regexp) string-compare the filterstr contained in
struct Filter but I thought there has to be a more slapd-API'ic way
available. After browsing through the mailinglist and various
openldap-source files my perhabs silly question is:
Is there some kind of Attribute-list (Attribute *) datastructure
available that can be traversed (in a more linear way) getting the
attributes (and might be the corresponding search-patterns used in a
search-filter statement? By linaer I mean some kind of (pseudo-code):
Attribute attr;
for(attr=filter->attrs;attr;attr=attrs->next;) {
attr->a_desc...
...
}
All I've seen so far is struct Filter with it's "filterstr" (char *) and
its various pointers to f_desc, f_av_desc, f_and, f_or, f_list and so
on. I've also had a look into function "test_filter()" and into
translucent-overlay search-callback, both use switch-case constructions
to strip (complex) filter-strings (struct Filter) into atoms. I think
that's nearly what I would need - again. ;-)
Because the filter atomization has already been done during
filter-processing my actual intention is to avoid coding (90%
copy&paste) the nearly same filter-processing mechanism into my own
overlay's _search()-callback in favor to use a might be already
existing datastructure.
In the moment I'm in doubt splitting the search filter twice could not
be very elegant nor very efficient regarding the resulting
performance... Probably I've not understood the overlay-processing and
datastructures correct, thus I'm looking forward to your advice, hints
and help.
Thanks a lot!
Cheers
Daniel