]> git.sur5r.net Git - openldap/commitdiff
ITS#7740 back-meta: avoid blocking other threads
authorJorge Perez Burgos <jorge.perez.burgos@ericsson.com>
Tue, 5 Nov 2013 09:12:41 +0000 (10:12 +0100)
committerHoward Chu <hyc@openldap.org>
Tue, 5 Nov 2013 14:45:40 +0000 (06:45 -0800)
Don't lock other threads while trying to connect to remote node.

servers/slapd/back-meta/bind.c

index f8f78bf318d058010e319c9d47163e2b704489b6..058e9ec9fbca4549daf6d41ee271b272c832d72f 100644 (file)
@@ -618,6 +618,10 @@ meta_back_single_dobind(
 
                /* FIXME: should we check if at least some of the op->o_ctrls
                 * can/should be passed? */
+               if(!dolock) {
+                       ldap_pvt_thread_mutex_unlock( &mi->mi_conninfo.lai_mutex );
+               }
+
                for (;;) {
                        rs->sr_err = ldap_sasl_bind( msc->msc_ld,
                                binddn, LDAP_SASL_SIMPLE, &cred,
@@ -628,6 +632,10 @@ meta_back_single_dobind(
                        ldap_pvt_thread_yield();
                }
 
+               if(!dolock) {
+                       ldap_pvt_thread_mutex_lock( &mi->mi_conninfo.lai_mutex );
+               }
+
                rs->sr_err = meta_back_bind_op_result( op, rs, mc, candidate, msgid, sendok, dolock );
 
                /* if bind succeeded, but anonymous, clear msc_bound_ndn */
@@ -1578,6 +1586,11 @@ meta_back_proxy_authz_bind(
                switch ( method ) {
                case LDAP_AUTH_NONE:
                case LDAP_AUTH_SIMPLE:
+
+                       if(!dolock) {
+                               ldap_pvt_thread_mutex_unlock( &mi->mi_conninfo.lai_mutex );
+                       }
+
                        for (;;) {
                                rs->sr_err = ldap_sasl_bind( msc->msc_ld,
                                        binddn.bv_val, LDAP_SASL_SIMPLE,
@@ -1587,6 +1600,11 @@ meta_back_proxy_authz_bind(
                                }
                                ldap_pvt_thread_yield();
                        }
+
+                       if(!dolock) {
+                               ldap_pvt_thread_mutex_lock( &mi->mi_conninfo.lai_mutex );
+                       }
+
                        rc = meta_back_bind_op_result( op, rs, mc, candidate, msgid, sendok, dolock );
                        if ( rc == LDAP_SUCCESS ) {
                                /* set rebind stuff in case of successful proxyAuthz bind,