I would like to propose a patch to the OpenLDAP
C APIs to support the operation thread safe features
described in the draft-zeilenga-ldap-c-api-concurrency
drafts.

The enhancements add upwardly compatible interfaces
and should have no behavioral regressions w.r.t. any
existing libldap interfaces.

The new concurrency APIs include:
    ldap_dup and ldap_destroy

They are described in more detail in the concurrency draft
and in the applicable man paged.  The related feature
options are also provided.

Additionally I would like to propose 1 new public error API
    ldap_get_lderror
which returns all three ldap_get_option results:
  LDAP_OPT_MATCHED_DN
  LDAP_OPT_DIAGNOSTIC_MESSAGE
  LDAP_OPT_RESULT_CODE
in a single API, and 1 new depreciated public API:
   ldap_get_lderrno
which performs almost the same function as ldap_get_error
but does so in a mt-unsafe manner, but that is compatible with
Mozilla's libldap API of the same name.

The point of the two new error APIs is to provide a transition
path from Mozilla libldap users that still use ldap_get_lderrno to either
a similar API that obeys OpenLDAP like practices (ldap_get_error)
or as a transition until any existing code can be converted away from
ldap_get_lderrno to just using ldap_get_options as needed.

The patch includes a new test case to test the new functionality
and man pages.

The new test case needs additional work for some
of the threading models.  Any input here is requested, since
I do not have testing resources for all the threading combination
and do not have the ability to test the Windows model.

I am looking forward to any and all comments.

I plan to submit a formal ITS with a finalized version of changes once
any and all issues are thrashed out and resolved to a level that
they are acceptable for integration.

Just for the record:

This patch file is derived from OpenLDAP Software. All of the modifications to
OpenLDAP Software represented in the following patch(es) were developed
by Oracle Corporation.
Oracle Corporation has not assigned rights and/or
interest in this work to any party. I, Douglas Leavitt am authorized by
Oracle Corporation,
my employer, to release this work under the following terms.



The initial version of my proposed patch can be found here:

http://cr.opensolaris.org/~djl/openldap-codereview

This includes a
    diff -U of the full patch (/diffU)

    a webrev diff  (/webrev) for on-line review

    and a tar ball image of the OpenLDAP HEAD as of 8/13/10
      with the current patch applied.


Thank you for you consideration, and I look forward
to any and all comments.

Doug Leavitt