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

Re: ldap_destroy() vs. ldap_unbind()



--On Monday, July 15, 2019 6:07 PM +0200 Edgar Fuß <ef@math.uni-bonn.de> wrote:

Hello.

I'm sorry if this is a silly question, but the only thing close to an
answer I could find is from a post of Hallvard B Furuseth to this list
(pre-dating the actual ldap_destroy() introduction) stating that
ldap_unbind() was mis-named and should have been called ldap_destroy().

The question is whether to use ldap_destroy() or ldap_unbind().
More precisely, the question is which one is preferable in a
single-threaded application that never calls ldap_dup().

From reading the man page of ldap_dup()/ldap_destroy() and above
mentioned post, I would get the impression that technichally, it doesn't
matter, so I would gess ldap_unbind() to be slightly preferable because
it works with pre-2.4.24 OpenLDAP.

However, proposing such an adjustment
(https://redmine.lighttpd.net/issues/2849 in case anyone cares[*]) was
vigorously turned down stating I didn't know what I was talking about so
I might be missing something.

2.4.24 was released in 2011. I think it's completely reasonable to have current releases of a piece of software use an API that's 8 years old. Additionally, ldap_destroy() is clearly documented as the thread safe way in which to destroy an LDAP filehandle.

Additionally, if you dig into the code base itself, you will find that both functions end up doing the same thing in the end -- calling the ldap_ld_free() function.

Regards,
Quanah

--

Quanah Gibson-Mount
Product Architect
Symas Corporation
Packaged, certified, and supported LDAP solutions powered by OpenLDAP:
<http://www.symas.com>