From b24ca75993676e46a307882a0f2d57c4f48e1e59 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Thu, 3 Sep 2020 12:37:32 +0100 Subject: [PATCH] ITS#9201 fix LDAP_THREAD_DEBUG Add missing defs to ldap_thr_debug.h. slap tools must init libldap so internal mutexes get inited. --- libraries/libldap/init.c | 3 +++ libraries/libldap/ldap_thr_debug.h | 8 ++++++++ servers/slapd/slapcommon.c | 2 ++ 3 files changed, 13 insertions(+) diff --git a/libraries/libldap/init.c b/libraries/libldap/init.c index 05a81c554b..93ff9713ee 100644 --- a/libraries/libldap/init.c +++ b/libraries/libldap/init.c @@ -604,6 +604,9 @@ void ldap_int_initialize_global_options( struct ldapoptions *gopts, int *dbglvl gopts->ldo_keepalive_interval = 0; gopts->ldo_keepalive_idle = 0; +#ifdef LDAP_R_COMPILE + ldap_pvt_thread_mutex_init( &gopts->ldo_mutex ); +#endif gopts->ldo_valid = LDAP_INITIALIZED; return; } diff --git a/libraries/libldap/ldap_thr_debug.h b/libraries/libldap/ldap_thr_debug.h index dd47986030..cef2411c05 100644 --- a/libraries/libldap/ldap_thr_debug.h +++ b/libraries/libldap/ldap_thr_debug.h @@ -83,6 +83,7 @@ #define ldap_pvt_thread_cond_broadcast ldap_int_thread_cond_broadcast #define ldap_pvt_thread_cond_wait ldap_int_thread_cond_wait #define ldap_pvt_thread_mutex_init ldap_int_thread_mutex_init +#define ldap_pvt_thread_mutex_recursive_init ldap_int_thread_mutex_recursive_init #define ldap_pvt_thread_mutex_destroy ldap_int_thread_mutex_destroy #define ldap_pvt_thread_mutex_lock ldap_int_thread_mutex_lock #define ldap_pvt_thread_mutex_trylock ldap_int_thread_mutex_trylock @@ -118,6 +119,8 @@ #define ldap_pvt_thread_pool_pause ldap_int_thread_pool_pause #define ldap_pvt_thread_pool_resume ldap_int_thread_pool_resume #define ldap_pvt_thread_pool_destroy ldap_int_thread_pool_destroy +#define ldap_pvt_thread_pool_close ldap_int_thread_pool_close +#define ldap_pvt_thread_pool_free ldap_int_thread_pool_free #define ldap_pvt_thread_pool_getkey ldap_int_thread_pool_getkey #define ldap_pvt_thread_pool_setkey ldap_int_thread_pool_setkey #define ldap_pvt_thread_pool_purgekey ldap_int_thread_pool_purgekey @@ -135,9 +138,11 @@ */ #undef ldap_pvt_thread_pool_destroy #define ldap_pvt_thread_pool_destroy(p,r) ldap_int_thread_pool_destroy(p,r) +#if 0 #define ldap_pvt_thread_pool_close(p,r) ldap_int_thread_pool_close(p,r) #define ldap_pvt_thread_pool_free(p) ldap_int_thread_pool_free(p) #endif +#endif #ifdef LDAP_THREAD_DEBUG_IMPLEMENTATION /* thr_debug.c */ #undef ldap_pvt_thread_mutex_t @@ -156,6 +161,7 @@ #undef ldap_pvt_thread_cond_broadcast #undef ldap_pvt_thread_cond_wait #undef ldap_pvt_thread_mutex_init +#undef ldap_pvt_thread_mutex_recursive_init #undef ldap_pvt_thread_mutex_destroy #undef ldap_pvt_thread_mutex_lock #undef ldap_pvt_thread_mutex_trylock @@ -183,6 +189,8 @@ #undef ldap_pvt_thread_pool_pause #undef ldap_pvt_thread_pool_resume #undef ldap_pvt_thread_pool_destroy +#undef ldap_pvt_thread_pool_close +#undef ldap_pvt_thread_pool_free #undef ldap_pvt_thread_pool_getkey #undef ldap_pvt_thread_pool_setkey #undef ldap_pvt_thread_pool_purgekey diff --git a/servers/slapd/slapcommon.c b/servers/slapd/slapcommon.c index 303c9defb5..1dba2fbd49 100644 --- a/servers/slapd/slapcommon.c +++ b/servers/slapd/slapcommon.c @@ -294,6 +294,8 @@ slap_tool_init( ldif_debug = slap_debug; #endif ldap_syslog = 0; + /* make sure libldap gets init'd */ + ldap_set_option( NULL, LDAP_OPT_DEBUG_LEVEL, &slap_debug ); #ifdef CSRIMALLOC leakfilename = malloc( strlen( progname ) + STRLENOF( ".leak" ) + 1 );