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

          Issue ID: 9465
           Summary: When compiled in debug mode ldap_get_option asserts
                    breaking API compatibility
           Product: OpenLDAP
           Version: unspecified
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: ---
         Component: libraries
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

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.

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

Reply via email to