From: Howard Chu Date: Wed, 24 Jan 2007 09:10:37 +0000 (+0000) Subject: ITS#4809 add reqMod attribute to modrdn records so that operational X-Git-Tag: OPENLDAP_REL_ENG_2_4_4ALPHA~8^2~155 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d84d5e98fb65ea3f8b652dbb1e8cc55a0c828c31;p=openldap ITS#4809 add reqMod attribute to modrdn records so that operational attributes may be propagated. use them in delta-sync. --- diff --git a/servers/slapd/overlays/accesslog.c b/servers/slapd/overlays/accesslog.c index 158a0f3ea9..0442b69c2b 100644 --- a/servers/slapd/overlays/accesslog.c +++ b/servers/slapd/overlays/accesslog.c @@ -402,7 +402,7 @@ static struct { "DESC 'ModRDN operation' " "SUP auditWriteObject STRUCTURAL " "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' " "DESC 'Search operation' " "SUP auditReadObject STRUCTURAL " @@ -1064,6 +1064,7 @@ static int accesslog_response(Operation *op, SlapReply *rs) { break; } + case LOG_EN_MODRDN: case LOG_EN_MODIFY: /* count all the mods */ i = 0; @@ -1100,6 +1101,13 @@ static int accesslog_response(Operation *op, SlapReply *rs) { if ( a ) 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 ) { for (b=m->sml_values; !BER_BVISNULL( b ); b++,i++) { char c_op; @@ -1167,43 +1175,10 @@ static int accesslog_response(Operation *op, SlapReply *rs) { a->a_nvals = vals; last_attr->a_next = a; } - break; - - case LOG_EN_MODRDN: - if ( old ) { - /* count all the vals */ - i = 0; - for ( a=old->e_attrs; a; a=a->a_next ) { - log_attr *la; + if ( logop == LOG_EN_MODIFY ) + break; - /* 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; - } + /* Now log the actual modRDN info */ attr_merge_one( e, ad_reqNewRDN, &op->orr_newrdn, &op->orr_nnewrdn ); attr_merge_one( e, ad_reqDeleteOldRDN, op->orr_deleteoldrdn ? (struct berval *)&slap_true_bv : (struct berval *)&slap_false_bv, diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c index 1271f76af9..e37181370c 100644 --- a/servers/slapd/syncrepl.c +++ b/servers/slapd/syncrepl.c @@ -1325,9 +1325,14 @@ syncrepl_message_to_op( op->orr_modlist = NULL; if ( slap_modrdn2mods( op, &rs )) goto done; - /* FIXME: append entryCSN, modifiersName, modifyTimestamp to - * modlist here. Should accesslog give these to us in a reqMod? - */ + /* Append modlist for operational attrs */ + { + 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 ); slap_mods_free( op->orr_modlist, 1 ); Debug( rc ? LDAP_DEBUG_ANY : LDAP_DEBUG_SYNC,