Commit 49ee5d9b authored by Howard Chu's avatar Howard Chu
Browse files

ITS#5344 slapo-rwm: fix prev commit

Must always generate newDN
parent 4588f4e5
...@@ -730,8 +730,9 @@ rwm_op_modrdn( Operation *op, SlapReply *rs ) ...@@ -730,8 +730,9 @@ rwm_op_modrdn( Operation *op, SlapReply *rs )
slap_overinst *on = (slap_overinst *) op->o_bd->bd_info; slap_overinst *on = (slap_overinst *) op->o_bd->bd_info;
struct ldaprwmap *rwmap = struct ldaprwmap *rwmap =
(struct ldaprwmap *)on->on_bi.bi_private; (struct ldaprwmap *)on->on_bi.bi_private;
struct berval pdn, pndn;
int rc, changedNewDN = 0; int rc;
dncookie dc; dncookie dc;
rwm_op_cb *roc = rwm_callback_get( op ); rwm_op_cb *roc = rwm_callback_get( op );
...@@ -757,7 +758,6 @@ rwm_op_modrdn( Operation *op, SlapReply *rs ) ...@@ -757,7 +758,6 @@ rwm_op_modrdn( Operation *op, SlapReply *rs )
} }
if ( op->orr_newSup->bv_val != newSup.bv_val ) { if ( op->orr_newSup->bv_val != newSup.bv_val ) {
changedNewDN = 1;
op->orr_newSup = op->o_tmpalloc( sizeof( struct berval ), op->orr_newSup = op->o_tmpalloc( sizeof( struct berval ),
op->o_tmpmemctx ); op->o_tmpmemctx );
op->orr_nnewSup = op->o_tmpalloc( sizeof( struct berval ), op->orr_nnewSup = op->o_tmpalloc( sizeof( struct berval ),
...@@ -765,6 +765,8 @@ rwm_op_modrdn( Operation *op, SlapReply *rs ) ...@@ -765,6 +765,8 @@ rwm_op_modrdn( Operation *op, SlapReply *rs )
*op->orr_newSup = newSup; *op->orr_newSup = newSup;
*op->orr_nnewSup = nnewSup; *op->orr_nnewSup = nnewSup;
} }
pdn = newSup;
pndn = nnewSup;
} }
/* /*
...@@ -788,29 +790,11 @@ rwm_op_modrdn( Operation *op, SlapReply *rs ) ...@@ -788,29 +790,11 @@ rwm_op_modrdn( Operation *op, SlapReply *rs )
} }
if ( op->orr_newrdn.bv_val != newrdn.bv_val ) { if ( op->orr_newrdn.bv_val != newrdn.bv_val ) {
changedNewDN = 1;
op->orr_newrdn = newrdn; op->orr_newrdn = newrdn;
op->orr_nnewrdn = nnewrdn; op->orr_nnewrdn = nnewrdn;
} }
} }
/*
* Update the new DN if changed
*/
if ( changedNewDN ) {
struct berval pdn, pndn;
if ( op->orr_newSup ) {
pdn = *op->orr_newSup;
pndn = *op->orr_nnewSup;
} else {
dnParent( &op->o_req_dn, &pdn );
dnParent( &op->o_req_ndn, &pndn );
}
build_new_dn( &op->orr_newDN, &pdn, &op->orr_newrdn, op->o_tmpmemctx );
build_new_dn( &op->orr_nnewDN, &pndn, &op->orr_nnewrdn, op->o_tmpmemctx );
}
/* /*
* Rewrite the dn, if needed * Rewrite the dn, if needed
*/ */
...@@ -820,6 +804,16 @@ rwm_op_modrdn( Operation *op, SlapReply *rs ) ...@@ -820,6 +804,16 @@ rwm_op_modrdn( Operation *op, SlapReply *rs )
send_ldap_error( op, rs, rc, "renameDN massage error" ); send_ldap_error( op, rs, rc, "renameDN massage error" );
goto err; goto err;
} }
if ( !op->orr_newSup ) {
dnParent( &op->o_req_dn, &pdn );
dnParent( &op->o_req_ndn, &pndn );
}
/*
* Update the new DN
*/
build_new_dn( &op->orr_newDN, &pdn, &op->orr_newrdn, op->o_tmpmemctx );
build_new_dn( &op->orr_nnewDN, &pndn, &op->orr_nnewrdn, op->o_tmpmemctx );
op->o_callback = &roc->cb; op->o_callback = &roc->cb;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment