]> git.sur5r.net Git - openldap/commitdiff
check mutex ownership
authorPierangelo Masarati <ando@openldap.org>
Mon, 26 Jul 2010 19:26:59 +0000 (19:26 +0000)
committerPierangelo Masarati <ando@openldap.org>
Mon, 26 Jul 2010 19:26:59 +0000 (19:26 +0000)
libraries/libldap/request.c

index 205599300a3fe8747f0a2b4029f29f4374e23a9e..eaf96e775576399425af219d6bed2311f20928bd 100644 (file)
@@ -382,6 +382,11 @@ find_tls_ext( LDAPURLDesc *srv )
        return 0;
 }
 
+/*
+ * caller must hold ld_req_mutex
+ * if ( connect != 0 ) or ( bind != NULL ) caller must also hold ld_res_mutex
+ */
+
 LDAPConn *
 ldap_new_connection( LDAP *ld, LDAPURLDesc **srvlist, int use_ldsb,
        int connect, LDAPreqinfo *bind )
@@ -389,6 +394,10 @@ ldap_new_connection( LDAP *ld, LDAPURLDesc **srvlist, int use_ldsb,
        LDAPConn        *lc;
        int             async = 0;
 
+#ifdef LDAP_R_COMPILE
+       LDAP_PVT_THREAD_ASSERT_MUTEX_OWNER( &ld->ld_req_mutex );
+#endif
+
        Debug( LDAP_DEBUG_TRACE, "ldap_new_connection %d %d %d\n",
                use_ldsb, connect, (bind != NULL) );
        /*
@@ -457,6 +466,10 @@ ldap_new_connection( LDAP *ld, LDAPURLDesc **srvlist, int use_ldsb,
 #endif
 
        if ( connect ) {
+#ifdef LDAP_R_COMPILE
+               LDAP_PVT_THREAD_ASSERT_MUTEX_OWNER( &ld->ld_res_mutex );
+#endif
+
 #ifdef HAVE_TLS
                if ( lc->lconn_server->lud_exts ) {
                        int rc, ext = find_tls_ext( lc->lconn_server );
@@ -492,6 +505,10 @@ 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_res_mutex );
+#endif
+
                /* Set flag to prevent additional referrals
                 * from being processed on this
                 * connection until the bind has completed
@@ -658,6 +675,9 @@ find_connection( LDAP *ld, LDAPURLDesc *srv, int any )
 }
 
 
+/*
+ * NOTE: the caller holds ld_req_mutex
+ */
 
 static void
 use_connection( LDAP *ld, LDAPConn *lc )