mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-24 13:24:56 +08:00
ITS#6672 mutex cleanup
This commit is contained in:
parent
1c9853c674
commit
0b660dc9f6
@ -71,18 +71,14 @@ ldap_abandon_ext(
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_abandon_ext %d\n", msgid, 0, 0 );
|
||||
|
||||
/* check client controls */
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_LOCK( &ld->ld_req_mutex );
|
||||
|
||||
rc = ldap_int_client_controls( ld, cctrls );
|
||||
if ( rc == LDAP_SUCCESS ) {
|
||||
rc = do_abandon( ld, msgid, msgid, sctrls, 1 );
|
||||
}
|
||||
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
|
||||
|
||||
return rc;
|
||||
}
|
||||
@ -115,16 +111,9 @@ ldap_pvt_discard(
|
||||
{
|
||||
int rc;
|
||||
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
|
||||
#endif
|
||||
|
||||
LDAP_MUTEX_LOCK( &ld->ld_req_mutex );
|
||||
rc = do_abandon( ld, msgid, msgid, NULL, 0 );
|
||||
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
|
||||
#endif
|
||||
|
||||
LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -180,13 +169,9 @@ start_again:;
|
||||
/* ldap_msgdelete locks the res_mutex. Give up the req_mutex
|
||||
* while we're in there.
|
||||
*/
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
|
||||
err = ldap_msgdelete( ld, msgid );
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_LOCK( &ld->ld_req_mutex );
|
||||
if ( err == 0 ) {
|
||||
ld->ld_errno = LDAP_SUCCESS;
|
||||
return LDAP_SUCCESS;
|
||||
@ -302,12 +287,10 @@ start_again:;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef LDAP_R_COMPILE
|
||||
/* ld_abandoned is actually protected by the ld_res_mutex;
|
||||
* give up the ld_req_mutex and get the other */
|
||||
ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
|
||||
ldap_pvt_thread_mutex_lock( &ld->ld_res_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
|
||||
LDAP_MUTEX_LOCK( &ld->ld_res_mutex );
|
||||
|
||||
/* use bisection */
|
||||
i = 0;
|
||||
@ -321,10 +304,8 @@ start_again:;
|
||||
ld->ld_errno = LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_unlock( &ld->ld_res_mutex );
|
||||
ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_UNLOCK( &ld->ld_res_mutex );
|
||||
LDAP_MUTEX_LOCK( &ld->ld_req_mutex );
|
||||
return( ld->ld_errno );
|
||||
}
|
||||
|
||||
|
@ -410,9 +410,7 @@ ldap_int_sasl_bind(
|
||||
}
|
||||
|
||||
rc = 0;
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_LOCK( &ld->ld_req_mutex );
|
||||
ber_sockbuf_ctrl( ld->ld_sb, LBER_SB_OPT_GET_FD, &sd );
|
||||
|
||||
if ( sd == AC_SOCKET_INVALID ) {
|
||||
@ -430,9 +428,7 @@ ldap_int_sasl_bind(
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
|
||||
if( rc != 0 ) return ld->ld_errno;
|
||||
|
||||
oldctx = ld->ld_defconn->lconn_sasl_authctx;
|
||||
|
@ -202,9 +202,7 @@ int ldap_domain2hostlist(
|
||||
}
|
||||
sprintf(request, "_ldap._tcp.%s", domain);
|
||||
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_lock(&ldap_int_resolv_mutex);
|
||||
#endif
|
||||
LDAP_MUTEX_LOCK(&ldap_int_resolv_mutex);
|
||||
|
||||
rc = LDAP_UNAVAILABLE;
|
||||
#ifdef NS_HFIXEDSZ
|
||||
@ -305,9 +303,7 @@ add_size:;
|
||||
*list = hostlist;
|
||||
|
||||
out:
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_unlock(&ldap_int_resolv_mutex);
|
||||
#endif
|
||||
LDAP_MUTEX_UNLOCK(&ldap_int_resolv_mutex);
|
||||
|
||||
if (request != NULL) {
|
||||
LDAP_FREE(request);
|
||||
|
@ -260,9 +260,7 @@ ldap_parse_result(
|
||||
if(referralsp != NULL) *referralsp = NULL;
|
||||
if(serverctrls != NULL) *serverctrls = NULL;
|
||||
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_lock( &ld->ld_res_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_LOCK( &ld->ld_res_mutex );
|
||||
/* Find the result, last msg in chain... */
|
||||
lm = r->lm_chain_tail;
|
||||
/* FIXME: either this is not possible (assert?)
|
||||
@ -282,9 +280,7 @@ ldap_parse_result(
|
||||
|
||||
if( lm == NULL ) {
|
||||
errcode = ld->ld_errno = LDAP_NO_RESULTS_RETURNED;
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_unlock( &ld->ld_res_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_UNLOCK( &ld->ld_res_mutex );
|
||||
goto done;
|
||||
}
|
||||
|
||||
@ -390,10 +386,7 @@ ldap_parse_result(
|
||||
*referralsp = ldap_value_dup( ld->ld_referrals );
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_unlock( &ld->ld_res_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_UNLOCK( &ld->ld_res_mutex );
|
||||
|
||||
done:
|
||||
if ( freeit ) {
|
||||
|
@ -435,11 +435,22 @@ LDAP_V( ldap_pvt_thread_mutex_t ) ldap_int_gssapi_mutex;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef LDAP_R_COMPILE
|
||||
#define LDAP_MUTEX_LOCK(mutex) ldap_pvt_thread_mutex_lock( mutex )
|
||||
#define LDAP_MUTEX_UNLOCK(mutex) ldap_pvt_thread_mutex_unlock( mutex )
|
||||
#define LDAP_ASSERT_MUTEX_OWNER(mutex) \
|
||||
LDAP_PVT_THREAD_ASSERT_MUTEX_OWNER(mutex)
|
||||
#else
|
||||
#define LDAP_MUTEX_LOCK(mutex)
|
||||
#define LDAP_MUTEX_UNLOCK(mutex)
|
||||
#define LDAP_ASSERT_MUTEX_OWNER(mutex)
|
||||
#endif
|
||||
|
||||
#ifdef LDAP_R_COMPILE
|
||||
#define LDAP_NEXT_MSGID(ld, id) \
|
||||
ldap_pvt_thread_mutex_lock( &(ld)->ld_req_mutex ); \
|
||||
LDAP_MUTEX_LOCK( &(ld)->ld_req_mutex ); \
|
||||
id = ++(ld)->ld_msgid; \
|
||||
ldap_pvt_thread_mutex_unlock( &(ld)->ld_req_mutex )
|
||||
LDAP_MUTEX_UNLOCK( &(ld)->ld_req_mutex )
|
||||
#else
|
||||
#define LDAP_NEXT_MSGID(ld, id) id = ++(ld)->ld_msgid
|
||||
#endif
|
||||
|
@ -592,16 +592,12 @@ ldap_connect_to_host(LDAP *ld, Sockbuf *sb,
|
||||
hints.ai_socktype = socktype;
|
||||
snprintf(serv, sizeof serv, "%d", port );
|
||||
|
||||
#ifdef LDAP_R_COMPILE
|
||||
/* most getaddrinfo(3) use non-threadsafe resolver libraries */
|
||||
ldap_pvt_thread_mutex_lock(&ldap_int_resolv_mutex);
|
||||
#endif
|
||||
LDAP_MUTEX_LOCK(&ldap_int_resolv_mutex);
|
||||
|
||||
err = getaddrinfo( host, serv, &hints, &res );
|
||||
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_unlock(&ldap_int_resolv_mutex);
|
||||
#endif
|
||||
LDAP_MUTEX_UNLOCK(&ldap_int_resolv_mutex);
|
||||
|
||||
if ( err != 0 ) {
|
||||
osip_debug(ld, "ldap_connect_to_host: getaddrinfo failed: %s\n",
|
||||
|
@ -98,17 +98,13 @@ ldap_send_initial_request(
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_send_initial_request\n", 0, 0, 0 );
|
||||
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_LOCK( &ld->ld_req_mutex );
|
||||
if ( ber_sockbuf_ctrl( ld->ld_sb, LBER_SB_OPT_GET_FD, NULL ) == -1 ) {
|
||||
/* not connected yet */
|
||||
rc = ldap_open_defconn( ld );
|
||||
|
||||
}
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
|
||||
if( rc < 0 ) {
|
||||
ber_free( ber, 1 );
|
||||
return( -1 );
|
||||
@ -134,14 +130,10 @@ ldap_send_initial_request(
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_LOCK( &ld->ld_req_mutex );
|
||||
rc = ldap_send_server_request( ld, ber, msgid, NULL,
|
||||
NULL, NULL, NULL );
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
|
||||
return(rc);
|
||||
}
|
||||
|
||||
@ -453,20 +445,14 @@ ldap_new_connection( LDAP *ld, LDAPURLDesc **srvlist, int use_ldsb,
|
||||
}
|
||||
|
||||
lc->lconn_status = async ? LDAP_CONNST_CONNECTING : LDAP_CONNST_CONNECTED;
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_lock( &ld->ld_conn_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_LOCK( &ld->ld_conn_mutex );
|
||||
lc->lconn_next = ld->ld_conns;
|
||||
ld->ld_conns = lc;
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_unlock( &ld->ld_conn_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_UNLOCK( &ld->ld_conn_mutex );
|
||||
|
||||
if ( connect ) {
|
||||
#ifdef LDAP_R_COMPILE
|
||||
LDAP_PVT_THREAD_ASSERT_MUTEX_OWNER( &ld->ld_req_mutex );
|
||||
LDAP_PVT_THREAD_ASSERT_MUTEX_OWNER( &ld->ld_res_mutex );
|
||||
#endif
|
||||
LDAP_ASSERT_MUTEX_OWNER( &ld->ld_req_mutex );
|
||||
LDAP_ASSERT_MUTEX_OWNER( &ld->ld_res_mutex );
|
||||
|
||||
#ifdef HAVE_TLS
|
||||
if ( lc->lconn_server->lud_exts ) {
|
||||
@ -478,15 +464,11 @@ ldap_new_connection( LDAP *ld, LDAPURLDesc **srvlist, int use_ldsb,
|
||||
++lc->lconn_refcnt; /* avoid premature free */
|
||||
ld->ld_defconn = lc;
|
||||
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
|
||||
ldap_pvt_thread_mutex_unlock( &ld->ld_res_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
|
||||
LDAP_MUTEX_UNLOCK( &ld->ld_res_mutex );
|
||||
rc = ldap_start_tls_s( ld, NULL, NULL );
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_lock( &ld->ld_res_mutex );
|
||||
ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_LOCK( &ld->ld_res_mutex );
|
||||
LDAP_MUTEX_LOCK( &ld->ld_req_mutex );
|
||||
ld->ld_defconn = savedefconn;
|
||||
--lc->lconn_refcnt;
|
||||
|
||||
@ -503,10 +485,8 @@ ldap_new_connection( LDAP *ld, LDAPURLDesc **srvlist, int use_ldsb,
|
||||
int err = 0;
|
||||
LDAPConn *savedefconn;
|
||||
|
||||
#ifdef LDAP_R_COMPILE
|
||||
LDAP_PVT_THREAD_ASSERT_MUTEX_OWNER( &ld->ld_req_mutex );
|
||||
LDAP_PVT_THREAD_ASSERT_MUTEX_OWNER( &ld->ld_res_mutex );
|
||||
#endif
|
||||
LDAP_ASSERT_MUTEX_OWNER( &ld->ld_req_mutex );
|
||||
LDAP_ASSERT_MUTEX_OWNER( &ld->ld_res_mutex );
|
||||
|
||||
/* Set flag to prevent additional referrals
|
||||
* from being processed on this
|
||||
@ -527,17 +507,13 @@ ldap_new_connection( LDAP *ld, LDAPURLDesc **srvlist, int use_ldsb,
|
||||
ld->ld_defconn = lc;
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "Call application rebind_proc\n", 0, 0, 0);
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
|
||||
ldap_pvt_thread_mutex_unlock( &ld->ld_res_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
|
||||
LDAP_MUTEX_UNLOCK( &ld->ld_res_mutex );
|
||||
err = (*ld->ld_rebind_proc)( ld,
|
||||
bind->ri_url, bind->ri_request, bind->ri_msgid,
|
||||
ld->ld_rebind_params );
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_lock( &ld->ld_res_mutex );
|
||||
ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_LOCK( &ld->ld_res_mutex );
|
||||
LDAP_MUTEX_LOCK( &ld->ld_req_mutex );
|
||||
|
||||
ld->ld_defconn = savedefconn;
|
||||
--lc->lconn_refcnt;
|
||||
@ -562,10 +538,8 @@ ldap_new_connection( LDAP *ld, LDAPURLDesc **srvlist, int use_ldsb,
|
||||
"anonymous rebind via ldap_sasl_bind(\"\")\n",
|
||||
0, 0, 0);
|
||||
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
|
||||
ldap_pvt_thread_mutex_unlock( &ld->ld_res_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
|
||||
LDAP_MUTEX_UNLOCK( &ld->ld_res_mutex );
|
||||
rc = ldap_sasl_bind( ld, "", LDAP_SASL_SIMPLE, &passwd,
|
||||
NULL, NULL, &msgid );
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
@ -609,10 +583,8 @@ ldap_new_connection( LDAP *ld, LDAPURLDesc **srvlist, int use_ldsb,
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_lock( &ld->ld_res_mutex );
|
||||
ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_LOCK( &ld->ld_res_mutex );
|
||||
LDAP_MUTEX_LOCK( &ld->ld_req_mutex );
|
||||
ld->ld_defconn = savedefconn;
|
||||
--lc->lconn_refcnt;
|
||||
|
||||
@ -641,9 +613,7 @@ find_connection( LDAP *ld, LDAPURLDesc *srv, int any )
|
||||
int lcu_port, lsu_port;
|
||||
int found = 0;
|
||||
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_lock( &ld->ld_conn_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_LOCK( &ld->ld_conn_mutex );
|
||||
for ( lc = ld->ld_conns; lc != NULL; lc = lc->lconn_next ) {
|
||||
lcu = lc->lconn_server;
|
||||
lcu_port = ldap_pvt_url_scheme_port( lcu->lud_scheme,
|
||||
@ -667,9 +637,7 @@ find_connection( LDAP *ld, LDAPURLDesc *srv, int any )
|
||||
if ( found )
|
||||
break;
|
||||
}
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_unlock( &ld->ld_conn_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_UNLOCK( &ld->ld_conn_mutex );
|
||||
return lc;
|
||||
}
|
||||
|
||||
@ -697,9 +665,7 @@ ldap_free_connection( LDAP *ld, LDAPConn *lc, int force, int unbind )
|
||||
|
||||
if ( force || --lc->lconn_refcnt <= 0 ) {
|
||||
/* remove from connections list first */
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_lock( &ld->ld_conn_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_LOCK( &ld->ld_conn_mutex );
|
||||
|
||||
for ( prevlc = NULL, tmplc = ld->ld_conns;
|
||||
tmplc != NULL;
|
||||
@ -718,9 +684,7 @@ ldap_free_connection( LDAP *ld, LDAPConn *lc, int force, int unbind )
|
||||
}
|
||||
prevlc = tmplc;
|
||||
}
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_unlock( &ld->ld_conn_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_UNLOCK( &ld->ld_conn_mutex );
|
||||
|
||||
/* process connection callbacks */
|
||||
{
|
||||
@ -960,9 +924,7 @@ ldap_free_request_int( LDAP *ld, LDAPRequest *lr )
|
||||
void
|
||||
ldap_free_request( LDAP *ld, LDAPRequest *lr )
|
||||
{
|
||||
#ifdef LDAP_R_COMPILE
|
||||
LDAP_PVT_THREAD_ASSERT_MUTEX_OWNER( &ld->ld_req_mutex );
|
||||
#endif
|
||||
LDAP_ASSERT_MUTEX_OWNER( &ld->ld_req_mutex );
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_free_request (origid %d, msgid %d)\n",
|
||||
lr->lr_origid, lr->lr_msgid, 0 );
|
||||
@ -1222,14 +1184,10 @@ ldap_chase_v3referrals( LDAP *ld, LDAPRequest *lr, char **refs, int sref, char *
|
||||
/* Send the new request to the server - may require a bind */
|
||||
rinfo.ri_msgid = origreq->lr_origid;
|
||||
rinfo.ri_url = refarray[i];
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_LOCK( &ld->ld_req_mutex );
|
||||
rc = ldap_send_server_request( ld, ber, id,
|
||||
origreq, &srv, NULL, &rinfo );
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
|
||||
if ( rc < 0 ) {
|
||||
/* Failure, try next referral in the list */
|
||||
Debug( LDAP_DEBUG_ANY, "Unable to chase referral \"%s\" (%d: %s)\n",
|
||||
@ -1409,14 +1367,10 @@ ldap_chase_referrals( LDAP *ld,
|
||||
|
||||
rinfo.ri_msgid = origreq->lr_origid;
|
||||
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_LOCK( &ld->ld_req_mutex );
|
||||
rc = ldap_send_server_request( ld, ber, id,
|
||||
lr, &srv, NULL, &rinfo );
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
|
||||
|
||||
LDAP_FREE( rinfo.ri_url );
|
||||
|
||||
@ -1612,9 +1566,7 @@ ldap_find_request_by_msgid( LDAP *ld, ber_int_t msgid )
|
||||
{
|
||||
LDAPRequest *lr;
|
||||
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_LOCK( &ld->ld_req_mutex );
|
||||
for ( lr = ld->ld_requests; lr != NULL; lr = lr->lr_next ) {
|
||||
if ( lr->lr_status == LDAP_REQST_COMPLETED ) {
|
||||
continue; /* Skip completed requests */
|
||||
@ -1624,9 +1576,7 @@ ldap_find_request_by_msgid( LDAP *ld, ber_int_t msgid )
|
||||
break;
|
||||
}
|
||||
}
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
|
||||
|
||||
return( lr );
|
||||
}
|
||||
@ -1636,9 +1586,7 @@ ldap_return_request( LDAP *ld, LDAPRequest *lrx, int freeit )
|
||||
{
|
||||
LDAPRequest *lr;
|
||||
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_LOCK( &ld->ld_req_mutex );
|
||||
for ( lr = ld->ld_requests; lr != NULL; lr = lr->lr_next ) {
|
||||
if ( lr == lrx ) {
|
||||
if ( lr->lr_refcnt > 0 ) {
|
||||
@ -1659,7 +1607,5 @@ ldap_return_request( LDAP *ld, LDAPRequest *lrx, int freeit )
|
||||
} else if ( freeit ) {
|
||||
ldap_free_request( ld, lrx );
|
||||
}
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
|
||||
}
|
||||
|
@ -113,15 +113,9 @@ ldap_result(
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_result ld %p msgid %d\n", (void *)ld, msgid, 0 );
|
||||
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_lock( &ld->ld_res_mutex );
|
||||
#endif
|
||||
|
||||
LDAP_MUTEX_LOCK( &ld->ld_res_mutex );
|
||||
rc = wait4msg( ld, msgid, all, timeout, result );
|
||||
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_unlock( &ld->ld_res_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_UNLOCK( &ld->ld_res_mutex );
|
||||
|
||||
return rc;
|
||||
}
|
||||
@ -142,9 +136,7 @@ chkResponseList(
|
||||
* wait until it arrives or timeout occurs.
|
||||
*/
|
||||
|
||||
#ifdef LDAP_R_COMPILE
|
||||
LDAP_PVT_THREAD_ASSERT_MUTEX_OWNER( &ld->ld_res_mutex );
|
||||
#endif
|
||||
LDAP_ASSERT_MUTEX_OWNER( &ld->ld_res_mutex );
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"ldap_chkResponseList ld %p msgid %d all %d\n",
|
||||
@ -257,9 +249,7 @@ wait4msg(
|
||||
assert( ld != NULL );
|
||||
assert( result != NULL );
|
||||
|
||||
#ifdef LDAP_R_COMPILE
|
||||
LDAP_PVT_THREAD_ASSERT_MUTEX_OWNER( &ld->ld_res_mutex );
|
||||
#endif
|
||||
LDAP_ASSERT_MUTEX_OWNER( &ld->ld_res_mutex );
|
||||
|
||||
if ( timeout == NULL && ld->ld_options.ldo_tm_api.tv_sec >= 0 ) {
|
||||
tv = ld->ld_options.ldo_tm_api;
|
||||
@ -294,18 +284,12 @@ wait4msg(
|
||||
if ( ldap_debug & LDAP_DEBUG_TRACE ) {
|
||||
Debug( LDAP_DEBUG_TRACE, "wait4msg continue ld %p msgid %d all %d\n",
|
||||
(void *)ld, msgid, all );
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_lock( &ld->ld_conn_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_LOCK( &ld->ld_conn_mutex );
|
||||
ldap_dump_connection( ld, ld->ld_conns, 1 );
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_unlock( &ld->ld_conn_mutex );
|
||||
ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_UNLOCK( &ld->ld_conn_mutex );
|
||||
LDAP_MUTEX_LOCK( &ld->ld_req_mutex );
|
||||
ldap_dump_requests_and_responses( ld );
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
|
||||
}
|
||||
#endif /* LDAP_DEBUG */
|
||||
|
||||
@ -315,9 +299,7 @@ wait4msg(
|
||||
} else {
|
||||
int lc_ready = 0;
|
||||
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_lock( &ld->ld_conn_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_LOCK( &ld->ld_conn_mutex );
|
||||
for ( lc = ld->ld_conns; lc != NULL; lc = lc->lconn_next ) {
|
||||
if ( ber_sockbuf_ctrl( lc->lconn_sb,
|
||||
LBER_SB_OPT_DATA_READY, NULL ) )
|
||||
@ -326,9 +308,7 @@ wait4msg(
|
||||
break;
|
||||
}
|
||||
}
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_unlock( &ld->ld_conn_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_UNLOCK( &ld->ld_conn_mutex );
|
||||
|
||||
if ( !lc_ready ) {
|
||||
int err;
|
||||
@ -361,9 +341,7 @@ wait4msg(
|
||||
if ( lc_ready ) {
|
||||
LDAPConn *lnext;
|
||||
rc = LDAP_MSG_X_KEEP_LOOKING;
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_LOCK( &ld->ld_req_mutex );
|
||||
if ( ld->ld_requests &&
|
||||
ld->ld_requests->lr_status == LDAP_REQST_WRITING &&
|
||||
ldap_is_write_ready( ld,
|
||||
@ -371,10 +349,8 @@ wait4msg(
|
||||
{
|
||||
ldap_int_flush_request( ld, ld->ld_requests );
|
||||
}
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
|
||||
ldap_pvt_thread_mutex_lock( &ld->ld_conn_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
|
||||
LDAP_MUTEX_LOCK( &ld->ld_conn_mutex );
|
||||
for ( lc = ld->ld_conns;
|
||||
rc == LDAP_MSG_X_KEEP_LOOKING && lc != NULL;
|
||||
lc = lnext )
|
||||
@ -384,34 +360,24 @@ wait4msg(
|
||||
{
|
||||
/* Don't let it get freed out from under us */
|
||||
++lc->lconn_refcnt;
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_unlock( &ld->ld_conn_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_UNLOCK( &ld->ld_conn_mutex );
|
||||
rc = try_read1msg( ld, msgid, all, lc, result );
|
||||
lnext = lc->lconn_next;
|
||||
|
||||
/* Only take locks if we're really freeing */
|
||||
if ( lc->lconn_refcnt <= 1 ) {
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_LOCK( &ld->ld_req_mutex );
|
||||
ldap_free_connection( ld, lc, 0, 1 );
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
|
||||
} else {
|
||||
--lc->lconn_refcnt;
|
||||
}
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_lock( &ld->ld_conn_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_LOCK( &ld->ld_conn_mutex );
|
||||
} else {
|
||||
lnext = lc->lconn_next;
|
||||
}
|
||||
}
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_unlock( &ld->ld_conn_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_UNLOCK( &ld->ld_conn_mutex );
|
||||
}
|
||||
}
|
||||
|
||||
@ -494,9 +460,7 @@ try_read1msg(
|
||||
assert( ld != NULL );
|
||||
assert( lc != NULL );
|
||||
|
||||
#ifdef LDAP_R_COMPILE
|
||||
LDAP_PVT_THREAD_ASSERT_MUTEX_OWNER( &ld->ld_res_mutex );
|
||||
#endif
|
||||
LDAP_ASSERT_MUTEX_OWNER( &ld->ld_res_mutex );
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "read1msg: ld %p msgid %d all %d\n",
|
||||
(void *)ld, msgid, all );
|
||||
@ -1331,9 +1295,7 @@ ldap_msgdelete( LDAP *ld, int msgid )
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_msgdelete ld=%p msgid=%d\n",
|
||||
(void *)ld, msgid, 0 );
|
||||
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_lock( &ld->ld_res_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_LOCK( &ld->ld_res_mutex );
|
||||
prev = NULL;
|
||||
for ( lm = ld->ld_responses; lm != NULL; lm = lm->lm_next ) {
|
||||
if ( lm->lm_msgid == msgid ) {
|
||||
@ -1352,9 +1314,7 @@ ldap_msgdelete( LDAP *ld, int msgid )
|
||||
prev->lm_next = lm->lm_next;
|
||||
}
|
||||
}
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_unlock( &ld->ld_res_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_UNLOCK( &ld->ld_res_mutex );
|
||||
if ( lm ) {
|
||||
switch ( ldap_msgfree( lm ) ) {
|
||||
case LDAP_RES_SEARCH_ENTRY:
|
||||
@ -1383,9 +1343,7 @@ ldap_msgdelete( LDAP *ld, int msgid )
|
||||
static int
|
||||
ldap_abandoned( LDAP *ld, ber_int_t msgid, int *idxp )
|
||||
{
|
||||
#ifdef LDAP_R_COMPILE
|
||||
LDAP_PVT_THREAD_ASSERT_MUTEX_OWNER( &ld->ld_res_mutex );
|
||||
#endif
|
||||
LDAP_ASSERT_MUTEX_OWNER( &ld->ld_res_mutex );
|
||||
|
||||
assert( idxp != NULL );
|
||||
assert( msgid >= 0 );
|
||||
@ -1401,9 +1359,7 @@ ldap_abandoned( LDAP *ld, ber_int_t msgid, int *idxp )
|
||||
static int
|
||||
ldap_mark_abandoned( LDAP *ld, ber_int_t msgid, int idx )
|
||||
{
|
||||
#ifdef LDAP_R_COMPILE
|
||||
LDAP_PVT_THREAD_ASSERT_MUTEX_OWNER( &ld->ld_res_mutex );
|
||||
#endif
|
||||
LDAP_ASSERT_MUTEX_OWNER( &ld->ld_res_mutex );
|
||||
|
||||
/* NOTE: those assertions are repeated in ldap_int_bisect_delete() */
|
||||
assert( idx >= 0 );
|
||||
|
@ -422,8 +422,8 @@ ldap_sasl_interactive_bind_s(
|
||||
int rc;
|
||||
char *smechs = NULL;
|
||||
|
||||
#if defined( LDAP_R_COMPILE ) && defined( HAVE_CYRUS_SASL )
|
||||
ldap_pvt_thread_mutex_lock( &ldap_int_sasl_mutex );
|
||||
#if defined( HAVE_CYRUS_SASL )
|
||||
LDAP_MUTEX_LOCK( &ldap_int_sasl_mutex );
|
||||
#endif
|
||||
#ifdef LDAP_CONNECTIONLESS
|
||||
if( LDAP_IS_UDP(ld) ) {
|
||||
@ -466,8 +466,8 @@ ldap_sasl_interactive_bind_s(
|
||||
flags, interact, defaults );
|
||||
|
||||
done:
|
||||
#if defined( LDAP_R_COMPILE ) && defined( HAVE_CYRUS_SASL )
|
||||
ldap_pvt_thread_mutex_unlock( &ldap_int_sasl_mutex );
|
||||
#if defined( HAVE_CYRUS_SASL )
|
||||
LDAP_MUTEX_UNLOCK( &ldap_int_sasl_mutex );
|
||||
#endif
|
||||
if ( smechs ) LDAP_FREE( smechs );
|
||||
|
||||
|
@ -81,9 +81,7 @@ ldap_ld_free(
|
||||
int err = LDAP_SUCCESS;
|
||||
|
||||
/* free LDAP structure and outstanding requests/responses */
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_lock( &ld->ld_req_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_LOCK( &ld->ld_req_mutex );
|
||||
while ( ld->ld_requests != NULL ) {
|
||||
ldap_free_request( ld, ld->ld_requests );
|
||||
}
|
||||
@ -92,13 +90,9 @@ ldap_ld_free(
|
||||
while ( ld->ld_conns != NULL ) {
|
||||
ldap_free_connection( ld, ld->ld_conns, 1, close );
|
||||
}
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_unlock( &ld->ld_req_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_UNLOCK( &ld->ld_req_mutex );
|
||||
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_lock( &ld->ld_res_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_LOCK( &ld->ld_res_mutex );
|
||||
for ( lm = ld->ld_responses; lm != NULL; lm = next ) {
|
||||
next = lm->lm_next;
|
||||
ldap_msgfree( lm );
|
||||
@ -108,9 +102,7 @@ ldap_ld_free(
|
||||
LDAP_FREE( ld->ld_abandoned );
|
||||
ld->ld_abandoned = NULL;
|
||||
}
|
||||
#ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_unlock( &ld->ld_res_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_UNLOCK( &ld->ld_res_mutex );
|
||||
|
||||
/* final close callbacks */
|
||||
{
|
||||
|
@ -107,15 +107,9 @@ char *ldap_pvt_ctime( const time_t *tp, char *buf )
|
||||
|
||||
#else
|
||||
|
||||
# ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_lock( &ldap_int_ctime_mutex );
|
||||
# endif
|
||||
|
||||
LDAP_MUTEX_LOCK( &ldap_int_ctime_mutex );
|
||||
AC_MEMCPY( buf, ctime(tp), 26 );
|
||||
|
||||
# ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_unlock( &ldap_int_ctime_mutex );
|
||||
# endif
|
||||
LDAP_MUTEX_UNLOCK( &ldap_int_ctime_mutex );
|
||||
|
||||
return buf;
|
||||
#endif
|
||||
@ -128,7 +122,7 @@ ldap_pvt_gmtime_lock( void )
|
||||
# ifndef LDAP_R_COMPILE
|
||||
return 0;
|
||||
# else /* LDAP_R_COMPILE */
|
||||
return ldap_pvt_thread_mutex_lock( &ldap_int_gmtime_mutex );
|
||||
return LDAP_MUTEX_LOCK( &ldap_int_gmtime_mutex );
|
||||
# endif /* LDAP_R_COMPILE */
|
||||
}
|
||||
|
||||
@ -138,7 +132,7 @@ ldap_pvt_gmtime_unlock( void )
|
||||
# ifndef LDAP_R_COMPILE
|
||||
return 0;
|
||||
# else /* LDAP_R_COMPILE */
|
||||
return ldap_pvt_thread_mutex_unlock( &ldap_int_gmtime_mutex );
|
||||
return LDAP_MUTEX_UNLOCK( &ldap_int_gmtime_mutex );
|
||||
# endif /* LDAP_R_COMPILE */
|
||||
}
|
||||
#endif /* !USE_GMTIME_R || !USE_LOCALTIME_R */
|
||||
@ -149,10 +143,7 @@ ldap_pvt_gmtime( const time_t *timep, struct tm *result )
|
||||
{
|
||||
struct tm *tm_ptr;
|
||||
|
||||
# ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_lock( &ldap_int_gmtime_mutex );
|
||||
# endif /* LDAP_R_COMPILE */
|
||||
|
||||
LDAP_MUTEX_LOCK( &ldap_int_gmtime_mutex );
|
||||
tm_ptr = gmtime( timep );
|
||||
if ( tm_ptr == NULL ) {
|
||||
result = NULL;
|
||||
@ -160,10 +151,7 @@ ldap_pvt_gmtime( const time_t *timep, struct tm *result )
|
||||
} else {
|
||||
*result = *tm_ptr;
|
||||
}
|
||||
|
||||
# ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_unlock( &ldap_int_gmtime_mutex );
|
||||
# endif /* LDAP_R_COMPILE */
|
||||
LDAP_MUTEX_UNLOCK( &ldap_int_gmtime_mutex );
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -175,10 +163,7 @@ ldap_pvt_localtime( const time_t *timep, struct tm *result )
|
||||
{
|
||||
struct tm *tm_ptr;
|
||||
|
||||
# ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_lock( &ldap_int_gmtime_mutex );
|
||||
# endif /* LDAP_R_COMPILE */
|
||||
|
||||
LDAP_MUTEX_LOCK( &ldap_int_gmtime_mutex );
|
||||
tm_ptr = localtime( timep );
|
||||
if ( tm_ptr == NULL ) {
|
||||
result = NULL;
|
||||
@ -186,10 +171,7 @@ ldap_pvt_localtime( const time_t *timep, struct tm *result )
|
||||
} else {
|
||||
*result = *tm_ptr;
|
||||
}
|
||||
|
||||
# ifdef LDAP_R_COMPILE
|
||||
ldap_pvt_thread_mutex_unlock( &ldap_int_gmtime_mutex );
|
||||
# endif /* LDAP_R_COMPILE */
|
||||
LDAP_MUTEX_UNLOCK( &ldap_int_gmtime_mutex );
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -385,7 +367,7 @@ int ldap_pvt_gethostbyname_a(
|
||||
int retval;
|
||||
*buf = NULL;
|
||||
|
||||
ldap_pvt_thread_mutex_lock( &ldap_int_resolv_mutex );
|
||||
LDAP_MUTEX_LOCK( &ldap_int_resolv_mutex );
|
||||
|
||||
he = gethostbyname( name );
|
||||
|
||||
@ -400,7 +382,7 @@ int ldap_pvt_gethostbyname_a(
|
||||
retval = 0;
|
||||
}
|
||||
|
||||
ldap_pvt_thread_mutex_unlock( &ldap_int_resolv_mutex );
|
||||
LDAP_MUTEX_UNLOCK( &ldap_int_resolv_mutex );
|
||||
|
||||
return retval;
|
||||
#else
|
||||
@ -444,13 +426,9 @@ int ldap_pvt_get_hname(
|
||||
int rc;
|
||||
#if defined( HAVE_GETNAMEINFO )
|
||||
|
||||
#if defined( LDAP_R_COMPILE )
|
||||
ldap_pvt_thread_mutex_lock( &ldap_int_resolv_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_LOCK( &ldap_int_resolv_mutex );
|
||||
rc = getnameinfo( sa, len, name, namelen, NULL, 0, 0 );
|
||||
#if defined( LDAP_R_COMPILE )
|
||||
ldap_pvt_thread_mutex_unlock( &ldap_int_resolv_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_UNLOCK( &ldap_int_resolv_mutex );
|
||||
if ( rc ) *err = (char *)AC_GAI_STRERROR( rc );
|
||||
return rc;
|
||||
|
||||
@ -514,9 +492,7 @@ int ldap_pvt_get_hname(
|
||||
LDAP_FREE(buf);
|
||||
#else /* HAVE_GETHOSTBYADDR_R */
|
||||
|
||||
#if defined( LDAP_R_COMPILE )
|
||||
ldap_pvt_thread_mutex_lock( &ldap_int_resolv_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_LOCK( &ldap_int_resolv_mutex );
|
||||
hp = gethostbyaddr( addr, alen, sa->sa_family );
|
||||
if (hp) {
|
||||
strncpy( name, hp->h_name, namelen );
|
||||
@ -525,9 +501,7 @@ int ldap_pvt_get_hname(
|
||||
rc = h_errno;
|
||||
*err = (char *)HSTRERROR( h_errno );
|
||||
}
|
||||
#if defined( LDAP_R_COMPILE )
|
||||
ldap_pvt_thread_mutex_unlock( &ldap_int_resolv_mutex );
|
||||
#endif
|
||||
LDAP_MUTEX_UNLOCK( &ldap_int_resolv_mutex );
|
||||
|
||||
#endif /* !HAVE_GETHOSTBYADDR_R */
|
||||
return rc;
|
||||
@ -582,8 +556,7 @@ int ldap_pvt_gethostbyaddr_a(
|
||||
int retval;
|
||||
*buf = NULL;
|
||||
|
||||
ldap_pvt_thread_mutex_lock( &ldap_int_resolv_mutex );
|
||||
|
||||
LDAP_MUTEX_LOCK( &ldap_int_resolv_mutex );
|
||||
he = gethostbyaddr( addr, len, type );
|
||||
|
||||
if (he==NULL) {
|
||||
@ -596,8 +569,7 @@ int ldap_pvt_gethostbyaddr_a(
|
||||
*result = resbuf;
|
||||
retval = 0;
|
||||
}
|
||||
|
||||
ldap_pvt_thread_mutex_unlock( &ldap_int_resolv_mutex );
|
||||
LDAP_MUTEX_UNLOCK( &ldap_int_resolv_mutex );
|
||||
|
||||
return retval;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user