From 16b7df8397829493aa0b02518f237f9ef7cf09b5 Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Mon, 6 Dec 2010 11:31:58 +0000 Subject: [PATCH] ITS#6625 Remove some LDAP_R_COMPILEs --- libraries/libldap/gssapi.c | 8 ++------ libraries/libldap/tls2.c | 12 ++---------- libraries/libldap/tls_g.c | 20 ++++---------------- libraries/libldap/tls_m.c | 20 ++++---------------- libraries/libldap/tls_o.c | 16 +++------------- 5 files changed, 15 insertions(+), 61 deletions(-) diff --git a/libraries/libldap/gssapi.c b/libraries/libldap/gssapi.c index 7e9a4406c8..faa43ba45e 100644 --- a/libraries/libldap/gssapi.c +++ b/libraries/libldap/gssapi.c @@ -664,9 +664,7 @@ ldap_int_gss_spnego_bind_s( LDAP *ld ) gss_buffer_desc input_token, output_token = GSS_C_EMPTY_BUFFER; struct berval cred, *scred = NULL; -#ifdef LDAP_R_COMPILE - ldap_pvt_thread_mutex_lock( &ldap_int_gssapi_mutex ); -#endif + LDAP_MUTEX_LOCK( &ldap_int_gssapi_mutex ); /* get information from RootDSE entry */ rc = ldap_gssapi_get_rootdse_infos ( ld, &mechlist, @@ -784,9 +782,7 @@ gss_error: (ret_mech != GSS_C_NO_OID ? ret_mech : req_mech ), gss_rc, minor_status ); rc_error: -#ifdef LDAP_R_COMPILE - ldap_pvt_thread_mutex_unlock( &ldap_int_gssapi_mutex ); -#endif + LDAP_MUTEX_UNLOCK( &ldap_int_gssapi_mutex ); LDAP_FREE( mechlist ); LDAP_FREE( ldapServiceName ); LDAP_FREE( dnsHostName ); diff --git a/libraries/libldap/tls2.c b/libraries/libldap/tls2.c index 91ca8d8bb8..f258bbbd53 100644 --- a/libraries/libldap/tls2.c +++ b/libraries/libldap/tls2.c @@ -37,10 +37,6 @@ #include "ldap-tls.h" -#ifdef LDAP_R_COMPILE -#include -#endif - static tls_impl *tls_imp = &ldap_int_tls_impl; #define HAS_TLS( sb ) ber_sockbuf_ctrl( sb, LBER_SB_OPT_HAS_IO, \ (void *)tls_imp->ti_sbio ) @@ -269,13 +265,9 @@ ldap_pvt_tls_init_def_ctx( int is_server ) { struct ldapoptions *lo = LDAP_INT_GLOBAL_OPT(); int rc; -#ifdef LDAP_R_COMPILE - ldap_pvt_thread_mutex_lock( &tls_def_ctx_mutex ); -#endif + LDAP_MUTEX_LOCK( &tls_def_ctx_mutex ); rc = ldap_int_tls_init_ctx( lo, is_server ); -#ifdef LDAP_R_COMPILE - ldap_pvt_thread_mutex_unlock( &tls_def_ctx_mutex ); -#endif + LDAP_MUTEX_UNLOCK( &tls_def_ctx_mutex ); return rc; } diff --git a/libraries/libldap/tls_g.c b/libraries/libldap/tls_g.c index f5076cdb99..e613b80c4f 100644 --- a/libraries/libldap/tls_g.c +++ b/libraries/libldap/tls_g.c @@ -41,10 +41,6 @@ #include "ldap-int.h" #include "ldap-tls.h" -#ifdef LDAP_R_COMPILE -#include -#endif - #include #include #include @@ -257,13 +253,9 @@ static void tlsg_ctx_ref( tls_ctx *ctx ) { tlsg_ctx *c = (tlsg_ctx *)ctx; -#ifdef LDAP_R_COMPILE - ldap_pvt_thread_mutex_lock( &c->ref_mutex ); -#endif + LDAP_MUTEX_LOCK( &c->ref_mutex ); c->refcount++; -#ifdef LDAP_R_COMPILE - ldap_pvt_thread_mutex_unlock( &c->ref_mutex ); -#endif + LDAP_MUTEX_UNLOCK( &c->ref_mutex ); } static void @@ -274,13 +266,9 @@ tlsg_ctx_free ( tls_ctx *ctx ) if ( !c ) return; -#ifdef LDAP_R_COMPILE - ldap_pvt_thread_mutex_lock( &c->ref_mutex ); -#endif + LDAP_MUTEX_LOCK( &c->ref_mutex ); refcount = --c->refcount; -#ifdef LDAP_R_COMPILE - ldap_pvt_thread_mutex_unlock( &c->ref_mutex ); -#endif + LDAP_MUTEX_UNLOCK( &c->ref_mutex ); if ( refcount ) return; #ifdef HAVE_CIPHERSUITES diff --git a/libraries/libldap/tls_m.c b/libraries/libldap/tls_m.c index 62d0f7792d..7d5e37e20f 100644 --- a/libraries/libldap/tls_m.c +++ b/libraries/libldap/tls_m.c @@ -42,10 +42,6 @@ #include "ldap-int.h" #include "ldap-tls.h" -#ifdef LDAP_R_COMPILE -#include -#endif - #define READ_PASSWORD_FROM_STDIN #define READ_PASSWORD_FROM_FILE @@ -1772,13 +1768,9 @@ static void tlsm_ctx_ref( tls_ctx *ctx ) { tlsm_ctx *c = (tlsm_ctx *)ctx; -#ifdef LDAP_R_COMPILE - ldap_pvt_thread_mutex_lock( &c->tc_refmutex ); -#endif + LDAP_MUTEX_LOCK( &c->tc_refmutex ); c->tc_refcnt++; -#ifdef LDAP_R_COMPILE - ldap_pvt_thread_mutex_unlock( &c->tc_refmutex ); -#endif + LDAP_MUTEX_UNLOCK( &c->tc_refmutex ); } static void @@ -1789,13 +1781,9 @@ tlsm_ctx_free ( tls_ctx *ctx ) if ( !c ) return; -#ifdef LDAP_R_COMPILE - ldap_pvt_thread_mutex_lock( &c->tc_refmutex ); -#endif + LDAP_MUTEX_LOCK( &c->tc_refmutex ); refcount = --c->tc_refcnt; -#ifdef LDAP_R_COMPILE - ldap_pvt_thread_mutex_unlock( &c->tc_refmutex ); -#endif + LDAP_MUTEX_UNLOCK( &c->tc_refmutex ); if ( refcount ) return; if ( c->tc_model ) diff --git a/libraries/libldap/tls_o.c b/libraries/libldap/tls_o.c index d70d7b88f3..b9474fa9ff 100644 --- a/libraries/libldap/tls_o.c +++ b/libraries/libldap/tls_o.c @@ -37,10 +37,6 @@ #include "ldap-int.h" #include "ldap-tls.h" -#ifdef LDAP_R_COMPILE -#include -#endif - #ifdef HAVE_OPENSSL_SSL_H #include #include @@ -1214,14 +1210,10 @@ tlso_tmp_dh_cb( SSL *ssl, int is_export, int key_length ) int i; /* Do we have params of this length already? */ -#ifdef LDAP_R_COMPILE - ldap_pvt_thread_mutex_lock( &tlso_dh_mutex ); -#endif + LDAP_MUTEX_LOCK( &tlso_dh_mutex ); for ( p = tlso_dhparams; p; p=p->next ) { if ( p->keylength == key_length ) { -#ifdef LDAP_R_COMPILE - ldap_pvt_thread_mutex_unlock( &tlso_dh_mutex ); -#endif + LDAP_MUTEX_UNLOCK( &tlso_dh_mutex ); return p->param; } } @@ -1254,9 +1246,7 @@ tlso_tmp_dh_cb( SSL *ssl, int is_export, int key_length ) } } -#ifdef LDAP_R_COMPILE - ldap_pvt_thread_mutex_unlock( &tlso_dh_mutex ); -#endif + LDAP_MUTEX_UNLOCK( &tlso_dh_mutex ); return dh; } -- 2.39.5