mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-25 17:19:43 -05:00
add newRDN rewriting; fix rewriteContext names (ITS#5834)
This commit is contained in:
parent
7c3e478f40
commit
1d9ff10ed7
2 changed files with 53 additions and 10 deletions
|
|
@ -355,8 +355,9 @@ modifyDN modify
|
|||
modifyAttrDN modify AVA (DN portion of "ref" excluded)
|
||||
referralAttrDN add/modify DN portion of referrals
|
||||
(default to none)
|
||||
modrDN modrdn
|
||||
newSuperiorDN modrdn
|
||||
renameDN modrdn (the old DN)
|
||||
newSuperiorDN modrdn (the new parent DN, if any)
|
||||
newRDN modrdn (the new relative DN)
|
||||
deleteDN delete
|
||||
exopPasswdDN password modify extended operation DN
|
||||
.fi
|
||||
|
|
|
|||
|
|
@ -96,6 +96,12 @@ rwm_op_rollback( Operation *op, SlapReply *rs, rwm_op_state *ros )
|
|||
op->orr_newSup = ros->orr_newSup;
|
||||
op->orr_nnewSup = ros->orr_nnewSup;
|
||||
}
|
||||
if ( op->orr_newrdn.bv_val != ros->orr_newrdn.bv_val ) {
|
||||
ch_free( op->orr_newrdn.bv_val );
|
||||
ch_free( op->orr_nnewrdn.bv_val );
|
||||
op->orr_newrdn = ros->orr_newrdn;
|
||||
op->orr_nnewrdn = ros->orr_nnewrdn;
|
||||
}
|
||||
break;
|
||||
case LDAP_REQ_SEARCH:
|
||||
ch_free( ros->mapped_attrs );
|
||||
|
|
@ -684,11 +690,11 @@ rwm_op_modrdn( Operation *op, SlapReply *rs )
|
|||
(struct ldaprwmap *)on->on_bi.bi_private;
|
||||
|
||||
int rc;
|
||||
dncookie dc;
|
||||
|
||||
rwm_op_cb *roc = rwm_callback_get( op, rs );
|
||||
|
||||
if ( op->orr_newSup ) {
|
||||
dncookie dc;
|
||||
struct berval nnewSup = BER_BVNULL;
|
||||
struct berval newSup = BER_BVNULL;
|
||||
|
||||
|
|
@ -718,6 +724,32 @@ rwm_op_modrdn( Operation *op, SlapReply *rs )
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Rewrite the newRDN, if needed
|
||||
*/
|
||||
{
|
||||
struct berval newrdn = BER_BVNULL;
|
||||
struct berval nnewrdn = BER_BVNULL;
|
||||
|
||||
dc.rwmap = rwmap;
|
||||
dc.conn = op->o_conn;
|
||||
dc.rs = rs;
|
||||
dc.ctx = "newRDN";
|
||||
newrdn = op->orr_newrdn;
|
||||
nnewrdn = op->orr_nnewrdn;
|
||||
rc = rwm_dn_massage_pretty_normalize( &dc, &op->orr_newrdn, &newrdn, &nnewrdn );
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
op->o_bd->bd_info = (BackendInfo *)on->on_info;
|
||||
send_ldap_error( op, rs, rc, "newRDN massage error" );
|
||||
goto err;
|
||||
}
|
||||
|
||||
if ( op->orr_newrdn.bv_val != newrdn.bv_val ) {
|
||||
op->orr_newrdn = newrdn;
|
||||
op->orr_nnewrdn = nnewrdn;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Rewrite the dn, if needed
|
||||
*/
|
||||
|
|
@ -725,6 +757,15 @@ rwm_op_modrdn( Operation *op, SlapReply *rs )
|
|||
if ( rc != LDAP_SUCCESS ) {
|
||||
op->o_bd->bd_info = (BackendInfo *)on->on_info;
|
||||
send_ldap_error( op, rs, rc, "renameDN massage error" );
|
||||
goto err;
|
||||
}
|
||||
|
||||
op->o_callback = &roc->cb;
|
||||
|
||||
rc = SLAP_CB_CONTINUE;
|
||||
|
||||
if ( 0 ) {
|
||||
err:;
|
||||
if ( op->orr_newSup != roc->ros.orr_newSup ) {
|
||||
ch_free( op->orr_newSup->bv_val );
|
||||
ch_free( op->orr_nnewSup->bv_val );
|
||||
|
|
@ -733,15 +774,16 @@ rwm_op_modrdn( Operation *op, SlapReply *rs )
|
|||
op->orr_newSup = roc->ros.orr_newSup;
|
||||
op->orr_nnewSup = roc->ros.orr_nnewSup;
|
||||
}
|
||||
return -1;
|
||||
|
||||
if ( op->orr_newrdn.bv_val != roc->ros.orr_newrdn.bv_val ) {
|
||||
ch_free( op->orr_newrdn.bv_val );
|
||||
ch_free( op->orr_nnewrdn.bv_val );
|
||||
op->orr_newrdn = roc->ros.orr_newrdn;
|
||||
op->orr_nnewrdn = roc->ros.orr_nnewrdn;
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO: rewrite newRDN, attribute types,
|
||||
* values of DN-valued attributes (hopefully not used in RDN)... */
|
||||
|
||||
op->o_callback = &roc->cb;
|
||||
|
||||
return SLAP_CB_CONTINUE;
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue