https://bugs.openldap.org/show_bug.cgi?id=9465

Howard Chu <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |TEST
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Howard Chu <[email protected]> ---
(In reply to [email protected] from comment #0)
> In a multi-threaded application, sometimes it is useful
> to use ldap_get_option to get the LDAP_OPT_RESULT_CODE
> of an operation (possibly from a different thread).
> 
> A useful side effect of calling ldap_get_option is that
> if the connection is no longer valid, the API returns
> LDAP_OPT_ERR when compiled without debug per the man page:
> ERRORS
>        On  success,  the  functions  return  LDAP_OPT_SUCCESS,  while they
> may
>        return LDAP_OPT_ERROR to indicate  a  generic  option  handling 
> error.
> ...
> 
> However, if libldap is compiled with debugging enabled the
> same if test throws an assert instead of returning the
> documented error code, changing the behavior of the API.
> 
> Specifically this assert:
> https://git.openldap.org/openldap/openldap/-/blob/master/libraries/libldap/
> options.c#L113
> 
> Compiling in debugging is useful for tracing output
> even in complex production environments but since there
> is no specific libldap API to test for valid LD* the
> seemingly best choice of ldap_get_option breaks in this
> situation.
> 
> It is not clear what the original rational for the assert
> at this specific location was.
> 
> This ITS requests removing the assert so that ldap_get_option
> behaves the same both with and without debugging enabled.

Removed assert. While I agree it served no purpose here,
not sure that the use case makes much sense. What makes the LDAP*
handle invalid? If it's already freed, then accessing the handle
is undefined behavior.

-- 
You are receiving this mail because:
You are on the CC list for the issue.

Reply via email to