From: Howard Chu Date: Wed, 25 Feb 2009 10:14:00 +0000 (+0000) Subject: Don't call NSS_Shutdown if someone else init'd the library X-Git-Tag: ACLCHECK_0~785 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=64884e7c6c25b5ad16f1c944a412533eae0c4fb5;p=openldap Don't call NSS_Shutdown if someone else init'd the library --- diff --git a/libraries/libldap/tls_m.c b/libraries/libldap/tls_m.c index 93ab4ae0c6..bd9fdcdc44 100644 --- a/libraries/libldap/tls_m.c +++ b/libraries/libldap/tls_m.c @@ -61,6 +61,8 @@ static const PRIOMethods tlsm_PR_methods; extern tls_impl ldap_int_tls_impl; +static int tslm_did_init; + #ifdef LDAP_R_COMPILE static void @@ -81,6 +83,8 @@ tlsm_init( void ) tlsm_layer_id = PR_GetUniqueIdentity("OpenLDAP"); if ( !NSS_IsInitialized() ) { + tlsm_did_init = 1; + NSS_NoDB_Init(""); NSS_SetDomesticPolicy(); @@ -97,7 +101,12 @@ tlsm_init( void ) static void tlsm_destroy( void ) { - NSS_Shutdown(); + /* Only if we did the actual initialization */ + if ( tlsm_did_init ) { + tlsm_did_init = 0; + + NSS_Shutdown(); + } PR_Cleanup(); }