From: Kurt Zeilenga Date: Sun, 25 Apr 2004 04:37:19 +0000 (+0000) Subject: Fail if default context is already initialized X-Git-Tag: OPENDLAP_REL_ENG_2_2_MP~435 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b0830a744f751e738f1569e9215f6d34cfb55161;p=openldap Fail if default context is already initialized --- diff --git a/libraries/libldap/tls.c b/libraries/libldap/tls.c index 391f342754..d80ada1df0 100644 --- a/libraries/libldap/tls.c +++ b/libraries/libldap/tls.c @@ -157,8 +157,7 @@ ldap_pvt_tls_init( void ) { static int tls_initialized = 0; - if ( tls_initialized ) return 0; - tls_initialized = 1; + if ( tls_initialized++ ) return 0; #ifdef HAVE_EBCDIC { @@ -197,6 +196,21 @@ ldap_pvt_tls_init_def_ctx( void ) char *certfile = tls_opt_certfile; char *keyfile = tls_opt_keyfile; + static int ctx_initialized = 0; + + if ( ctx_initialized++ ) { +#ifdef NEW_LOGGING + LDAP_LOG ( TRANSPORT, ERR, "ldap_pvt_tls_init_def_ctx: " + "TLS default ctx already initialized.\n", + 0, 0, 0 ); +#else + Debug( LDAP_DEBUG_ANY, + "TLS: default ctx already initialized.\n", + 0, 0, 0); +#endif + return 1; + } + #ifdef HAVE_EBCDIC /* This ASCII/EBCDIC handling is a real pain! */ if ( ciphersuite ) {