From 2027e19e01dd5d8e9720e3c32c9a1ea5a3608e9c Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Wed, 5 Oct 2005 08:59:59 +0000 Subject: [PATCH] Fix rdn timestamp normalization --- servers/slapd/overlays/accesslog.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/servers/slapd/overlays/accesslog.c b/servers/slapd/overlays/accesslog.c index 2cbda0046e..ab2d1aad52 100644 --- a/servers/slapd/overlays/accesslog.c +++ b/servers/slapd/overlays/accesslog.c @@ -654,7 +654,7 @@ static Entry *accesslog_entry( Operation *op, int logop ) { log_info *li = on->on_bi.bi_private; char rdnbuf[STRLENOF(RDNEQ)+LDAP_LUTIL_GENTIME_BUFSIZE+8]; - struct berval rdn, timestamp, bv; + struct berval rdn, nrdn, timestamp, ntimestamp, bv; slap_verbmasks *lo = logops+logop+EN_OFFSET; Entry *e = ch_calloc( 1, sizeof(Entry) ); @@ -665,19 +665,23 @@ static Entry *accesslog_entry( Operation *op, int logop ) { timestamp.bv_val = rdnbuf+STRLENOF(RDNEQ); timestamp.bv_len = sizeof(rdnbuf) - STRLENOF(RDNEQ); slap_timestamp( &op->o_time, ×tamp ); - if ( op->o_tincr ) { - sprintf( timestamp.bv_val + timestamp.bv_len-1, ".%06dZ", op->o_tincr ); - timestamp.bv_len += 7; - } + sprintf( timestamp.bv_val + timestamp.bv_len-1, ".%06dZ", op->o_tincr ); + timestamp.bv_len += 7; + rdn.bv_len = STRLENOF(RDNEQ)+timestamp.bv_len; + rdnNormalize( 0, NULL, NULL, &rdn, &nrdn, op->o_tmpmemctx ); build_new_dn( &e->e_name, li->li_db->be_suffix, &rdn, NULL ); - build_new_dn( &e->e_nname, li->li_db->be_nsuffix, &rdn, NULL ); + build_new_dn( &e->e_nname, li->li_db->be_nsuffix, &nrdn, NULL ); attr_merge_one( e, slap_schema.si_ad_objectClass, &log_ocs[logop]->soc_cname, NULL ); attr_merge_one( e, slap_schema.si_ad_structuralObjectClass, &log_ocs[logop]->soc_cname, NULL ); - attr_merge_one( e, ad_reqStart, ×tamp, NULL ); + + ntimestamp.bv_val = nrdn.bv_val + STRLENOF(RDNEQ); + ntimestamp.bv_len = nrdn.bv_len - STRLENOF(RDNEQ); + attr_merge_one( e, ad_reqStart, ×tamp, &ntimestamp ); + op->o_tmpfree( nrdn.bv_val, op->o_tmpmemctx ); /* Exops have OID appended */ if ( logop == LOG_EN_EXTENDED ) { -- 2.39.5