]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib:ldb: Use tdb_parse_record() in ldb_kv_dn_list_store()
authorAndreas Schneider <asn@samba.org>
Thu, 2 May 2024 14:45:59 +0000 (16:45 +0200)
committerVolker Lendecke <vl@samba.org>
Thu, 26 Sep 2024 08:46:29 +0000 (08:46 +0000)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
lib/ldb/ldb_key_value/ldb_kv_index.c

index 51ac99b8f5b4a41e0152cdef2563265214c6b3cc..6a265166e1d4b922bc2291ae809b5768c7cba2e5 100644 (file)
@@ -841,6 +841,9 @@ static int ldb_kv_dn_list_store(struct ldb_module *module,
        int ret = LDB_SUCCESS;
        struct dn_list *list2 = NULL;
        struct ldb_kv_idxptr *idxptr = NULL;
+       struct ldb_dn_list_state state = {
+               .module = module,
+       };
 
        key.dptr = discard_const_p(unsigned char, ldb_dn_get_linearized(dn));
        if (key.dptr == NULL) {
@@ -865,14 +868,16 @@ static int ldb_kv_dn_list_store(struct ldb_module *module,
         * the dn_list directly.
         *
         */
-       rec = tdb_fetch(idxptr->itdb, key);
-       if (rec.dptr != NULL) {
-               list2 = ldb_kv_index_idxptr(module, rec);
+       ret = tdb_parse_record(idxptr->itdb,
+                              key,
+                              ldb_kv_index_idxptr_wrapper,
+                              &state);
+       if (ret == 0) {
+               list2 = state.list;
                if (list2 == NULL) {
                        free(rec.dptr);
                        return LDB_ERR_OPERATIONS_ERROR;
                }
-               free(rec.dptr);
                /* Now put the updated pointer back in the cache */
                if (list->dn == NULL) {
                        list2->dn = NULL;