diff options
Diffstat (limited to 'source4/lib/ldb/ldb_tdb')
-rw-r--r-- | source4/lib/ldb/ldb_tdb/ldb_cache.c | 59 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_tdb/ldb_index.c | 100 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_tdb/ldb_pack.c | 8 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_tdb/ldb_search.c | 39 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_tdb/ldb_tdb.c | 129 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_tdb/ldb_tdb.h | 2 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_tdb/ldb_tdb_wrap.c | 2 |
7 files changed, 207 insertions, 132 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_cache.c b/source4/lib/ldb/ldb_tdb/ldb_cache.c index 2576e2c7bd..43b965f239 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_cache.c +++ b/source4/lib/ldb/ldb_tdb/ldb_cache.c @@ -31,8 +31,6 @@ * Author: Andrew Tridgell */ -#include "ldb_includes.h" - #include "ldb_tdb.h" #define LTDB_FLAG_CASE_INSENSITIVE (1<<0) @@ -57,10 +55,14 @@ static const struct { */ static void ltdb_attributes_unload(struct ldb_module *module) { - struct ltdb_private *ltdb = (struct ltdb_private *)module->private_data; + struct ldb_context *ldb; + void *data = ldb_module_get_private(module); + struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private); struct ldb_message *msg; int i; + ldb = ldb_module_get_ctx(module); + if (ltdb->cache->attributes == NULL) { /* no previously loaded attributes */ return; @@ -68,7 +70,7 @@ static void ltdb_attributes_unload(struct ldb_module *module) msg = ltdb->cache->attributes; for (i=0;i<msg->num_elements;i++) { - ldb_schema_attribute_remove(module->ldb, msg->elements[i].name); + ldb_schema_attribute_remove(ldb, msg->elements[i].name); } talloc_free(ltdb->cache->attributes); @@ -104,12 +106,16 @@ static int ltdb_attributes_flags(struct ldb_message_element *el, unsigned *v) */ static int ltdb_attributes_load(struct ldb_module *module) { - struct ltdb_private *ltdb = (struct ltdb_private *)module->private_data; + struct ldb_context *ldb; + void *data = ldb_module_get_private(module); + struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private); struct ldb_message *msg = ltdb->cache->attributes; struct ldb_dn *dn; int i, r; - dn = ldb_dn_new(module, module->ldb, LTDB_ATTRIBUTES); + ldb = ldb_module_get_ctx(module); + + dn = ldb_dn_new(module, ldb, LTDB_ATTRIBUTES); if (dn == NULL) goto failed; r = ltdb_search_dn1(module, dn, msg); @@ -128,7 +134,7 @@ static int ltdb_attributes_load(struct ldb_module *module) const struct ldb_schema_syntax *s; if (ltdb_attributes_flags(&msg->elements[i], &flags) != 0) { - ldb_debug(module->ldb, LDB_DEBUG_ERROR, "Invalid @ATTRIBUTES element for '%s'\n", msg->elements[i].name); + ldb_debug(ldb, LDB_DEBUG_ERROR, "Invalid @ATTRIBUTES element for '%s'\n", msg->elements[i].name); goto failed; } switch (flags & ~LTDB_FLAG_HIDDEN) { @@ -142,22 +148,22 @@ static int ltdb_attributes_load(struct ldb_module *module) syntax = LDB_SYNTAX_INTEGER; break; default: - ldb_debug(module->ldb, LDB_DEBUG_ERROR, + ldb_debug(ldb, LDB_DEBUG_ERROR, "Invalid flag combination 0x%x for '%s' in @ATTRIBUTES\n", flags, msg->elements[i].name); goto failed; } - s = ldb_standard_syntax_by_name(module->ldb, syntax); + s = ldb_standard_syntax_by_name(ldb, syntax); if (s == NULL) { - ldb_debug(module->ldb, LDB_DEBUG_ERROR, + ldb_debug(ldb, LDB_DEBUG_ERROR, "Invalid attribute syntax '%s' for '%s' in @ATTRIBUTES\n", syntax, msg->elements[i].name); goto failed; } flags |= LDB_ATTR_FLAG_ALLOCATED; - if (ldb_schema_attribute_add_with_syntax(module->ldb, msg->elements[i].name, flags, s) != 0) { + if (ldb_schema_attribute_add_with_syntax(ldb, msg->elements[i].name, flags, s) != 0) { goto failed; } } @@ -173,7 +179,9 @@ failed: */ static int ltdb_baseinfo_init(struct ldb_module *module) { - struct ltdb_private *ltdb = (struct ltdb_private *)module->private_data; + struct ldb_context *ldb; + void *data = ldb_module_get_private(module); + struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private); struct ldb_message *msg; struct ldb_message_element el; struct ldb_val val; @@ -183,6 +191,8 @@ static int ltdb_baseinfo_init(struct ldb_module *module) out. */ const char *initial_sequence_number = "1"; + ldb = ldb_module_get_ctx(module); + ltdb->sequence_number = atof(initial_sequence_number); msg = talloc(ltdb, struct ldb_message); @@ -192,7 +202,7 @@ static int ltdb_baseinfo_init(struct ldb_module *module) msg->num_elements = 1; msg->elements = ⪙ - msg->dn = ldb_dn_new(msg, module->ldb, LTDB_BASEINFO); + msg->dn = ldb_dn_new(msg, ldb, LTDB_BASEINFO); if (!msg->dn) { goto failed; } @@ -226,7 +236,8 @@ failed: */ static void ltdb_cache_free(struct ldb_module *module) { - struct ltdb_private *ltdb = (struct ltdb_private *)module->private_data; + void *data = ldb_module_get_private(module); + struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private); ltdb->sequence_number = 0; talloc_free(ltdb->cache); @@ -248,13 +259,17 @@ int ltdb_cache_reload(struct ldb_module *module) */ int ltdb_cache_load(struct ldb_module *module) { - struct ltdb_private *ltdb = (struct ltdb_private *)module->private_data; + struct ldb_context *ldb; + void *data = ldb_module_get_private(module); + struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private); struct ldb_dn *baseinfo_dn = NULL, *options_dn = NULL; struct ldb_dn *indexlist_dn = NULL; uint64_t seq; struct ldb_message *baseinfo = NULL, *options = NULL; int r; + ldb = ldb_module_get_ctx(module); + /* a very fast check to avoid extra database reads */ if (ltdb->cache != NULL && tdb_get_seqnum(ltdb->tdb) == ltdb->tdb_seqnum) { @@ -275,7 +290,7 @@ int ltdb_cache_load(struct ldb_module *module) baseinfo = talloc(ltdb->cache, struct ldb_message); if (baseinfo == NULL) goto failed; - baseinfo_dn = ldb_dn_new(module, module->ldb, LTDB_BASEINFO); + baseinfo_dn = ldb_dn_new(module, ldb, LTDB_BASEINFO); if (baseinfo_dn == NULL) goto failed; r= ltdb_search_dn1(module, baseinfo_dn, baseinfo); @@ -307,7 +322,7 @@ int ltdb_cache_load(struct ldb_module *module) options = talloc(ltdb->cache, struct ldb_message); if (options == NULL) goto failed; - options_dn = ldb_dn_new(options, module->ldb, LTDB_OPTIONS); + options_dn = ldb_dn_new(options, ldb, LTDB_OPTIONS); if (options_dn == NULL) goto failed; r= ltdb_search_dn1(module, options_dn, options); @@ -336,7 +351,7 @@ int ltdb_cache_load(struct ldb_module *module) goto failed; } - indexlist_dn = ldb_dn_new(module, module->ldb, LTDB_INDEXLIST); + indexlist_dn = ldb_dn_new(module, ldb, LTDB_INDEXLIST); if (indexlist_dn == NULL) goto failed; r = ltdb_search_dn1(module, indexlist_dn, ltdb->cache->indexlist); @@ -369,7 +384,9 @@ failed: */ int ltdb_increase_sequence_number(struct ldb_module *module) { - struct ltdb_private *ltdb = (struct ltdb_private *)module->private_data; + struct ldb_context *ldb; + void *data = ldb_module_get_private(module); + struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private); struct ldb_message *msg; struct ldb_message_element el[2]; struct ldb_val val; @@ -378,6 +395,8 @@ int ltdb_increase_sequence_number(struct ldb_module *module) char *s = NULL; int ret; + ldb = ldb_module_get_ctx(module); + msg = talloc(ltdb, struct ldb_message); if (msg == NULL) { errno = ENOMEM; @@ -392,7 +411,7 @@ int ltdb_increase_sequence_number(struct ldb_module *module) msg->num_elements = ARRAY_SIZE(el); msg->elements = el; - msg->dn = ldb_dn_new(msg, module->ldb, LTDB_BASEINFO); + msg->dn = ldb_dn_new(msg, ldb, LTDB_BASEINFO); if (msg->dn == NULL) { talloc_free(msg); errno = ENOMEM; diff --git a/source4/lib/ldb/ldb_tdb/ldb_index.c b/source4/lib/ldb/ldb_tdb/ldb_index.c index c4c23022f8..cdbef3944b 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_index.c +++ b/source4/lib/ldb/ldb_tdb/ldb_index.c @@ -31,8 +31,6 @@ * Author: Andrew Tridgell */ -#include "ldb_includes.h" - #include "ldb_tdb.h" /* @@ -69,8 +67,8 @@ struct ltdb_idxptr { */ static int ltdb_idxptr_add(struct ldb_module *module, const struct ldb_message *msg) { - struct ltdb_private *ltdb = - talloc_get_type(module->private_data, struct ltdb_private); + void *data = ldb_module_get_private(module); + struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private); ltdb->idxptr->dn_list = talloc_realloc(ltdb->idxptr, ltdb->idxptr->dn_list, const char *, ltdb->idxptr->num_dns+1); if (ltdb->idxptr->dn_list == NULL) { @@ -177,8 +175,8 @@ static int ltdb_convert_to_idxptr(struct ldb_module *module, struct ldb_message_ struct ldb_index_pointer *ptr, *tmp; int i; struct ldb_val *val2; - struct ltdb_private *ltdb = - talloc_get_type(module->private_data, struct ltdb_private); + void *data = ldb_module_get_private(module); + struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private); ptr = NULL; @@ -216,8 +214,8 @@ static int ltdb_convert_to_idxptr(struct ldb_module *module, struct ldb_message_ /* enable the idxptr mode when transactions start */ int ltdb_index_transaction_start(struct ldb_module *module) { - struct ltdb_private *ltdb = - talloc_get_type(module->private_data, struct ltdb_private); + void *data = ldb_module_get_private(module); + struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private); ltdb->idxptr = talloc_zero(module, struct ltdb_idxptr); return LDB_SUCCESS; } @@ -260,11 +258,14 @@ static int ltdb_search_dn1_index(struct ldb_module *module, */ static int ltdb_idxptr_fix_dn(struct ldb_module *module, const char *strdn) { + struct ldb_context *ldb; struct ldb_dn *dn; struct ldb_message *msg = ldb_msg_new(module); int ret; - dn = ldb_dn_new(msg, module->ldb, strdn); + ldb = ldb_module_get_ctx(module); + + dn = ldb_dn_new(msg, ldb, strdn); if (ltdb_search_dn1_index(module, dn, msg) == LDB_SUCCESS) { ret = ltdb_store(module, msg, TDB_REPLACE); } @@ -276,8 +277,8 @@ static int ltdb_idxptr_fix_dn(struct ldb_module *module, const char *strdn) int ltdb_index_transaction_commit(struct ldb_module *module) { int i; - struct ltdb_private *ltdb = - talloc_get_type(module->private_data, struct ltdb_private); + void *data = ldb_module_get_private(module); + struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private); /* fix all the DNs that we have modified */ if (ltdb->idxptr) { @@ -298,8 +299,8 @@ int ltdb_index_transaction_commit(struct ldb_module *module) /* cleanup the idxptr mode when transaction cancels */ int ltdb_index_transaction_cancel(struct ldb_module *module) { - struct ltdb_private *ltdb = - talloc_get_type(module->private_data, struct ltdb_private); + void *data = ldb_module_get_private(module); + struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private); talloc_free(ltdb->idxptr); ltdb->idxptr = NULL; return LDB_SUCCESS; @@ -314,8 +315,8 @@ int ltdb_index_transaction_cancel(struct ldb_module *module) */ int ltdb_store_idxptr(struct ldb_module *module, const struct ldb_message *msg, int flgs) { - struct ltdb_private *ltdb = - talloc_get_type(module->private_data, struct ltdb_private); + void *data = ldb_module_get_private(module); + struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private); int ret; if (ltdb->idxptr) { @@ -510,12 +511,14 @@ static int ltdb_index_dn_simple(struct ldb_module *module, const struct ldb_message *index_list, struct dn_list *list) { - struct ldb_context *ldb = module->ldb; + struct ldb_context *ldb; struct ldb_dn *dn; int ret; unsigned int i, j; struct ldb_message *msg; + ldb = ldb_module_get_ctx(module); + list->count = 0; list->dn = NULL; @@ -587,15 +590,18 @@ static int ltdb_index_dn_leaf(struct ldb_module *module, const struct ldb_message *index_list, struct dn_list *list) { + struct ldb_context *ldb; + ldb = ldb_module_get_ctx(module); + if (ldb_attr_dn(tree->u.equality.attr) == 0) { list->dn = talloc_array(list, char *, 1); if (list->dn == NULL) { - ldb_oom(module->ldb); + ldb_oom(ldb); return LDB_ERR_OPERATIONS_ERROR; } list->dn[0] = talloc_strdup(list->dn, (char *)tree->u.equality.value.data); if (list->dn[0] == NULL) { - ldb_oom(module->ldb); + ldb_oom(ldb); return LDB_ERR_OPERATIONS_ERROR; } list->count = 1; @@ -707,10 +713,12 @@ static int ltdb_index_dn_or(struct ldb_module *module, const struct ldb_message *index_list, struct dn_list *list) { - struct ldb_context *ldb = module->ldb; + struct ldb_context *ldb; unsigned int i; int ret; + ldb = ldb_module_get_ctx(module); + ret = LDB_ERR_OPERATIONS_ERROR; list->dn = NULL; list->count = 0; @@ -791,10 +799,12 @@ static int ltdb_index_dn_and(struct ldb_module *module, const struct ldb_message *index_list, struct dn_list *list) { - struct ldb_context *ldb = module->ldb; + struct ldb_context *ldb; unsigned int i; int ret; + ldb = ldb_module_get_ctx(module); + ret = LDB_ERR_OPERATIONS_ERROR; list->dn = NULL; list->count = 0; @@ -852,7 +862,7 @@ static int ltdb_index_dn_one(struct ldb_module *module, struct ldb_dn *parent_dn, struct dn_list *list) { - struct ldb_context *ldb = module->ldb; + struct ldb_context *ldb; struct dn_list *list2; struct ldb_message *msg; struct ldb_dn *key; @@ -860,6 +870,8 @@ static int ltdb_index_dn_one(struct ldb_module *module, unsigned int i, j; int ret; + ldb = ldb_module_get_ctx(module); + list2 = talloc_zero(module, struct dn_list); if (list2 == NULL) { return LDB_ERR_OPERATIONS_ERROR; @@ -991,9 +1003,12 @@ static int ltdb_index_dn(struct ldb_module *module, static int ltdb_index_filter(const struct dn_list *dn_list, struct ltdb_context *ac) { + struct ldb_context *ldb; struct ldb_message *msg; unsigned int i; + ldb = ldb_module_get_ctx(ac->module); + for (i = 0; i < dn_list->count; i++) { struct ldb_dn *dn; int ret; @@ -1003,7 +1018,7 @@ static int ltdb_index_filter(const struct dn_list *dn_list, return LDB_ERR_OPERATIONS_ERROR; } - dn = ldb_dn_new(msg, ac->module->ldb, dn_list->dn[i]); + dn = ldb_dn_new(msg, ldb, dn_list->dn[i]); if (dn == NULL) { talloc_free(msg); return LDB_ERR_OPERATIONS_ERROR; @@ -1023,7 +1038,7 @@ static int ltdb_index_filter(const struct dn_list *dn_list, return LDB_ERR_OPERATIONS_ERROR; } - if (!ldb_match_msg(ac->module->ldb, msg, + if (!ldb_match_msg(ldb, msg, ac->tree, ac->base, ac->scope)) { talloc_free(msg); continue; @@ -1054,10 +1069,14 @@ static int ltdb_index_filter(const struct dn_list *dn_list, */ int ltdb_search_indexed(struct ltdb_context *ac) { - struct ltdb_private *ltdb = talloc_get_type(ac->module->private_data, struct ltdb_private); + struct ldb_context *ldb; + void *data = ldb_module_get_private(ac->module); + struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private); struct dn_list *dn_list; int ret, idxattr, idxone; + ldb = ldb_module_get_ctx(ac->module); + idxattr = idxone = 0; ret = ldb_msg_find_idx(ltdb->cache->indexlist, NULL, NULL, LTDB_IDXATTR); if (ret == 0 ) { @@ -1087,12 +1106,12 @@ int ltdb_search_indexed(struct ltdb_context *ac) /* with BASE searches only one DN can match */ dn_list->dn = talloc_array(dn_list, char *, 1); if (dn_list->dn == NULL) { - ldb_oom(ac->module->ldb); + ldb_oom(ldb); return LDB_ERR_OPERATIONS_ERROR; } dn_list->dn[0] = ldb_dn_alloc_linearized(dn_list, ac->base); if (dn_list->dn[0] == NULL) { - ldb_oom(ac->module->ldb); + ldb_oom(ldb); return LDB_ERR_OPERATIONS_ERROR; } dn_list->count = 1; @@ -1198,12 +1217,14 @@ static int ltdb_index_add1_add(struct ldb_context *ldb, static int ltdb_index_add1(struct ldb_module *module, const char *dn, struct ldb_message_element *el, int v_idx) { - struct ldb_context *ldb = module->ldb; + struct ldb_context *ldb; struct ldb_message *msg; struct ldb_dn *dn_key; int ret; unsigned int i; + ldb = ldb_module_get_ctx(module); + msg = talloc(module, struct ldb_message); if (msg == NULL) { errno = ENOMEM; @@ -1253,7 +1274,8 @@ static int ltdb_index_add1(struct ldb_module *module, const char *dn, static int ltdb_index_add0(struct ldb_module *module, const char *dn, struct ldb_message_element *elements, int num_el) { - struct ltdb_private *ltdb = (struct ltdb_private *)module->private_data; + void *data = ldb_module_get_private(module); + struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private); int ret; unsigned int i, j; @@ -1308,12 +1330,14 @@ int ltdb_index_add(struct ldb_module *module, const struct ldb_message *msg) int ltdb_index_del_value(struct ldb_module *module, const char *dn, struct ldb_message_element *el, int v_idx) { - struct ldb_context *ldb = module->ldb; + struct ldb_context *ldb; struct ldb_message *msg; struct ldb_dn *dn_key; int ret, i; unsigned int j; + ldb = ldb_module_get_ctx(module); + if (dn[0] == '@') { return LDB_SUCCESS; } @@ -1351,7 +1375,7 @@ int ltdb_index_del_value(struct ldb_module *module, const char *dn, ldb_dn_get_linearized(dn_key)); ldif.changetype = LDB_CHANGETYPE_NONE; ldif.msg = msg; - ldb_ldif_write_file(module->ldb, stdout, &ldif); + ldb_ldif_write_file(ldb, stdout, &ldif); sleep(100); /* it ain't there. hmmm */ talloc_free(dn_key); @@ -1383,7 +1407,8 @@ int ltdb_index_del_value(struct ldb_module *module, const char *dn, */ int ltdb_index_del(struct ldb_module *module, const struct ldb_message *msg) { - struct ltdb_private *ltdb = (struct ltdb_private *)module->private_data; + void *data = ldb_module_get_private(module); + struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private); int ret; const char *dn; unsigned int i, j; @@ -1425,7 +1450,8 @@ int ltdb_index_del(struct ldb_module *module, const struct ldb_message *msg) */ int ltdb_index_one(struct ldb_module *module, const struct ldb_message *msg, int add) { - struct ltdb_private *ltdb = (struct ltdb_private *)module->private_data; + void *data = ldb_module_get_private(module); + struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private); struct ldb_message_element el; struct ldb_val val; struct ldb_dn *pdn; @@ -1489,12 +1515,15 @@ static int delete_index(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, vo */ static int re_index(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void *state) { + struct ldb_context *ldb; struct ldb_module *module = (struct ldb_module *)state; struct ldb_message *msg; const char *dn = NULL; int ret; TDB_DATA key2; + ldb = ldb_module_get_ctx(module); + if (strncmp((char *)key.dptr, "DN=@", 4) == 0 || strncmp((char *)key.dptr, "DN=", 3) != 0) { return 0; @@ -1516,7 +1545,7 @@ static int re_index(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void * key2 = ltdb_key(module, msg->dn); if (key2.dptr == NULL) { /* probably a corrupt record ... darn */ - ldb_debug(module->ldb, LDB_DEBUG_ERROR, "Invalid DN in re_index: %s\n", + ldb_debug(ldb, LDB_DEBUG_ERROR, "Invalid DN in re_index: %s\n", ldb_dn_get_linearized(msg->dn)); talloc_free(msg); return 0; @@ -1537,7 +1566,7 @@ static int re_index(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void * if (ret == LDB_SUCCESS) { ret = ltdb_index_add0(module, dn, msg->elements, msg->num_elements); } else { - ldb_debug(module->ldb, LDB_DEBUG_ERROR, + ldb_debug(ldb, LDB_DEBUG_ERROR, "Adding special ONE LEVEL index failed (%s)!\n", ldb_dn_get_linearized(msg->dn)); } @@ -1554,7 +1583,8 @@ static int re_index(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void * */ int ltdb_reindex(struct ldb_module *module) { - struct ltdb_private *ltdb = (struct ltdb_private *)module->private_data; + void *data = ldb_module_get_private(module); + struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private); int ret; if (ltdb_cache_reload(module) != 0) { diff --git a/source4/lib/ldb/ldb_tdb/ldb_pack.c b/source4/lib/ldb/ldb_tdb/ldb_pack.c index afb07dcbca..1995606f88 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_pack.c +++ b/source4/lib/ldb/ldb_tdb/ldb_pack.c @@ -31,7 +31,6 @@ * Author: Andrew Tridgell */ -#include "ldb_includes.h" #include "ldb_tdb.h" /* change this if the data format ever changes */ @@ -79,13 +78,15 @@ int ltdb_pack_data(struct ldb_module *module, const struct ldb_message *message, struct TDB_DATA *data) { - struct ldb_context *ldb = module->ldb; + struct ldb_context *ldb; unsigned int i, j, real_elements=0; size_t size; const char *dn; uint8_t *p; size_t len; + ldb = ldb_module_get_ctx(module); + dn = ldb_dn_get_linearized(message->dn); if (dn == NULL) { errno = ENOMEM; @@ -159,13 +160,14 @@ int ltdb_unpack_data(struct ldb_module *module, const struct TDB_DATA *data, struct ldb_message *message) { - struct ldb_context *ldb = module->ldb; + struct ldb_context *ldb; uint8_t *p; unsigned int remaining; unsigned int i, j; unsigned format; size_t len; + ldb = ldb_module_get_ctx(module); message->elements = NULL; p = data->dptr; diff --git a/source4/lib/ldb/ldb_tdb/ldb_search.c b/source4/lib/ldb/ldb_tdb/ldb_search.c index 35149c4b77..0f595267fc 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_search.c +++ b/source4/lib/ldb/ldb_tdb/ldb_search.c @@ -31,8 +31,6 @@ * Author: Andrew Tridgell */ -#include "ldb_includes.h" - #include "ldb_tdb.h" /* @@ -112,10 +110,12 @@ static int msg_add_distinguished_name(struct ldb_message *msg) static int msg_add_all_elements(struct ldb_module *module, struct ldb_message *ret, const struct ldb_message *msg) { - struct ldb_context *ldb = module->ldb; + struct ldb_context *ldb; unsigned int i; int check_duplicates = (ret->num_elements != 0); + ldb = ldb_module_get_ctx(module); + if (msg_add_distinguished_name(ret) != 0) { return -1; } @@ -207,7 +207,8 @@ static struct ldb_message *ltdb_pull_attrs(struct ldb_module *module, */ static int ltdb_search_base(struct ldb_module *module, struct ldb_dn *dn) { - struct ltdb_private *ltdb = (struct ltdb_private *)module->private_data; + void *data = ldb_module_get_private(module); + struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private); TDB_DATA tdb_key, tdb_data; if (ldb_dn_is_null(dn)) { @@ -239,7 +240,8 @@ static int ltdb_search_base(struct ldb_module *module, struct ldb_dn *dn) */ int ltdb_search_dn1(struct ldb_module *module, struct ldb_dn *dn, struct ldb_message *msg) { - struct ltdb_private *ltdb = (struct ltdb_private *)module->private_data; + void *data = ldb_module_get_private(module); + struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private); int ret; TDB_DATA tdb_key, tdb_data; @@ -371,11 +373,13 @@ int ltdb_filter_attrs(struct ldb_message *msg, const char * const *attrs) */ static int search_func(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void *state) { + struct ldb_context *ldb; struct ltdb_context *ac; struct ldb_message *msg; int ret; ac = talloc_get_type(state, struct ltdb_context); + ldb = ldb_module_get_ctx(ac->module); if (key.dsize < 4 || strncmp((char *)key.dptr, "DN=", 3) != 0) { @@ -395,7 +399,7 @@ static int search_func(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, voi } if (!msg->dn) { - msg->dn = ldb_dn_new(msg, ac->module->ldb, + msg->dn = ldb_dn_new(msg, ldb, (char *)key.dptr + 3); if (msg->dn == NULL) { talloc_free(msg); @@ -404,7 +408,7 @@ static int search_func(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, voi } /* see if it matches the given expression */ - if (!ldb_match_msg(ac->module->ldb, msg, + if (!ldb_match_msg(ldb, msg, ac->tree, ac->base, ac->scope)) { talloc_free(msg); return 0; @@ -435,7 +439,8 @@ static int search_func(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, voi */ static int ltdb_search_full(struct ltdb_context *ctx) { - struct ltdb_private *ltdb = talloc_get_type(ctx->module->private_data, struct ltdb_private); + void *data = ldb_module_get_private(ctx->module); + struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private); int ret; if (ltdb->in_transaction != 0) { @@ -457,12 +462,16 @@ static int ltdb_search_full(struct ltdb_context *ctx) */ int ltdb_search(struct ltdb_context *ctx) { + struct ldb_context *ldb; struct ldb_module *module = ctx->module; struct ldb_request *req = ctx->req; - struct ltdb_private *ltdb = talloc_get_type(module->private_data, struct ltdb_private); + void *data = ldb_module_get_private(module); + struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private); int ret; - req->handle->state = LDB_ASYNC_PENDING; + ldb = ldb_module_get_ctx(module); + + ldb_request_set_state(req, LDB_ASYNC_PENDING); if (ltdb_lock_read(module) != 0) { return LDB_ERR_OPERATIONS_ERROR; @@ -483,12 +492,12 @@ int ltdb_search(struct ltdb_context *ctx) /* Check what we should do with a NULL dn */ switch (req->op.search.scope) { case LDB_SCOPE_BASE: - ldb_asprintf_errstring(module->ldb, + ldb_asprintf_errstring(ldb, "NULL Base DN invalid for a base search"); ret = LDB_ERR_INVALID_DN_SYNTAX; break; case LDB_SCOPE_ONELEVEL: - ldb_asprintf_errstring(module->ldb, + ldb_asprintf_errstring(ldb, "NULL Base DN invalid for a one-level search"); ret = LDB_ERR_INVALID_DN_SYNTAX; break; @@ -500,7 +509,7 @@ int ltdb_search(struct ltdb_context *ctx) } else if (ldb_dn_is_valid(req->op.search.base) == false) { /* We don't want invalid base DNs here */ - ldb_asprintf_errstring(module->ldb, + ldb_asprintf_errstring(ldb, "Invalid Base DN: %s", ldb_dn_get_linearized(req->op.search.base)); ret = LDB_ERR_INVALID_DN_SYNTAX; @@ -510,7 +519,7 @@ int ltdb_search(struct ltdb_context *ctx) ret = ltdb_search_base(module, req->op.search.base); if (ret == LDB_ERR_NO_SUCH_OBJECT) { - ldb_asprintf_errstring(module->ldb, + ldb_asprintf_errstring(ldb, "No such Base DN: %s", ldb_dn_get_linearized(req->op.search.base)); } @@ -539,7 +548,7 @@ int ltdb_search(struct ltdb_context *ctx) /* Not indexed, so we need to do a full scan */ ret = ltdb_search_full(ctx); if (ret != LDB_SUCCESS) { - ldb_set_errstring(module->ldb, "Indexed and full searches both failed!\n"); + ldb_set_errstring(ldb, "Indexed and full searches both failed!\n"); } } } diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c index 9528f5a662..d6276c4b86 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c +++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c @@ -45,8 +45,6 @@ * Author: Simo Sorce */ -#include "ldb_includes.h" - #include "ldb_tdb.h" @@ -84,7 +82,8 @@ static int ltdb_err_map(enum TDB_ERROR tdb_code) */ int ltdb_lock_read(struct ldb_module *module) { - struct ltdb_private *ltdb = (struct ltdb_private *)module->private_data; + void *data = ldb_module_get_private(module); + struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private); if (ltdb->in_transaction == 0) { return tdb_lockall_read(ltdb->tdb); } @@ -96,7 +95,8 @@ int ltdb_lock_read(struct ldb_module *module) */ int ltdb_unlock_read(struct ldb_module *module) { - struct ltdb_private *ltdb = (struct ltdb_private *)module->private_data; + void *data = ldb_module_get_private(module); + struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private); if (ltdb->in_transaction == 0) { return tdb_unlockall_read(ltdb->tdb); } @@ -113,7 +113,7 @@ int ltdb_unlock_read(struct ldb_module *module) */ struct TDB_DATA ltdb_key(struct ldb_module *module, struct ldb_dn *dn) { - struct ldb_context *ldb = module->ldb; + struct ldb_context *ldb = ldb_module_get_ctx(module); TDB_DATA key; char *key_str = NULL; const char *dn_folded = NULL; @@ -164,6 +164,7 @@ failed: static int ltdb_check_special_dn(struct ldb_module *module, const struct ldb_message *msg) { + struct ldb_context *ldb = ldb_module_get_ctx(module); int i, j; if (! ldb_dn_is_special(msg->dn) || @@ -176,7 +177,7 @@ static int ltdb_check_special_dn(struct ldb_module *module, for (i = 0; i < msg->num_elements; i++) { for (j = 0; j < msg->elements[i].num_values; j++) { if (ltdb_check_at_attributes_values(&msg->elements[i].values[j]) != 0) { - ldb_set_errstring(module->ldb, "Invalid attribute value in an @ATTRIBUTES entry"); + ldb_set_errstring(ldb, "Invalid attribute value in an @ATTRIBUTES entry"); return LDB_ERR_INVALID_ATTRIBUTE_SYNTAX; } } @@ -214,8 +215,8 @@ static int ltdb_modified(struct ldb_module *module, struct ldb_dn *dn) */ int ltdb_store(struct ldb_module *module, const struct ldb_message *msg, int flgs) { - struct ltdb_private *ltdb = - talloc_get_type(module->private_data, struct ltdb_private); + void *data = ldb_module_get_private(module); + struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private); TDB_DATA tdb_key, tdb_data; int ret; @@ -252,6 +253,7 @@ done: static int ltdb_add_internal(struct ldb_module *module, const struct ldb_message *msg) { + struct ldb_context *ldb = ldb_module_get_ctx(module); int ret; ret = ltdb_check_special_dn(module, msg); @@ -266,7 +268,7 @@ static int ltdb_add_internal(struct ldb_module *module, ret = ltdb_store(module, msg, TDB_INSERT); if (ret == LDB_ERR_ENTRY_ALREADY_EXISTS) { - ldb_asprintf_errstring(module->ldb, + ldb_asprintf_errstring(ldb, "Entry %s already exists", ldb_dn_get_linearized(msg->dn)); return ret; @@ -296,7 +298,7 @@ static int ltdb_add(struct ltdb_context *ctx) struct ldb_request *req = ctx->req; int tret; - req->handle->state = LDB_ASYNC_PENDING; + ldb_request_set_state(req, LDB_ASYNC_PENDING); tret = ltdb_add_internal(module, req->op.add.message); if (tret != LDB_SUCCESS) { @@ -312,8 +314,8 @@ static int ltdb_add(struct ltdb_context *ctx) */ int ltdb_delete_noindex(struct ldb_module *module, struct ldb_dn *dn) { - struct ltdb_private *ltdb = - talloc_get_type(module->private_data, struct ltdb_private); + void *data = ldb_module_get_private(module); + struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private); TDB_DATA tdb_key; int ret; @@ -386,7 +388,7 @@ static int ltdb_delete(struct ltdb_context *ctx) struct ldb_request *req = ctx->req; int tret; - req->handle->state = LDB_ASYNC_PENDING; + ldb_request_set_state(req, LDB_ASYNC_PENDING); if (ltdb_cache_load(module) != 0) { return LDB_ERR_OPERATIONS_ERROR; @@ -514,7 +516,7 @@ static int msg_delete_element(struct ldb_module *module, const char *name, const struct ldb_val *val) { - struct ldb_context *ldb = module->ldb; + struct ldb_context *ldb = ldb_module_get_ctx(module); unsigned int i; int found; struct ldb_message_element *el; @@ -560,9 +562,9 @@ static int msg_delete_element(struct ldb_module *module, int ltdb_modify_internal(struct ldb_module *module, const struct ldb_message *msg) { - struct ldb_context *ldb = module->ldb; - struct ltdb_private *ltdb = - talloc_get_type(module->private_data, struct ltdb_private); + struct ldb_context *ldb = ldb_module_get_ctx(module); + void *data = ldb_module_get_private(module); + struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private); TDB_DATA tdb_key, tdb_data; struct ldb_message *msg2; unsigned i, j; @@ -625,12 +627,12 @@ int ltdb_modify_internal(struct ldb_module *module, for (j=0;j<el->num_values;j++) { if (ldb_msg_find_val(el2, &el->values[j])) { - ldb_asprintf_errstring(module->ldb, "%s: value #%d already exists", el->name, j); + ldb_asprintf_errstring(ldb, "%s: value #%d already exists", el->name, j); ret = LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS; goto failed; } if (ldb_msg_find_val(el, &el->values[j]) != &el->values[j]) { - ldb_asprintf_errstring(module->ldb, "%s: value #%d provided more than once", el->name, j); + ldb_asprintf_errstring(ldb, "%s: value #%d provided more than once", el->name, j); ret = LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS; goto failed; } @@ -661,7 +663,7 @@ int ltdb_modify_internal(struct ldb_module *module, for (j=0;j<el->num_values;j++) { if (ldb_msg_find_val(el, &el->values[j]) != &el->values[j]) { - ldb_asprintf_errstring(module->ldb, "%s: value #%d provided more than once", el->name, j); + ldb_asprintf_errstring(ldb, "%s: value #%d provided more than once", el->name, j); ret = LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS; goto failed; } @@ -688,7 +690,7 @@ int ltdb_modify_internal(struct ldb_module *module, if (msg->elements[i].num_values == 0) { if (msg_delete_attribute(module, ldb, msg2, msg->elements[i].name) != 0) { - ldb_asprintf_errstring(module->ldb, "No such attribute: %s for delete on %s", msg->elements[i].name, dn); + ldb_asprintf_errstring(ldb, "No such attribute: %s for delete on %s", msg->elements[i].name, dn); ret = LDB_ERR_NO_SUCH_ATTRIBUTE; goto failed; } @@ -699,7 +701,7 @@ int ltdb_modify_internal(struct ldb_module *module, msg2, msg->elements[i].name, &msg->elements[i].values[j]) != 0) { - ldb_asprintf_errstring(module->ldb, "No matching attribute value when deleting attribute: %s on %s", msg->elements[i].name, dn); + ldb_asprintf_errstring(ldb, "No matching attribute value when deleting attribute: %s on %s", msg->elements[i].name, dn); ret = LDB_ERR_NO_SUCH_ATTRIBUTE; goto failed; } @@ -710,7 +712,7 @@ int ltdb_modify_internal(struct ldb_module *module, } break; default: - ldb_asprintf_errstring(module->ldb, + ldb_asprintf_errstring(ldb, "Invalid ldb_modify flags on %s: 0x%x", msg->elements[i].name, msg->elements[i].flags & LDB_FLAG_MOD_MASK); @@ -750,7 +752,7 @@ static int ltdb_modify(struct ltdb_context *ctx) struct ldb_request *req = ctx->req; int tret; - req->handle->state = LDB_ASYNC_PENDING; + ldb_request_set_state(req, LDB_ASYNC_PENDING); tret = ltdb_check_special_dn(module, req->op.mod.message); if (tret != LDB_SUCCESS) { @@ -779,7 +781,7 @@ static int ltdb_rename(struct ltdb_context *ctx) struct ldb_message *msg; int tret; - req->handle->state = LDB_ASYNC_PENDING; + ldb_request_set_state(req, LDB_ASYNC_PENDING); if (ltdb_cache_load(ctx->module) != 0) { return LDB_ERR_OPERATIONS_ERROR; @@ -841,8 +843,8 @@ static int ltdb_rename(struct ltdb_context *ctx) static int ltdb_start_trans(struct ldb_module *module) { - struct ltdb_private *ltdb = - talloc_get_type(module->private_data, struct ltdb_private); + void *data = ldb_module_get_private(module); + struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private); if (tdb_transaction_start(ltdb->tdb) != 0) { return ltdb_err_map(tdb_error(ltdb->tdb)); @@ -857,8 +859,8 @@ static int ltdb_start_trans(struct ldb_module *module) static int ltdb_end_trans(struct ldb_module *module) { - struct ltdb_private *ltdb = - talloc_get_type(module->private_data, struct ltdb_private); + void *data = ldb_module_get_private(module); + struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private); ltdb->in_transaction--; @@ -875,8 +877,8 @@ static int ltdb_end_trans(struct ldb_module *module) static int ltdb_del_trans(struct ldb_module *module) { - struct ltdb_private *ltdb = - talloc_get_type(module->private_data, struct ltdb_private); + void *data = ldb_module_get_private(module); + struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private); ltdb->in_transaction--; @@ -897,6 +899,7 @@ static int ltdb_del_trans(struct ldb_module *module) static int ltdb_sequence_number(struct ltdb_context *ctx, struct ldb_extended **ext) { + struct ldb_context *ldb; struct ldb_module *module = ctx->module; struct ldb_request *req = ctx->req; TALLOC_CTX *tmp_ctx; @@ -907,13 +910,15 @@ static int ltdb_sequence_number(struct ltdb_context *ctx, const char *date; int ret; + ldb = ldb_module_get_ctx(module); + seq = talloc_get_type(req->op.extended.data, struct ldb_seqnum_request); if (seq == NULL) { return LDB_ERR_OPERATIONS_ERROR; } - req->handle->state = LDB_ASYNC_PENDING; + ldb_request_set_state(req, LDB_ASYNC_PENDING); if (ltdb_lock_read(module) != 0) { return LDB_ERR_OPERATIONS_ERROR; @@ -930,7 +935,7 @@ static int ltdb_sequence_number(struct ltdb_context *ctx, goto done; } - dn = ldb_dn_new(tmp_ctx, module->ldb, LTDB_BASEINFO); + dn = ldb_dn_new(tmp_ctx, ldb, LTDB_BASEINFO); msg = talloc(tmp_ctx, struct ldb_message); if (msg == NULL) { @@ -978,18 +983,23 @@ done: return ret; } -static void ltdb_request_done(struct ldb_request *req, int error) +static void ltdb_request_done(struct ltdb_context *ctx, int error) { + struct ldb_context *ldb; + struct ldb_request *req; struct ldb_reply *ares; + ldb = ldb_module_get_ctx(ctx->module); + req = ctx->req; + /* if we already returned an error just return */ - if (req->handle->status != LDB_SUCCESS) { + if (ldb_request_get_status(req) != LDB_SUCCESS) { return; } ares = talloc_zero(req, struct ldb_reply); if (!ares) { - ldb_oom(req->handle->ldb); + ldb_oom(ldb); req->callback(req, NULL); return; } @@ -1007,23 +1017,28 @@ static void ltdb_timeout(struct tevent_context *ev, struct ltdb_context *ctx; ctx = talloc_get_type(private_data, struct ltdb_context); - ltdb_request_done(ctx->req, LDB_ERR_TIME_LIMIT_EXCEEDED); + ltdb_request_done(ctx, LDB_ERR_TIME_LIMIT_EXCEEDED); } -static void ltdb_request_extended_done(struct ldb_request *req, +static void ltdb_request_extended_done(struct ltdb_context *ctx, struct ldb_extended *ext, int error) { + struct ldb_context *ldb; + struct ldb_request *req; struct ldb_reply *ares; + ldb = ldb_module_get_ctx(ctx->module); + req = ctx->req; + /* if we already returned an error just return */ - if (req->handle->status != LDB_SUCCESS) { + if (ldb_request_get_status(req) != LDB_SUCCESS) { return; } ares = talloc_zero(req, struct ldb_reply); if (!ares) { - ldb_oom(req->handle->ldb); + ldb_oom(ldb); req->callback(req, NULL); return; } @@ -1048,7 +1063,7 @@ static void ltdb_handle_extended(struct ltdb_context *ctx) ret = LDB_ERR_UNSUPPORTED_CRITICAL_EXTENSION; } - ltdb_request_extended_done(ctx->req, ext, ret); + ltdb_request_extended_done(ctx, ext, ret); } static void ltdb_callback(struct tevent_context *ev, @@ -1088,13 +1103,14 @@ static void ltdb_callback(struct tevent_context *ev, if (!ctx->callback_failed) { /* Once we are done, we do not need timeout events */ talloc_free(ctx->timeout_event); - ltdb_request_done(ctx->req, ret); + ltdb_request_done(ctx, ret); } } static int ltdb_handle_request(struct ldb_module *module, struct ldb_request *req) { + struct ldb_context *ldb; struct tevent_context *ev; struct ltdb_context *ac; struct tevent_timer *te; @@ -1104,16 +1120,18 @@ static int ltdb_handle_request(struct ldb_module *module, return LDB_ERR_UNSUPPORTED_CRITICAL_EXTENSION; } + ldb = ldb_module_get_ctx(module); + if (req->starttime == 0 || req->timeout == 0) { - ldb_set_errstring(module->ldb, "Invalid timeout settings"); + ldb_set_errstring(ldb, "Invalid timeout settings"); return LDB_ERR_TIME_LIMIT_EXCEEDED; } - ev = ldb_get_event_context(module->ldb); + ev = ldb_get_event_context(ldb); ac = talloc_zero(req, struct ltdb_context); if (ac == NULL) { - ldb_set_errstring(module->ldb, "Out of Memory"); + ldb_set_errstring(ldb, "Out of Memory"); return LDB_ERR_OPERATIONS_ERROR; } @@ -1154,8 +1172,9 @@ static const struct ldb_module_ops ltdb_ops = { */ static int ltdb_connect(struct ldb_context *ldb, const char *url, unsigned int flags, const char *options[], - struct ldb_module **module) + struct ldb_module **_module) { + struct ldb_module *module; const char *path; int tdb_flags, open_flags; struct ltdb_private *ltdb; @@ -1199,7 +1218,7 @@ static int ltdb_connect(struct ldb_context *ldb, const char *url, /* note that we use quite a large default hash size */ ltdb->tdb = ltdb_wrap_open(ltdb, path, 10000, tdb_flags, open_flags, - ldb->create_perms, ldb); + ldb_get_create_perms(ldb), ldb); if (!ltdb->tdb) { ldb_debug(ldb, LDB_DEBUG_ERROR, "Unable to open tdb '%s'\n", path); @@ -1209,24 +1228,20 @@ static int ltdb_connect(struct ldb_context *ldb, const char *url, ltdb->sequence_number = 0; - *module = talloc(ldb, struct ldb_module); - if ((*module) == NULL) { - ldb_oom(ldb); + module = ldb_module_new(ldb, ldb, "ldb_tdb backend", <db_ops); + if (!module) { talloc_free(ltdb); return -1; } - talloc_set_name_const(*module, "ldb_tdb backend"); - (*module)->ldb = ldb; - (*module)->prev = (*module)->next = NULL; - (*module)->private_data = ltdb; - (*module)->ops = <db_ops; + ldb_module_set_private(module, ltdb); - if (ltdb_cache_load(*module) != 0) { - talloc_free(*module); + if (ltdb_cache_load(module) != 0) { + talloc_free(module); talloc_free(ltdb); return -1; } + *_module = module; return 0; } diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.h b/source4/lib/ldb/ldb_tdb/ldb_tdb.h index b373d37b7e..7ebf199f6f 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_tdb.h +++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.h @@ -6,6 +6,8 @@ #include "tdb.h" #endif +#include "ldb_module.h" + /* this private structure is used by the ltdb backend in the ldb_context */ struct ltdb_private { diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb_wrap.c b/source4/lib/ldb/ldb_tdb/ldb_tdb_wrap.c index 4fea43c8c8..6ee8417e25 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_tdb_wrap.c +++ b/source4/lib/ldb/ldb_tdb/ldb_tdb_wrap.c @@ -21,8 +21,6 @@ License along with this library; if not, see <http://www.gnu.org/licenses/>. */ -#include "ldb_includes.h" - #include "ldb_tdb.h" /* |