From: Pierangelo Masarati Date: Sat, 6 Dec 2003 14:35:45 +0000 (+0000) Subject: improvements X-Git-Tag: OPENLDAP_REL_ENG_2_1_MP~256 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=4ccd44af8ba155ab6f8056d8a359a5ff73e1ffdb;p=openldap improvements --- diff --git a/servers/slapd/overlays/rwm.c b/servers/slapd/overlays/rwm.c index 71729665e7..e1eeb4588e 100644 --- a/servers/slapd/overlays/rwm.c +++ b/servers/slapd/overlays/rwm.c @@ -60,6 +60,10 @@ rwm_op_dn_massage( Operation *op, SlapReply *rs, void *cookie ) return rc; } + if ( mdn.bv_val == op->o_req_dn.bv_val ) { + return LDAP_SUCCESS; + } + rc = dnPrettyNormal( NULL, &mdn, &dn, &ndn, op->o_tmpmemctx ); if ( rc != LDAP_SUCCESS ) { return rc; @@ -121,7 +125,7 @@ rwm_delete( Operation *op, SlapReply *rs ) int rc; #ifdef ENABLE_REWRITE - rc = rwm_op_dn_massage( op, rs, "addDn" ); + rc = rwm_op_dn_massage( op, rs, "deleteDn" ); #else rc = 1; rc = rwm_op_dn_massage( op, rs, &rc ); @@ -139,7 +143,7 @@ rwm_modrdn( Operation *op, SlapReply *rs ) int rc; #ifdef ENABLE_REWRITE - rc = rwm_op_dn_massage( op, rs, "addDn" ); + rc = rwm_op_dn_massage( op, rs, "renameDn" ); #else rc = 1; rc = rwm_op_dn_massage( op, rs, &rc ); @@ -158,7 +162,7 @@ rwm_modify( Operation *op, SlapReply *rs ) int rc; #ifdef ENABLE_REWRITE - rc = rwm_op_dn_massage( op, rs, "addDn" ); + rc = rwm_op_dn_massage( op, rs, "modifyDn" ); #else rc = 1; rc = rwm_op_dn_massage( op, rs, &rc ); @@ -177,7 +181,7 @@ rwm_compare( Operation *op, SlapReply *rs ) int rc; #ifdef ENABLE_REWRITE - rc = rwm_op_dn_massage( op, rs, "addDn" ); + rc = rwm_op_dn_massage( op, rs, "compareDn" ); #else rc = 1; rc = rwm_op_dn_massage( op, rs, &rc ); @@ -196,7 +200,7 @@ rwm_search( Operation *op, SlapReply *rs ) int rc; #ifdef ENABLE_REWRITE - rc = rwm_op_dn_massage( op, rs, "addDn" ); + rc = rwm_op_dn_massage( op, rs, "searchDn" ); #else rc = 1; rc = rwm_op_dn_massage( op, rs, &rc ); @@ -215,7 +219,7 @@ rwm_extended( Operation *op, SlapReply *rs ) int rc; #ifdef ENABLE_REWRITE - rc = rwm_op_dn_massage( op, rs, "addDn" ); + rc = rwm_op_dn_massage( op, rs, "extendedDn" ); #else rc = 1; rc = rwm_op_dn_massage( op, rs, &rc ); @@ -256,7 +260,7 @@ rwm_matched( Operation *op, SlapReply *rs ) if ( mdn.bv_val != dn.bv_val ) { if ( rs->sr_flags & REP_MATCHED_MUSTBEFREED ) { - free( rs->sr_matched ); + ch_free( (void *)rs->sr_matched ); } else { rs->sr_flags |= REP_MATCHED_MUSTBEFREED; } @@ -289,7 +293,7 @@ rwm_send_entry( Operation *op, SlapReply *rs ) #ifdef ENABLE_REWRITE dc.conn = op->o_conn; dc.rs = NULL; - dc.ctx = "searchResult"; + dc.ctx = "searchResultDN"; #else dc.tofrom = 0; dc.normalized = 0; @@ -298,6 +302,10 @@ rwm_send_entry( Operation *op, SlapReply *rs ) return LDAP_OTHER; } + if ( e->e_name.bv_val == dn.bv_val ) { + return SLAP_CB_CONTINUE; + } + /* * Note: this may fail if the target host(s) schema differs * from the one known to the meta, and a DN with unknown @@ -311,7 +319,7 @@ rwm_send_entry( Operation *op, SlapReply *rs ) goto fail; } - if ( !rs->sr_flags & REP_ENTRY_MODIFIABLE ) { + if ( !( rs->sr_flags & REP_ENTRY_MODIFIABLE ) ) { e = entry_dup( e ); if ( e == NULL ) { goto fail; diff --git a/servers/slapd/overlays/rwmconf.c b/servers/slapd/overlays/rwmconf.c index 4e20ed2506..0690670c14 100644 --- a/servers/slapd/overlays/rwmconf.c +++ b/servers/slapd/overlays/rwmconf.c @@ -298,7 +298,7 @@ suffix_massage_config( ch_free( rargv[ 2 ] ); rargv[ 0 ] = "rewriteContext"; - rargv[ 1 ] = "searchResult"; + rargv[ 1 ] = "searchResultDN"; rargv[ 2 ] = NULL; rewrite_parse( info, "", ++line, 2, rargv ); @@ -314,14 +314,14 @@ suffix_massage_config( rargv[ 0 ] = "rewriteContext"; rargv[ 1 ] = "matchedDN"; rargv[ 2 ] = "alias"; - rargv[ 3 ] = "searchResult"; + rargv[ 3 ] = "searchResultDN"; rargv[ 4 ] = NULL; rewrite_parse( info, "", ++line, 4, rargv ); rargv[ 0 ] = "rewriteContext"; rargv[ 1 ] = "searchAttrDN"; rargv[ 2 ] = "alias"; - rargv[ 3 ] = "searchResult"; + rargv[ 3 ] = "searchResultDN"; rargv[ 4 ] = NULL; rewrite_parse( info, "", ++line, 4, rargv );