]> git.sur5r.net Git - openldap/commitdiff
check mutex ownership
authorQuanah Gibson-Mount <quanah@openldap.org>
Fri, 17 Dec 2010 18:09:21 +0000 (18:09 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Fri, 17 Dec 2010 18:09:21 +0000 (18:09 +0000)
libraries/libldap/request.c

index 205599300a3fe8747f0a2b4029f29f4374e23a9e..287ce471093cf47ef23594da2b331aded36e3e8e 100644 (file)
@@ -382,6 +382,12 @@ find_tls_ext( LDAPURLDesc *srv )
        return 0;
 }
 
+/*
+ * caller must hold ld_req_mutex or be exclusive user of ld
+ * if ( connect != 0 ) or ( bind != NULL ) caller must also hold
+ * ld_req_mutex and ld_res_mutex
+ */
+
 LDAPConn *
 ldap_new_connection( LDAP *ld, LDAPURLDesc **srvlist, int use_ldsb,
        int connect, LDAPreqinfo *bind )
@@ -457,6 +463,11 @@ 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_req_mutex );
+               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 +503,11 @@ 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
+
                /* Set flag to prevent additional referrals
                 * from being processed on this
                 * connection until the bind has completed
@@ -658,6 +674,9 @@ find_connection( LDAP *ld, LDAPURLDesc *srv, int any )
 }
 
 
+/*
+ * NOTE: the caller holds ld_req_mutex
+ */
 
 static void
 use_connection( LDAP *ld, LDAPConn *lc )