diff --git a/servers/slapd/back-ldbm/bind.c b/servers/slapd/back-ldbm/bind.c
index 70d3d06d4a79e8e7596c510e30fd43feedc32857..97d88b921c626d0c84cd5175db7f58626d7da231 100644
--- a/servers/slapd/back-ldbm/bind.c
+++ b/servers/slapd/back-ldbm/bind.c
@@ -64,6 +64,7 @@ ldbm_back_bind(
     Operation		*op,
     char		*dn,
     int			method,
+	char		*mech,
     struct berval	*cred,
 	char**	edn
 )
diff --git a/servers/slapd/back-ldbm/external.h b/servers/slapd/back-ldbm/external.h
index 144b56c78efeb4fb288770eee2112af2b6151516..6b674eef5238b8b28d94c42f4b47a2fa180340d7 100644
--- a/servers/slapd/back-ldbm/external.h
+++ b/servers/slapd/back-ldbm/external.h
@@ -18,7 +18,7 @@ extern int	ldbm_back_db_config LDAP_P(( BackendDB *bd,
 
 extern int ldbm_back_bind LDAP_P(( BackendDB *bd,
 	Connection *conn, Operation *op,
-	char *dn, int method, struct berval *cred, char** edn ));
+	char *dn, int method, char* mech, struct berval *cred, char** edn ));
 
 extern int	ldbm_back_unbind LDAP_P(( BackendDB *bd,
 	Connection *conn, Operation *op ));
diff --git a/servers/slapd/bind.c b/servers/slapd/bind.c
index 54759e8d166a8e75319682590e9f8ca3e7ad28a9..ee532b14444ac98a9c88e8671155bb519d367fa5 100644
--- a/servers/slapd/bind.c
+++ b/servers/slapd/bind.c
@@ -164,7 +164,7 @@ do_bind(
 
 		ndn = suffixAlias( ndn, op, be );
 
-		if ( (*be->be_bind)( be, conn, op, ndn, method, &cred, &edn ) == 0 ) {
+		if ( (*be->be_bind)( be, conn, op, ndn, method, NULL, &cred, &edn ) == 0 ) {
 			ldap_pvt_thread_mutex_lock( &conn->c_mutex );
 
 			conn->c_protocol = version;
diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c
index 4def5161becec03875d6aa124ee00be01adaefc3..7546d42e1e3645600f588feb8a8db557a7fcf5c7 100644
--- a/servers/slapd/connection.c
+++ b/servers/slapd/connection.c
@@ -898,6 +898,8 @@ static int connection_op_activate( Connection *conn, Operation *op )
 	arg->co_op->o_dn = ch_strdup( tmpdn != NULL ? tmpdn : "" );
 	arg->co_op->o_ndn = dn_normalize_case( ch_strdup( arg->co_op->o_dn ) );
 
+	arg->co_op->o_protocol = conn->c_protocol;
+
 	slap_op_add( &conn->c_ops, arg->co_op );
 
 	if(tag == LDAP_REQ_BIND) {
diff --git a/servers/slapd/libslapd.dsp b/servers/slapd/libslapd.dsp
index f1b794db01f8628e6a6a309b4ec8746d314b013b..3c58616d44632fe44a7169f17b6a3f3be64cedca 100644
--- a/servers/slapd/libslapd.dsp
+++ b/servers/slapd/libslapd.dsp
@@ -224,10 +224,6 @@ SOURCE=.\monitor.c
 # End Source File
 # Begin Source File
 
-SOURCE=.\nt_debug.c
-# End Source File
-# Begin Source File
-
 SOURCE=.\operation.c
 # End Source File
 # Begin Source File
diff --git a/servers/slapd/modrdn.c b/servers/slapd/modrdn.c
index a38160f4f2a6790e24418a94600bb5ce82ac96b9..33a4bc35b7627739ec9d5830cd4b2dac37855926 100644
--- a/servers/slapd/modrdn.c
+++ b/servers/slapd/modrdn.c
@@ -76,13 +76,16 @@ do_modrdn(
 
 	if ( ber_peek_tag( op->o_ber, &length ) == LDAP_TAG_NEWSUPERIOR ) {
 
-		if ( conn->c_protocol ==  0 ) {
+		if ( op->o_protocol ==  0 ) {
 			/*
 			 * Promote to LDAPv3
 			 */
+			ldap_pvt_thread_mutex_lock( &conn->c_mutex );
 			conn->c_protocol = LDAP_VERSION3;
+			ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
+			op->o_protocol = LDAP_VERSION3;
 
-		} else if ( conn->c_protocol < LDAP_VERSION3 ) {
+		} else if ( op->o_protocol < LDAP_VERSION3 ) {
 			/* Conection record indicates v2 but field 
 			 * newSuperior is present: report error.
 			 */
@@ -103,7 +106,7 @@ do_modrdn(
 				      "" );
 		    return;
 
-		}/* if ( ber_scanf( ber, { "a}", &newSuperior ) == ... ) */
+		}
 
 
 		Debug( LDAP_DEBUG_ARGS, "do_modrdn: newSuperior=(%s)\n",
@@ -138,7 +141,7 @@ do_modrdn(
 			
 		}
 
-	}/* if ( ber_peek_tag( op->o_ber, &length ) == LDAP_TAG_NEWSUPERIOR )*/
+	}
 
 	dn_normalize_case( ndn );
 
@@ -180,7 +183,7 @@ do_modrdn(
 	    
 		return;
 
-	}/* if ( (newSuperior_be != NULL) && ( be != newSuperior_be) ) */
+	}
 
 
 	/* alias suffix if approp */
diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h
index e34f4e38f312a413cfd28843379b1907f51538d6..c9b944fc09100261b55f1b5499c0396caa92169c 100644
--- a/servers/slapd/slap.h
+++ b/servers/slapd/slap.h
@@ -427,7 +427,8 @@ struct backend_info {
 	/* LDAP Operations Handling Routines */
 	int	(*bi_op_bind)  LDAP_P(( BackendDB *bd,
 		struct slap_conn *c, struct slap_op *o,
-		char *dn, int method, struct berval *cred, char** edn ));
+		char *dn, int method, char* mechanism,
+		struct berval *cred, char** edn ));
 	int (*bi_op_unbind) LDAP_P((BackendDB *bd,
 		struct slap_conn *c, struct slap_op *o ));
 	int	(*bi_op_search) LDAP_P((BackendDB *bd,
@@ -491,9 +492,13 @@ typedef struct slap_op {
 	time_t		o_time;		/* time op was initiated	  */
 	char		*o_dn;		/* dn bound when op was initiated */
 	char		*o_ndn;		/* normalized dn bound when op was initiated */
+	ber_int_t	o_protocol;	/* version of the LDAP protocol used by client */
 	ber_tag_t	o_authtype;	/* auth method used to bind dn	  */
 					/* values taken from ldap.h	  */
 					/* LDAP_AUTH_*			  */
+	char		*o_authmech; /* SASL mechanism used to bind dn */
+
+	LDAPControl	**o_ctrls;	 /* controls */
 
 /*	 long	o_connid;	*//* id of conn initiating this op  */
 
@@ -533,6 +538,7 @@ typedef struct slap_conn {
 	char	*c_dn;		/* DN bound to this conn  */
 	ber_int_t	c_protocol;	/* version of the LDAP protocol used by client */
 	ber_tag_t	c_authtype;	/* auth method used to bind c_dn  */
+	char	*c_authmech;	/* SASL mechanism used to bind c_dn */
 
 	Operation	*c_ops;			/* list of operations being processed */
 	Operation	*c_pending_ops;	/* list of pending operations */