]> git.sur5r.net Git - openldap/commitdiff
ITS#4198 initialize logdb contextCSN from main DB contextCSN
authorHoward Chu <hyc@openldap.org>
Fri, 25 Nov 2005 21:51:49 +0000 (21:51 +0000)
committerHoward Chu <hyc@openldap.org>
Fri, 25 Nov 2005 21:51:49 +0000 (21:51 +0000)
servers/slapd/overlays/accesslog.c

index 87a2aa78926b7dff6e2e11bfa46d0197b42c96af..e802492e8f2c8204a0383fbfb3e4c44f68d09f9f 100644 (file)
@@ -1243,6 +1243,8 @@ accesslog_db_open(
                char *ptr;
                AttributeDescription *ad = NULL;
                const char *text = NULL;
+               Entry *e_ctx;
+
                e = ch_calloc( 1, sizeof( Entry ));
                e->e_name = *li->li_db->be_suffix;
                e->e_nname = *li->li_db->be_nsuffix;
@@ -1268,6 +1270,23 @@ accesslog_db_open(
                nrdn.bv_val = ptr+1;
                attr_merge_one( e, ad, &rdn, &nrdn );
 
+               /* Get contextCSN from main DB */
+               op->o_bd = be;
+               op->o_bd->bd_info = on->on_info->oi_orig;
+               rc = be_entry_get_rw( op, be->be_nsuffix, NULL,
+                       slap_schema.si_ad_contextCSN, 0, &e_ctx );
+
+               if ( e_ctx ) {
+                       Attribute *a;
+
+                       a = attr_find( e_ctx->e_attrs, slap_schema.si_ad_contextCSN );
+                       if ( a )
+                               attr_merge( e, a->a_desc, a->a_vals, NULL );
+                       be_entry_release_rw( op, e_ctx, 0 );
+               }
+               op->o_bd->bd_info = (BackendInfo *)on;
+               op->o_bd = li->li_db;
+
                op->ora_e = e;
                op->o_req_dn = e->e_name;
                op->o_req_ndn = e->e_nname;