]> git.sur5r.net Git - openldap/commitdiff
ITS#5161
authorQuanah Gibson-Mount <quanah@openldap.org>
Fri, 7 Dec 2007 19:50:54 +0000 (19:50 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Fri, 7 Dec 2007 19:50:54 +0000 (19:50 +0000)
CHANGES
servers/slapd/overlays/accesslog.c

diff --git a/CHANGES b/CHANGES
index 968e95fd47da27390387e0f9fe625e273b0e8fc7..95b9b5f7d8f467bc1be48cfce360a08fb9faa66a 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -16,6 +16,7 @@ OpenLDAP 2.4.7 Release (2007/12/01)
        Fixed slapd-bdb/hdb dn2entry lock bug (ITS#5257)
        Fixed slapd-bdb/hdb dn2id lock bug (ITS#5262)
        Fixed slapd-hdb caching on rename ops (ITS#5221)
+       Fixed slapo-accesslog abandoned op cleanup (ITS#5161)
        Fixed slapo-pcache op->o_abandon handling (ITS#5187)
        Fixed slapo-ppolicy single password check on modify (ITS#5146)
        Fixed slapo-ppolicy internal search (ITS#5235)
index ff04ea5dd088d3603d76e99a58bf8e979640de7c..90205ca45c67852e3e158ff562c912bc70f076bf 100644 (file)
@@ -67,6 +67,7 @@ typedef struct log_info {
        Entry *li_old;
        log_attr *li_oldattrs;
        int li_success;
+       int li_unlock;
        ldap_pvt_thread_rmutex_t li_op_rmutex;
        ldap_pvt_thread_mutex_t li_log_mutex;
 } log_info;
@@ -1341,6 +1342,7 @@ static int accesslog_response(Operation *op, SlapReply *rs) {
                ldap_pvt_thread_mutex_lock( &li->li_log_mutex );
                old = li->li_old;
                li->li_old = NULL;
+               li->li_unlock = 0;
                ldap_pvt_thread_rmutex_unlock( &li->li_op_rmutex, op->o_tid );
        }
 
@@ -1686,6 +1688,25 @@ accesslog_op_bind( Operation *op, SlapReply *rs )
        return SLAP_CB_CONTINUE;
 }
 
+static int
+accesslog_mod_cleanup( Operation *op, SlapReply *rs )
+{
+       slap_callback *sc = op->o_callback;
+       slap_overinst *on = sc->sc_private;
+       log_info *li = on->on_bi.bi_private;
+       op->o_callback = sc->sc_next;
+
+       op->o_tmpfree( sc, op->o_tmpmemctx );
+
+       if ( li->li_unlock ) {
+               BackendInfo *bi = op->o_bd->bd_info;
+               op->o_bd->bd_info = (BackendInfo *)on;
+               accesslog_response( op, rs );
+               op->o_bd->bd_info = bi;
+       }
+       return 0;
+}
+
 static int
 accesslog_op_mod( Operation *op, SlapReply *rs )
 {
@@ -1693,7 +1714,15 @@ accesslog_op_mod( Operation *op, SlapReply *rs )
        log_info *li = on->on_bi.bi_private;
 
        if ( li->li_ops & LOG_OP_WRITES ) {
+               slap_callback *cb = op->o_tmpalloc( sizeof( slap_callback ), op->o_tmpmemctx );
+               cb->sc_cleanup = accesslog_mod_cleanup;
+               cb->sc_response = NULL;
+               cb->sc_private = on;
+               cb->sc_next = op->o_callback;
+               op->o_callback = cb;
+
                ldap_pvt_thread_rmutex_lock( &li->li_op_rmutex, op->o_tid );
+               li->li_unlock = 1;
                if ( li->li_oldf && ( op->o_tag == LDAP_REQ_DELETE ||
                        op->o_tag == LDAP_REQ_MODIFY ||
                        ( op->o_tag == LDAP_REQ_MODRDN && li->li_oldattrs ))) {