andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 6 months ago
Clone
dc8c34
From 5c89312cdfe484e7b8e4cf32427d7576aa4ba2ac Mon Sep 17 00:00:00 2001
dc8c34
From: Noriko Hosoi <nhosoi@redhat.com>
dc8c34
Date: Mon, 11 Jan 2016 15:53:28 -0800
dc8c34
Subject: [PATCH 373/375] Ticket #48406 - Avoid self deadlock by
dc8c34
 PR_Lock(conn->c_mutex)
dc8c34
dc8c34
Description:  Fixing ticket 48338 introduced a self deadlock.
dc8c34
To avoid the self deadlock, tried to remove PR_Lock(conn->c_mutex)
dc8c34
which looked harmless, but it introduced a crash by memory corruption.
dc8c34
dc8c34
This patch replaces PR_Lock/Unlock with PR_EnterMonitor/ExitMonitor,
dc8c34
respectively.
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/48406
dc8c34
dc8c34
Reviewed by rmeggins@redhat.com, lkrispen@redhat.com, and wibrown@redhat.com.
dc8c34
Thank you, Rich, Ludwig and William!
dc8c34
dc8c34
(cherry picked from commit f25f804a8bce83b3790e7045dfc03230d7ece1af)
dc8c34
(cherry picked from commit 84da7d05ddc5a963b0d025df08f38a6ccd7d90d2)
dc8c34
(cherry picked from commit ad08d1fa7c258bb99cd64a4de570035d82e6a492)
dc8c34
(cherry picked from commit f69d19a351a34313c5f45499718c892a9bb3b42a)
dc8c34
---
dc8c34
 ldap/servers/slapd/abandon.c         |   4 +-
dc8c34
 ldap/servers/slapd/bind.c            |   4 +-
dc8c34
 ldap/servers/slapd/connection.c      |  88 +++++++++++++++---------------
dc8c34
 ldap/servers/slapd/conntable.c       |  19 +++----
dc8c34
 ldap/servers/slapd/daemon.c          |  14 ++---
dc8c34
 ldap/servers/slapd/extendop.c        |  10 ++--
dc8c34
 ldap/servers/slapd/opshared.c        |  18 +++----
dc8c34
 ldap/servers/slapd/pagedresults.c    | 100 +++++++++++++++++------------------
dc8c34
 ldap/servers/slapd/pblock.c          |  72 ++++++++++++-------------
dc8c34
 ldap/servers/slapd/psearch.c         |   8 +--
dc8c34
 ldap/servers/slapd/saslbind.c        |  26 ++++-----
dc8c34
 ldap/servers/slapd/slap.h            |   2 +-
dc8c34
 ldap/servers/slapd/start_tls_extop.c |  15 +++---
dc8c34
 ldap/servers/slapd/unbind.c          |   4 +-
dc8c34
 14 files changed, 192 insertions(+), 192 deletions(-)
dc8c34
dc8c34
diff --git a/ldap/servers/slapd/abandon.c b/ldap/servers/slapd/abandon.c
dc8c34
index 09da149..06a17e1 100644
dc8c34
--- a/ldap/servers/slapd/abandon.c
dc8c34
+++ b/ldap/servers/slapd/abandon.c
dc8c34
@@ -108,7 +108,7 @@ do_abandon( Slapi_PBlock *pb )
dc8c34
 	 * flag and abort the operation at a convenient time.
dc8c34
 	 */
dc8c34
 
dc8c34
-	PR_Lock( pb->pb_conn->c_mutex );
dc8c34
+	PR_EnterMonitor(pb->pb_conn->c_mutex);
dc8c34
 	for ( o = pb->pb_conn->c_ops; o != NULL; o = o->o_next ) {
dc8c34
 		if ( o->o_msgid == id && o != pb->pb_op)
dc8c34
 			break;
dc8c34
@@ -170,7 +170,7 @@ do_abandon( Slapi_PBlock *pb )
dc8c34
 
dc8c34
 	}
dc8c34
 
dc8c34
-	PR_Unlock( pb->pb_conn->c_mutex );
dc8c34
+	PR_ExitMonitor(pb->pb_conn->c_mutex);
dc8c34
 	/*
dc8c34
 	 * Wake up the persistent searches, so they
dc8c34
 	 * can notice if they've been abandoned.
dc8c34
diff --git a/ldap/servers/slapd/bind.c b/ldap/servers/slapd/bind.c
dc8c34
index 11ec22e..bc8040f 100644
dc8c34
--- a/ldap/servers/slapd/bind.c
dc8c34
+++ b/ldap/servers/slapd/bind.c
dc8c34
@@ -290,7 +290,7 @@ do_bind( Slapi_PBlock *pb )
dc8c34
         slapi_pblock_get (pb, SLAPI_PWPOLICY, &pw_response_requested);
dc8c34
     }
dc8c34
 
dc8c34
-    PR_Lock( pb->pb_conn->c_mutex );
dc8c34
+    PR_EnterMonitor(pb->pb_conn->c_mutex);
dc8c34
 
dc8c34
     bind_credentials_clear( pb->pb_conn, PR_FALSE, /* do not lock conn */
dc8c34
                             PR_FALSE /* do not clear external creds. */ );
dc8c34
@@ -323,7 +323,7 @@ do_bind( Slapi_PBlock *pb )
dc8c34
      * bound user can work properly
dc8c34
      */
dc8c34
     pb->pb_conn->c_needpw = 0;
dc8c34
-    PR_Unlock( pb->pb_conn->c_mutex );
dc8c34
+    PR_ExitMonitor(pb->pb_conn->c_mutex);
dc8c34
 
dc8c34
     log_bind_access(pb, dn?dn:"empty", method, version, saslmech, NULL);
dc8c34
 
dc8c34
diff --git a/ldap/servers/slapd/connection.c b/ldap/servers/slapd/connection.c
dc8c34
index c2ec4a7..d0387fc 100644
dc8c34
--- a/ldap/servers/slapd/connection.c
dc8c34
+++ b/ldap/servers/slapd/connection.c
dc8c34
@@ -111,7 +111,7 @@ connection_done(Connection *conn)
dc8c34
 	}
dc8c34
 	if (NULL != conn->c_mutex)
dc8c34
 	{
dc8c34
-		PR_DestroyLock(conn->c_mutex);
dc8c34
+		PR_DestroyMonitor(conn->c_mutex);
dc8c34
 	}
dc8c34
 	if (NULL != conn->c_pdumutex)
dc8c34
 	{
dc8c34
@@ -703,10 +703,10 @@ int connection_is_free (Connection *conn)
dc8c34
 {
dc8c34
     int rc;
dc8c34
 
dc8c34
-    PR_Lock(conn->c_mutex);
dc8c34
+    PR_EnterMonitor(conn->c_mutex);
dc8c34
     rc = conn->c_sd == SLAPD_INVALID_SOCKET && conn->c_refcnt == 0 &&
dc8c34
          !(conn->c_flags & CONN_FLAG_CLOSING);
dc8c34
-    PR_Unlock(conn->c_mutex);
dc8c34
+    PR_ExitMonitor(conn->c_mutex);
dc8c34
 
dc8c34
     return rc;
dc8c34
 }
dc8c34
@@ -748,17 +748,17 @@ static void inc_op_count(Connection* conn)
dc8c34
 static int connection_increment_reference(Connection *conn)
dc8c34
 {
dc8c34
 	int rc = 0;
dc8c34
-	PR_Lock( conn->c_mutex );
dc8c34
+	PR_EnterMonitor(conn->c_mutex);
dc8c34
 	rc = connection_acquire_nolock (conn);
dc8c34
-	PR_Unlock( conn->c_mutex );
dc8c34
+	PR_ExitMonitor(conn->c_mutex);
dc8c34
 	return rc;
dc8c34
 }
dc8c34
 
dc8c34
 static void connection_decrement_reference(Connection *conn)
dc8c34
 {
dc8c34
-	PR_Lock( conn->c_mutex );
dc8c34
+	PR_EnterMonitor(conn->c_mutex);
dc8c34
 	connection_release_nolock (conn);
dc8c34
-	PR_Unlock( conn->c_mutex );
dc8c34
+	PR_ExitMonitor(conn->c_mutex);
dc8c34
 }
dc8c34
 
dc8c34
 static void
dc8c34
@@ -990,29 +990,29 @@ done:
dc8c34
 	     * If not a persistent search, remove the operation
dc8c34
 	     * from this connection's list.
dc8c34
 	     */
dc8c34
-	    PR_Lock( conn->c_mutex );
dc8c34
+	    PR_EnterMonitor(conn->c_mutex);
dc8c34
 	    connection_remove_operation( conn, op );
dc8c34
-	    PR_Unlock( conn->c_mutex );
dc8c34
+	    PR_ExitMonitor(conn->c_mutex);
dc8c34
 
dc8c34
 		/* destroying the pblock will cause destruction of the operation
dc8c34
 		 * so this must happen before releasing the connection
dc8c34
 		 */
dc8c34
 	    slapi_pblock_destroy( pb );
dc8c34
 
dc8c34
-	    PR_Lock( conn->c_mutex );
dc8c34
+	    PR_EnterMonitor(conn->c_mutex);
dc8c34
         if (connection_release_nolock (conn) != 0)
dc8c34
 	    {
dc8c34
 			return_value = -1;
dc8c34
 		}
dc8c34
-	    PR_Unlock( conn->c_mutex );
dc8c34
+	    PR_ExitMonitor(conn->c_mutex);
dc8c34
 
dc8c34
 	} else { /* ps code acquires ref to conn - we need to release ours here */
dc8c34
-	    PR_Lock( conn->c_mutex );
dc8c34
+	    PR_EnterMonitor(conn->c_mutex);
dc8c34
         if (connection_release_nolock (conn) != 0)
dc8c34
 	    {
dc8c34
 			return_value = -1;
dc8c34
 		}
dc8c34
-	    PR_Unlock( conn->c_mutex );
dc8c34
+	    PR_ExitMonitor(conn->c_mutex);
dc8c34
 	}
dc8c34
 	return return_value;
dc8c34
 }
dc8c34
@@ -1075,19 +1075,19 @@ static int connection_operation_new(Connection *conn, Operation **ppOp)
dc8c34
 	Operation *temp_op = NULL;
dc8c34
 	int rc;
dc8c34
 
dc8c34
-	PR_Lock( conn->c_mutex );
dc8c34
+	PR_EnterMonitor(conn->c_mutex);
dc8c34
 	if (connection_is_active_nolock(conn) == 0) {
dc8c34
 	    LDAPDebug(LDAP_DEBUG_CONNS,
dc8c34
 		      "not creating a new operation when conn %" NSPRIu64 " closing\n",
dc8c34
 		      conn->c_connid,0,0);
dc8c34
-	    PR_Unlock( conn->c_mutex );
dc8c34
+	    PR_ExitMonitor(conn->c_mutex);
dc8c34
 	    return -1;
dc8c34
 	}
dc8c34
 	temp_op = operation_new( plugin_build_operation_action_bitmap( 0,
dc8c34
 			plugin_get_server_plg() ));
dc8c34
 	connection_add_operation( conn, temp_op);
dc8c34
 	rc = connection_acquire_nolock (conn); 
dc8c34
-	PR_Unlock( conn->c_mutex );
dc8c34
+	PR_ExitMonitor(conn->c_mutex);
dc8c34
 	/* Stash the op pointer in the connection structure for later use */
dc8c34
 	PR_ASSERT(NULL == conn->c_private->c_current_op);
dc8c34
 	conn->c_private->c_current_op = temp_op;
dc8c34
@@ -1173,21 +1173,21 @@ static int read_the_data(Connection *conn, int *process_op, int *defer_io, int *
dc8c34
 						"conn=%" NSPRIu64 " fd=%d The length of BER Element was too long.\n",
dc8c34
 						conn->c_connid, conn->c_sd );
dc8c34
 				}
dc8c34
-				PR_Lock( conn->c_mutex );
dc8c34
+				PR_EnterMonitor(conn->c_mutex);
dc8c34
 				connection_remove_operation( conn, op );
dc8c34
 				operation_free(&op, conn);
dc8c34
 				priv->c_current_op = NULL;
dc8c34
-				PR_Unlock( conn->c_mutex );
dc8c34
+				PR_ExitMonitor(conn->c_mutex);
dc8c34
 				return -1; /* Abandon Connection */
dc8c34
 			}
dc8c34
 		}
dc8c34
 		if (is_ber_too_big(conn,ber_len))
dc8c34
 		{
dc8c34
-			PR_Lock( conn->c_mutex );
dc8c34
+			PR_EnterMonitor(conn->c_mutex);
dc8c34
 			connection_remove_operation( conn, op );
dc8c34
 			operation_free(&op, conn);
dc8c34
 			priv->c_current_op = NULL;
dc8c34
-			PR_Unlock( conn->c_mutex );
dc8c34
+			PR_ExitMonitor(conn->c_mutex);
dc8c34
 			return -1; /* Abandon Connection */
dc8c34
 		}
dc8c34
 
dc8c34
@@ -1210,11 +1210,11 @@ static int read_the_data(Connection *conn, int *process_op, int *defer_io, int *
dc8c34
 					"conn=%" NSPRIu64 " received a non-LDAP message"
dc8c34
 					" (tag 0x%lx, expected 0x%lx)\n",
dc8c34
 					conn->c_connid, tag, LDAP_TAG_MESSAGE );
dc8c34
-				PR_Lock( conn->c_mutex );
dc8c34
+				PR_EnterMonitor(conn->c_mutex);
dc8c34
 				connection_remove_operation( conn, op );
dc8c34
 	     	    operation_free(&op, conn);
dc8c34
 				priv->c_current_op = NULL;
dc8c34
-				PR_Unlock( conn->c_mutex );
dc8c34
+				PR_ExitMonitor(conn->c_mutex);
dc8c34
 				return -1; /* Abandon Connection */
dc8c34
 			}
dc8c34
 		}
dc8c34
@@ -1891,10 +1891,10 @@ int connection_read_operation(Connection *conn, Operation *op, ber_tag_t *tag, i
dc8c34
 		if (ret <= 0) {
dc8c34
 			if (0 == ret) {
dc8c34
 				/* Connection is closed */
dc8c34
-				PR_Lock( conn->c_mutex );
dc8c34
+				PR_EnterMonitor(conn->c_mutex);
dc8c34
 				disconnect_server_nomutex( conn, conn->c_connid, -1, SLAPD_DISCONNECT_BAD_BER_TAG, 0 );
dc8c34
 				conn->c_gettingber = 0;
dc8c34
-				PR_Unlock( conn->c_mutex );
dc8c34
+				PR_ExitMonitor(conn->c_mutex);
dc8c34
 				signal_listner();
dc8c34
 				return CONN_DONE;
dc8c34
 			}
dc8c34
@@ -2024,9 +2024,9 @@ int connection_read_operation(Connection *conn, Operation *op, ber_tag_t *tag, i
dc8c34
 
dc8c34
 void connection_make_readable(Connection *conn)
dc8c34
 {
dc8c34
-	PR_Lock( conn->c_mutex );
dc8c34
+	PR_EnterMonitor(conn->c_mutex);
dc8c34
 	conn->c_gettingber = 0;
dc8c34
-	PR_Unlock( conn->c_mutex );
dc8c34
+	PR_ExitMonitor(conn->c_mutex);
dc8c34
 	signal_listner();
dc8c34
 }
dc8c34
 
dc8c34
@@ -2037,7 +2037,7 @@ void connection_check_activity_level(Connection *conn)
dc8c34
 {
dc8c34
 	int current_count = 0;
dc8c34
 	int delta_count = 0;
dc8c34
-	PR_Lock( conn->c_mutex );
dc8c34
+	PR_EnterMonitor(conn->c_mutex);
dc8c34
 	/* get the current op count */
dc8c34
 	current_count = conn->c_opscompleted;
dc8c34
 	/* compare to the previous op count */
dc8c34
@@ -2048,7 +2048,7 @@ void connection_check_activity_level(Connection *conn)
dc8c34
 	conn->c_private->previous_op_count = current_count;
dc8c34
 	/* update the last checked time */
dc8c34
 	conn->c_private->previous_count_check_time = current_time();
dc8c34
-	PR_Unlock( conn->c_mutex );
dc8c34
+	PR_ExitMonitor(conn->c_mutex);
dc8c34
 	LDAPDebug(LDAP_DEBUG_CONNS,"conn %" NSPRIu64 " activity level = %d\n",conn->c_connid,delta_count,0); 
dc8c34
 }
dc8c34
 
dc8c34
@@ -2092,7 +2092,7 @@ void connection_enter_leave_turbo(Connection *conn, int current_turbo_flag, int
dc8c34
 	int connection_count = 0;
dc8c34
 	int our_rank = 0;
dc8c34
 	int threshold_rank = 0;
dc8c34
-	PR_Lock(conn->c_mutex);
dc8c34
+	PR_EnterMonitor(conn->c_mutex);
dc8c34
 	/* We can already be in turbo mode, or not */
dc8c34
 	current_mode = current_turbo_flag;
dc8c34
 	if (pagedresults_in_use_nolock(conn)) {
dc8c34
@@ -2148,7 +2148,7 @@ void connection_enter_leave_turbo(Connection *conn, int current_turbo_flag, int
dc8c34
 		}
dc8c34
 	  }
dc8c34
 	}
dc8c34
-	PR_Unlock(conn->c_mutex);
dc8c34
+	PR_ExitMonitor(conn->c_mutex);
dc8c34
 	if (current_mode != new_mode) {
dc8c34
 		if (current_mode) {
dc8c34
 			LDAPDebug(LDAP_DEBUG_CONNS,"conn %" NSPRIu64 " leaving turbo mode\n",conn->c_connid,0,0); 
dc8c34
@@ -2244,13 +2244,13 @@ connection_threadmain()
dc8c34
 			*/
dc8c34
 			PR_Sleep(PR_INTERVAL_NO_WAIT);
dc8c34
 
dc8c34
-			PR_Lock(conn->c_mutex);
dc8c34
+			PR_EnterMonitor(conn->c_mutex);
dc8c34
 			/* Make our own pb in turbo mode */
dc8c34
 			connection_make_new_pb(&pb,conn);
dc8c34
 			if (connection_call_io_layer_callbacks(conn)) {
dc8c34
 				LDAPDebug0Args( LDAP_DEBUG_ANY, "Error: could not add/remove IO layers from connection\n" );
dc8c34
 			}
dc8c34
-			PR_Unlock(conn->c_mutex);
dc8c34
+			PR_ExitMonitor(conn->c_mutex);
dc8c34
 			if (! config_check_referral_mode()) {
dc8c34
 			  slapi_counter_increment(ops_initiated);
dc8c34
 			  slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsInOps); 
dc8c34
@@ -2374,7 +2374,7 @@ done:
dc8c34
 		/* If this op isn't a persistent search, remove it */
dc8c34
 		if ( !( pb->pb_op->o_flags & OP_FLAG_PS )) {
dc8c34
 		    /* delete from connection operation queue & decr refcnt */
dc8c34
-		    PR_Lock( conn->c_mutex );
dc8c34
+		    PR_EnterMonitor(conn->c_mutex);
dc8c34
 		    connection_remove_operation( conn, op );
dc8c34
 			/* destroying the pblock will cause destruction of the operation
dc8c34
 			 * so this must happend before releasing the connection
dc8c34
@@ -2386,11 +2386,11 @@ done:
dc8c34
 		    if (!thread_turbo_flag && !more_data) {
dc8c34
 				connection_release_nolock (conn);
dc8c34
 			}
dc8c34
-		    PR_Unlock( conn->c_mutex );
dc8c34
+		    PR_ExitMonitor(conn->c_mutex);
dc8c34
 		} else { /* the ps code acquires a ref to the conn - we need to release ours here */
dc8c34
-		    PR_Lock( conn->c_mutex );
dc8c34
+		    PR_EnterMonitor(conn->c_mutex);
dc8c34
 			connection_release_nolock (conn);
dc8c34
-		    PR_Unlock( conn->c_mutex );
dc8c34
+		    PR_ExitMonitor(conn->c_mutex);
dc8c34
 		}
dc8c34
 		/* Since we didn't do so earlier, we need to make a replication connection readable again here */
dc8c34
 		if ( ((1 == is_timedout) || (replication_connection && !thread_turbo_flag)) && !more_data)
dc8c34
@@ -2401,7 +2401,7 @@ done:
dc8c34
 		}
dc8c34
 
dc8c34
 		if (!thread_turbo_flag && !more_data) { /* Don't do this in turbo mode */
dc8c34
-			PR_Lock( conn->c_mutex );
dc8c34
+			PR_EnterMonitor(conn->c_mutex);
dc8c34
 			/* if the threadnumber of now below the maximum, wakeup
dc8c34
 			 * the listener thread so that we start polling on this 
dc8c34
 			 * connection again
dc8c34
@@ -2412,7 +2412,7 @@ done:
dc8c34
 			else
dc8c34
 				need_wakeup = 0;
dc8c34
 			conn->c_threadnumber--;
dc8c34
-			PR_Unlock( conn->c_mutex );
dc8c34
+			PR_ExitMonitor(conn->c_mutex);
dc8c34
 	
dc8c34
 			if (need_wakeup)
dc8c34
 				signal_listner();
dc8c34
@@ -2647,7 +2647,7 @@ op_copy_identity(Connection *conn, Operation *op)
dc8c34
     size_t dnlen;
dc8c34
     size_t typelen;
dc8c34
 
dc8c34
-	PR_Lock( conn->c_mutex );
dc8c34
+	PR_EnterMonitor(conn->c_mutex);
dc8c34
 	dnlen= conn->c_dn ? strlen (conn->c_dn) : 0;
dc8c34
 	typelen= conn->c_authtype ? strlen (conn->c_authtype) : 0;
dc8c34
 
dc8c34
@@ -2679,14 +2679,14 @@ op_copy_identity(Connection *conn, Operation *op)
dc8c34
         op->o_ssf = conn->c_local_ssf;
dc8c34
     }
dc8c34
 
dc8c34
-    PR_Unlock( conn->c_mutex );
dc8c34
+    PR_ExitMonitor(conn->c_mutex);
dc8c34
 }
dc8c34
 
dc8c34
 /* Sets the SSL SSF in the connection struct. */
dc8c34
 static void
dc8c34
 connection_set_ssl_ssf(Connection *conn)
dc8c34
 {
dc8c34
-	PR_Lock( conn->c_mutex );
dc8c34
+	PR_EnterMonitor(conn->c_mutex);
dc8c34
 
dc8c34
 	if (conn->c_flags & CONN_FLAG_SSL) {
dc8c34
 		SSL_SecurityStatus(conn->c_prfd, NULL, NULL, NULL, &(conn->c_ssl_ssf), NULL, NULL);
dc8c34
@@ -2694,7 +2694,7 @@ connection_set_ssl_ssf(Connection *conn)
dc8c34
 		conn->c_ssl_ssf = 0;
dc8c34
 	}
dc8c34
 
dc8c34
-	PR_Unlock( conn->c_mutex );
dc8c34
+	PR_ExitMonitor(conn->c_mutex);
dc8c34
 }
dc8c34
 
dc8c34
 static int
dc8c34
@@ -2741,9 +2741,9 @@ log_ber_too_big_error(const Connection *conn, ber_len_t ber_len,
dc8c34
 void
dc8c34
 disconnect_server( Connection *conn, PRUint64 opconnid, int opid, PRErrorCode reason, PRInt32 error )
dc8c34
 {
dc8c34
-	PR_Lock( conn->c_mutex );
dc8c34
+	PR_EnterMonitor(conn->c_mutex);
dc8c34
 	disconnect_server_nomutex( conn, opconnid, opid, reason, error );
dc8c34
-	PR_Unlock( conn->c_mutex );
dc8c34
+	PR_ExitMonitor(conn->c_mutex);
dc8c34
 }
dc8c34
 
dc8c34
 static ps_wakeup_all_fn_ptr ps_wakeup_all_fn = NULL;
dc8c34
diff --git a/ldap/servers/slapd/conntable.c b/ldap/servers/slapd/conntable.c
dc8c34
index 7cf9f31..5917401 100644
dc8c34
--- a/ldap/servers/slapd/conntable.c
dc8c34
+++ b/ldap/servers/slapd/conntable.c
dc8c34
@@ -141,11 +141,11 @@ connection_table_abandon_all_operations(Connection_Table *ct)
dc8c34
 	int	i;
dc8c34
 	for ( i = 0; i < ct->size; i++ )
dc8c34
 	{
dc8c34
-		if ( ct->c[i].c_mutex != NULL )
dc8c34
+		if ( ct->c[i].c_mutex )
dc8c34
 		{
dc8c34
-			PR_Lock( ct->c[i].c_mutex );
dc8c34
+			PR_EnterMonitor(ct->c[i].c_mutex);
dc8c34
 			connection_abandon_operations( &ct->c[i] );
dc8c34
-			PR_Unlock( ct->c[i].c_mutex );
dc8c34
+			PR_ExitMonitor(ct->c[i].c_mutex);
dc8c34
 		}
dc8c34
 	}
dc8c34
 }
dc8c34
@@ -195,7 +195,7 @@ connection_table_get_connection(Connection_Table *ct, int sd)
dc8c34
 		if ( c->c_mutex == NULL )
dc8c34
 		{
dc8c34
 			PR_Lock( ct->table_mutex );
dc8c34
-			c->c_mutex = PR_NewLock();
dc8c34
+			c->c_mutex = PR_NewMonitor();
dc8c34
 			c->c_pdumutex = PR_NewLock();
dc8c34
 			PR_Unlock( ct->table_mutex );
dc8c34
 			if ( c->c_mutex == NULL || c->c_pdumutex == NULL )
dc8c34
@@ -399,7 +399,7 @@ connection_table_as_entry(Connection_Table *ct, Slapi_Entry *e)
dc8c34
 		/* Can't take c_mutex if holding table_mutex; temporarily unlock */ 
dc8c34
 		PR_Unlock( ct->table_mutex );
dc8c34
 
dc8c34
-		PR_Lock( ct->c[i].c_mutex );
dc8c34
+		PR_EnterMonitor(ct->c[i].c_mutex);
dc8c34
 		if ( ct->c[i].c_sd != SLAPD_INVALID_SOCKET )
dc8c34
 		{
dc8c34
 			char buf2[20];
dc8c34
@@ -446,7 +446,7 @@ connection_table_as_entry(Connection_Table *ct, Slapi_Entry *e)
dc8c34
 			attrlist_merge( &e->e_attrs, "connection", vals );
dc8c34
 			slapi_ch_free_string(&newbuf);
dc8c34
 		}
dc8c34
-		PR_Unlock( ct->c[i].c_mutex );
dc8c34
+		PR_ExitMonitor(ct->c[i].c_mutex);
dc8c34
 	}
dc8c34
 
dc8c34
 	PR_snprintf( buf, sizeof(buf), "%d", nconns );
dc8c34
@@ -474,14 +474,15 @@ void
dc8c34
 connection_table_dump_activity_to_errors_log(Connection_Table *ct)
dc8c34
 {
dc8c34
 	int i;
dc8c34
+
dc8c34
 	for ( i = 0; i < ct->size; i++ )
dc8c34
 	{
dc8c34
 		Connection *c= &(ct->c[i]);
dc8c34
-		if ( c->c_mutex != NULL )
dc8c34
+		if ( c->c_mutex )
dc8c34
 		{
dc8c34
 			/* Find the connection we are referring to */
dc8c34
 			int j= c->c_fdi;
dc8c34
-			PR_Lock( c->c_mutex );
dc8c34
+			PR_EnterMonitor(c->c_mutex);
dc8c34
 			if ( (c->c_sd != SLAPD_INVALID_SOCKET) && 
dc8c34
 			     (j >= 0) && (c->c_prfd == ct->fd[j].fd) )
dc8c34
 			{
dc8c34
@@ -491,7 +492,7 @@ connection_table_dump_activity_to_errors_log(Connection_Table *ct)
dc8c34
 					LDAPDebug( LDAP_DEBUG_CONNS,"activity on %d%s\n", i, r ? "r" : "",0 );
dc8c34
 				}
dc8c34
 			}
dc8c34
-			PR_Unlock( c->c_mutex );
dc8c34
+			PR_ExitMonitor(c->c_mutex);
dc8c34
 		}
dc8c34
 	}
dc8c34
 }
dc8c34
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
dc8c34
index 9a362c7..b34358d 100644
dc8c34
--- a/ldap/servers/slapd/daemon.c
dc8c34
+++ b/ldap/servers/slapd/daemon.c
dc8c34
@@ -1678,7 +1678,7 @@ setup_pr_read_pds(Connection_Table *ct, PRFileDesc **n_tcps, PRFileDesc **s_tcps
dc8c34
 		}
dc8c34
 		else
dc8c34
 		{
dc8c34
-			PR_Lock( c->c_mutex );
dc8c34
+			PR_EnterMonitor(c->c_mutex);
dc8c34
 			if (c->c_flags & CONN_FLAG_CLOSING)
dc8c34
 			{
dc8c34
 				/* A worker thread has marked that this connection
dc8c34
@@ -1724,7 +1724,7 @@ setup_pr_read_pds(Connection_Table *ct, PRFileDesc **n_tcps, PRFileDesc **s_tcps
dc8c34
 					c->c_fdi = SLAPD_INVALID_SOCKET_INDEX;
dc8c34
 				}
dc8c34
 			}
dc8c34
-			PR_Unlock( c->c_mutex );
dc8c34
+			PR_ExitMonitor(c->c_mutex);
dc8c34
 		}
dc8c34
 		c = next;
dc8c34
 	}
dc8c34
@@ -1743,7 +1743,7 @@ handle_timeout( void )
dc8c34
 	time_t curtime = current_time();
dc8c34
 
dc8c34
 	if (0 == prevtime) {
dc8c34
-		prevtime = time (&housekeeping_fire_time);		
dc8c34
+		prevtime = time (&housekeeping_fire_time);
dc8c34
 	}
dc8c34
 
dc8c34
 	if ( difftime(curtime, prevtime) >= 
dc8c34
@@ -1979,7 +1979,7 @@ handle_pr_read_ready(Connection_Table *ct, PRIntn num_poll)
dc8c34
 	{
dc8c34
 		if ( c->c_mutex != NULL )
dc8c34
 		{
dc8c34
-			PR_Lock( c->c_mutex );
dc8c34
+			PR_EnterMonitor(c->c_mutex);
dc8c34
 			if ( connection_is_active_nolock (c) && c->c_gettingber == 0 )
dc8c34
 			{
dc8c34
 			    PRInt16 out_flags;
dc8c34
@@ -2036,7 +2036,7 @@ handle_pr_read_ready(Connection_Table *ct, PRIntn num_poll)
dc8c34
 								   SLAPD_DISCONNECT_IDLE_TIMEOUT, EAGAIN );
dc8c34
 				}
dc8c34
 			}
dc8c34
-			PR_Unlock( c->c_mutex );
dc8c34
+			PR_ExitMonitor(c->c_mutex);
dc8c34
 		}
dc8c34
 	}
dc8c34
 #endif
dc8c34
@@ -2611,7 +2611,7 @@ handle_new_connection(Connection_Table *ct, int tcps, PRFileDesc *pr_acceptfd, i
dc8c34
 		PR_Close(pr_acceptfd);
dc8c34
 		return -1;
dc8c34
 	}
dc8c34
-	PR_Lock( conn->c_mutex );
dc8c34
+	PR_EnterMonitor(conn->c_mutex);
dc8c34
 
dc8c34
 	/*
dc8c34
 	 * Set the default idletimeout and the handle.  We'll update c_idletimeout
dc8c34
@@ -2721,7 +2721,7 @@ handle_new_connection(Connection_Table *ct, int tcps, PRFileDesc *pr_acceptfd, i
dc8c34
 		connection_table_move_connection_on_to_active_list(the_connection_table,conn);
dc8c34
 	}
dc8c34
 
dc8c34
-	PR_Unlock( conn->c_mutex );
dc8c34
+	PR_ExitMonitor(conn->c_mutex);
dc8c34
 
dc8c34
 	g_increment_current_conn_count();
dc8c34
 
dc8c34
diff --git a/ldap/servers/slapd/extendop.c b/ldap/servers/slapd/extendop.c
dc8c34
index 8f25b27..0a0615c 100644
dc8c34
--- a/ldap/servers/slapd/extendop.c
dc8c34
+++ b/ldap/servers/slapd/extendop.c
dc8c34
@@ -90,7 +90,7 @@ static void extop_handle_import_start(Slapi_PBlock *pb, char *extoid,
dc8c34
         send_ldap_result(pb, LDAP_OPERATIONS_ERROR, NULL, NULL, 0, NULL);
dc8c34
         return;
dc8c34
     }
dc8c34
-	suffix = slapi_sdn_get_dn(sdn);
dc8c34
+    suffix = slapi_sdn_get_dn(sdn);
dc8c34
     /*    be = slapi_be_select(sdn); */
dc8c34
     be = slapi_mapping_tree_find_backend_for_sdn(sdn);
dc8c34
     if (be == NULL || be == defbackend_get_backend()) {
dc8c34
@@ -164,10 +164,10 @@ static void extop_handle_import_start(Slapi_PBlock *pb, char *extoid,
dc8c34
     /* okay, the import is starting now -- save the backend in the
dc8c34
      * connection block & mark this connection as belonging to a bulk import
dc8c34
      */
dc8c34
-    PR_Lock(pb->pb_conn->c_mutex);
dc8c34
+    PR_EnterMonitor(pb->pb_conn->c_mutex);
dc8c34
     pb->pb_conn->c_flags |= CONN_FLAG_IMPORT;
dc8c34
     pb->pb_conn->c_bi_backend = be;
dc8c34
-    PR_Unlock(pb->pb_conn->c_mutex);
dc8c34
+    PR_ExitMonitor(pb->pb_conn->c_mutex);
dc8c34
 
dc8c34
     slapi_pblock_set(pb, SLAPI_EXT_OP_RET_OID, EXTOP_BULK_IMPORT_START_OID);
dc8c34
     bv.bv_val = NULL;
dc8c34
@@ -189,11 +189,11 @@ static void extop_handle_import_done(Slapi_PBlock *pb, char *extoid,
dc8c34
     struct berval bv;
dc8c34
     int ret;
dc8c34
 
dc8c34
-    PR_Lock(pb->pb_conn->c_mutex);
dc8c34
+    PR_EnterMonitor(pb->pb_conn->c_mutex);
dc8c34
     pb->pb_conn->c_flags &= ~CONN_FLAG_IMPORT;
dc8c34
     be = pb->pb_conn->c_bi_backend;
dc8c34
     pb->pb_conn->c_bi_backend = NULL;
dc8c34
-    PR_Unlock(pb->pb_conn->c_mutex);
dc8c34
+    PR_ExitMonitor(pb->pb_conn->c_mutex);
dc8c34
 
dc8c34
     if ((be == NULL) || (be->be_wire_import == NULL)) {
dc8c34
         /* can this even happen? */
dc8c34
diff --git a/ldap/servers/slapd/opshared.c b/ldap/servers/slapd/opshared.c
dc8c34
index e73ac6e..6ddbc91 100644
dc8c34
--- a/ldap/servers/slapd/opshared.c
dc8c34
+++ b/ldap/servers/slapd/opshared.c
dc8c34
@@ -700,7 +700,7 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
dc8c34
        * In async paged result case, the search result might be released
dc8c34
        * by other theads.  We need to double check it in the locked region.
dc8c34
        */
dc8c34
-      PR_Lock(pb->pb_conn->c_mutex);
dc8c34
+      PR_EnterMonitor(pb->pb_conn->c_mutex);
dc8c34
       pr_search_result = pagedresults_get_search_result(pb->pb_conn, operation, 1/*locked*/, pr_idx);
dc8c34
       if (pr_search_result) {
dc8c34
         if (pagedresults_is_abandoned_or_notavailable(pb->pb_conn, 1/*locked*/, pr_idx)) {
dc8c34
@@ -708,7 +708,7 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
dc8c34
           /* Previous operation was abandoned and the simplepaged object is not in use. */
dc8c34
           send_ldap_result(pb, 0, NULL, "Simple Paged Results Search abandoned", 0, NULL);
dc8c34
           rc = LDAP_SUCCESS;
dc8c34
-          PR_Unlock(pb->pb_conn->c_mutex);
dc8c34
+          PR_ExitMonitor(pb->pb_conn->c_mutex);
dc8c34
           goto free_and_return;
dc8c34
         } else {
dc8c34
           slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_SET, pr_search_result );
dc8c34
@@ -717,7 +717,7 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
dc8c34
           /* search result could be reset in the backend/dse */
dc8c34
           slapi_pblock_get(pb, SLAPI_SEARCH_RESULT_SET, &sr);
dc8c34
           pagedresults_set_search_result(pb->pb_conn, operation, sr, 1/*locked*/, pr_idx);
dc8c34
-          PR_Unlock(pb->pb_conn->c_mutex);
dc8c34
+          PR_ExitMonitor(pb->pb_conn->c_mutex);
dc8c34
         }
dc8c34
       } else {
dc8c34
         pr_stat = PAGEDRESULTS_SEARCH_END;
dc8c34
@@ -851,10 +851,10 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
dc8c34
         /* PAGED RESULTS */
dc8c34
         if (op_is_pagedresults(operation)) {
dc8c34
             /* cleanup the slot */
dc8c34
-            PR_Lock(pb->pb_conn->c_mutex);
dc8c34
+            PR_EnterMonitor(pb->pb_conn->c_mutex);
dc8c34
             pagedresults_set_search_result(pb->pb_conn, operation, NULL, 1, pr_idx);
dc8c34
             rc = pagedresults_set_current_be(pb->pb_conn, NULL, pr_idx, 1);
dc8c34
-            PR_Unlock(pb->pb_conn->c_mutex);
dc8c34
+            PR_ExitMonitor(pb->pb_conn->c_mutex);
dc8c34
         }
dc8c34
         if (1 == flag_no_such_object) {
dc8c34
             break;
dc8c34
@@ -896,11 +896,11 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
dc8c34
             slapi_pblock_get(pb, SLAPI_SEARCH_RESULT_SET, &sr);
dc8c34
             if (PAGEDRESULTS_SEARCH_END == pr_stat) {
dc8c34
               /* no more entries, but at least another backend */
dc8c34
-              PR_Lock(pb->pb_conn->c_mutex);
dc8c34
+              PR_EnterMonitor(pb->pb_conn->c_mutex);
dc8c34
               pagedresults_set_search_result(pb->pb_conn, operation, NULL, 1, pr_idx);
dc8c34
               be->be_search_results_release(&sr);
dc8c34
               rc = pagedresults_set_current_be(pb->pb_conn, next_be, pr_idx, 1);
dc8c34
-              PR_Unlock(pb->pb_conn->c_mutex);
dc8c34
+              PR_ExitMonitor(pb->pb_conn->c_mutex);
dc8c34
               if (NULL == next_be) {
dc8c34
                   /* no more entries && no more backends */
dc8c34
                   curr_search_count = -1;
dc8c34
@@ -925,9 +925,9 @@ op_shared_search (Slapi_PBlock *pb, int send_result)
dc8c34
             next_be = NULL; /* to break the loop */
dc8c34
             if (operation->o_status & SLAPI_OP_STATUS_ABANDONED) {
dc8c34
                 /* It turned out this search was abandoned. */
dc8c34
-                PR_Lock(pb->pb_conn->c_mutex);
dc8c34
+                PR_EnterMonitor(pb->pb_conn->c_mutex);
dc8c34
                 pagedresults_free_one_msgid_nolock( pb->pb_conn, operation->o_msgid);
dc8c34
-                PR_Unlock(pb->pb_conn->c_mutex);
dc8c34
+                PR_ExitMonitor(pb->pb_conn->c_mutex);
dc8c34
                 /* paged-results-request was abandoned; making an empty cookie. */
dc8c34
                 pagedresults_set_response_control(pb, 0, estimate, -1, pr_idx);
dc8c34
                 send_ldap_result(pb, 0, NULL, "Simple Paged Results Search abandoned", 0, NULL);
dc8c34
diff --git a/ldap/servers/slapd/pagedresults.c b/ldap/servers/slapd/pagedresults.c
dc8c34
index c1947f1..d10edd0 100644
dc8c34
--- a/ldap/servers/slapd/pagedresults.c
dc8c34
+++ b/ldap/servers/slapd/pagedresults.c
dc8c34
@@ -119,7 +119,7 @@ pagedresults_parse_control_value( Slapi_PBlock *pb,
dc8c34
         return LDAP_PROTOCOL_ERROR;
dc8c34
     }
dc8c34
 
dc8c34
-    PR_Lock(conn->c_mutex);
dc8c34
+    PR_EnterMonitor(conn->c_mutex);
dc8c34
     /* the ber encoding is no longer needed */
dc8c34
     ber_free(ber, 1);
dc8c34
     if ( cookie.bv_len <= 0 ) {
dc8c34
@@ -217,7 +217,7 @@ bail:
dc8c34
             }
dc8c34
         }
dc8c34
     }
dc8c34
-    PR_Unlock(conn->c_mutex);
dc8c34
+    PR_ExitMonitor(conn->c_mutex);
dc8c34
 
dc8c34
     LDAPDebug1Arg(LDAP_DEBUG_TRACE,
dc8c34
                   "<-- pagedresults_parse_control_value: idx %d\n", *index);
dc8c34
@@ -314,7 +314,7 @@ pagedresults_free_one( Connection *conn, Operation *op, int index )
dc8c34
     LDAPDebug1Arg(LDAP_DEBUG_TRACE,
dc8c34
                   "--> pagedresults_free_one: idx=%d\n", index);
dc8c34
     if (conn && (index > -1)) {
dc8c34
-        PR_Lock(conn->c_mutex);
dc8c34
+        PR_EnterMonitor(conn->c_mutex);
dc8c34
         if (conn->c_pagedresults.prl_count <= 0) {
dc8c34
             LDAPDebug2Args(LDAP_DEBUG_TRACE, "pagedresults_free_one: "
dc8c34
                            "conn=%d paged requests list count is %d\n",
dc8c34
@@ -325,7 +325,7 @@ pagedresults_free_one( Connection *conn, Operation *op, int index )
dc8c34
             conn->c_pagedresults.prl_count--;
dc8c34
             rc = 0;
dc8c34
         }
dc8c34
-        PR_Unlock(conn->c_mutex);
dc8c34
+        PR_ExitMonitor(conn->c_mutex);
dc8c34
     }
dc8c34
 
dc8c34
     LDAPDebug1Arg(LDAP_DEBUG_TRACE, "<-- pagedresults_free_one: %d\n", rc);
dc8c34
@@ -377,11 +377,11 @@ pagedresults_get_current_be(Connection *conn, int index)
dc8c34
     LDAPDebug1Arg(LDAP_DEBUG_TRACE,
dc8c34
                   "--> pagedresults_get_current_be: idx=%d\n", index);
dc8c34
     if (conn && (index > -1)) {
dc8c34
-        PR_Lock(conn->c_mutex);
dc8c34
+        PR_EnterMonitor(conn->c_mutex);
dc8c34
         if (index < conn->c_pagedresults.prl_maxlen) {
dc8c34
             be = conn->c_pagedresults.prl_list[index].pr_current_be;
dc8c34
         }
dc8c34
-        PR_Unlock(conn->c_mutex);
dc8c34
+        PR_ExitMonitor(conn->c_mutex);
dc8c34
     }
dc8c34
     LDAPDebug1Arg(LDAP_DEBUG_TRACE,
dc8c34
                   "<-- pagedresults_get_current_be: %p\n", be);
dc8c34
@@ -395,12 +395,12 @@ pagedresults_set_current_be(Connection *conn, Slapi_Backend *be, int index, int
dc8c34
     LDAPDebug1Arg(LDAP_DEBUG_TRACE,
dc8c34
                   "--> pagedresults_set_current_be: idx=%d\n", index);
dc8c34
     if (conn && (index > -1)) {
dc8c34
-        if (!nolock) PR_Lock(conn->c_mutex);
dc8c34
+        if (!nolock) PR_EnterMonitor(conn->c_mutex);
dc8c34
         if (index < conn->c_pagedresults.prl_maxlen) {
dc8c34
             conn->c_pagedresults.prl_list[index].pr_current_be = be;
dc8c34
         }
dc8c34
         rc = 0;
dc8c34
-        if (!nolock) PR_Unlock(conn->c_mutex);
dc8c34
+        if (!nolock) PR_ExitMonitor(conn->c_mutex);
dc8c34
     }
dc8c34
     LDAPDebug1Arg(LDAP_DEBUG_TRACE,
dc8c34
                   "<-- pagedresults_set_current_be: %d\n", rc);
dc8c34
@@ -419,13 +419,13 @@ pagedresults_get_search_result(Connection *conn, Operation *op, int locked, int
dc8c34
                    locked?"locked":"not locked", index);
dc8c34
     if (conn && (index > -1)) {
dc8c34
         if (!locked) {
dc8c34
-            PR_Lock(conn->c_mutex);
dc8c34
+            PR_EnterMonitor(conn->c_mutex);
dc8c34
         }
dc8c34
         if (index < conn->c_pagedresults.prl_maxlen) {
dc8c34
             sr = conn->c_pagedresults.prl_list[index].pr_search_result_set;
dc8c34
         }
dc8c34
         if (!locked) {
dc8c34
-            PR_Unlock(conn->c_mutex);
dc8c34
+            PR_ExitMonitor(conn->c_mutex);
dc8c34
         }
dc8c34
     }
dc8c34
     LDAPDebug1Arg(LDAP_DEBUG_TRACE,
dc8c34
@@ -444,7 +444,7 @@ pagedresults_set_search_result(Connection *conn, Operation *op, void *sr, int lo
dc8c34
                    "--> pagedresults_set_search_result: idx=%d, sr=%p\n",
dc8c34
                    index, sr);
dc8c34
     if (conn && (index > -1)) {
dc8c34
-        if (!locked) PR_Lock(conn->c_mutex);
dc8c34
+        if (!locked) PR_EnterMonitor(conn->c_mutex);
dc8c34
         if (index < conn->c_pagedresults.prl_maxlen) {
dc8c34
             PagedResults *prp = conn->c_pagedresults.prl_list + index;
dc8c34
             if (!(prp->pr_flags & CONN_FLAG_PAGEDRESULTS_ABANDONED) || !sr) {
dc8c34
@@ -453,7 +453,7 @@ pagedresults_set_search_result(Connection *conn, Operation *op, void *sr, int lo
dc8c34
             }
dc8c34
             rc = 0;
dc8c34
         }
dc8c34
-        if (!locked) PR_Unlock(conn->c_mutex);
dc8c34
+        if (!locked) PR_ExitMonitor(conn->c_mutex);
dc8c34
     }
dc8c34
     LDAPDebug1Arg(LDAP_DEBUG_TRACE,
dc8c34
                   "<-- pagedresults_set_search_result: %d\n", rc);
dc8c34
@@ -470,11 +470,11 @@ pagedresults_get_search_result_count(Connection *conn, Operation *op, int index)
dc8c34
     LDAPDebug1Arg(LDAP_DEBUG_TRACE,
dc8c34
                   "--> pagedresults_get_search_result_count: idx=%d\n", index);
dc8c34
     if (conn && (index > -1)) {
dc8c34
-        PR_Lock(conn->c_mutex);
dc8c34
+        PR_EnterMonitor(conn->c_mutex);
dc8c34
         if (index < conn->c_pagedresults.prl_maxlen) {
dc8c34
             count = conn->c_pagedresults.prl_list[index].pr_search_result_count;
dc8c34
         }
dc8c34
-        PR_Unlock(conn->c_mutex);
dc8c34
+        PR_ExitMonitor(conn->c_mutex);
dc8c34
     }
dc8c34
     LDAPDebug1Arg(LDAP_DEBUG_TRACE,
dc8c34
                   "<-- pagedresults_get_search_result_count: %d\n", count);
dc8c34
@@ -492,11 +492,11 @@ pagedresults_set_search_result_count(Connection *conn, Operation *op,
dc8c34
     LDAPDebug1Arg(LDAP_DEBUG_TRACE,
dc8c34
                   "--> pagedresults_set_search_result_count: idx=%d\n", index);
dc8c34
     if (conn && (index > -1)) {
dc8c34
-        PR_Lock(conn->c_mutex);
dc8c34
+        PR_EnterMonitor(conn->c_mutex);
dc8c34
         if (index < conn->c_pagedresults.prl_maxlen) {
dc8c34
             conn->c_pagedresults.prl_list[index].pr_search_result_count = count;
dc8c34
         }
dc8c34
-        PR_Unlock(conn->c_mutex);
dc8c34
+        PR_ExitMonitor(conn->c_mutex);
dc8c34
         rc = 0;
dc8c34
     }
dc8c34
     LDAPDebug1Arg(LDAP_DEBUG_TRACE,
dc8c34
@@ -517,11 +517,11 @@ pagedresults_get_search_result_set_size_estimate(Connection *conn,
dc8c34
                   "--> pagedresults_get_search_result_set_size_estimate: "
dc8c34
                   "idx=%d\n", index);
dc8c34
     if (conn && (index > -1)) {
dc8c34
-        PR_Lock(conn->c_mutex);
dc8c34
+        PR_EnterMonitor(conn->c_mutex);
dc8c34
         if (index < conn->c_pagedresults.prl_maxlen) {
dc8c34
             count = conn->c_pagedresults.prl_list[index].pr_search_result_set_size_estimate;
dc8c34
         }
dc8c34
-        PR_Unlock(conn->c_mutex);
dc8c34
+        PR_ExitMonitor(conn->c_mutex);
dc8c34
     }
dc8c34
     LDAPDebug1Arg(LDAP_DEBUG_TRACE,
dc8c34
                   "<-- pagedresults_get_search_result_set_size_estimate: %d\n",
dc8c34
@@ -542,11 +542,11 @@ pagedresults_set_search_result_set_size_estimate(Connection *conn,
dc8c34
                   "--> pagedresults_set_search_result_set_size_estimate: "
dc8c34
                   "idx=%d\n", index);
dc8c34
     if (conn && (index > -1)) {
dc8c34
-        PR_Lock(conn->c_mutex);
dc8c34
+        PR_EnterMonitor(conn->c_mutex);
dc8c34
         if (index < conn->c_pagedresults.prl_maxlen) {
dc8c34
             conn->c_pagedresults.prl_list[index].pr_search_result_set_size_estimate = count;
dc8c34
         }
dc8c34
-        PR_Unlock(conn->c_mutex);
dc8c34
+        PR_ExitMonitor(conn->c_mutex);
dc8c34
         rc = 0;
dc8c34
     }
dc8c34
     LDAPDebug1Arg(LDAP_DEBUG_TRACE,
dc8c34
@@ -565,11 +565,11 @@ pagedresults_get_with_sort(Connection *conn, Operation *op, int index)
dc8c34
     LDAPDebug1Arg(LDAP_DEBUG_TRACE,
dc8c34
                   "--> pagedresults_get_with_sort: idx=%d\n", index);
dc8c34
     if (conn && (index > -1)) {
dc8c34
-        PR_Lock(conn->c_mutex);
dc8c34
+        PR_EnterMonitor(conn->c_mutex);
dc8c34
         if (index < conn->c_pagedresults.prl_maxlen) {
dc8c34
             flags = conn->c_pagedresults.prl_list[index].pr_flags&CONN_FLAG_PAGEDRESULTS_WITH_SORT;
dc8c34
         }
dc8c34
-        PR_Unlock(conn->c_mutex);
dc8c34
+        PR_ExitMonitor(conn->c_mutex);
dc8c34
     }
dc8c34
     LDAPDebug1Arg(LDAP_DEBUG_TRACE,
dc8c34
                   "<-- pagedresults_get_with_sort: %p\n", flags);
dc8c34
@@ -587,14 +587,14 @@ pagedresults_set_with_sort(Connection *conn, Operation *op,
dc8c34
     LDAPDebug1Arg(LDAP_DEBUG_TRACE,
dc8c34
                   "--> pagedresults_set_with_sort: idx=%d\n", index);
dc8c34
     if (conn && (index > -1)) {
dc8c34
-        PR_Lock(conn->c_mutex);
dc8c34
+        PR_EnterMonitor(conn->c_mutex);
dc8c34
         if (index < conn->c_pagedresults.prl_maxlen) {
dc8c34
             if (flags & OP_FLAG_SERVER_SIDE_SORTING) {
dc8c34
                 conn->c_pagedresults.prl_list[index].pr_flags |=
dc8c34
                                                CONN_FLAG_PAGEDRESULTS_WITH_SORT;
dc8c34
             }
dc8c34
         }
dc8c34
-        PR_Unlock(conn->c_mutex);
dc8c34
+        PR_ExitMonitor(conn->c_mutex);
dc8c34
         rc = 0;
dc8c34
     }
dc8c34
     LDAPDebug1Arg(LDAP_DEBUG_TRACE, "<-- pagedresults_set_with_sort: %d\n", rc);
dc8c34
@@ -611,11 +611,11 @@ pagedresults_get_unindexed(Connection *conn, Operation *op, int index)
dc8c34
     LDAPDebug1Arg(LDAP_DEBUG_TRACE,
dc8c34
                   "--> pagedresults_get_unindexed: idx=%d\n", index);
dc8c34
     if (conn && (index > -1)) {
dc8c34
-        PR_Lock(conn->c_mutex);
dc8c34
+        PR_EnterMonitor(conn->c_mutex);
dc8c34
         if (index < conn->c_pagedresults.prl_maxlen) {
dc8c34
             flags = conn->c_pagedresults.prl_list[index].pr_flags&CONN_FLAG_PAGEDRESULTS_UNINDEXED;
dc8c34
         }
dc8c34
-        PR_Unlock(conn->c_mutex);
dc8c34
+        PR_ExitMonitor(conn->c_mutex);
dc8c34
     }
dc8c34
     LDAPDebug1Arg(LDAP_DEBUG_TRACE,
dc8c34
                   "<-- pagedresults_get_unindexed: %p\n", flags);
dc8c34
@@ -632,12 +632,12 @@ pagedresults_set_unindexed(Connection *conn, Operation *op, int index)
dc8c34
     LDAPDebug1Arg(LDAP_DEBUG_TRACE,
dc8c34
                   "--> pagedresults_set_unindexed: idx=%d\n", index);
dc8c34
     if (conn && (index > -1)) {
dc8c34
-        PR_Lock(conn->c_mutex);
dc8c34
+        PR_EnterMonitor(conn->c_mutex);
dc8c34
         if (index < conn->c_pagedresults.prl_maxlen) {
dc8c34
             conn->c_pagedresults.prl_list[index].pr_flags |=
dc8c34
                                                CONN_FLAG_PAGEDRESULTS_UNINDEXED;
dc8c34
         }
dc8c34
-        PR_Unlock(conn->c_mutex);
dc8c34
+        PR_ExitMonitor(conn->c_mutex);
dc8c34
         rc = 0;
dc8c34
     }
dc8c34
     LDAPDebug1Arg(LDAP_DEBUG_TRACE,
dc8c34
@@ -655,11 +655,11 @@ pagedresults_get_sort_result_code(Connection *conn, Operation *op, int index)
dc8c34
     LDAPDebug1Arg(LDAP_DEBUG_TRACE,
dc8c34
                   "--> pagedresults_get_sort_result_code: idx=%d\n", index);
dc8c34
     if (conn && (index > -1)) {
dc8c34
-        PR_Lock(conn->c_mutex);
dc8c34
+        PR_EnterMonitor(conn->c_mutex);
dc8c34
         if (index < conn->c_pagedresults.prl_maxlen) {
dc8c34
             code = conn->c_pagedresults.prl_list[index].pr_sort_result_code;
dc8c34
         }
dc8c34
-        PR_Unlock(conn->c_mutex);
dc8c34
+        PR_ExitMonitor(conn->c_mutex);
dc8c34
     }
dc8c34
     LDAPDebug1Arg(LDAP_DEBUG_TRACE,
dc8c34
                   "<-- pagedresults_get_sort_result_code: %d\n", code);
dc8c34
@@ -677,11 +677,11 @@ pagedresults_set_sort_result_code(Connection *conn, Operation *op,
dc8c34
     LDAPDebug1Arg(LDAP_DEBUG_TRACE,
dc8c34
                   "--> pagedresults_set_sort_result_code: idx=%d\n", index);
dc8c34
     if (conn && (index > -1)) {
dc8c34
-        PR_Lock(conn->c_mutex);
dc8c34
+        PR_EnterMonitor(conn->c_mutex);
dc8c34
         if (index < conn->c_pagedresults.prl_maxlen) {
dc8c34
             conn->c_pagedresults.prl_list[index].pr_sort_result_code = code;
dc8c34
         }
dc8c34
-        PR_Unlock(conn->c_mutex);
dc8c34
+        PR_ExitMonitor(conn->c_mutex);
dc8c34
         rc = 0;
dc8c34
     }
dc8c34
     LDAPDebug1Arg(LDAP_DEBUG_TRACE,
dc8c34
@@ -700,11 +700,11 @@ pagedresults_set_timelimit(Connection *conn, Operation *op,
dc8c34
     LDAPDebug1Arg(LDAP_DEBUG_TRACE,
dc8c34
                   "--> pagedresults_set_timelimit: idx=%d\n", index);
dc8c34
     if (conn && (index > -1)) {
dc8c34
-        PR_Lock(conn->c_mutex);
dc8c34
+        PR_EnterMonitor(conn->c_mutex);
dc8c34
         if (index < conn->c_pagedresults.prl_maxlen) {
dc8c34
             conn->c_pagedresults.prl_list[index].pr_timelimit = timelimit;
dc8c34
         }
dc8c34
-        PR_Unlock(conn->c_mutex);
dc8c34
+        PR_ExitMonitor(conn->c_mutex);
dc8c34
         rc = 0;
dc8c34
     }
dc8c34
     LDAPDebug1Arg(LDAP_DEBUG_TRACE, "<-- pagedresults_set_timelimit: %d\n", rc);
dc8c34
@@ -762,7 +762,7 @@ pagedresults_cleanup(Connection *conn, int needlock)
dc8c34
     }
dc8c34
 
dc8c34
     if (needlock) {
dc8c34
-        PR_Lock(conn->c_mutex);
dc8c34
+        PR_EnterMonitor(conn->c_mutex);
dc8c34
     }
dc8c34
     for (i = 0; conn->c_pagedresults.prl_list &&
dc8c34
                 i < conn->c_pagedresults.prl_maxlen; i++) {
dc8c34
@@ -780,7 +780,7 @@ pagedresults_cleanup(Connection *conn, int needlock)
dc8c34
     }
dc8c34
     conn->c_pagedresults.prl_count = 0;
dc8c34
     if (needlock) {
dc8c34
-        PR_Unlock(conn->c_mutex);
dc8c34
+        PR_ExitMonitor(conn->c_mutex);
dc8c34
     }
dc8c34
     LDAPDebug1Arg(LDAP_DEBUG_TRACE, "<-- pagedresults_cleanup: %d\n", rc);
dc8c34
     return rc;
dc8c34
@@ -807,7 +807,7 @@ pagedresults_cleanup_all(Connection *conn, int needlock)
dc8c34
     }
dc8c34
 
dc8c34
     if (needlock) {
dc8c34
-        PR_Lock(conn->c_mutex);
dc8c34
+        PR_EnterMonitor(conn->c_mutex);
dc8c34
     }
dc8c34
     for (i = 0; conn->c_pagedresults.prl_list &&
dc8c34
                 i < conn->c_pagedresults.prl_maxlen; i++) {
dc8c34
@@ -826,7 +826,7 @@ pagedresults_cleanup_all(Connection *conn, int needlock)
dc8c34
     conn->c_pagedresults.prl_maxlen = 0;
dc8c34
     conn->c_pagedresults.prl_count = 0;
dc8c34
     if (needlock) {
dc8c34
-        PR_Unlock(conn->c_mutex);
dc8c34
+        PR_ExitMonitor(conn->c_mutex);
dc8c34
     }
dc8c34
     LDAPDebug1Arg(LDAP_DEBUG_TRACE, "<-- pagedresults_cleanup_all: %d\n", rc);
dc8c34
     return rc;
dc8c34
@@ -845,7 +845,7 @@ pagedresults_check_or_set_processing(Connection *conn, int index)
dc8c34
     LDAPDebug1Arg(LDAP_DEBUG_TRACE,
dc8c34
                   "--> pagedresults_check_or_set_processing\n", index);
dc8c34
     if (conn && (index > -1)) {
dc8c34
-        PR_Lock(conn->c_mutex);
dc8c34
+        PR_EnterMonitor(conn->c_mutex);
dc8c34
         if (index < conn->c_pagedresults.prl_maxlen) {
dc8c34
             ret = (conn->c_pagedresults.prl_list[index].pr_flags &
dc8c34
                    CONN_FLAG_PAGEDRESULTS_PROCESSING);
dc8c34
@@ -853,7 +853,7 @@ pagedresults_check_or_set_processing(Connection *conn, int index)
dc8c34
             conn->c_pagedresults.prl_list[index].pr_flags |=
dc8c34
                                               CONN_FLAG_PAGEDRESULTS_PROCESSING;
dc8c34
         }
dc8c34
-        PR_Unlock(conn->c_mutex);
dc8c34
+        PR_ExitMonitor(conn->c_mutex);
dc8c34
     }
dc8c34
     LDAPDebug1Arg(LDAP_DEBUG_TRACE,
dc8c34
                   "<-- pagedresults_check_or_set_processing: %d\n", ret);
dc8c34
@@ -872,7 +872,7 @@ pagedresults_reset_processing(Connection *conn, int index)
dc8c34
     LDAPDebug1Arg(LDAP_DEBUG_TRACE,
dc8c34
                   "--> pagedresults_reset_processing: idx=%d\n", index);
dc8c34
     if (conn && (index > -1)) {
dc8c34
-        PR_Lock(conn->c_mutex);
dc8c34
+        PR_EnterMonitor(conn->c_mutex);
dc8c34
         if (index < conn->c_pagedresults.prl_maxlen) {
dc8c34
             ret = (conn->c_pagedresults.prl_list[index].pr_flags &
dc8c34
                    CONN_FLAG_PAGEDRESULTS_PROCESSING);
dc8c34
@@ -880,7 +880,7 @@ pagedresults_reset_processing(Connection *conn, int index)
dc8c34
             conn->c_pagedresults.prl_list[index].pr_flags &=
dc8c34
                                              ~CONN_FLAG_PAGEDRESULTS_PROCESSING;
dc8c34
         }
dc8c34
-        PR_Unlock(conn->c_mutex);
dc8c34
+        PR_ExitMonitor(conn->c_mutex);
dc8c34
     }
dc8c34
     LDAPDebug1Arg(LDAP_DEBUG_TRACE,
dc8c34
                   "<-- pagedresults_reset_processing: %d\n", ret);
dc8c34
@@ -994,9 +994,9 @@ pagedresults_lock( Connection *conn, int index )
dc8c34
     if (!conn || (index < 0) || (index >= conn->c_pagedresults.prl_maxlen)) {
dc8c34
         return;
dc8c34
     }
dc8c34
-    PR_Lock(conn->c_mutex);
dc8c34
+    PR_EnterMonitor(conn->c_mutex);
dc8c34
     prp = conn->c_pagedresults.prl_list + index;
dc8c34
-    PR_Unlock(conn->c_mutex);
dc8c34
+    PR_ExitMonitor(conn->c_mutex);
dc8c34
     if (prp->pr_mutex) {
dc8c34
         PR_Lock(prp->pr_mutex);
dc8c34
     }
dc8c34
@@ -1010,9 +1010,9 @@ pagedresults_unlock( Connection *conn, int index )
dc8c34
     if (!conn || (index < 0) || (index >= conn->c_pagedresults.prl_maxlen)) {
dc8c34
         return;
dc8c34
     }
dc8c34
-    PR_Lock(conn->c_mutex);
dc8c34
+    PR_EnterMonitor(conn->c_mutex);
dc8c34
     prp = conn->c_pagedresults.prl_list + index;
dc8c34
-    PR_Unlock(conn->c_mutex);
dc8c34
+    PR_ExitMonitor(conn->c_mutex);
dc8c34
     if (prp->pr_mutex) {
dc8c34
         PR_Unlock(prp->pr_mutex);
dc8c34
     }
dc8c34
@@ -1027,11 +1027,11 @@ pagedresults_is_abandoned_or_notavailable(Connection *conn, int locked, int inde
dc8c34
         return 1; /* not abandoned, but do not want to proceed paged results op. */
dc8c34
     }
dc8c34
     if (!locked) {
dc8c34
-        PR_Lock(conn->c_mutex);
dc8c34
+        PR_EnterMonitor(conn->c_mutex);
dc8c34
     }
dc8c34
     prp = conn->c_pagedresults.prl_list + index;
dc8c34
     if (!locked) {
dc8c34
-        PR_Unlock(conn->c_mutex);
dc8c34
+        PR_ExitMonitor(conn->c_mutex);
dc8c34
     }
dc8c34
     return prp->pr_flags & CONN_FLAG_PAGEDRESULTS_ABANDONED;
dc8c34
 }
dc8c34
@@ -1055,12 +1055,12 @@ pagedresults_set_search_result_pb(Slapi_PBlock *pb, void *sr, int locked)
dc8c34
     LDAPDebug2Args(LDAP_DEBUG_TRACE,
dc8c34
                    "--> pagedresults_set_search_result_pb: idx=%d, sr=%p\n", index, sr);
dc8c34
     if (conn && (index > -1)) {
dc8c34
-        if (!locked) PR_Lock(conn->c_mutex);
dc8c34
+        if (!locked) PR_EnterMonitor(conn->c_mutex);
dc8c34
         if (index < conn->c_pagedresults.prl_maxlen) {
dc8c34
             conn->c_pagedresults.prl_list[index].pr_search_result_set = sr;
dc8c34
             rc = 0;
dc8c34
         }
dc8c34
-        if (!locked) PR_Unlock(conn->c_mutex);
dc8c34
+        if (!locked) PR_ExitMonitor(conn->c_mutex);
dc8c34
     }
dc8c34
     LDAPDebug1Arg(LDAP_DEBUG_TRACE,
dc8c34
                   "<-- pagedresults_set_search_result_pb: %d\n", rc);
dc8c34
diff --git a/ldap/servers/slapd/pblock.c b/ldap/servers/slapd/pblock.c
dc8c34
index b12881b..40d0358 100644
dc8c34
--- a/ldap/servers/slapd/pblock.c
dc8c34
+++ b/ldap/servers/slapd/pblock.c
dc8c34
@@ -145,7 +145,7 @@ if ( PBLOCK ->pb_plugin->plg_type != TYPE) return( -1 )
dc8c34
 int
dc8c34
 slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
dc8c34
 {
dc8c34
-    char *authtype;
dc8c34
+	char *authtype;
dc8c34
 	Slapi_Backend		*be;
dc8c34
 
dc8c34
 	PR_ASSERT( NULL != pblock );
dc8c34
@@ -202,10 +202,10 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
dc8c34
 		          "Connection is NULL and hence cannot access SLAPI_CONN_DN \n", 0, 0, 0 );
dc8c34
 			return (-1);
dc8c34
 		}
dc8c34
-		PR_Lock( pblock->pb_conn->c_mutex );
dc8c34
+		PR_EnterMonitor(pblock->pb_conn->c_mutex);
dc8c34
 		(*(char **)value) = (NULL == pblock->pb_conn->c_dn ? NULL :
dc8c34
 		    slapi_ch_strdup( pblock->pb_conn->c_dn ));
dc8c34
-		PR_Unlock( pblock->pb_conn->c_mutex );
dc8c34
+		PR_ExitMonitor(pblock->pb_conn->c_mutex);
dc8c34
 		break;
dc8c34
 	case SLAPI_CONN_AUTHTYPE:/* deprecated */
dc8c34
 		if (pblock->pb_conn == NULL) {
dc8c34
@@ -213,9 +213,9 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
dc8c34
 		          "Connection is NULL and hence cannot access SLAPI_CONN_AUTHTYPE \n", 0, 0, 0 );
dc8c34
 			return (-1);
dc8c34
 		}
dc8c34
-		PR_Lock( pblock->pb_conn->c_mutex );
dc8c34
-                authtype = pblock->pb_conn->c_authtype;
dc8c34
-		PR_Unlock( pblock->pb_conn->c_mutex );
dc8c34
+		PR_EnterMonitor(pblock->pb_conn->c_mutex);
dc8c34
+		authtype = pblock->pb_conn->c_authtype;
dc8c34
+		PR_ExitMonitor(pblock->pb_conn->c_mutex);
dc8c34
                 if (authtype == NULL) {
dc8c34
                     (*(char **)value) = NULL;
dc8c34
                 } else if (strcasecmp(authtype, SLAPD_AUTH_NONE) == 0) {
dc8c34
@@ -240,10 +240,10 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
dc8c34
 		          "Connection is NULL and hence cannot access SLAPI_CONN_AUTHMETHOD \n", 0, 0, 0 );
dc8c34
 			return (-1);
dc8c34
 		}
dc8c34
-		PR_Lock( pblock->pb_conn->c_mutex );
dc8c34
+		PR_EnterMonitor(pblock->pb_conn->c_mutex);
dc8c34
 		(*(char **)value) = pblock->pb_conn->c_authtype ?
dc8c34
                     slapi_ch_strdup(pblock->pb_conn->c_authtype) : NULL;
dc8c34
-		PR_Unlock( pblock->pb_conn->c_mutex );
dc8c34
+		PR_ExitMonitor(pblock->pb_conn->c_mutex);
dc8c34
 		break;
dc8c34
 	case SLAPI_CONN_CLIENTNETADDR:
dc8c34
 		if (pblock->pb_conn == NULL)
dc8c34
@@ -251,14 +251,14 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
dc8c34
 			memset( value, 0, sizeof( PRNetAddr ));
dc8c34
 			break;
dc8c34
 		}
dc8c34
-		PR_Lock( pblock->pb_conn->c_mutex );
dc8c34
+		PR_EnterMonitor(pblock->pb_conn->c_mutex);
dc8c34
 		if ( pblock->pb_conn->cin_addr == NULL ) {
dc8c34
 			memset( value, 0, sizeof( PRNetAddr ));
dc8c34
 		} else {
dc8c34
 			(*(PRNetAddr *)value) =
dc8c34
 			    *(pblock->pb_conn->cin_addr);
dc8c34
 		}
dc8c34
-		PR_Unlock( pblock->pb_conn->c_mutex );
dc8c34
+		PR_ExitMonitor(pblock->pb_conn->c_mutex);
dc8c34
 		break;
dc8c34
 	case SLAPI_CONN_SERVERNETADDR:
dc8c34
 		if (pblock->pb_conn == NULL)
dc8c34
@@ -266,14 +266,14 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
dc8c34
 			memset( value, 0, sizeof( PRNetAddr ));
dc8c34
 			break;
dc8c34
 		}
dc8c34
-		PR_Lock( pblock->pb_conn->c_mutex );
dc8c34
+		PR_EnterMonitor(pblock->pb_conn->c_mutex);
dc8c34
 		if ( pblock->pb_conn->cin_destaddr == NULL ) {
dc8c34
 			memset( value, 0, sizeof( PRNetAddr ));
dc8c34
 		} else {
dc8c34
 			(*(PRNetAddr *)value) =
dc8c34
 				*(pblock->pb_conn->cin_destaddr);
dc8c34
 		}
dc8c34
-		PR_Unlock( pblock->pb_conn->c_mutex );
dc8c34
+		PR_ExitMonitor(pblock->pb_conn->c_mutex);
dc8c34
 		break;
dc8c34
 	case SLAPI_CONN_CLIENTIP:
dc8c34
 		if (pblock->pb_conn == NULL)
dc8c34
@@ -281,7 +281,7 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
dc8c34
 			memset( value, 0, sizeof( struct in_addr ));
dc8c34
 			break;
dc8c34
 		}
dc8c34
-		PR_Lock( pblock->pb_conn->c_mutex );
dc8c34
+		PR_EnterMonitor(pblock->pb_conn->c_mutex);
dc8c34
 		if ( pblock->pb_conn->cin_addr == NULL ) {
dc8c34
 			memset( value, 0, sizeof( struct in_addr ));
dc8c34
 		} else {
dc8c34
@@ -296,7 +296,7 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
dc8c34
 				memset( value, 0, sizeof( struct in_addr ));
dc8c34
 			}
dc8c34
 		}
dc8c34
-		PR_Unlock( pblock->pb_conn->c_mutex );
dc8c34
+		PR_ExitMonitor(pblock->pb_conn->c_mutex);
dc8c34
 		break;
dc8c34
 	case SLAPI_CONN_SERVERIP:
dc8c34
 		if (pblock->pb_conn == NULL)
dc8c34
@@ -304,7 +304,7 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
dc8c34
 			memset( value, 0, sizeof( struct in_addr ));
dc8c34
 			break;
dc8c34
 		}
dc8c34
-		PR_Lock( pblock->pb_conn->c_mutex );
dc8c34
+		PR_EnterMonitor(pblock->pb_conn->c_mutex);
dc8c34
 		if ( pblock->pb_conn->cin_destaddr == NULL ) {
dc8c34
 			memset( value, 0, sizeof( PRNetAddr ));
dc8c34
 		} else {
dc8c34
@@ -320,7 +320,7 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
dc8c34
 			}
dc8c34
 
dc8c34
 		}
dc8c34
-		PR_Unlock( pblock->pb_conn->c_mutex );
dc8c34
+		PR_ExitMonitor(pblock->pb_conn->c_mutex);
dc8c34
 		break;
dc8c34
 	case SLAPI_CONN_IS_REPLICATION_SESSION:
dc8c34
 		if (pblock->pb_conn == NULL) {
dc8c34
@@ -328,9 +328,9 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
dc8c34
 		          "Connection is NULL and hence cannot access SLAPI_CONN_IS_REPLICATION_SESSION \n", 0, 0, 0 );
dc8c34
 			return (-1);
dc8c34
 		}
dc8c34
-		PR_Lock( pblock->pb_conn->c_mutex );
dc8c34
+		PR_EnterMonitor(pblock->pb_conn->c_mutex);
dc8c34
 		(*(int *)value) = pblock->pb_conn->c_isreplication_session;
dc8c34
-		PR_Unlock( pblock->pb_conn->c_mutex );
dc8c34
+		PR_ExitMonitor(pblock->pb_conn->c_mutex);
dc8c34
 		break;
dc8c34
 	case SLAPI_CONN_IS_SSL_SESSION:
dc8c34
 		if (pblock->pb_conn == NULL) {
dc8c34
@@ -338,9 +338,9 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
dc8c34
 		          "Connection is NULL and hence cannot access SLAPI_CONN_IS_SSL_SESSION \n", 0, 0, 0 );
dc8c34
 			return (-1);
dc8c34
 		}
dc8c34
-		PR_Lock( pblock->pb_conn->c_mutex );
dc8c34
+		PR_EnterMonitor(pblock->pb_conn->c_mutex);
dc8c34
 		(*(int *)value) = pblock->pb_conn->c_flags & CONN_FLAG_SSL;
dc8c34
-		PR_Unlock( pblock->pb_conn->c_mutex );
dc8c34
+		PR_ExitMonitor(pblock->pb_conn->c_mutex);
dc8c34
 		break;
dc8c34
 	case SLAPI_CONN_SASL_SSF:
dc8c34
 		if (pblock->pb_conn == NULL) {
dc8c34
@@ -348,9 +348,9 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
dc8c34
 			  "Connection is NULL and hence cannot access SLAPI_CONN_SASL_SSF \n", 0, 0, 0 );
dc8c34
 			return (-1);
dc8c34
 		}
dc8c34
-		PR_Lock( pblock->pb_conn->c_mutex );
dc8c34
+		PR_EnterMonitor(pblock->pb_conn->c_mutex);
dc8c34
 		(*(int *)value) = pblock->pb_conn->c_sasl_ssf;
dc8c34
-		PR_Unlock( pblock->pb_conn->c_mutex );
dc8c34
+		PR_ExitMonitor(pblock->pb_conn->c_mutex);
dc8c34
 		break;
dc8c34
 	case SLAPI_CONN_SSL_SSF:
dc8c34
 		if (pblock->pb_conn == NULL) {
dc8c34
@@ -358,9 +358,9 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
dc8c34
 			  "Connection is NULL and hence cannot access SLAPI_CONN_SSL_SSF \n", 0, 0, 0 );
dc8c34
 			return (-1);
dc8c34
 		}
dc8c34
-		PR_Lock( pblock->pb_conn->c_mutex );
dc8c34
+		PR_EnterMonitor(pblock->pb_conn->c_mutex);
dc8c34
 		(*(int *)value) = pblock->pb_conn->c_ssl_ssf;
dc8c34
-		PR_Unlock( pblock->pb_conn->c_mutex );
dc8c34
+		PR_ExitMonitor(pblock->pb_conn->c_mutex);
dc8c34
 		break;
dc8c34
 	case SLAPI_CONN_LOCAL_SSF:
dc8c34
 		if (pblock->pb_conn == NULL) {
dc8c34
@@ -368,9 +368,9 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
dc8c34
 			    "Connection is NULL and hence cannot access SLAPI_CONN_LOCAL_SSF \n", 0, 0, 0 );
dc8c34
 			return (-1);
dc8c34
 		}
dc8c34
-		PR_Lock( pblock->pb_conn->c_mutex );
dc8c34
+		PR_EnterMonitor(pblock->pb_conn->c_mutex);
dc8c34
 		(*(int *)value) = pblock->pb_conn->c_local_ssf;
dc8c34
-		PR_Unlock( pblock->pb_conn->c_mutex );
dc8c34
+		PR_ExitMonitor(pblock->pb_conn->c_mutex);
dc8c34
 		break;
dc8c34
 	case SLAPI_CONN_CERT:
dc8c34
 		if (pblock->pb_conn == NULL) {
dc8c34
@@ -1970,7 +1970,7 @@ slapi_pblock_get( Slapi_PBlock *pblock, int arg, void *value )
dc8c34
 int
dc8c34
 slapi_pblock_set( Slapi_PBlock *pblock, int arg, void *value )
dc8c34
 {
dc8c34
-    char *authtype;
dc8c34
+	char *authtype;
dc8c34
 
dc8c34
 	PR_ASSERT( NULL != pblock );
dc8c34
 
dc8c34
@@ -2036,10 +2036,10 @@ slapi_pblock_set( Slapi_PBlock *pblock, int arg, void *value )
dc8c34
 		          "Connection is NULL and hence cannot access SLAPI_CONN_AUTHMETHOD \n", 0, 0, 0 );
dc8c34
 			return (-1);
dc8c34
 		}
dc8c34
-		PR_Lock( pblock->pb_conn->c_mutex );
dc8c34
-                slapi_ch_free((void**)&pblock->pb_conn->c_authtype);
dc8c34
+		PR_EnterMonitor(pblock->pb_conn->c_mutex);
dc8c34
+		slapi_ch_free((void**)&pblock->pb_conn->c_authtype);
dc8c34
 		pblock->pb_conn->c_authtype = slapi_ch_strdup((char *) value);
dc8c34
-		PR_Unlock( pblock->pb_conn->c_mutex );
dc8c34
+		PR_ExitMonitor(pblock->pb_conn->c_mutex);
dc8c34
 		break;
dc8c34
 	case SLAPI_CONN_IS_REPLICATION_SESSION:
dc8c34
 		if (pblock->pb_conn == NULL) {
dc8c34
@@ -2047,9 +2047,9 @@ slapi_pblock_set( Slapi_PBlock *pblock, int arg, void *value )
dc8c34
 		          "Connection is NULL and hence cannot access SLAPI_CONN_IS_REPLICATION_SESSION \n", 0, 0, 0 );
dc8c34
 			return (-1);
dc8c34
 		}
dc8c34
-		PR_Lock( pblock->pb_conn->c_mutex );
dc8c34
+		PR_EnterMonitor(pblock->pb_conn->c_mutex);
dc8c34
 		pblock->pb_conn->c_isreplication_session = *((int *) value);
dc8c34
-		PR_Unlock( pblock->pb_conn->c_mutex );
dc8c34
+		PR_ExitMonitor(pblock->pb_conn->c_mutex);
dc8c34
 		break;
dc8c34
 
dc8c34
 	/* stuff related to config file processing */
dc8c34
@@ -3565,7 +3565,7 @@ bind_credentials_clear( Connection *conn, PRBool lock_conn,
dc8c34
 		PRBool clear_externalcreds )
dc8c34
 {
dc8c34
     if ( lock_conn ) {
dc8c34
-        PR_Lock( conn->c_mutex );
dc8c34
+        PR_EnterMonitor(conn->c_mutex);
dc8c34
     }
dc8c34
 
dc8c34
     if ( conn->c_dn != NULL ) {		/* a non-anonymous bind has occurred */
dc8c34
@@ -3591,7 +3591,7 @@ bind_credentials_clear( Connection *conn, PRBool lock_conn,
dc8c34
     }
dc8c34
 
dc8c34
     if ( lock_conn ) {
dc8c34
-        PR_Unlock( conn->c_mutex );
dc8c34
+        PR_ExitMonitor(conn->c_mutex);
dc8c34
     }
dc8c34
 
dc8c34
 }
dc8c34
@@ -3647,10 +3647,10 @@ void
dc8c34
 bind_credentials_set( Connection *conn, char *authtype, char *normdn,
dc8c34
 		char *extauthtype, char *externaldn, CERTCertificate *clientcert, Slapi_Entry * bind_target_entry )
dc8c34
 {
dc8c34
-	PR_Lock( conn->c_mutex );
dc8c34
+	PR_EnterMonitor(conn->c_mutex);
dc8c34
 	bind_credentials_set_nolock(conn, authtype, normdn,
dc8c34
 		extauthtype, externaldn, clientcert, bind_target_entry);
dc8c34
-	PR_Unlock( conn->c_mutex );
dc8c34
+	PR_ExitMonitor(conn->c_mutex);
dc8c34
 }
dc8c34
 
dc8c34
 void
dc8c34
diff --git a/ldap/servers/slapd/psearch.c b/ldap/servers/slapd/psearch.c
dc8c34
index b5b4c3a..dcfc07a 100644
dc8c34
--- a/ldap/servers/slapd/psearch.c
dc8c34
+++ b/ldap/servers/slapd/psearch.c
dc8c34
@@ -300,9 +300,9 @@ ps_send_results( void *arg )
dc8c34
 
dc8c34
     /* need to acquire a reference to this connection so that it will not
dc8c34
        be released or cleaned up out from under us */
dc8c34
-    PR_Lock( ps->ps_pblock->pb_conn->c_mutex );
dc8c34
+    PR_EnterMonitor(ps->ps_pblock->pb_conn->c_mutex);
dc8c34
     conn_acq_flag = connection_acquire_nolock(ps->ps_pblock->pb_conn);    
dc8c34
-    PR_Unlock( ps->ps_pblock->pb_conn->c_mutex );
dc8c34
+    PR_ExitMonitor(ps->ps_pblock->pb_conn->c_mutex);
dc8c34
 
dc8c34
 	if (conn_acq_flag) {
dc8c34
 		slapi_log_error(SLAPI_LOG_CONNS, "Persistent Search",
dc8c34
@@ -419,7 +419,7 @@ ps_send_results( void *arg )
dc8c34
 	slapi_filter_free(filter, 1);
dc8c34
 
dc8c34
     /* Clean up the connection structure */
dc8c34
-    PR_Lock( ps->ps_pblock->pb_conn->c_mutex );
dc8c34
+    PR_EnterMonitor(ps->ps_pblock->pb_conn->c_mutex);
dc8c34
 
dc8c34
 	slapi_log_error(SLAPI_LOG_CONNS, "Persistent Search",
dc8c34
 					"conn=%" NSPRIu64 " op=%d Releasing the connection and operation\n",
dc8c34
@@ -433,7 +433,7 @@ ps_send_results( void *arg )
dc8c34
     if (conn_acq_flag == 0) { /* we acquired it, so release it */
dc8c34
 	connection_release_nolock (ps->ps_pblock->pb_conn);
dc8c34
     }
dc8c34
-    PR_Unlock( ps->ps_pblock->pb_conn->c_mutex );
dc8c34
+    PR_ExitMonitor(ps->ps_pblock->pb_conn->c_mutex);
dc8c34
 
dc8c34
     PR_DestroyLock ( ps->ps_lock );
dc8c34
     ps->ps_lock = NULL;
dc8c34
diff --git a/ldap/servers/slapd/saslbind.c b/ldap/servers/slapd/saslbind.c
dc8c34
index eb814a2..c1e5f2b 100644
dc8c34
--- a/ldap/servers/slapd/saslbind.c
dc8c34
+++ b/ldap/servers/slapd/saslbind.c
dc8c34
@@ -673,7 +673,7 @@ char **ids_sasl_listmech(Slapi_PBlock *pb)
dc8c34
     if (sasl_conn == NULL) return ret;
dc8c34
 
dc8c34
     /* sasl library mechanisms are connection dependent */
dc8c34
-    PR_Lock(pb->pb_conn->c_mutex);
dc8c34
+    PR_EnterMonitor(pb->pb_conn->c_mutex);
dc8c34
     if (sasl_listmech(sasl_conn, 
dc8c34
                       NULL,     /* username */
dc8c34
                       "", ",", "",
dc8c34
@@ -686,7 +686,7 @@ char **ids_sasl_listmech(Slapi_PBlock *pb)
dc8c34
         charray_free(others);
dc8c34
         slapi_ch_free((void**)&dupstr);
dc8c34
     }
dc8c34
-    PR_Unlock(pb->pb_conn->c_mutex);
dc8c34
+    PR_ExitMonitor(pb->pb_conn->c_mutex);
dc8c34
 
dc8c34
     LDAPDebug( LDAP_DEBUG_TRACE, "<= ids_sasl_listmech\n", 0, 0, 0 );
dc8c34
 
dc8c34
@@ -769,13 +769,13 @@ void ids_sasl_check_bind(Slapi_PBlock *pb)
dc8c34
     PR_ASSERT(pb);
dc8c34
     PR_ASSERT(pb->pb_conn);
dc8c34
 
dc8c34
-    PR_Lock(pb->pb_conn->c_mutex); /* BIG LOCK */
dc8c34
+    PR_EnterMonitor(pb->pb_conn->c_mutex); /* BIG LOCK */
dc8c34
     continuing = pb->pb_conn->c_flags & CONN_FLAG_SASL_CONTINUE;
dc8c34
     pb->pb_conn->c_flags &= ~CONN_FLAG_SASL_CONTINUE; /* reset flag */
dc8c34
 
dc8c34
     sasl_conn = (sasl_conn_t*)pb->pb_conn->c_sasl_conn;
dc8c34
     if (sasl_conn == NULL) {
dc8c34
-        PR_Unlock(pb->pb_conn->c_mutex);
dc8c34
+        PR_ExitMonitor(pb->pb_conn->c_mutex); /* BIG LOCK */
dc8c34
         send_ldap_result( pb, LDAP_AUTH_METHOD_NOT_SUPPORTED, NULL,
dc8c34
                           "sasl library unavailable", 0, NULL );
dc8c34
         return;
dc8c34
@@ -850,7 +850,7 @@ void ids_sasl_check_bind(Slapi_PBlock *pb)
dc8c34
         if (sasl_conn == NULL) {
dc8c34
             send_ldap_result( pb, LDAP_AUTH_METHOD_NOT_SUPPORTED, NULL,
dc8c34
                           "sasl library unavailable", 0, NULL );
dc8c34
-            PR_Unlock(pb->pb_conn->c_mutex); /* BIG LOCK */
dc8c34
+            PR_ExitMonitor(pb->pb_conn->c_mutex); /* BIG LOCK */
dc8c34
             return;
dc8c34
         }
dc8c34
     }
dc8c34
@@ -866,7 +866,7 @@ void ids_sasl_check_bind(Slapi_PBlock *pb)
dc8c34
         /* retrieve the authenticated username */
dc8c34
         if (sasl_getprop(sasl_conn, SASL_USERNAME,
dc8c34
                          (const void**)&username) != SASL_OK) {
dc8c34
-            PR_Unlock(pb->pb_conn->c_mutex); /* BIG LOCK */
dc8c34
+            PR_ExitMonitor(pb->pb_conn->c_mutex); /* BIG LOCK */
dc8c34
             send_ldap_result(pb, LDAP_OPERATIONS_ERROR, NULL,
dc8c34
                              "could not obtain sasl username", 0, NULL);
dc8c34
             break;
dc8c34
@@ -887,7 +887,7 @@ void ids_sasl_check_bind(Slapi_PBlock *pb)
dc8c34
             }
dc8c34
         }
dc8c34
         if (dn == NULL) {
dc8c34
-            PR_Unlock(pb->pb_conn->c_mutex); /* BIG LOCK */
dc8c34
+            PR_ExitMonitor(pb->pb_conn->c_mutex); /* BIG LOCK */
dc8c34
             send_ldap_result(pb, LDAP_OPERATIONS_ERROR, NULL,
dc8c34
                              "could not get auth dn from sasl", 0, NULL);
dc8c34
             break;
dc8c34
@@ -928,7 +928,7 @@ void ids_sasl_check_bind(Slapi_PBlock *pb)
dc8c34
                                     slapi_ch_strdup(normdn), 
dc8c34
                                     NULL, NULL, NULL, bind_target_entry);
dc8c34
 
dc8c34
-        PR_Unlock(pb->pb_conn->c_mutex); /* BIG LOCK */
dc8c34
+        PR_ExitMonitor(pb->pb_conn->c_mutex); /* BIG LOCK */
dc8c34
 
dc8c34
         if (plugin_call_plugins( pb, SLAPI_PLUGIN_PRE_BIND_FN ) != 0){
dc8c34
             break;
dc8c34
@@ -1003,9 +1003,9 @@ void ids_sasl_check_bind(Slapi_PBlock *pb)
dc8c34
         /* see if we negotiated a security layer */
dc8c34
         if (*ssfp > 0) {
dc8c34
             /* Enable SASL I/O on the connection */
dc8c34
-            PR_Lock(pb->pb_conn->c_mutex);
dc8c34
+            PR_EnterMonitor(pb->pb_conn->c_mutex);
dc8c34
             connection_set_io_layer_cb(pb->pb_conn, sasl_io_enable, NULL, NULL);
dc8c34
-            PR_Unlock(pb->pb_conn->c_mutex);
dc8c34
+            PR_ExitMonitor(pb->pb_conn->c_mutex);
dc8c34
         }
dc8c34
 
dc8c34
         /* send successful result */
dc8c34
@@ -1018,7 +1018,7 @@ void ids_sasl_check_bind(Slapi_PBlock *pb)
dc8c34
 
dc8c34
     case SASL_CONTINUE:         /* another step needed */
dc8c34
         pb->pb_conn->c_flags |= CONN_FLAG_SASL_CONTINUE;
dc8c34
-        PR_Unlock(pb->pb_conn->c_mutex); /* BIG LOCK */
dc8c34
+        PR_ExitMonitor(pb->pb_conn->c_mutex); /* BIG LOCK */
dc8c34
 
dc8c34
         if (plugin_call_plugins( pb, SLAPI_PLUGIN_PRE_BIND_FN ) != 0){
dc8c34
             break;
dc8c34
@@ -1040,7 +1040,7 @@ void ids_sasl_check_bind(Slapi_PBlock *pb)
dc8c34
 
dc8c34
     case SASL_NOMECH:
dc8c34
 
dc8c34
-        PR_Unlock(pb->pb_conn->c_mutex); /* BIG LOCK */
dc8c34
+        PR_ExitMonitor(pb->pb_conn->c_mutex); /* BIG LOCK */
dc8c34
         send_ldap_result(pb, LDAP_AUTH_METHOD_NOT_SUPPORTED, NULL,
dc8c34
                          "sasl mechanism not supported", 0, NULL);
dc8c34
         break;
dc8c34
@@ -1048,7 +1048,7 @@ void ids_sasl_check_bind(Slapi_PBlock *pb)
dc8c34
     default:                    /* other error */
dc8c34
         errstr = sasl_errdetail(sasl_conn);
dc8c34
 
dc8c34
-        PR_Unlock(pb->pb_conn->c_mutex); /* BIG LOCK */
dc8c34
+        PR_ExitMonitor(pb->pb_conn->c_mutex); /* BIG LOCK */
dc8c34
         send_ldap_result(pb, LDAP_INVALID_CREDENTIALS, NULL,
dc8c34
                          (char*)errstr, 0, NULL);
dc8c34
         break;
dc8c34
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
dc8c34
index da90fe6..a84e802 100644
dc8c34
--- a/ldap/servers/slapd/slap.h
dc8c34
+++ b/ldap/servers/slapd/slap.h
dc8c34
@@ -1417,7 +1417,7 @@ typedef struct conn {
dc8c34
 	PRInt32			c_opscompleted;	/* # ops completed		  */
dc8c34
 	PRInt32			c_threadnumber; /* # threads used in this conn    */
dc8c34
 	int				c_refcnt;	/* # ops refering to this conn    */
dc8c34
-	PRLock			*c_mutex;	/* protect each conn structure    */
dc8c34
+	PRMonitor		*c_mutex;	/* protect each conn structure; need to be re-entrant */ 
dc8c34
 	PRLock			*c_pdumutex;	/* only write one pdu at a time   */
dc8c34
 	time_t			c_idlesince;	/* last time of activity on conn  */
dc8c34
 	int			c_idletimeout;	/* local copy of idletimeout */
dc8c34
diff --git a/ldap/servers/slapd/start_tls_extop.c b/ldap/servers/slapd/start_tls_extop.c
dc8c34
index 1efa657..ef492f3 100644
dc8c34
--- a/ldap/servers/slapd/start_tls_extop.c
dc8c34
+++ b/ldap/servers/slapd/start_tls_extop.c
dc8c34
@@ -209,7 +209,7 @@ start_tls( Slapi_PBlock *pb )
dc8c34
 	/* At least we know that the request was indeed an Start TLS one. */
dc8c34
 
dc8c34
 	conn = pb->pb_conn;
dc8c34
-	PR_Lock( conn->c_mutex );
dc8c34
+	PR_EnterMonitor(conn->c_mutex);
dc8c34
 	/* cannot call slapi_send_ldap_result with mutex locked - will deadlock if ber_flush returns error */
dc8c34
 #ifndef _WIN32
dc8c34
 	if ( conn->c_prfd == (PRFileDesc *) NULL ) {
dc8c34
@@ -298,12 +298,12 @@ start_tls( Slapi_PBlock *pb )
dc8c34
 
dc8c34
 	/* Since no specific argument for denying the Start TLS request has been found, 
dc8c34
 	 * we send a success response back to the client. */
dc8c34
-        ldapmsg = "Start TLS request accepted.Server willing to negotiate SSL.";
dc8c34
- unlock_and_return:
dc8c34
-	PR_Unlock( conn->c_mutex );
dc8c34
+	ldapmsg = "Start TLS request accepted.Server willing to negotiate SSL.";
dc8c34
+unlock_and_return:
dc8c34
+	PR_ExitMonitor(conn->c_mutex);
dc8c34
 	slapi_send_ldap_result( pb, ldaprc, NULL, ldapmsg, 0, NULL );
dc8c34
 
dc8c34
-	return( SLAPI_PLUGIN_EXTENDED_SENT_RESULT );	
dc8c34
+	return( SLAPI_PLUGIN_EXTENDED_SENT_RESULT );
dc8c34
 
dc8c34
 }/* start_tls */
dc8c34
 
dc8c34
@@ -368,8 +368,7 @@ start_tls_graceful_closure( Connection *c, Slapi_PBlock * pb, int is_initiator )
dc8c34
 	   */
dc8c34
 	}
dc8c34
 
dc8c34
-
dc8c34
-	PR_Lock( c->c_mutex );
dc8c34
+	PR_EnterMonitor(c->c_mutex);
dc8c34
 
dc8c34
 	/* "Unimport" the socket from SSL, i.e. get rid of the upper layer of the 
dc8c34
 	 * file descriptor stack, which represents SSL. 
dc8c34
@@ -409,7 +408,7 @@ start_tls_graceful_closure( Connection *c, Slapi_PBlock * pb, int is_initiator )
dc8c34
 
dc8c34
 	bind_credentials_clear( c, PR_FALSE, PR_TRUE );
dc8c34
 
dc8c34
-	PR_Unlock( c->c_mutex );
dc8c34
+	PR_ExitMonitor(c->c_mutex);
dc8c34
 
dc8c34
 
dc8c34
 
dc8c34
diff --git a/ldap/servers/slapd/unbind.c b/ldap/servers/slapd/unbind.c
dc8c34
index afc6069..8800ce4 100644
dc8c34
--- a/ldap/servers/slapd/unbind.c
dc8c34
+++ b/ldap/servers/slapd/unbind.c
dc8c34
@@ -104,9 +104,9 @@ do_unbind( Slapi_PBlock *pb )
dc8c34
 	}
dc8c34
 
dc8c34
 	/* target spec is used to decide which plugins are applicable for the operation */
dc8c34
-	PR_Lock( pb->pb_conn->c_mutex );
dc8c34
+	PR_EnterMonitor(pb->pb_conn->c_mutex);
dc8c34
 	operation_set_target_spec_str (operation, pb->pb_conn->c_dn);
dc8c34
-	PR_Unlock( pb->pb_conn->c_mutex );
dc8c34
+	PR_ExitMonitor(pb->pb_conn->c_mutex);
dc8c34
 
dc8c34
 	/* ONREPL - plugins should be called and passed bind dn and, possibly, other data */
dc8c34
 
dc8c34
-- 
dc8c34
2.4.3
dc8c34