From: Andreas Schneider Date: Thu, 2 May 2024 14:45:59 +0000 (+0200) Subject: lib:ldb: Use tdb_parse_record() in ldb_kv_dn_list_store() X-Git-Tag: tdb-1.4.13~1149 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3582250538e48053fa118a7ebda88b9a116f13b0;p=thirdparty%2Fsamba.git lib:ldb: Use tdb_parse_record() in ldb_kv_dn_list_store() Signed-off-by: Andreas Schneider Reviewed-by: Volker Lendecke --- diff --git a/lib/ldb/ldb_key_value/ldb_kv_index.c b/lib/ldb/ldb_key_value/ldb_kv_index.c index 51ac99b8f5b..6a265166e1d 100644 --- a/lib/ldb/ldb_key_value/ldb_kv_index.c +++ b/lib/ldb/ldb_key_value/ldb_kv_index.c @@ -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;