]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#10109 Pass operation to slap_get_csn()
authorOndřej Kuzník <ondra@mistotebe.net>
Mon, 27 Nov 2023 12:33:29 +0000 (12:33 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Tue, 16 Jan 2024 20:33:15 +0000 (20:33 +0000)
contrib/slapd-modules/lastmod/lastmod.c

index 116b9ae87bfa25d3a2380def6d19750609b169ac..b329ef700ee09383d5b88535189d29b482bd6195 100644 (file)
@@ -372,7 +372,7 @@ best_guess( Operation *op,
        
                entryCSN.bv_val = csnbuf;
                entryCSN.bv_len = sizeof( csnbuf );
-               slap_get_csn( NULL, &entryCSN, 0 );
+               slap_get_csn( op, &entryCSN, 0 );
 
                ber_dupbv( bv_entryCSN, &entryCSN );
                ber_dupbv( bv_nentryCSN, &entryCSN );
@@ -833,6 +833,11 @@ lastmod_db_open( BackendDB *be, ConfigReply *cr )
        static char             tmbuf[ LDAP_LUTIL_GENTIME_BUFSIZE ];
 
        char                    csnbuf[ LDAP_PVT_CSNSTR_BUFSIZE ];
+       void                    *thrctx = ldap_pvt_thread_pool_context();
+       Connection              conn = { 0 };
+       OperationBuffer         opbuf;
+       Operation               *op;
+
        struct berval           entryCSN;
        struct berval timestamp;
 
@@ -841,6 +846,9 @@ lastmod_db_open( BackendDB *be, ConfigReply *cr )
                return -1;
        }
 
+       connection_fake_init2( &conn, &opbuf, thrctx, 0 );
+       op = &opbuf.ob_op;
+
        /*
         * Start
         */
@@ -850,7 +858,7 @@ lastmod_db_open( BackendDB *be, ConfigReply *cr )
 
        entryCSN.bv_val = csnbuf;
        entryCSN.bv_len = sizeof( csnbuf );
-       slap_get_csn( NULL, &entryCSN, 0 );
+       slap_get_csn( op, &entryCSN, 0 );
 
        if ( BER_BVISNULL( &lmi->lmi_rdnvalue ) ) {
                ber_str2bv( "Lastmod", 0, 1, &lmi->lmi_rdnvalue );