Clean up the code format after the rename in the previous commit.
Hopefully doing a rename commit followed by a reformat commit makes the
code easier to review.
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
checks and also copes with CPUs that are fussy about pointer
alignment
*/
-static struct dn_list *ldb_kv_index_idxptr(struct ldb_module *module, TDB_DATA rec, bool check_parent)
+static struct dn_list *ldb_kv_index_idxptr(struct ldb_module *module,
+ TDB_DATA rec,
+ bool check_parent)
{
struct dn_list *list;
if (rec.dsize != sizeof(void *)) {
struct dn_list
*/
static int ldb_kv_dn_list_load(struct ldb_module *module,
- struct ltdb_private *ltdb,
- struct ldb_dn *dn, struct dn_list *list)
+ struct ltdb_private *ltdb,
+ struct ldb_dn *dn,
+ struct dn_list *list)
{
struct ldb_message *msg;
int ret, version;
return LDB_ERR_OPERATIONS_ERROR;
}
- ret = ldb_kv_search_dn1(module, dn, msg,
- LDB_UNPACK_DATA_FLAG_NO_DATA_ALLOC
- |LDB_UNPACK_DATA_FLAG_NO_DN);
+ ret = ldb_kv_search_dn1(module,
+ dn,
+ msg,
+ LDB_UNPACK_DATA_FLAG_NO_DATA_ALLOC |
+ LDB_UNPACK_DATA_FLAG_NO_DN);
if (ret != LDB_SUCCESS) {
talloc_free(msg);
return ret;
}
int ldb_kv_key_dn_from_idx(struct ldb_module *module,
- struct ltdb_private *ltdb,
- TALLOC_CTX *mem_ctx,
- struct ldb_dn *dn,
- TDB_DATA *tdb_key)
+ struct ltdb_private *ltdb,
+ TALLOC_CTX *mem_ctx,
+ struct ldb_dn *dn,
+ TDB_DATA *tdb_key)
{
struct ldb_context *ldb = ldb_module_get_ctx(module);
int ret;
return LDB_ERR_OPERATIONS_ERROR;
}
-
ret = ldb_kv_index_dn_base_dn(module, ltdb, dn, list, &truncation);
if (ret != LDB_SUCCESS) {
TALLOC_FREE(list);
return LDB_ERR_OPERATIONS_ERROR;
}
- ret = ldb_kv_idx_to_key(module, ltdb,
- ldb, &list->dn[i],
- &key);
+ ret = ldb_kv_idx_to_key(
+ module, ltdb, ldb, &list->dn[i], &key);
if (ret != LDB_SUCCESS) {
TALLOC_FREE(list);
TALLOC_FREE(rec);
return ret;
}
- ret = ldb_kv_search_key(module, ltdb, key,
- rec, flags);
+ ret = ldb_kv_search_key(module, ltdb, key, rec, flags);
if (key.dptr != guid_key) {
TALLOC_FREE(key.dptr);
}
}
/* The tdb_key memory is allocated by the caller */
- ret = ldb_kv_guid_to_key(module, ltdb,
- &list->dn[index], tdb_key);
+ ret = ldb_kv_guid_to_key(module, ltdb, &list->dn[index], tdb_key);
TALLOC_FREE(list);
if (ret != LDB_SUCCESS) {
save a dn_list into a full @IDX style record
*/
static int ldb_kv_dn_list_store_full(struct ldb_module *module,
- struct ltdb_private *ltdb,
- struct ldb_dn *dn,
- struct dn_list *list)
+ struct ltdb_private *ltdb,
+ struct ldb_dn *dn,
+ struct dn_list *list)
{
struct ldb_message *msg;
int ret;
/*
save a dn_list into the database, in either @IDX or internal format
*/
-static int ldb_kv_dn_list_store(struct ldb_module *module, struct ldb_dn *dn,
- struct dn_list *list)
+static int ldb_kv_dn_list_store(struct ldb_module *module,
+ struct ldb_dn *dn,
+ struct dn_list *list)
{
struct ltdb_private *ltdb = talloc_get_type(ldb_module_get_private(module), struct ltdb_private);
TDB_DATA rec, key;
struct dn_list *list2;
if (ltdb->idxptr == NULL) {
- return ldb_kv_dn_list_store_full(module, ltdb,
- dn, list);
+ return ldb_kv_dn_list_store_full(module, ltdb, dn, list);
}
if (ltdb->idxptr->itdb == NULL) {
/*
traverse function for storing the in-memory index entries on disk
*/
-static int ldb_kv_index_traverse_store(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void *state)
+static int ldb_kv_index_traverse_store(struct tdb_context *tdb,
+ TDB_DATA key,
+ TDB_DATA data,
+ void *state)
{
struct ldb_module *module = state;
struct ltdb_private *ltdb = talloc_get_type(ldb_module_get_private(module), struct ltdb_private);
return -1;
}
- ltdb->idxptr->error = ldb_kv_dn_list_store_full(module, ltdb,
- dn, list);
+ ltdb->idxptr->error = ldb_kv_dn_list_store_full(module, ltdb, dn, list);
talloc_free(dn);
if (ltdb->idxptr->error != 0) {
return -1;
ldb_reset_err_string(ldb);
if (ltdb->idxptr->itdb) {
- tdb_traverse(ltdb->idxptr->itdb, ldb_kv_index_traverse_store, module);
+ tdb_traverse(
+ ltdb->idxptr->itdb, ldb_kv_index_traverse_store, module);
tdb_close(ltdb->idxptr->itdb);
}
the caller is responsible for freeing
*/
static struct ldb_dn *ldb_kv_index_key(struct ldb_context *ldb,
- struct ltdb_private *ltdb,
- const char *attr, const struct ldb_val *value,
- const struct ldb_schema_attribute **ap,
- enum key_truncation *truncation)
+ struct ltdb_private *ltdb,
+ const char *attr,
+ const struct ldb_val *value,
+ const struct ldb_schema_attribute **ap,
+ enum key_truncation *truncation)
{
struct ldb_dn *ret;
struct ldb_val v;
see if a attribute value is in the list of indexed attributes
*/
static bool ldb_kv_is_indexed(struct ldb_module *module,
- struct ltdb_private *ltdb,
- const char *attr)
+ struct ltdb_private *ltdb,
+ const char *attr)
{
struct ldb_context *ldb = ldb_module_get_ctx(module);
unsigned int i;
equality search only)
*/
static int ldb_kv_index_dn_simple(struct ldb_module *module,
- struct ltdb_private *ltdb,
- const struct ldb_parse_tree *tree,
- struct dn_list *list)
+ struct ltdb_private *ltdb,
+ const struct ldb_parse_tree *tree,
+ struct dn_list *list)
{
struct ldb_context *ldb;
struct ldb_dn *dn;
/* the attribute is indexed. Pull the list of DNs that match the
search criterion */
- dn = ldb_kv_index_key(ldb, ltdb,
- tree->u.equality.attr,
- &tree->u.equality.value, NULL, &truncation);
+ dn = ldb_kv_index_key(ldb,
+ ltdb,
+ tree->u.equality.attr,
+ &tree->u.equality.value,
+ NULL,
+ &truncation);
/*
* We ignore truncation here and allow multi-valued matches
* as ltdb_search_indexed will filter out the wrong one in
return a list of dn's that might match a leaf indexed search
*/
static int ldb_kv_index_dn_leaf(struct ldb_module *module,
- struct ltdb_private *ltdb,
- const struct ldb_parse_tree *tree,
- struct dn_list *list)
+ struct ltdb_private *ltdb,
+ const struct ldb_parse_tree *tree,
+ struct dn_list *list)
{
if (ltdb->disallow_dn_filter &&
(ldb_attr_cmp(tree->u.equality.attr, "dn") == 0)) {
* We can't call TALLOC_FREE(dn) as this must belong
* to list for the memory to remain valid.
*/
- return ldb_kv_index_dn_base_dn(module, ltdb, dn, list,
- &truncation);
+ return ldb_kv_index_dn_base_dn(
+ module, ltdb, dn, list, &truncation);
/*
* We ignore truncation here and allow multi-valued matches
* as ltdb_search_indexed will filter out the wrong one in
for (i=0;i<short_list->count;i++) {
/* For the GUID index case, this is a binary search */
- if (ldb_kv_dn_list_find_val(ltdb, long_list,
- &short_list->dn[i]) != -1) {
+ if (ldb_kv_dn_list_find_val(
+ ltdb, long_list, &short_list->dn[i]) != -1) {
list3->dn[list3->count] = short_list->dn[i];
list3->count++;
}
}
static int ldb_kv_index_dn(struct ldb_module *module,
- struct ltdb_private *ltdb,
- const struct ldb_parse_tree *tree,
- struct dn_list *list);
-
+ struct ltdb_private *ltdb,
+ const struct ldb_parse_tree *tree,
+ struct dn_list *list);
/*
process an OR list (a union)
*/
static int ldb_kv_index_dn_or(struct ldb_module *module,
- struct ltdb_private *ltdb,
- const struct ldb_parse_tree *tree,
- struct dn_list *list)
+ struct ltdb_private *ltdb,
+ const struct ldb_parse_tree *tree,
+ struct dn_list *list)
{
struct ldb_context *ldb;
unsigned int i;
return LDB_ERR_OPERATIONS_ERROR;
}
- ret = ldb_kv_index_dn(module, ltdb,
- tree->u.list.elements[i], list2);
+ ret = ldb_kv_index_dn(
+ module, ltdb, tree->u.list.elements[i], list2);
if (ret == LDB_ERR_NO_SUCH_OBJECT) {
/* X || 0 == X */
NOT an index results
*/
static int ldb_kv_index_dn_not(struct ldb_module *module,
- struct ltdb_private *ltdb,
- const struct ldb_parse_tree *tree,
- struct dn_list *list)
+ struct ltdb_private *ltdb,
+ const struct ldb_parse_tree *tree,
+ struct dn_list *list)
{
/* the only way to do an indexed not would be if we could
negate the not via another not or if we knew the total
* by GUID, DN or a unique attribute
*/
static bool ldb_kv_index_unique(struct ldb_context *ldb,
- struct ltdb_private *ltdb,
- const char *attr)
+ struct ltdb_private *ltdb,
+ const char *attr)
{
const struct ldb_schema_attribute *a;
if (ltdb->cache->GUID_index_attribute != NULL) {
process an AND expression (intersection)
*/
static int ldb_kv_index_dn_and(struct ldb_module *module,
- struct ltdb_private *ltdb,
- const struct ldb_parse_tree *tree,
- struct dn_list *list)
+ struct ltdb_private *ltdb,
+ const struct ldb_parse_tree *tree,
+ struct dn_list *list)
{
struct ldb_context *ldb;
unsigned int i;
int ret;
if (subtree->operation != LDB_OP_EQUALITY ||
- !ldb_kv_index_unique(ldb, ltdb,
- subtree->u.equality.attr)) {
+ !ldb_kv_index_unique(ldb, ltdb, subtree->u.equality.attr)) {
continue;
}
return a list of matching objects using a one-level index
*/
static int ldb_kv_index_dn_attr(struct ldb_module *module,
- struct ltdb_private *ltdb,
- const char *attr,
- struct ldb_dn *dn,
- struct dn_list *list,
- enum key_truncation *truncation)
+ struct ltdb_private *ltdb,
+ const char *attr,
+ struct ldb_dn *dn,
+ struct dn_list *list,
+ enum key_truncation *truncation)
{
struct ldb_context *ldb;
struct ldb_dn *key;
return a list of matching objects using a one-level index
*/
static int ldb_kv_index_dn_one(struct ldb_module *module,
- struct ltdb_private *ltdb,
- struct ldb_dn *parent_dn,
- struct dn_list *list,
- enum key_truncation *truncation)
+ struct ltdb_private *ltdb,
+ struct ldb_dn *parent_dn,
+ struct dn_list *list,
+ enum key_truncation *truncation)
{
/* Ensure we do not shortcut on intersection for this list */
list->strict = true;
- return ldb_kv_index_dn_attr(module, ltdb,
- LTDB_IDXONE, parent_dn, list, truncation);
-
+ return ldb_kv_index_dn_attr(
+ module, ltdb, LTDB_IDXONE, parent_dn, list, truncation);
}
/*
return a list of matching objects using the DN index
*/
static int ldb_kv_index_dn_base_dn(struct ldb_module *module,
- struct ltdb_private *ltdb,
- struct ldb_dn *base_dn,
- struct dn_list *dn_list,
- enum key_truncation *truncation)
+ struct ltdb_private *ltdb,
+ struct ldb_dn *base_dn,
+ struct dn_list *dn_list,
+ enum key_truncation *truncation)
{
const struct ldb_val *guid_val = NULL;
if (ltdb->cache->GUID_index_attribute == NULL) {
return LDB_SUCCESS;
}
- return ldb_kv_index_dn_attr(module, ltdb,
- LTDB_IDXDN, base_dn, dn_list, truncation);
+ return ldb_kv_index_dn_attr(
+ module, ltdb, LTDB_IDXDN, base_dn, dn_list, truncation);
}
/*
an error. return LDB_ERR_NO_SUCH_OBJECT for no matches, or LDB_SUCCESS for matches
*/
static int ldb_kv_index_dn(struct ldb_module *module,
- struct ltdb_private *ltdb,
- const struct ldb_parse_tree *tree,
- struct dn_list *list)
+ struct ltdb_private *ltdb,
+ const struct ldb_parse_tree *tree,
+ struct dn_list *list)
{
int ret = LDB_ERR_OPERATIONS_ERROR;
extracting just the given attributes
*/
static int ldb_kv_index_filter(struct ltdb_private *ltdb,
- const struct dn_list *dn_list,
- struct ltdb_context *ac,
- uint32_t *match_count,
- enum key_truncation scope_one_truncation)
+ const struct dn_list *dn_list,
+ struct ltdb_context *ac,
+ uint32_t *match_count,
+ enum key_truncation scope_one_truncation)
{
struct ldb_context *ldb = ldb_module_get_ctx(ac->module);
struct ldb_message *msg;
for (i = 0; i < dn_list->count; i++) {
int ret;
- ret = ldb_kv_idx_to_key(ac->module,
- ltdb,
- keys,
- &dn_list->dn[i],
- &keys[num_keys]);
+ ret = ldb_kv_idx_to_key(
+ ac->module, ltdb, keys, &dn_list->dn[i], &keys[num_keys]);
if (ret != LDB_SUCCESS) {
talloc_free(keys);
return ret;
return LDB_ERR_OPERATIONS_ERROR;
}
- ret = ldb_kv_search_key(ac->module, ltdb,
- keys[i], msg,
- LDB_UNPACK_DATA_FLAG_NO_DATA_ALLOC|
- LDB_UNPACK_DATA_FLAG_NO_VALUES_ALLOC);
+ ret =
+ ldb_kv_search_key(ac->module,
+ ltdb,
+ keys[i],
+ msg,
+ LDB_UNPACK_DATA_FLAG_NO_DATA_ALLOC |
+ LDB_UNPACK_DATA_FLAG_NO_VALUES_ALLOC);
if (ret == LDB_ERR_NO_SUCH_OBJECT) {
/*
* the record has disappeared? yes, this can
/*
sort a DN list
*/
-static void ldb_kv_dn_list_sort(struct ltdb_private *ltdb,
- struct dn_list *list)
+static void ldb_kv_dn_list_sort(struct ltdb_private *ltdb, struct dn_list *list)
{
if (list->count < 2) {
return;
* the tree, we must ensure we strictly intersect with
* this list, as we trust the ONELEVEL index
*/
- ret = ldb_kv_index_dn_one(ac->module, ltdb, ac->base, dn_list,
- &scope_one_truncation);
+ ret = ldb_kv_index_dn_one(
+ ac->module, ltdb, ac->base, dn_list, &scope_one_truncation);
if (ret != LDB_SUCCESS) {
talloc_free(dn_list);
return ret;
* index can't trim the result list down then
* the ONELEVEL index is still good enough.
*/
- ret = ldb_kv_index_dn(ac->module, ltdb, ac->tree,
- idx_one_tree_list);
+ ret = ldb_kv_index_dn(
+ ac->module, ltdb, ac->tree, idx_one_tree_list);
if (ret == LDB_SUCCESS) {
if (!list_intersect(ldb, ltdb,
dn_list,
* processing as the truncation here refers only to the
* SCOPE_ONELEVEL index.
*/
- ret = ldb_kv_index_filter(ltdb, dn_list, ac, match_count,
- scope_one_truncation);
+ ret = ldb_kv_index_filter(
+ ltdb, dn_list, ac, match_count, scope_one_truncation);
talloc_free(dn_list);
return ret;
}
* @return An ldb error code
*/
static int ldb_kv_index_add1(struct ldb_module *module,
- struct ltdb_private *ltdb,
- const struct ldb_message *msg,
- struct ldb_message_element *el, int v_idx)
+ struct ltdb_private *ltdb,
+ const struct ldb_message *msg,
+ struct ldb_message_element *el,
+ int v_idx)
{
struct ldb_context *ldb;
struct ldb_dn *dn_key;
return LDB_ERR_OPERATIONS_ERROR;
}
- dn_key = ldb_kv_index_key(ldb, ltdb,
- el->name, &el->values[v_idx], &a, &truncation);
+ dn_key = ldb_kv_index_key(
+ ldb, ltdb, el->name, &el->values[v_idx], &a, &truncation);
if (!dn_key) {
talloc_free(list);
return LDB_ERR_OPERATIONS_ERROR;
return LDB_ERR_OPERATIONS_ERROR;
}
- ret = ldb_kv_idx_to_key(module, ltdb,
- ldb, &list->dn[i],
- &key);
+ ret = ldb_kv_idx_to_key(
+ module, ltdb, ldb, &list->dn[i], &key);
if (ret != LDB_SUCCESS) {
TALLOC_FREE(list);
TALLOC_FREE(rec);
return ret;
}
- ret = ldb_kv_search_key(module, ltdb, key,
- rec, flags);
+ ret = ldb_kv_search_key(module, ltdb, key, rec, flags);
if (key.dptr != guid_key) {
TALLOC_FREE(key.dptr);
}
add index entries for one elements in a message
*/
static int ldb_kv_index_add_el(struct ldb_module *module,
- struct ltdb_private *ltdb,
- const struct ldb_message *msg,
- struct ldb_message_element *el)
+ struct ltdb_private *ltdb,
+ const struct ldb_message *msg,
+ struct ldb_message_element *el)
{
unsigned int i;
for (i = 0; i < el->num_values; i++) {
- int ret = ldb_kv_index_add1(module, ltdb,
- msg, el, i);
+ int ret = ldb_kv_index_add1(module, ltdb, msg, el, i);
if (ret != LDB_SUCCESS) {
return ret;
}
add index entries for all elements in a message
*/
static int ldb_kv_index_add_all(struct ldb_module *module,
- struct ltdb_private *ltdb,
- const struct ldb_message *msg)
+ struct ltdb_private *ltdb,
+ const struct ldb_message *msg)
{
struct ldb_message_element *elements = msg->elements;
unsigned int i;
if (!ldb_kv_is_indexed(module, ltdb, elements[i].name)) {
continue;
}
- ret = ldb_kv_index_add_el(module, ltdb,
- msg, &elements[i]);
+ ret = ldb_kv_index_add_el(module, ltdb, msg, &elements[i]);
if (ret != LDB_SUCCESS) {
struct ldb_context *ldb = ldb_module_get_ctx(module);
ldb_asprintf_errstring(ldb,
insert a DN index for a message
*/
static int ldb_kv_modify_index_dn(struct ldb_module *module,
- struct ltdb_private *ltdb,
- const struct ldb_message *msg,
- struct ldb_dn *dn,
- const char *index, int add)
+ struct ltdb_private *ltdb,
+ const struct ldb_message *msg,
+ struct ldb_dn *dn,
+ const char *index,
+ int add)
{
struct ldb_message_element el;
struct ldb_val val;
insert a one level index for a message
*/
static int ldb_kv_index_onelevel(struct ldb_module *module,
- const struct ldb_message *msg, int add)
+ const struct ldb_message *msg,
+ int add)
{
struct ltdb_private *ltdb = talloc_get_type(ldb_module_get_private(module),
struct ltdb_private);
if (pdn == NULL) {
return LDB_ERR_OPERATIONS_ERROR;
}
- ret = ldb_kv_modify_index_dn(module, ltdb,
- msg, pdn, LTDB_IDXONE, add);
+ ret = ldb_kv_modify_index_dn(module, ltdb, msg, pdn, LTDB_IDXONE, add);
talloc_free(pdn);
insert a one level index for a message
*/
static int ldb_kv_write_index_dn_guid(struct ldb_module *module,
- const struct ldb_message *msg,
- int add)
+ const struct ldb_message *msg,
+ int add)
{
int ret;
struct ltdb_private *ltdb = talloc_get_type(ldb_module_get_private(module),
return LDB_SUCCESS;
}
- ret = ldb_kv_modify_index_dn(module, ltdb, msg, msg->dn,
- LTDB_IDXDN, add);
+ ret =
+ ldb_kv_modify_index_dn(module, ltdb, msg, msg->dn, LTDB_IDXDN, add);
if (ret == LDB_ERR_CONSTRAINT_VIOLATION) {
ldb_asprintf_errstring(ldb_module_get_ctx(module),
The caller guarantees that these element values are not yet indexed
*/
int ldb_kv_index_add_element(struct ldb_module *module,
- struct ltdb_private *ltdb,
- const struct ldb_message *msg,
- struct ldb_message_element *el)
+ struct ltdb_private *ltdb,
+ const struct ldb_message *msg,
+ struct ldb_message_element *el)
{
if (ldb_dn_is_special(msg->dn)) {
return LDB_SUCCESS;
add the index entries for a new record
*/
int ldb_kv_index_add_new(struct ldb_module *module,
- struct ltdb_private *ltdb,
- const struct ldb_message *msg)
+ struct ltdb_private *ltdb,
+ const struct ldb_message *msg)
{
int ret;
delete an index entry for one message element
*/
int ldb_kv_index_del_value(struct ldb_module *module,
- struct ltdb_private *ltdb,
- const struct ldb_message *msg,
- struct ldb_message_element *el, unsigned int v_idx)
+ struct ltdb_private *ltdb,
+ const struct ldb_message *msg,
+ struct ldb_message_element *el,
+ unsigned int v_idx)
{
struct ldb_context *ldb;
struct ldb_dn *dn_key;
return LDB_SUCCESS;
}
- dn_key = ldb_kv_index_key(ldb, ltdb,
- el->name, &el->values[v_idx],
- NULL, &truncation);
+ dn_key = ldb_kv_index_key(
+ ldb, ltdb, el->name, &el->values[v_idx], NULL, &truncation);
/*
* We ignore key truncation in ltdb_index_add1() so
* match that by ignoring it here as well
return -1 on failure
*/
int ldb_kv_index_del_element(struct ldb_module *module,
- struct ltdb_private *ltdb,
- const struct ldb_message *msg,
- struct ldb_message_element *el)
+ struct ltdb_private *ltdb,
+ const struct ldb_message *msg,
+ struct ldb_message_element *el)
{
const char *dn_str;
int ret;
delete the index entries for a record
return -1 on failure
*/
-int ldb_kv_index_delete(struct ldb_module *module, const struct ldb_message *msg)
+int ldb_kv_index_delete(struct ldb_module *module,
+ const struct ldb_message *msg)
{
struct ltdb_private *ltdb = talloc_get_type(ldb_module_get_private(module), struct ltdb_private);
int ret;
}
for (i = 0; i < msg->num_elements; i++) {
- ret = ldb_kv_index_del_element(module, ltdb,
- msg, &msg->elements[i]);
+ ret = ldb_kv_index_del_element(
+ module, ltdb, msg, &msg->elements[i]);
if (ret != LDB_SUCCESS) {
return ret;
}
and LDB_SUCCESS on success
*/
int ldb_kv_search_base(struct ldb_module *module,
- TALLOC_CTX *mem_ctx,
- struct ldb_dn *dn,
- struct ldb_dn **ret_dn)
+ TALLOC_CTX *mem_ctx,
+ struct ldb_dn *dn,
+ struct ldb_dn **ret_dn)
{
int exists;
int ret;
return LDB_ERR_OPERATIONS_ERROR;
}
- ret = ldb_kv_search_dn1(module, dn,
- msg,
- LDB_UNPACK_DATA_FLAG_NO_ATTRS);
+ ret = ldb_kv_search_dn1(module, dn, msg, LDB_UNPACK_DATA_FLAG_NO_ATTRS);
if (ret == LDB_SUCCESS) {
const char *dn_linearized
= ldb_dn_get_linearized(dn);
};
static int ldb_kv_parse_data_unpack(struct ldb_val key,
- struct ldb_val data,
- void *private_data)
+ struct ldb_val data,
+ void *private_data)
{
struct ltdb_parse_data_unpack_ctx *ctx = private_data;
unsigned int nb_elements_in_db;
return LDB_ERR_NO_SUCH_OBJECT on record-not-found
and LDB_SUCCESS on success
*/
-int ldb_kv_search_key(struct ldb_module *module, struct ltdb_private *ltdb,
- const struct TDB_DATA tdb_key,
- struct ldb_message *msg,
- unsigned int unpack_flags)
+int ldb_kv_search_key(struct ldb_module *module,
+ struct ltdb_private *ltdb,
+ const struct TDB_DATA tdb_key,
+ struct ldb_message *msg,
+ unsigned int unpack_flags)
{
int ret;
struct ltdb_parse_data_unpack_ctx ctx = {
msg->num_elements = 0;
msg->elements = NULL;
- ret = ltdb->kv_ops->fetch_and_parse(ltdb, ldb_key,
- ldb_kv_parse_data_unpack, &ctx);
+ ret = ltdb->kv_ops->fetch_and_parse(
+ ltdb, ldb_key, ldb_kv_parse_data_unpack, &ctx);
if (ret == -1) {
ret = ltdb->kv_ops->error(ltdb);
return LDB_ERR_NO_SUCH_OBJECT on record-not-found
and LDB_SUCCESS on success
*/
-int ldb_kv_search_dn1(struct ldb_module *module, struct ldb_dn *dn, struct ldb_message *msg,
- unsigned int unpack_flags)
+int ldb_kv_search_dn1(struct ldb_module *module,
+ struct ldb_dn *dn,
+ struct ldb_message *msg,
+ unsigned int unpack_flags)
{
void *data = ldb_module_get_private(module);
struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private);
* used for internal memory.
*
*/
- ret = ldb_kv_key_dn_from_idx(module, ltdb,
- msg,
- dn, &tdb_key);
+ ret = ldb_kv_key_dn_from_idx(module, ltdb, msg, dn, &tdb_key);
if (ret != LDB_SUCCESS) {
return ret;
}
*/
int ldb_kv_filter_attrs(TALLOC_CTX *mem_ctx,
- const struct ldb_message *msg, const char * const *attrs,
- struct ldb_message **filtered_msg)
+ const struct ldb_message *msg,
+ const char *const *attrs,
+ struct ldb_message **filtered_msg)
{
unsigned int i;
bool keep_all = false;
}
static int ldb_kv_search_and_return_base(struct ltdb_private *ltdb,
- struct ltdb_context *ctx)
+ struct ltdb_context *ctx)
{
struct ldb_message *msg, *filtered_msg;
struct ldb_context *ldb = ldb_module_get_ctx(ctx->module);
if (!msg) {
return LDB_ERR_OPERATIONS_ERROR;
}
- ret = ldb_kv_search_dn1(ctx->module, ctx->base, msg,
- LDB_UNPACK_DATA_FLAG_NO_DATA_ALLOC|
- LDB_UNPACK_DATA_FLAG_NO_VALUES_ALLOC);
+ ret = ldb_kv_search_dn1(ctx->module,
+ ctx->base,
+ msg,
+ LDB_UNPACK_DATA_FLAG_NO_DATA_ALLOC |
+ LDB_UNPACK_DATA_FLAG_NO_VALUES_ALLOC);
if (ret == LDB_ERR_NO_SUCH_OBJECT) {
if (ltdb->check_base == false) {
* dn. Also optimise the subsequent filter by filling
* in the ctx->base to be exactly case correct
*/
- ret = ldb_kv_search_base(module, ctx,
- req->op.search.base,
- &ctx->base);
-
+ ret = ldb_kv_search_base(
+ module, ctx, req->op.search.base, &ctx->base);
+
if (ret == LDB_ERR_NO_SUCH_OBJECT) {
ldb_asprintf_errstring(ldb,
"No such Base DN: %s",
note that the key for a record can depend on whether the
dn refers to a case sensitive index record or not
*/
-TDB_DATA ldb_kv_key_dn(struct ldb_module *module, TALLOC_CTX *mem_ctx,
- struct ldb_dn *dn)
+TDB_DATA ldb_kv_key_dn(struct ldb_module *module,
+ TALLOC_CTX *mem_ctx,
+ struct ldb_dn *dn)
{
TDB_DATA key;
char *key_str = NULL;
/* The caller is to provide a correctly sized key */
int ldb_kv_guid_to_key(struct ldb_module *module,
- struct ltdb_private *ltdb,
- const struct ldb_val *GUID_val,
- TDB_DATA *key)
+ struct ltdb_private *ltdb,
+ const struct ldb_val *GUID_val,
+ TDB_DATA *key)
{
const char *GUID_prefix = LTDB_GUID_KEY_PREFIX;
const int GUID_prefix_len = sizeof(LTDB_GUID_KEY_PREFIX) - 1;
* the GUID index mode
*/
int ldb_kv_idx_to_key(struct ldb_module *module,
- struct ltdb_private *ltdb,
- TALLOC_CTX *mem_ctx,
- const struct ldb_val *idx_val,
- TDB_DATA *key)
+ struct ltdb_private *ltdb,
+ TALLOC_CTX *mem_ctx,
+ const struct ldb_val *idx_val,
+ TDB_DATA *key)
{
struct ldb_context *ldb = ldb_module_get_ctx(module);
struct ldb_dn *dn;
if (ltdb->cache->GUID_index_attribute != NULL) {
- return ldb_kv_guid_to_key(module, ltdb,
- idx_val, key);
+ return ldb_kv_guid_to_key(module, ltdb, idx_val, key);
}
dn = ldb_dn_from_ldb_val(mem_ctx, ldb, idx_val);
note that the key for a record can depend on whether a
GUID index is in use, or the DN is used as the key
*/
-TDB_DATA ldb_kv_key_msg(struct ldb_module *module, TALLOC_CTX *mem_ctx,
- const struct ldb_message *msg)
+TDB_DATA ldb_kv_key_msg(struct ldb_module *module,
+ TALLOC_CTX *mem_ctx,
+ const struct ldb_message *msg)
{
void *data = ldb_module_get_private(module);
struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private);
currently only @ATTRIBUTES is checked
*/
static int ldb_kv_check_special_dn(struct ldb_module *module,
- const struct ldb_message *msg)
+ const struct ldb_message *msg)
{
struct ldb_context *ldb = ldb_module_get_ctx(module);
unsigned int i, j;
if (ldb_attr_cmp(msg->elements[i].name, "distinguishedName") == 0) continue;
for (j = 0; j < msg->elements[i].num_values; j++) {
- if (ldb_kv_check_at_attributes_values(&msg->elements[i].values[j]) != 0) {
+ if (ldb_kv_check_at_attributes_values(
+ &msg->elements[i].values[j]) != 0) {
ldb_set_errstring(ldb, "Invalid attribute value in an @ATTRIBUTES entry");
return LDB_ERR_INVALID_ATTRIBUTE_SYNTAX;
}
return ret;
}
-static int ltdb_store(struct ltdb_private *ltdb, struct ldb_val ldb_key,
- struct ldb_val ldb_data, int flags)
+static int ltdb_store(struct ltdb_private *ltdb,
+ struct ldb_val ldb_key,
+ struct ldb_val ldb_data,
+ int flags)
{
TDB_DATA key = {
.dptr = ldb_key.data,
/*
store a record into the db
*/
-int ldb_kv_store(
- struct ldb_module *module,
- const struct ldb_message *msg,
- int flgs)
+int ldb_kv_store(struct ldb_module *module,
+ const struct ldb_message *msg,
+ int flgs)
{
void *data = ldb_module_get_private(module);
struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private);
check if a attribute is a single valued, for a given element
*/
static bool ldb_kv_single_valued(const struct ldb_schema_attribute *a,
- struct ldb_message_element *el)
+ struct ldb_message_element *el)
{
if (!a) return false;
if (el != NULL) {
}
static int ldb_kv_add_internal(struct ldb_module *module,
- struct ltdb_private *ltdb,
- const struct ldb_message *msg,
- bool check_single_value)
+ struct ltdb_private *ltdb,
+ const struct ldb_message *msg,
+ bool check_single_value)
{
struct ldb_context *ldb = ldb_module_get_ctx(module);
int ret = LDB_SUCCESS;
el->name, ldb_dn_get_linearized(msg->dn));
return LDB_ERR_CONSTRAINT_VIOLATION;
}
- if (check_single_value &&
- el->num_values > 1 &&
- ldb_kv_single_valued(a, el)) {
+ if (check_single_value && el->num_values > 1 &&
+ ldb_kv_single_valued(a, el)) {
ldb_asprintf_errstring(ldb, "SINGLE-VALUE attribute %s on %s specified more than once",
el->name, ldb_dn_get_linearized(msg->dn));
return LDB_ERR_CONSTRAINT_VIOLATION;
if (mem_ctx == NULL) {
return ldb_module_operr(module);
}
- ret2 = ldb_kv_search_base(module, mem_ctx,
- msg->dn, &dn2);
+ ret2 =
+ ldb_kv_search_base(module, mem_ctx, msg->dn, &dn2);
TALLOC_FREE(mem_ctx);
if (ret2 == LDB_SUCCESS) {
ret = LDB_ERR_ENTRY_ALREADY_EXISTS;
return LDB_ERR_OPERATIONS_ERROR;
}
- ret = ldb_kv_add_internal(module, ltdb,
- req->op.add.message, true);
+ ret = ldb_kv_add_internal(module, ltdb, req->op.add.message, true);
return ret;
}
index records)
*/
int ldb_kv_delete_noindex(struct ldb_module *module,
- const struct ldb_message *msg)
+ const struct ldb_message *msg)
{
void *data = ldb_module_get_private(module);
struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private);
/* in case any attribute of the message was indexed, we need
to fetch the old record */
- ret = ldb_kv_search_dn1(module, dn, msg, LDB_UNPACK_DATA_FLAG_NO_DATA_ALLOC);
+ ret = ldb_kv_search_dn1(
+ module, dn, msg, LDB_UNPACK_DATA_FLAG_NO_DATA_ALLOC);
if (ret != LDB_SUCCESS) {
/* not finding the old record is an error */
goto done;
returns 0 on success, -1 on failure (and sets errno)
*/
static int ldb_kv_msg_add_element(struct ldb_message *msg,
- struct ldb_message_element *el)
+ struct ldb_message_element *el)
{
struct ldb_message_element *e2;
unsigned int i;
delete all elements having a specified attribute name
*/
static int ldb_kv_msg_delete_attribute(struct ldb_module *module,
- struct ltdb_private *ltdb,
- struct ldb_message *msg, const char *name)
+ struct ltdb_private *ltdb,
+ struct ldb_message *msg,
+ const char *name)
{
unsigned int i;
int ret;
return LDB Error on failure
*/
static int ldb_kv_msg_delete_element(struct ldb_module *module,
- struct ltdb_private *ltdb,
- struct ldb_message *msg,
- const char *name,
- const struct ldb_val *val)
+ struct ltdb_private *ltdb,
+ struct ldb_message *msg,
+ const char *name,
+ const struct ldb_val *val)
{
struct ldb_context *ldb = ldb_module_get_ctx(module);
unsigned int i;
}
if (matched) {
if (el->num_values == 1) {
- return ldb_kv_msg_delete_attribute(module,
- ltdb, msg, name);
+ return ldb_kv_msg_delete_attribute(
+ module, ltdb, msg, name);
}
ret = ldb_kv_index_del_value(module, ltdb, msg, el, i);
'req' is optional, and is used to specify controls if supplied
*/
int ldb_kv_modify_internal(struct ldb_module *module,
- const struct ldb_message *msg,
- struct ldb_request *req)
+ const struct ldb_message *msg,
+ struct ldb_request *req)
{
struct ldb_context *ldb = ldb_module_get_ctx(module);
void *data = ldb_module_get_private(module);
goto done;
}
- ret = ldb_kv_search_dn1(module, msg->dn,
- msg2,
- LDB_UNPACK_DATA_FLAG_NO_DATA_ALLOC);
+ ret = ldb_kv_search_dn1(
+ module, msg->dn, msg2, LDB_UNPACK_DATA_FLAG_NO_DATA_ALLOC);
if (ret != LDB_SUCCESS) {
goto done;
}
ret = LDB_ERR_OTHER;
goto done;
}
- ret = ldb_kv_index_add_element(module, ltdb,
- msg2,
- el);
+ ret = ldb_kv_index_add_element(
+ module, ltdb, msg2, el);
if (ret != LDB_SUCCESS) {
goto done;
}
el2->values = vals;
el2->num_values += el->num_values;
- ret = ldb_kv_index_add_element(module, ltdb,
- msg2, el);
+ ret = ldb_kv_index_add_element(
+ module, ltdb, msg2, el);
if (ret != LDB_SUCCESS) {
goto done;
}
}
/* Delete the attribute if it exists in the DB */
- if (ldb_kv_msg_delete_attribute(module, ltdb,
- msg2,
- el->name) != 0) {
+ if (ldb_kv_msg_delete_attribute(
+ module, ltdb, msg2, el->name) != 0) {
ret = LDB_ERR_OTHER;
goto done;
}
goto done;
}
- ret = ldb_kv_index_add_element(module, ltdb,
- msg2, el);
+ ret = ldb_kv_index_add_element(module, ltdb, msg2, el);
if (ret != LDB_SUCCESS) {
goto done;
}
if (msg->elements[i].num_values == 0) {
/* Delete the whole attribute */
- ret = ldb_kv_msg_delete_attribute(module,
- ltdb,
- msg2,
- msg->elements[i].name);
+ ret = ldb_kv_msg_delete_attribute(
+ module, ltdb, msg2, msg->elements[i].name);
if (ret == LDB_ERR_NO_SUCH_ATTRIBUTE &&
control_permissive) {
ret = LDB_SUCCESS;
} else {
/* Delete specified values from an attribute */
for (j=0; j < msg->elements[i].num_values; j++) {
- ret = ldb_kv_msg_delete_element(module,
- ltdb,
- msg2,
- msg->elements[i].name,
- &msg->elements[i].values[j]);
+ ret = ldb_kv_msg_delete_element(
+ module,
+ ltdb,
+ msg2,
+ msg->elements[i].name,
+ &msg->elements[i].values[j]);
if (ret == LDB_ERR_NO_SUCH_ATTRIBUTE &&
control_permissive) {
ret = LDB_SUCCESS;
}
/* we need to fetch the old record to re-add under the new name */
- ret = ldb_kv_search_dn1(module, req->op.rename.olddn, msg,
- LDB_UNPACK_DATA_FLAG_NO_DATA_ALLOC);
+ ret = ldb_kv_search_dn1(module,
+ req->op.rename.olddn,
+ msg,
+ LDB_UNPACK_DATA_FLAG_NO_DATA_ALLOC);
if (ret != LDB_SUCCESS) {
/* not finding the old record is an error */
return ret;
*/
if (tdb_key_old.dsize != tdb_key.dsize
|| memcmp(tdb_key.dptr, tdb_key_old.dptr, tdb_key.dsize) != 0) {
- ret = ldb_kv_search_base(module, msg,
- req->op.rename.newdn,
- &db_dn);
+ ret = ldb_kv_search_base(
+ module, msg, req->op.rename.newdn, &db_dn);
if (ret == LDB_SUCCESS) {
ret = LDB_ERR_ENTRY_ALREADY_EXISTS;
} else if (ret == LDB_ERR_NO_SUCH_OBJECT) {
return ltdb->kv_ops->error(ltdb);
}
-
ldb_kv_index_transaction_start(module);
ltdb->reindex_failed = false;
void *data = ldb_module_get_private(module);
struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private);
-
if (ldb_kv_index_transaction_cancel(module) != 0) {
ltdb->kv_ops->abort_write(ltdb);
return ltdb->kv_ops->error(ltdb);
return sequenceNumber from @BASEINFO
*/
static int ldb_kv_sequence_number(struct ltdb_context *ctx,
- struct ldb_extended **ext)
+ struct ldb_extended **ext)
{
struct ldb_context *ldb;
struct ldb_module *module = ctx->module;
}
static void ldb_kv_timeout(struct tevent_context *ev,
- struct tevent_timer *te,
- struct timeval t,
- void *private_data)
+ struct tevent_timer *te,
+ struct timeval t,
+ void *private_data)
{
struct ltdb_context *ctx;
ctx = talloc_get_type(private_data, struct ltdb_context);
}
static void ldb_kv_request_extended_done(struct ltdb_context *ctx,
- struct ldb_extended *ext,
- int error)
+ struct ldb_extended *ext,
+ int error)
{
struct ldb_context *ldb;
struct ldb_request *req;
void *private_data);
};
-static int ltdb_traverse_fn_wrapper(struct tdb_context *tdb, TDB_DATA tdb_key, TDB_DATA tdb_data, void *ctx)
+static int ltdb_traverse_fn_wrapper(struct tdb_context *tdb,
+ TDB_DATA tdb_key,
+ TDB_DATA tdb_data,
+ void *ctx)
{
struct kv_ctx *kv_ctx = ctx;
struct ldb_val key = {
return kv_ctx->kv_traverse_fn(kv_ctx->ltdb, key, data, kv_ctx->ctx);
}
-static int ltdb_traverse_fn(struct ltdb_private *ltdb, ldb_kv_traverse_fn fn, void *ctx)
+static int ltdb_traverse_fn(struct ltdb_private *ltdb,
+ ldb_kv_traverse_fn fn,
+ void *ctx)
{
struct kv_ctx kv_ctx = {
.kv_traverse_fn = fn,
.ltdb = ltdb
};
if (tdb_transaction_active(ltdb->tdb)) {
- return tdb_traverse(ltdb->tdb, ltdb_traverse_fn_wrapper, &kv_ctx);
+ return tdb_traverse(
+ ltdb->tdb, ltdb_traverse_fn_wrapper, &kv_ctx);
} else {
- return tdb_traverse_read(ltdb->tdb, ltdb_traverse_fn_wrapper, &kv_ctx);
+ return tdb_traverse_read(
+ ltdb->tdb, ltdb_traverse_fn_wrapper, &kv_ctx);
}
}
static int ltdb_update_in_iterate(struct ltdb_private *ltdb,
- struct ldb_val ldb_key,
- struct ldb_val ldb_key2,
- struct ldb_val ldb_data, void *state)
+ struct ldb_val ldb_key,
+ struct ldb_val ldb_key2,
+ struct ldb_val ldb_data,
+ void *state)
{
int tdb_ret;
struct ldb_context *ldb;
return tdb_ret;
}
-static int ltdb_parse_record_wrapper(TDB_DATA tdb_key, TDB_DATA tdb_data,
- void *ctx)
+static int ltdb_parse_record_wrapper(TDB_DATA tdb_key,
+ TDB_DATA tdb_data,
+ void *ctx)
{
struct kv_ctx *kv_ctx = ctx;
struct ldb_val key = {
}
static int ltdb_parse_record(struct ltdb_private *ltdb,
- struct ldb_val ldb_key,
- int (*parser)(struct ldb_val key,
- struct ldb_val data,
- void *private_data),
- void *ctx)
+ struct ldb_val ldb_key,
+ int (*parser)(struct ldb_val key,
+ struct ldb_val data,
+ void *private_data),
+ void *ctx)
{
struct kv_ctx kv_ctx = {
.parser = parser,
return LDB_ERR_PROTOCOL_ERROR;
}
- ret = tdb_parse_record(ltdb->tdb, key, ltdb_parse_record_wrapper,
- &kv_ctx);
+ ret = tdb_parse_record(
+ ltdb->tdb, key, ltdb_parse_record_wrapper, &kv_ctx);
if (ret == 0) {
return LDB_SUCCESS;
}
return ltdb_err_map(tdb_error(ltdb->tdb));
}
-static const char * ltdb_name(struct ltdb_private *ltdb)
+static const char *ltdb_name(struct ltdb_private *ltdb)
{
return tdb_name(ltdb->tdb);
}
}
static const struct kv_db_ops key_value_ops = {
- .store = ltdb_store,
- .delete = ltdb_delete,
- .iterate = ltdb_traverse_fn,
- .update_in_iterate = ltdb_update_in_iterate,
- .fetch_and_parse = ltdb_parse_record,
- .lock_read = ltdb_lock_read,
- .unlock_read = ltdb_unlock_read,
- .begin_write = ltdb_transaction_start,
- .prepare_write = ltdb_transaction_prepare_commit,
- .finish_write = ltdb_transaction_commit,
- .abort_write = ltdb_transaction_cancel,
- .error = ltdb_error,
- .errorstr = ltdb_errorstr,
- .name = ltdb_name,
- .has_changed = ltdb_changed,
- .transaction_active = ltdb_transaction_active,
+ .store = ltdb_store,
+ .delete = ltdb_delete,
+ .iterate = ltdb_traverse_fn,
+ .update_in_iterate = ltdb_update_in_iterate,
+ .fetch_and_parse = ltdb_parse_record,
+ .lock_read = ltdb_lock_read,
+ .unlock_read = ltdb_unlock_read,
+ .begin_write = ltdb_transaction_start,
+ .prepare_write = ltdb_transaction_prepare_commit,
+ .finish_write = ltdb_transaction_commit,
+ .abort_write = ltdb_transaction_cancel,
+ .error = ltdb_error,
+ .errorstr = ltdb_errorstr,
+ .name = ltdb_name,
+ .has_changed = ltdb_changed,
+ .transaction_active = ltdb_transaction_active,
};
static void ldb_kv_callback(struct tevent_context *ev,
- struct tevent_timer *te,
- struct timeval t,
- void *private_data)
+ struct tevent_timer *te,
+ struct timeval t,
+ void *private_data)
{
struct ltdb_context *ctx;
int ret;
}
static int ldb_kv_handle_request(struct ldb_module *module,
- struct ldb_request *req)
+ struct ldb_request *req)
{
struct ldb_control *control_permissive;
struct ldb_context *ldb;
if (req->timeout > 0) {
tv.tv_sec = req->starttime + req->timeout;
tv.tv_usec = 0;
- ac->timeout_event = tevent_add_timer(ev, ac, tv,
- ldb_kv_timeout, ac);
+ ac->timeout_event =
+ tevent_add_timer(ev, ac, tv, ldb_kv_timeout, ac);
if (NULL == ac->timeout_event) {
talloc_free(ac);
return LDB_ERR_OPERATIONS_ERROR;
return LDB_SUCCESS;
}
-
static int ldb_kv_lock_read(struct ldb_module *module)
{
void *data = ldb_module_get_private(module);
}
static const struct ldb_module_ops ldb_kv_ops = {
- .name = "tdb",
- .init_context = ldb_kv_init_rootdse,
- .search = ldb_kv_handle_request,
- .add = ldb_kv_handle_request,
- .modify = ldb_kv_handle_request,
- .del = ldb_kv_handle_request,
- .rename = ldb_kv_handle_request,
- .extended = ldb_kv_handle_request,
- .start_transaction = ldb_kv_start_trans,
- .end_transaction = ldb_kv_end_trans,
- .prepare_commit = ldb_kv_prepare_commit,
- .del_transaction = ldb_kv_del_trans,
- .read_lock = ldb_kv_lock_read,
- .read_unlock = ldb_kv_unlock_read,
+ .name = "tdb",
+ .init_context = ldb_kv_init_rootdse,
+ .search = ldb_kv_handle_request,
+ .add = ldb_kv_handle_request,
+ .modify = ldb_kv_handle_request,
+ .del = ldb_kv_handle_request,
+ .rename = ldb_kv_handle_request,
+ .extended = ldb_kv_handle_request,
+ .start_transaction = ldb_kv_start_trans,
+ .end_transaction = ldb_kv_end_trans,
+ .prepare_commit = ldb_kv_prepare_commit,
+ .del_transaction = ldb_kv_del_trans,
+ .read_lock = ldb_kv_lock_read,
+ .read_unlock = ldb_kv_unlock_read,
};
int ldb_kv_init_store(struct ltdb_private *ltdb,
int ldb_kv_search_indexed(struct ltdb_context *ctx, uint32_t *);
int ldb_kv_index_add_new(struct ldb_module *module,
- struct ltdb_private *ltdb,
- const struct ldb_message *msg);
-int ldb_kv_index_delete(struct ldb_module *module, const struct ldb_message *msg);
+ struct ltdb_private *ltdb,
+ const struct ldb_message *msg);
+int ldb_kv_index_delete(struct ldb_module *module,
+ const struct ldb_message *msg);
int ldb_kv_index_del_element(struct ldb_module *module,
- struct ltdb_private *ltdb,
- const struct ldb_message *msg,
- struct ldb_message_element *el);
+ struct ltdb_private *ltdb,
+ const struct ldb_message *msg,
+ struct ldb_message_element *el);
int ldb_kv_index_add_element(struct ldb_module *module,
+ struct ltdb_private *ltdb,
+ const struct ldb_message *msg,
+ struct ldb_message_element *el);
+int ldb_kv_index_del_value(struct ldb_module *module,
struct ltdb_private *ltdb,
const struct ldb_message *msg,
- struct ldb_message_element *el);
-int ldb_kv_index_del_value(struct ldb_module *module,
- struct ltdb_private *ltdb,
- const struct ldb_message *msg,
- struct ldb_message_element *el, unsigned int v_idx);
+ struct ldb_message_element *el,
+ unsigned int v_idx);
int ldb_kv_reindex(struct ldb_module *module);
int ldb_kv_index_transaction_start(struct ldb_module *module);
int ldb_kv_index_transaction_commit(struct ldb_module *module);
int ldb_kv_index_transaction_cancel(struct ldb_module *module);
int ldb_kv_key_dn_from_idx(struct ldb_module *module,
- struct ltdb_private *ltdb,
- TALLOC_CTX *mem_ctx,
- struct ldb_dn *dn,
- TDB_DATA *tdb_key);
+ struct ltdb_private *ltdb,
+ TALLOC_CTX *mem_ctx,
+ struct ldb_dn *dn,
+ TDB_DATA *tdb_key);
/* The following definitions come from lib/ldb/ldb_tdb/ldb_search.c */
int ltdb_has_wildcard(struct ldb_module *module, const char *attr_name,
const struct ldb_val *val);
void ltdb_search_dn1_free(struct ldb_module *module, struct ldb_message *msg);
-int ldb_kv_search_dn1(struct ldb_module *module, struct ldb_dn *dn, struct ldb_message *msg,
- unsigned int unpack_flags);
+int ldb_kv_search_dn1(struct ldb_module *module,
+ struct ldb_dn *dn,
+ struct ldb_message *msg,
+ unsigned int unpack_flags);
int ldb_kv_search_base(struct ldb_module *module,
- TALLOC_CTX *mem_ctx,
- struct ldb_dn *dn,
- struct ldb_dn **ret_dn);
-int ldb_kv_search_key(struct ldb_module *module, struct ltdb_private *ltdb,
- struct TDB_DATA tdb_key,
- struct ldb_message *msg,
- unsigned int unpack_flags);
+ TALLOC_CTX *mem_ctx,
+ struct ldb_dn *dn,
+ struct ldb_dn **ret_dn);
+int ldb_kv_search_key(struct ldb_module *module,
+ struct ltdb_private *ltdb,
+ struct TDB_DATA tdb_key,
+ struct ldb_message *msg,
+ unsigned int unpack_flags);
int ldb_kv_filter_attrs(TALLOC_CTX *mem_ctx,
- const struct ldb_message *msg, const char * const *attrs,
- struct ldb_message **filtered_msg);
+ const struct ldb_message *msg,
+ const char *const *attrs,
+ struct ldb_message **filtered_msg);
int ldb_kv_search(struct ltdb_context *ctx);
/* The following definitions come from lib/ldb/ldb_tdb/ldb_tdb.c */
* index, the old DN index and a possible future ID=
*/
bool ldb_kv_key_is_record(TDB_DATA key);
-TDB_DATA ldb_kv_key_dn(struct ldb_module *module, TALLOC_CTX *mem_ctx,
- struct ldb_dn *dn);
-TDB_DATA ldb_kv_key_msg(struct ldb_module *module, TALLOC_CTX *mem_ctx,
- const struct ldb_message *msg);
+TDB_DATA ldb_kv_key_dn(struct ldb_module *module,
+ TALLOC_CTX *mem_ctx,
+ struct ldb_dn *dn);
+TDB_DATA ldb_kv_key_msg(struct ldb_module *module,
+ TALLOC_CTX *mem_ctx,
+ const struct ldb_message *msg);
int ldb_kv_guid_to_key(struct ldb_module *module,
- struct ltdb_private *ltdb,
- const struct ldb_val *GUID_val,
- TDB_DATA *key);
+ struct ltdb_private *ltdb,
+ const struct ldb_val *GUID_val,
+ TDB_DATA *key);
int ldb_kv_idx_to_key(struct ldb_module *module,
- struct ltdb_private *ltdb,
- TALLOC_CTX *mem_ctx,
- const struct ldb_val *idx_val,
- TDB_DATA *key);
+ struct ltdb_private *ltdb,
+ TALLOC_CTX *mem_ctx,
+ const struct ldb_val *idx_val,
+ TDB_DATA *key);
TDB_DATA ltdb_key(struct ldb_module *module, struct ldb_dn *dn);
-int ldb_kv_store(struct ldb_module *module, const struct ldb_message *msg, int flgs);
-int ldb_kv_modify_internal(struct ldb_module *module, const struct ldb_message *msg, struct ldb_request *req);
+int ldb_kv_store(struct ldb_module *module,
+ const struct ldb_message *msg,
+ int flgs);
+int ldb_kv_modify_internal(struct ldb_module *module,
+ const struct ldb_message *msg,
+ struct ldb_request *req);
int ldb_kv_delete_noindex(struct ldb_module *module,
- const struct ldb_message *msg);
+ const struct ldb_message *msg);
int ltdb_err_map(enum TDB_ERROR tdb_code);
struct tdb_context *ltdb_wrap_open(TALLOC_CTX *mem_ctx,
const char *path, int hash_size, int tdb_flags,
int open_flags, mode_t mode,
struct ldb_context *ldb);
-int ldb_kv_init_store(struct ltdb_private *ltdb, const char *name,
- struct ldb_context *ldb, const char *options[],
+int ldb_kv_init_store(struct ltdb_private *ltdb,
+ const char *name,
+ struct ldb_context *ldb,
+ const char *options[],
struct ldb_module **_module);
int ltdb_connect(struct ldb_context *ldb, const char *url,