]> git.sur5r.net Git - openldap/commitdiff
ITS#4809 add reqMod attribute to modrdn records so that operational
authorHoward Chu <hyc@openldap.org>
Wed, 24 Jan 2007 09:10:37 +0000 (09:10 +0000)
committerHoward Chu <hyc@openldap.org>
Wed, 24 Jan 2007 09:10:37 +0000 (09:10 +0000)
attributes may be propagated. use them in delta-sync.

servers/slapd/overlays/accesslog.c
servers/slapd/syncrepl.c

index 158a0f3ea9f3b1ac9ba34e067975a36a8114af13..0442b69c2b840c028b8375f9b268437ff47dfeba 100644 (file)
@@ -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,
index 1271f76af92bf1261e984612c2daafd2e12aa169..e37181370cefd755b6d30f04c2c86a6e63c72514 100644 (file)
@@ -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,