]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#9538 Populate op2.o_hdr earlier
authorOndřej Kuzník <ondra@mistotebe.net>
Tue, 14 Sep 2021 10:06:13 +0000 (11:06 +0100)
committerQuanah Gibson-Mount <quanah@openldap.org>
Wed, 12 Jan 2022 22:43:50 +0000 (22:43 +0000)
servers/slapd/overlays/accesslog.c

index a9fd3177e34c9de6ba1a8c49455f04e7bb1097a2..fc7abe7b5852b3deb6a4508501774d9e19131e2e 100644 (file)
@@ -2166,6 +2166,12 @@ accesslog_unbind( Operation *op, SlapReply *rs )
                        return SLAP_CB_CONTINUE;
        }
 
+       op2.o_hdr = op->o_hdr;
+       op2.o_tag = LDAP_REQ_ADD;
+       op2.o_bd = li->li_db;
+       op2.o_csn.bv_val = csnbuf;
+       op2.o_csn.bv_len = sizeof(csnbuf);
+
        ldap_pvt_thread_mutex_lock( &li->li_op_rmutex );
 
        if ( SLAP_LASTMOD( li->li_db ) ) {
@@ -2174,8 +2180,6 @@ accesslog_unbind( Operation *op, SlapReply *rs )
                 * ordering
                 */
                if ( BER_BVISEMPTY( &op->o_csn ) ) {
-                       op2.o_csn.bv_val = csnbuf;
-                       op2.o_csn.bv_len = sizeof(csnbuf);
                        slap_get_csn( &op2, &op2.o_csn, 1 );
                } else {
                        Debug( LDAP_DEBUG_ANY, "%s accesslog_unbind: "
@@ -2190,9 +2194,6 @@ accesslog_unbind( Operation *op, SlapReply *rs )
        ldap_pvt_thread_mutex_unlock( &li->li_op_rmutex );
 
        e = accesslog_entry( op, rs, li, LOG_EN_UNBIND, &op2 );
-       op2.o_hdr = op->o_hdr;
-       op2.o_tag = LDAP_REQ_ADD;
-       op2.o_bd = li->li_db;
        op2.o_dn = li->li_db->be_rootdn;
        op2.o_ndn = li->li_db->be_rootndn;
        op2.o_req_dn = e->e_name;
@@ -2245,6 +2246,12 @@ accesslog_abandon( Operation *op, SlapReply *rs )
                        return SLAP_CB_CONTINUE;
        }
 
+       op2.o_hdr = op->o_hdr;
+       op2.o_tag = LDAP_REQ_ADD;
+       op2.o_bd = li->li_db;
+       op2.o_csn.bv_val = csnbuf;
+       op2.o_csn.bv_len = sizeof(csnbuf);
+
        ldap_pvt_thread_mutex_lock( &li->li_op_rmutex );
        if ( SLAP_LASTMOD( li->li_db ) ) {
                /*
@@ -2252,8 +2259,6 @@ accesslog_abandon( Operation *op, SlapReply *rs )
                 * ordering
                 */
                if ( BER_BVISEMPTY( &op->o_csn ) ) {
-                       op2.o_csn.bv_val = csnbuf;
-                       op2.o_csn.bv_len = sizeof(csnbuf);
                        slap_get_csn( &op2, &op2.o_csn, 1 );
                } else {
                        Debug( LDAP_DEBUG_ANY, "%s accesslog_abandon: "
@@ -2274,9 +2279,6 @@ accesslog_abandon( Operation *op, SlapReply *rs )
                attr_merge_one( e, ad_reqId, &bv, NULL );
        } /* else? */
 
-       op2.o_hdr = op->o_hdr;
-       op2.o_tag = LDAP_REQ_ADD;
-       op2.o_bd = li->li_db;
        op2.o_dn = li->li_db->be_rootdn;
        op2.o_ndn = li->li_db->be_rootndn;
        op2.o_req_dn = e->e_name;