https://bugs.openldap.org/show_bug.cgi?id=9952
Matthew Hardin mhardin@symas.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|VERIFIED |CONFIRMED Resolution|FIXED |---
--- Comment #12 from Matthew Hardin mhardin@symas.com --- This bug is still in evidence as of 2.6.8 under Windows/MSYS2/UCRT64. slapd and slaptools all dump core on exit. Applying the below patch, which is supposed to be obsolete, fixes the problem, so there's still more work to do here.
Subject: [PATCH] ITS#9952 libldap: use atexit for TLS teardown
--- libraries/libldap/init.c | 3 --- libraries/libldap/tls2.c | 14 +++++++++++++- 2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/libraries/libldap/init.c b/libraries/libldap/init.c index 3a81790dcf..b9915533bd 100644 --- a/libraries/libldap/init.c +++ b/libraries/libldap/init.c @@ -544,9 +544,6 @@ ldap_int_destroy_global_options(void) gopts->ldo_def_sasl_authcid = NULL; } #endif -#ifdef HAVE_TLS - ldap_int_tls_destroy( gopts ); -#endif }
/* diff --git a/libraries/libldap/tls2.c b/libraries/libldap/tls2.c index dff845bc10..4bfc346c70 100644 --- a/libraries/libldap/tls2.c +++ b/libraries/libldap/tls2.c @@ -160,6 +160,14 @@ ldap_pvt_tls_destroy( void ) tls_imp->ti_tls_destroy(); }
+static void +ldap_exit_tls_destroy( void ) +{ + struct ldapoptions *lo = LDAP_INT_GLOBAL_OPT(); + + ldap_int_tls_destroy( lo ); +} + /* * Initialize a particular TLS implementation. * Called once per implementation. @@ -168,6 +176,7 @@ static int tls_init(tls_impl *impl, int do_threads ) { static int tls_initialized = 0; + int rc;
if ( !tls_initialized++ ) { #ifdef LDAP_R_COMPILE @@ -183,7 +192,10 @@ tls_init(tls_impl *impl, int do_threads ) #endif }
- return impl->ti_tls_init(); + rc = impl->ti_tls_init(); + + atexit( ldap_exit_tls_destroy ); + return rc; }