ITS#4809 add reqMod attribute to modrdn records so that operational

attributes may be propagated. use them in delta-sync.
This commit is contained in:
Howard Chu 2007-01-24 09:10:37 +00:00
parent c9dd0afdff
commit d84d5e98fb
2 changed files with 20 additions and 40 deletions

View file

@ -402,7 +402,7 @@ static struct {
"DESC 'ModRDN operation' " "DESC 'ModRDN operation' "
"SUP auditWriteObject STRUCTURAL " "SUP auditWriteObject STRUCTURAL "
"MUST ( reqNewRDN $ reqDeleteOldRDN ) " "MUST ( reqNewRDN $ reqDeleteOldRDN ) "
"MAY ( reqNewSuperior $ reqOld ) )", &log_ocs[LOG_EN_MODRDN] }, "MAY ( reqNewSuperior $ reqMod $ reqOld ) )", &log_ocs[LOG_EN_MODRDN] },
{ "( " LOG_SCHEMA_OC ".11 NAME 'auditSearch' " { "( " LOG_SCHEMA_OC ".11 NAME 'auditSearch' "
"DESC 'Search operation' " "DESC 'Search operation' "
"SUP auditReadObject STRUCTURAL " "SUP auditReadObject STRUCTURAL "
@ -1064,6 +1064,7 @@ static int accesslog_response(Operation *op, SlapReply *rs) {
break; break;
} }
case LOG_EN_MODRDN:
case LOG_EN_MODIFY: case LOG_EN_MODIFY:
/* count all the mods */ /* count all the mods */
i = 0; i = 0;
@ -1100,6 +1101,13 @@ static int accesslog_response(Operation *op, SlapReply *rs) {
if ( a ) if ( a )
a->a_flags = 1; a->a_flags = 1;
} }
/* don't log the RDN mods; they're explicitly logged later */
if ( logop == LOG_EN_MODRDN &&
( m->sml_op == SLAP_MOD_SOFTADD ||
m->sml_op == LDAP_MOD_DELETE ))
continue;
if ( m->sml_values ) { if ( m->sml_values ) {
for (b=m->sml_values; !BER_BVISNULL( b ); b++,i++) { for (b=m->sml_values; !BER_BVISNULL( b ); b++,i++) {
char c_op; char c_op;
@ -1167,43 +1175,10 @@ static int accesslog_response(Operation *op, SlapReply *rs) {
a->a_nvals = vals; a->a_nvals = vals;
last_attr->a_next = a; last_attr->a_next = a;
} }
break; if ( logop == LOG_EN_MODIFY )
break;
case LOG_EN_MODRDN: /* Now log the actual modRDN info */
if ( old ) {
/* count all the vals */
i = 0;
for ( a=old->e_attrs; a; a=a->a_next ) {
log_attr *la;
/* look for attrs that are always logged */
for ( la=li->li_oldattrs; la; la=la->next ) {
if ( a->a_desc == la->attr ) {
for (b=a->a_vals; !BER_BVISNULL( b ); b++) {
i++;
}
}
}
}
vals = ch_malloc( (i+1) * sizeof( struct berval ));
i = 0;
for ( a=old->e_attrs; a; a=a->a_next ) {
log_attr *la;
for ( la=li->li_oldattrs; la; la=la->next ) {
if ( a->a_desc == la->attr ) {
for (b=a->a_vals; !BER_BVISNULL( b ); b++,i++) {
accesslog_val2val( a->a_desc, b, 0, &vals[i] );
}
}
}
}
vals[i].bv_val = NULL;
vals[i].bv_len = 0;
a = attr_alloc( ad_reqOld );
a->a_vals = vals;
a->a_nvals = vals;
last_attr->a_next = a;
}
attr_merge_one( e, ad_reqNewRDN, &op->orr_newrdn, &op->orr_nnewrdn ); attr_merge_one( e, ad_reqNewRDN, &op->orr_newrdn, &op->orr_nnewrdn );
attr_merge_one( e, ad_reqDeleteOldRDN, op->orr_deleteoldrdn ? attr_merge_one( e, ad_reqDeleteOldRDN, op->orr_deleteoldrdn ?
(struct berval *)&slap_true_bv : (struct berval *)&slap_false_bv, (struct berval *)&slap_true_bv : (struct berval *)&slap_false_bv,

View file

@ -1325,9 +1325,14 @@ syncrepl_message_to_op(
op->orr_modlist = NULL; op->orr_modlist = NULL;
if ( slap_modrdn2mods( op, &rs )) if ( slap_modrdn2mods( op, &rs ))
goto done; goto done;
/* FIXME: append entryCSN, modifiersName, modifyTimestamp to /* Append modlist for operational attrs */
* modlist here. Should accesslog give these to us in a reqMod? {
*/ Modifications *m;
for ( m = op->orr_modlist; m->sml_next; m = m->sml_next ) ;
m->sml_next = modlist;
modlist = NULL;
}
rc = op->o_bd->be_modrdn( op, &rs ); rc = op->o_bd->be_modrdn( op, &rs );
slap_mods_free( op->orr_modlist, 1 ); slap_mods_free( op->orr_modlist, 1 );
Debug( rc ? LDAP_DEBUG_ANY : LDAP_DEBUG_SYNC, Debug( rc ? LDAP_DEBUG_ANY : LDAP_DEBUG_SYNC,