summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Lockyer <gary@catalyst.net.nz>2019-06-21 14:52:24 +1200
committerAndrew Bartlett <abartlet@samba.org>2019-06-21 04:27:12 +0000
commit1a52b03b2f4c1503b52784f1a01f8291b78e7604 (patch)
tree3305fe5f6538f82548f1b7edc1bc3a78a7d2584f
parent201684e59fd417ca913cb1d2d099e91b57dace6c (diff)
downloadsamba-1a52b03b2f4c1503b52784f1a01f8291b78e7604.tar.gz
lib ldb key value: Remove check_parent from ldb_kv_index_idxptr()
The callers will soon have two possible parents for this pointer, so we need to remove this check, which was added out of caution given the rather strange pattern of putting an active memory pointer into a TDB (as a hash map). That is, the only callers that did call this with "true" would have to call this with "false", so just remove the complexity. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
-rw-r--r--lib/ldb/ldb_key_value/ldb_kv_index.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/lib/ldb/ldb_key_value/ldb_kv_index.c b/lib/ldb/ldb_key_value/ldb_kv_index.c
index d0916387b11..5697c2f9c43 100644
--- a/lib/ldb/ldb_key_value/ldb_kv_index.c
+++ b/lib/ldb/ldb_key_value/ldb_kv_index.c
@@ -325,8 +325,7 @@ static int ldb_kv_dn_list_find_msg(struct ldb_kv_private *ldb_kv,
alignment
*/
static struct dn_list *ldb_kv_index_idxptr(struct ldb_module *module,
- TDB_DATA rec,
- bool check_parent)
+ TDB_DATA rec)
{
struct dn_list *list;
if (rec.dsize != sizeof(void *)) {
@@ -345,12 +344,6 @@ static struct dn_list *ldb_kv_index_idxptr(struct ldb_module *module,
talloc_get_name(list));
return NULL;
}
- if (check_parent && list->dn && talloc_parent(list->dn) != list) {
- ldb_asprintf_errstring(ldb_module_get_ctx(module),
- "Bad parent '%s' for idxptr",
- talloc_get_name(talloc_parent(list->dn)));
- return NULL;
- }
return list;
}
@@ -387,7 +380,7 @@ static int ldb_kv_dn_list_load(struct ldb_module *module,
}
/* we've found an in-memory index entry */
- list2 = ldb_kv_index_idxptr(module, rec, true);
+ list2 = ldb_kv_index_idxptr(module, rec);
if (list2 == NULL) {
free(rec.dptr);
return LDB_ERR_OPERATIONS_ERROR;
@@ -741,7 +734,7 @@ static int ldb_kv_dn_list_store(struct ldb_module *module,
rec = tdb_fetch(ldb_kv->idxptr->itdb, key);
if (rec.dptr != NULL) {
- list2 = ldb_kv_index_idxptr(module, rec, false);
+ list2 = ldb_kv_index_idxptr(module, rec);
if (list2 == NULL) {
free(rec.dptr);
return LDB_ERR_OPERATIONS_ERROR;
@@ -790,7 +783,7 @@ static int ldb_kv_index_traverse_store(_UNUSED_ struct tdb_context *tdb,
struct ldb_val v;
struct dn_list *list;
- list = ldb_kv_index_idxptr(module, data, true);
+ list = ldb_kv_index_idxptr(module, data);
if (list == NULL) {
ldb_kv->idxptr->error = LDB_ERR_OPERATIONS_ERROR;
return -1;