From 3bb8b737ed8e444c6771c1465574eb6cf5b7f19a Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sat, 14 Oct 2017 11:22:53 +0100 Subject: [PATCH] ITS#8752 accesslog: cleanup should only be called on failures --- servers/slapd/overlays/accesslog.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/servers/slapd/overlays/accesslog.c b/servers/slapd/overlays/accesslog.c index 53369b32c5..3561b0f489 100644 --- a/servers/slapd/overlays/accesslog.c +++ b/servers/slapd/overlays/accesslog.c @@ -1943,7 +1943,7 @@ accesslog_mod_cleanup( Operation *op, SlapReply *rs ) op->o_tmpfree( sc, op->o_tmpmemctx ); - if ( on ) { + if ( on && rs->sr_err != LDAP_SUCCESS ) { BackendInfo *bi = op->o_bd->bd_info; op->o_bd->bd_info = (BackendInfo *)on; accesslog_response( op, rs ); @@ -1994,11 +1994,11 @@ accesslog_op_mod( Operation *op, SlapReply *rs ) } if ( doit ) { - slap_callback *cb = op->o_tmpcalloc( 1, sizeof( slap_callback ), op->o_tmpmemctx ), *cb2; + slap_callback *cb = op->o_tmpcalloc( 1, sizeof( slap_callback ), op->o_tmpmemctx ); cb->sc_cleanup = accesslog_mod_cleanup; cb->sc_private = on; - for ( cb2 = op->o_callback; cb2->sc_next; cb2 = cb2->sc_next ); - cb2->sc_next = cb; + cb->sc_next = op->o_callback; + op->o_callback = cb; #ifdef RMUTEX_DEBUG Debug( LDAP_DEBUG_SYNC, -- 2.39.2