[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Wrapping ldap_search()

At 06:39 PM 1/10/2006, Dave Horsfall wrote:
>Is it possible to extract some sort of session ID from the LDAP handle, 
>which can be matched up against SLAPD's log?  I understand that this can 
>(and will) change between releases, but I can wear that.

You can use ldap_get_option(..., LDAP_OPT_DESC, ...) to extract
the underlying socket descriptor and from that obtain the
local and remote IP/port pairs that identify the TCP stream.
You can then match up this information with slapd's logs
(IIRC, we do log local/remove IP/port pairs on accept).

>As an aside, in <ldap.h> I can see where "LDAP" is typedef'd, but where is 
>the structure itself defined?  It's certainly well hidden :-)

It's define in an internal header, libraries/libldap/ldap-int.h.
You should, of course, avoid including this header by using
an accessor function such as ldap_get_option.  If there is
something you need which cannot be accessed thru an accessor
function, you should extend it to avoid violating the wall.