return ldb_err;
}
-
static bool lmdb_transaction_active(struct ldb_kv_private *ldb_kv)
{
return ldb_kv->lmdb_private->txlist != NULL;
static int lmdb_store(struct ldb_kv_private *ldb_kv,
struct ldb_val key,
- struct ldb_val data, int flags)
+ struct ldb_val data,
+ int flags)
{
struct lmdb_private *lmdb = ldb_kv->lmdb_private;
MDB_val mdb_key;
}
/* Handles only a single record */
-static int lmdb_parse_record(struct ldb_kv_private *ldb_kv, struct ldb_val key,
- int (*parser)(struct ldb_val key, struct ldb_val data,
+static int lmdb_parse_record(struct ldb_kv_private *ldb_kv,
+ struct ldb_val key,
+ int (*parser)(struct ldb_val key,
+ struct ldb_val data,
void *private_data),
void *ctx)
{
static int lmdb_lock_read(struct ldb_module *module)
{
void *data = ldb_module_get_private(module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
struct lmdb_private *lmdb = ldb_kv->lmdb_private;
pid_t pid = getpid();
static int lmdb_unlock_read(struct ldb_module *module)
{
void *data = ldb_module_get_private(module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
- if (lmdb_transaction_active(ldb_kv) == false && ldb_kv->read_lock_count == 1) {
+ if (lmdb_transaction_active(ldb_kv) == false &&
+ ldb_kv->read_lock_count == 1) {
struct lmdb_private *lmdb = ldb_kv->lmdb_private;
mdb_txn_commit(lmdb->read_txn);
lmdb->read_txn = NULL;
return mdb_strerror(ldb_kv->lmdb_private->error);
}
-static const char * lmdb_name(struct ldb_kv_private *ldb_kv)
+static const char *lmdb_name(struct ldb_kv_private *ldb_kv)
{
return "lmdb";
}
* supplying its own attribute handling
*/
ldb_kv->cache->attribute_indexes = true;
- ldb_kv->cache->one_level_indexes = ldb->schema.one_level_indexes;
- ldb_kv->cache->GUID_index_attribute
- = ldb->schema.GUID_index_attribute;
- ldb_kv->cache->GUID_index_dn_component
- = ldb->schema.GUID_index_dn_component;
+ ldb_kv->cache->one_level_indexes =
+ ldb->schema.one_level_indexes;
+ ldb_kv->cache->GUID_index_attribute =
+ ldb->schema.GUID_index_attribute;
+ ldb_kv->cache->GUID_index_dn_component =
+ ldb->schema.GUID_index_dn_component;
return 0;
}
return -1;
}
- if (ldb_msg_find_element(ldb_kv->cache->indexlist, LTDB_IDXONE) != NULL) {
+ if (ldb_msg_find_element(ldb_kv->cache->indexlist, LTDB_IDXONE) !=
+ NULL) {
ldb_kv->cache->one_level_indexes = true;
}
- if (ldb_msg_find_element(ldb_kv->cache->indexlist, LTDB_IDXATTR) != NULL) {
+ if (ldb_msg_find_element(ldb_kv->cache->indexlist, LTDB_IDXATTR) !=
+ NULL) {
ldb_kv->cache->attribute_indexes = true;
}
- ldb_kv->cache->GUID_index_attribute
- = ldb_msg_find_attr_as_string(ldb_kv->cache->indexlist,
- LTDB_IDXGUID, NULL);
- ldb_kv->cache->GUID_index_dn_component
- = ldb_msg_find_attr_as_string(ldb_kv->cache->indexlist,
- LTDB_IDX_DN_GUID, NULL);
+ ldb_kv->cache->GUID_index_attribute = ldb_msg_find_attr_as_string(
+ ldb_kv->cache->indexlist, LTDB_IDXGUID, NULL);
+ ldb_kv->cache->GUID_index_dn_component = ldb_msg_find_attr_as_string(
+ ldb_kv->cache->indexlist, LTDB_IDX_DN_GUID, NULL);
- lmdb_subdb_version
- = ldb_msg_find_attr_as_int(ldb_kv->cache->indexlist,
- LTDB_IDX_LMDB_SUBDB, 0);
+ lmdb_subdb_version = ldb_msg_find_attr_as_int(
+ ldb_kv->cache->indexlist, LTDB_IDX_LMDB_SUBDB, 0);
if (lmdb_subdb_version != 0) {
ldb_set_errstring(ldb,
{
struct ldb_context *ldb;
void *data = ldb_module_get_private(module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
struct ldb_message *msg;
struct ldb_message_element el;
struct ldb_val val;
static void ldb_kv_cache_free(struct ldb_module *module)
{
void *data = ldb_module_get_private(module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
ldb_kv->sequence_number = 0;
talloc_free(ldb_kv->cache);
{
struct ldb_context *ldb;
void *data = ldb_module_get_private(module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
struct ldb_dn *baseinfo_dn = NULL, *options_dn = NULL;
uint64_t seq;
struct ldb_message *baseinfo = NULL, *options = NULL;
if (ldb_kv->cache == NULL) {
ldb_kv->cache = talloc_zero(ldb_kv, struct ltdb_cache);
- if (ldb_kv->cache == NULL) goto failed;
+ if (ldb_kv->cache == NULL)
+ goto failed;
}
baseinfo = ldb_msg_new(ldb_kv->cache);
/* set flags if they do exist */
if (r == LDB_SUCCESS) {
- ldb_kv->check_base = ldb_msg_find_attr_as_bool(options,
- LTDB_CHECK_BASE,
- false);
- ldb_kv->disallow_dn_filter = ldb_msg_find_attr_as_bool(options,
- LTDB_DISALLOW_DN_FILTER,
- false);
+ ldb_kv->check_base =
+ ldb_msg_find_attr_as_bool(options, LTDB_CHECK_BASE, false);
+ ldb_kv->disallow_dn_filter = ldb_msg_find_attr_as_bool(
+ options, LTDB_DISALLOW_DN_FILTER, false);
} else {
ldb_kv->check_base = false;
ldb_kv->disallow_dn_filter = false;
* Now the attributes are loaded, set the guid_index_syntax.
* This can't fail, it will return a default at worst
*/
- a = ldb_schema_attribute_by_name(ldb,
- ldb_kv->cache->GUID_index_attribute);
+ a = ldb_schema_attribute_by_name(
+ ldb, ldb_kv->cache->GUID_index_attribute);
ldb_kv->GUID_index_syntax = a->syntax;
}
{
struct ldb_context *ldb;
void *data = ldb_module_get_private(module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
struct ldb_message *msg;
struct ldb_message_element el[2];
struct ldb_val val;
return LDB_ERR_OPERATIONS_ERROR;
}
- s = talloc_asprintf(msg, "%llu", ldb_kv->sequence_number+1);
+ s = talloc_asprintf(msg, "%llu", ldb_kv->sequence_number + 1);
if (!s) {
talloc_free(msg);
errno = ENOMEM;
static unsigned ldb_kv_max_key_length(struct ldb_kv_private *ldb_kv)
{
- if (ldb_kv->max_key_length == 0){
+ if (ldb_kv->max_key_length == 0) {
return UINT_MAX;
}
return ldb_kv->max_key_length;
/* enable the idxptr mode when transactions start */
int ldb_kv_index_transaction_start(struct ldb_module *module)
{
- struct ldb_kv_private *ldb_kv = talloc_get_type(ldb_module_get_private(module), struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv = talloc_get_type(
+ ldb_module_get_private(module), struct ldb_kv_private);
ldb_kv->idxptr = talloc_zero(ldb_kv, struct ltdb_idxptr);
if (ldb_kv->idxptr == NULL) {
return ldb_oom(ldb_module_get_ctx(module));
v.data = discard_const_p(unsigned char, dn_str);
v.length = strlen(dn_str);
} else {
- key_val = ldb_msg_find_ldb_val(msg,
- ldb_kv->cache->GUID_index_attribute);
+ key_val = ldb_msg_find_ldb_val(
+ msg, ldb_kv->cache->GUID_index_attribute);
if (key_val == NULL) {
return -1;
}
list->count = 0;
/* see if we have any in-memory index entries */
- if (ldb_kv->idxptr == NULL ||
- ldb_kv->idxptr->itdb == NULL) {
+ if (ldb_kv->idxptr == NULL || ldb_kv->idxptr->itdb == NULL) {
goto normal_index;
}
"against %s for %s: too many "
"values (%u > 1)",
ldb_kv->cache->GUID_index_attribute,
- dn_str, list->count);
+ dn_str,
+ list->count);
TALLOC_FREE(list);
return LDB_ERR_CONSTRAINT_VIOLATION;
}
return ret;
}
- ret = ldb_kv_search_key(module, ldb_kv, key, rec, flags);
+ ret =
+ ldb_kv_search_key(module, ldb_kv, key, rec, flags);
if (key.dptr != guid_key) {
TALLOC_FREE(key.dptr);
}
struct ldb_dn *dn,
struct dn_list *list)
{
- struct ldb_kv_private *ldb_kv = talloc_get_type(ldb_module_get_private(module), struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv = talloc_get_type(
+ ldb_module_get_private(module), struct ldb_kv_private);
TDB_DATA rec, key;
int ret;
struct dn_list *list2;
}
if (ldb_kv->idxptr->itdb == NULL) {
- ldb_kv->idxptr->itdb = tdb_open(NULL, 1000, TDB_INTERNAL, O_RDWR, 0);
+ ldb_kv->idxptr->itdb =
+ tdb_open(NULL, 1000, TDB_INTERNAL, O_RDWR, 0);
if (ldb_kv->idxptr->itdb == NULL) {
return LDB_ERR_OPERATIONS_ERROR;
}
void *state)
{
struct ldb_module *module = state;
- struct ldb_kv_private *ldb_kv = talloc_get_type(ldb_module_get_private(module), struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv = talloc_get_type(
+ ldb_module_get_private(module), struct ldb_kv_private);
struct ldb_dn *dn;
struct ldb_context *ldb = ldb_module_get_ctx(module);
struct ldb_val v;
return -1;
}
- ldb_kv->idxptr->error = ldb_kv_dn_list_store_full(module, ldb_kv, dn, list);
+ ldb_kv->idxptr->error =
+ ldb_kv_dn_list_store_full(module, ldb_kv, dn, list);
talloc_free(dn);
if (ldb_kv->idxptr->error != 0) {
return -1;
/* cleanup the idxptr mode when transaction commits */
int ldb_kv_index_transaction_commit(struct ldb_module *module)
{
- struct ldb_kv_private *ldb_kv = talloc_get_type(ldb_module_get_private(module), struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv = talloc_get_type(
+ ldb_module_get_private(module), struct ldb_kv_private);
int ret;
struct ldb_context *ldb = ldb_module_get_ctx(module);
/* cleanup the idxptr mode when transaction cancels */
int ldb_kv_index_transaction_cancel(struct ldb_module *module)
{
- struct ldb_kv_private *ldb_kv = talloc_get_type(ldb_module_get_private(module), struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv = talloc_get_type(
+ ldb_module_get_private(module), struct ldb_kv_private);
if (ldb_kv->idxptr && ldb_kv->idxptr->itdb) {
tdb_close(ldb_kv->idxptr->itdb);
}
struct ldb_message_element *el;
if ((ldb_kv->cache->GUID_index_attribute != NULL) &&
- (ldb_attr_cmp(attr,
- ldb_kv->cache->GUID_index_attribute) == 0)) {
+ (ldb_attr_cmp(attr, ldb_kv->cache->GUID_index_attribute) == 0)) {
/* Implicity covered, this is the index key */
return false;
}
return ret;
}
-
static bool list_union(struct ldb_context *ldb,
struct ldb_kv_private *ldb_kv,
- struct dn_list *list, struct dn_list *list2);
+ struct dn_list *list,
+ struct dn_list *list2);
/*
return a list of dn's that might match a leaf indexed search
* ensure we get the index in binary, rather
* than a string
*/
- ret = ldb_kv->GUID_index_syntax->canonicalise_fn(ldb,
- list->dn,
- &tree->u.equality.value,
- &list->dn[0]);
+ ret = ldb_kv->GUID_index_syntax->canonicalise_fn(
+ ldb, list->dn, &tree->u.equality.value, &list->dn[0]);
if (ret != LDB_SUCCESS) {
return LDB_ERR_OPERATIONS_ERROR;
}
*/
static bool list_intersect(struct ldb_context *ldb,
struct ldb_kv_private *ldb_kv,
- struct dn_list *list, const struct dn_list *list2)
+ struct dn_list *list,
+ const struct dn_list *list2)
{
const struct dn_list *short_list, *long_list;
struct dn_list *list3;
*/
static bool list_union(struct ldb_context *ldb,
struct ldb_kv_private *ldb_kv,
- struct dn_list *list, struct dn_list *list2)
+ struct dn_list *list,
+ struct dn_list *list2)
{
struct ldb_val *dn3;
unsigned int i = 0, j = 0, k = 0;
{
const struct ldb_schema_attribute *a;
if (ldb_kv->cache->GUID_index_attribute != NULL) {
- if (ldb_attr_cmp(attr, ldb_kv->cache->GUID_index_attribute) == 0) {
+ if (ldb_attr_cmp(attr, ldb_kv->cache->GUID_index_attribute) ==
+ 0) {
return true;
}
}
int ret;
if (subtree->operation != LDB_OP_EQUALITY ||
- !ldb_kv_index_unique(ldb, ldb_kv, subtree->u.equality.attr)) {
+ !ldb_kv_index_unique(
+ ldb, ldb_kv, subtree->u.equality.attr)) {
continue;
}
list->dn = list2->dn;
list->count = list2->count;
found = true;
- } else if (!list_intersect(ldb, ldb_kv,
- list, list2)) {
+ } else if (!list_intersect(ldb, ldb_kv, list, list2)) {
talloc_free(list2);
return LDB_ERR_OPERATIONS_ERROR;
}
}
if (ldb_kv->cache->GUID_index_dn_component != NULL) {
- guid_val = ldb_dn_get_extended_component(base_dn,
- ldb_kv->cache->GUID_index_dn_component);
+ guid_val = ldb_dn_get_extended_component(
+ base_dn, ldb_kv->cache->GUID_index_dn_component);
}
if (guid_val != NULL) {
*
* LDB_SCOPE_BASE is not passed in by our only caller.
*/
- if (ac->scope == LDB_SCOPE_ONELEVEL
- && ldb_kv->cache->one_level_indexes
- && scope_one_truncation == KEY_NOT_TRUNCATED) {
+ if (ac->scope == LDB_SCOPE_ONELEVEL &&
+ ldb_kv->cache->one_level_indexes &&
+ scope_one_truncation == KEY_NOT_TRUNCATED) {
ret = ldb_match_message(ldb, msg, ac->tree,
ac->scope, &matched);
} else {
/*
sort a DN list
*/
-static void ldb_kv_dn_list_sort(struct ldb_kv_private *ltdb, struct dn_list *list)
+static void ldb_kv_dn_list_sort(struct ldb_kv_private *ltdb,
+ struct dn_list *list)
{
if (list->count < 2) {
return;
int ldb_kv_search_indexed(struct ldb_kv_context *ac, uint32_t *match_count)
{
struct ldb_context *ldb = ldb_module_get_ctx(ac->module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(ldb_module_get_private(ac->module), struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv = talloc_get_type(
+ ldb_module_get_private(ac->module), struct ldb_kv_private);
struct dn_list *dn_list;
int ret;
enum ldb_scope index_scope;
/* see if indexing is enabled */
if (!ldb_kv->cache->attribute_indexes &&
- !ldb_kv->cache->one_level_indexes &&
- ac->scope != LDB_SCOPE_BASE) {
+ !ldb_kv->cache->one_level_indexes && ac->scope != LDB_SCOPE_BASE) {
/* fallback to a full search */
return LDB_ERR_OPERATIONS_ERROR;
}
* 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, ldb_kv, ac->base, dn_list, &scope_one_truncation);
+ ret = ldb_kv_index_dn_one(ac->module,
+ ldb_kv,
+ ac->base,
+ dn_list,
+ &scope_one_truncation);
if (ret != LDB_SUCCESS) {
talloc_free(dn_list);
return ret;
ret = ldb_kv_index_dn(
ac->module, ldb_kv, ac->tree, idx_one_tree_list);
if (ret == LDB_SUCCESS) {
- if (!list_intersect(ldb, ldb_kv,
+ if (!list_intersect(ldb,
+ ldb_kv,
dn_list,
idx_one_tree_list)) {
talloc_free(idx_one_tree_list);
(el->flags & LDB_FLAG_INTERNAL_FORCE_UNIQUE_INDEX)))) {
ldb_asprintf_errstring(
- ldb,
- __location__ ": unique index key on %s in %s, "
- "exceeds maximum key length of %u (encoded).",
- el->name,
- ldb_dn_get_linearized(msg->dn),
- ldb_kv->max_key_length);
+ ldb,
+ __location__ ": unique index key on %s in %s, "
+ "exceeds maximum key length of %u (encoded).",
+ el->name,
+ ldb_dn_get_linearized(msg->dn),
+ ldb_kv->max_key_length);
talloc_free(list);
return LDB_ERR_CONSTRAINT_VIOLATION;
}
return ret;
}
- ret = ldb_kv_search_key(module, ldb_kv, key, rec, flags);
+ ret =
+ ldb_kv_search_key(module, ldb_kv, key, rec, flags);
if (key.dptr != guid_key) {
TALLOC_FREE(key.dptr);
}
ldb_dn_get_linearized(dn_key));
} else {
/* This can't fail, gives a default at worst */
- const struct ldb_schema_attribute *attr
- = ldb_schema_attribute_by_name(
- ldb,
- ldb_kv->cache->GUID_index_attribute);
+ const struct ldb_schema_attribute *attr =
+ ldb_schema_attribute_by_name(
+ ldb, ldb_kv->cache->GUID_index_attribute);
struct ldb_val v;
ret = attr->syntax->ldif_write_fn(ldb, list,
&list->dn[0], &v);
if (ret == LDB_SUCCESS) {
- ldb_debug(ldb, LDB_DEBUG_WARNING,
+ ldb_debug(ldb,
+ LDB_DEBUG_WARNING,
__location__
": unique index violation on %s in "
"%s, conficts with %s %*.*s in %s",
} else {
const struct ldb_val *key_val;
struct ldb_val *exact = NULL, *next = NULL;
- key_val = ldb_msg_find_ldb_val(msg,
- ldb_kv->cache->GUID_index_attribute);
+ key_val = ldb_msg_find_ldb_val(
+ msg, ldb_kv->cache->GUID_index_attribute);
if (key_val == NULL) {
talloc_free(list);
return ldb_module_operr(module);
*/
if (exact != NULL && truncation == KEY_NOT_TRUNCATED) {
/* This can't fail, gives a default at worst */
- const struct ldb_schema_attribute *attr
- = ldb_schema_attribute_by_name(
- ldb,
- ldb_kv->cache->GUID_index_attribute);
+ const struct ldb_schema_attribute *attr =
+ ldb_schema_attribute_by_name(
+ ldb, ldb_kv->cache->GUID_index_attribute);
struct ldb_val v;
ret = attr->syntax->ldif_write_fn(ldb, list,
exact, &v);
if (ret == LDB_SUCCESS) {
- ldb_debug(ldb, LDB_DEBUG_WARNING,
+ ldb_debug(ldb,
+ LDB_DEBUG_WARNING,
__location__
": duplicate attribute value in %s "
"for index on %s, "
if (val.data == NULL) {
const char *dn_str = ldb_dn_get_linearized(dn);
ldb_asprintf_errstring(ldb_module_get_ctx(module),
- __location__
- ": Failed to modify %s "
- "against %s in %s: failed "
- "to get casefold DN",
+ __location__ ": Failed to modify %s "
+ "against %s in %s: failed "
+ "to get casefold DN",
index,
ldb_kv->cache->GUID_index_attribute,
dn_str);
struct ldb_context *ldb = ldb_module_get_ctx(module);
const char *dn_str = ldb_dn_get_linearized(dn);
ldb_asprintf_errstring(ldb,
- __location__
- ": Failed to modify %s "
- "against %s in %s - %s",
+ __location__ ": Failed to modify %s "
+ "against %s in %s - %s",
index,
ldb_kv->cache->GUID_index_attribute,
- dn_str, ldb_errstring(ldb));
+ dn_str,
+ ldb_errstring(ldb));
return ret;
}
return ret;
const struct ldb_message *msg,
int add)
{
- struct ldb_kv_private *ldb_kv = talloc_get_type(ldb_module_get_private(module),
- struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv = talloc_get_type(
+ ldb_module_get_private(module), struct ldb_kv_private);
struct ldb_dn *pdn;
int ret;
if (pdn == NULL) {
return LDB_ERR_OPERATIONS_ERROR;
}
- ret = ldb_kv_modify_index_dn(module, ldb_kv, msg, pdn, LTDB_IDXONE, add);
+ ret =
+ ldb_kv_modify_index_dn(module, ldb_kv, msg, pdn, LTDB_IDXONE, add);
talloc_free(pdn);
int add)
{
int ret;
- struct ldb_kv_private *ldb_kv = talloc_get_type(ldb_module_get_private(module),
- struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv = talloc_get_type(
+ ldb_module_get_private(module), struct ldb_kv_private);
/* We index for DN only if using a GUID index */
if (ldb_kv->cache->GUID_index_attribute == NULL) {
return LDB_SUCCESS;
}
- ret =
- ldb_kv_modify_index_dn(module, ldb_kv, msg, msg->dn, LTDB_IDXDN, add);
+ ret = ldb_kv_modify_index_dn(
+ module, ldb_kv, msg, msg->dn, LTDB_IDXDN, add);
if (ret == LDB_ERR_CONSTRAINT_VIOLATION) {
ldb_asprintf_errstring(ldb_module_get_ctx(module),
int ldb_kv_index_delete(struct ldb_module *module,
const struct ldb_message *msg)
{
- struct ldb_kv_private *ldb_kv = talloc_get_type(ldb_module_get_private(module), struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv = talloc_get_type(
+ ldb_module_get_private(module), struct ldb_kv_private);
int ret;
unsigned int i;
commit, which in turn greatly reduces DB churn as we will likely
be able to do a direct update into the old record.
*/
-static int delete_index(struct ldb_kv_private *ldb_kv, struct ldb_val key, struct ldb_val data, void *state)
+static int delete_index(struct ldb_kv_private *ldb_kv,
+ struct ldb_val key,
+ struct ldb_val data,
+ void *state)
{
struct ldb_module *module = state;
const char *dnstr = "DN=" LTDB_INDEX ":";
/*
traversal function that adds @INDEX records during a re index TODO wrong comment
*/
-static int re_key(struct ldb_kv_private *ldb_kv, struct ldb_val ldb_key, struct ldb_val val, void *state)
+static int re_key(struct ldb_kv_private *ldb_kv,
+ struct ldb_val ldb_key,
+ struct ldb_val val,
+ void *state)
{
struct ldb_context *ldb;
struct ldb_kv_reindex_context *ctx =
.data = key2.dptr,
.length = key2.dsize
};
- ldb_kv->kv_ops->update_in_iterate(ldb_kv, ldb_key, ldb_key2, val, ctx);
+ ldb_kv->kv_ops->update_in_iterate(
+ ldb_kv, ldb_key, ldb_key2, val, ctx);
}
talloc_free(key2.dptr);
/*
traversal function that adds @INDEX records during a re index
*/
-static int re_index(struct ldb_kv_private *ldb_kv, struct ldb_val ldb_key, struct ldb_val val, void *state)
+static int re_index(struct ldb_kv_private *ldb_kv,
+ struct ldb_val ldb_key,
+ struct ldb_val val,
+ void *state)
{
struct ldb_context *ldb;
struct ldb_kv_reindex_context *ctx =
*/
int ldb_kv_reindex(struct ldb_module *module)
{
- struct ldb_kv_private *ldb_kv = talloc_get_type(ldb_module_get_private(module), struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv = talloc_get_type(
+ ldb_module_get_private(module), struct ldb_kv_private);
int ret;
struct ldb_kv_reindex_context ctx;
if (ctx.count > 10000) {
ldb_debug(ldb_module_get_ctx(module),
- LDB_DEBUG_WARNING, "Reindexing: re_index successful on %s, "
+ LDB_DEBUG_WARNING,
+ "Reindexing: re_index successful on %s, "
"final index write-out will be in transaction commit",
ldb_kv->kv_ops->name(ldb_kv));
}
unsigned int unpack_flags)
{
void *data = ldb_module_get_private(module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
int ret;
uint8_t guid_key[LTDB_GUID_KEY_SIZE];
TDB_DATA tdb_key = {
TALLOC_CTX *tdb_key_ctx = NULL;
if (ldb_kv->cache->GUID_index_attribute == NULL ||
- ldb_dn_is_special(dn)) {
+ ldb_dn_is_special(dn)) {
tdb_key_ctx = talloc_new(msg);
if (!tdb_key_ctx) {
/*
search function for a non-indexed search
*/
-static int search_func(struct ldb_kv_private *ldb_kv, struct ldb_val key, struct ldb_val val, void *state)
+static int search_func(struct ldb_kv_private *ldb_kv,
+ struct ldb_val key,
+ struct ldb_val val,
+ void *state)
{
struct ldb_context *ldb;
struct ldb_kv_context *ac;
static int ldb_kv_search_full(struct ldb_kv_context *ctx)
{
void *data = ldb_module_get_private(ctx->module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
int ret;
ctx->error = LDB_SUCCESS;
struct ldb_module *module = ctx->module;
struct ldb_request *req = ctx->req;
void *data = ldb_module_get_private(module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
int ret;
ldb = ldb_module_get_ctx(module);
* callback error */
if ( ! ctx->request_terminated && ret != LDB_SUCCESS) {
/* Not indexed, so we need to do a full scan */
- if (ldb_kv->warn_unindexed || ldb_kv->disable_full_db_scan) {
+ if (ldb_kv->warn_unindexed ||
+ ldb_kv->disable_full_db_scan) {
/* useful for debugging when slow performance
* is caused by unindexed searches */
char *expression = ldb_filter_from_tree(ctx, ctx->tree);
static int ltdb_lock_read(struct ldb_module *module)
{
void *data = ldb_module_get_private(module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
int tdb_ret = 0;
int ret;
pid_t pid = getpid();
if (ldb_kv->pid != pid) {
- ldb_asprintf_errstring(
- ldb_module_get_ctx(module),
- __location__": Reusing ldb opend by pid %d in "
- "process %d\n",
- ldb_kv->pid,
- pid);
+ ldb_asprintf_errstring(ldb_module_get_ctx(module),
+ __location__
+ ": Reusing ldb opend by pid %d in "
+ "process %d\n",
+ ldb_kv->pid,
+ pid);
return LDB_ERR_PROTOCOL_ERROR;
}
static int ltdb_unlock_read(struct ldb_module *module)
{
void *data = ldb_module_get_private(module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
pid_t pid = getpid();
if (ldb_kv->pid != pid) {
- ldb_asprintf_errstring(
- ldb_module_get_ctx(module),
- __location__": Reusing ldb opend by pid %d in "
- "process %d\n",
- ldb_kv->pid,
- pid);
+ ldb_asprintf_errstring(ldb_module_get_ctx(module),
+ __location__
+ ": Reusing ldb opend by pid %d in "
+ "process %d\n",
+ ldb_kv->pid,
+ pid);
return LDB_ERR_PROTOCOL_ERROR;
}
- if (!tdb_transaction_active(ldb_kv->tdb) && ldb_kv->read_lock_count == 1) {
+ if (!tdb_transaction_active(ldb_kv->tdb) &&
+ ldb_kv->read_lock_count == 1) {
tdb_unlockall_read(ldb_kv->tdb);
ldb_kv->read_lock_count--;
return 0;
const struct ldb_message *msg)
{
void *data = ldb_module_get_private(module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
TDB_DATA key;
const struct ldb_val *guid_val;
int ret;
return ldb_kv_key_dn(module, mem_ctx, msg->dn);
}
- guid_val = ldb_msg_find_ldb_val(msg,
- ldb_kv->cache->GUID_index_attribute);
+ guid_val =
+ ldb_msg_find_ldb_val(msg, ldb_kv->cache->GUID_index_attribute);
if (guid_val == NULL) {
ldb_asprintf_errstring(ldb_module_get_ctx(module),
"Did not find GUID attribute %s "
static int ldb_kv_modified(struct ldb_module *module, struct ldb_dn *dn)
{
int ret = LDB_SUCCESS;
- struct ldb_kv_private *ldb_kv = talloc_get_type(ldb_module_get_private(module), struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv = talloc_get_type(
+ ldb_module_get_private(module), struct ldb_kv_private);
/* only allow modifies inside a transaction, otherwise the
* ldb is unsafe */
{
if (ldb_kv->warn_reindex) {
ldb_debug(ldb_module_get_ctx(module),
- LDB_DEBUG_ERROR, "Reindexing %s due to modification on %s",
- ldb_kv->kv_ops->name(ldb_kv), ldb_dn_get_linearized(dn));
+ LDB_DEBUG_ERROR,
+ "Reindexing %s due to modification on %s",
+ ldb_kv->kv_ops->name(ldb_kv),
+ ldb_dn_get_linearized(dn));
}
ret = ldb_kv_reindex(module);
}
int flgs)
{
void *data = ldb_module_get_private(module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
TDB_DATA tdb_key;
struct ldb_val ldb_key;
struct ldb_val ldb_data;
* LDB_ERR_ENTRY_ALREADY_EXISTS means the DN, not
* the GUID, so re-map
*/
- if (ret == LDB_ERR_ENTRY_ALREADY_EXISTS
- && !is_special
- && ldb_kv->cache->GUID_index_attribute != NULL) {
+ if (ret == LDB_ERR_ENTRY_ALREADY_EXISTS && !is_special &&
+ ldb_kv->cache->GUID_index_attribute != NULL) {
ret = LDB_ERR_CONSTRAINT_VIOLATION;
}
goto done;
struct ldb_module *module = ctx->module;
struct ldb_request *req = ctx->req;
void *data = ldb_module_get_private(module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
int ret = LDB_SUCCESS;
if (ldb_kv->max_key_length != 0 &&
ldb_kv->cache->GUID_index_attribute == NULL &&
- !ldb_dn_is_special(req->op.add.message->dn))
- {
+ !ldb_dn_is_special(req->op.add.message->dn)) {
ldb_set_errstring(ldb_module_get_ctx(module),
"Must operate ldb_mdb in GUID "
"index mode, but " LTDB_IDXGUID " not set.");
const struct ldb_message *msg)
{
void *data = ldb_module_get_private(module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
struct ldb_val ldb_key;
TDB_DATA tdb_key;
int ret;
ldb_key.data = tdb_key.dptr;
ldb_key.length = tdb_key.dsize;
- ret = ldb_kv->kv_ops->delete(ldb_kv, ldb_key);
+ ret = ldb_kv->kv_ops->delete (ldb_kv, ldb_key);
TALLOC_FREE(tdb_key_ctx);
if (ret != 0) {
struct ldb_message_element *el;
bool is_special = ldb_dn_is_special(msg->dn);
- if (!is_special
- && ldb_kv->cache->GUID_index_attribute != NULL
- && ldb_attr_cmp(name, ldb_kv->cache->GUID_index_attribute) == 0) {
+ if (!is_special && ldb_kv->cache->GUID_index_attribute != NULL &&
+ ldb_attr_cmp(name, ldb_kv->cache->GUID_index_attribute) == 0) {
struct ldb_context *ldb = ldb_module_get_ctx(module);
- ldb_asprintf_errstring(ldb, "Must not modify GUID "
+ ldb_asprintf_errstring(ldb,
+ "Must not modify GUID "
"attribute %s (used as DB index)",
ldb_kv->cache->GUID_index_attribute);
return LDB_ERR_CONSTRAINT_VIOLATION;
module, ldb_kv, msg, name);
}
- ret = ldb_kv_index_del_value(module, ldb_kv, msg, el, i);
+ ret =
+ ldb_kv_index_del_value(module, ldb_kv, msg, el, i);
if (ret != LDB_SUCCESS) {
return ret;
}
{
struct ldb_context *ldb = ldb_module_get_ctx(module);
void *data = ldb_module_get_private(module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
struct ldb_message *msg2;
unsigned int i, j;
int ret = LDB_SUCCESS, idx;
goto done;
}
- ret = ldb_kv_index_add_element(module, ldb_kv, msg2, el);
+ ret =
+ ldb_kv_index_add_element(module, ldb_kv, 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, ldb_kv, msg2, msg->elements[i].name);
+ module,
+ ldb_kv,
+ msg2,
+ msg->elements[i].name);
if (ret == LDB_ERR_NO_SUCH_ATTRIBUTE &&
control_permissive) {
ret = LDB_SUCCESS;
{
struct ldb_module *module = ctx->module;
void *data = ldb_module_get_private(module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
struct ldb_request *req = ctx->req;
struct ldb_message *msg;
int ret = LDB_SUCCESS;
pid_t pid = getpid();
if (ldb_kv->pid != pid) {
- ldb_asprintf_errstring(
- ldb_module_get_ctx(ldb_kv->module),
- __location__": Reusing ldb opend by pid %d in "
- "process %d\n",
- ldb_kv->pid,
- pid);
+ ldb_asprintf_errstring(ldb_module_get_ctx(ldb_kv->module),
+ __location__
+ ": Reusing ldb opend by pid %d in "
+ "process %d\n",
+ ldb_kv->pid,
+ pid);
return LDB_ERR_PROTOCOL_ERROR;
}
pid_t pid = getpid();
if (ldb_kv->pid != pid) {
- ldb_asprintf_errstring(
- ldb_module_get_ctx(ldb_kv->module),
- __location__": Reusing ldb opend by pid %d in "
- "process %d\n",
- ldb_kv->pid,
- pid);
+ ldb_asprintf_errstring(ldb_module_get_ctx(ldb_kv->module),
+ __location__
+ ": Reusing ldb opend by pid %d in "
+ "process %d\n",
+ ldb_kv->pid,
+ pid);
return LDB_ERR_PROTOCOL_ERROR;
}
pid_t pid = getpid();
if (ldb_kv->pid != pid) {
- ldb_asprintf_errstring(
- ldb_module_get_ctx(ldb_kv->module),
- __location__": Reusing ldb opend by pid %d in "
- "process %d\n",
- ldb_kv->pid,
- pid);
+ ldb_asprintf_errstring(ldb_module_get_ctx(ldb_kv->module),
+ __location__
+ ": Reusing ldb opend by pid %d in "
+ "process %d\n",
+ ldb_kv->pid,
+ pid);
return LDB_ERR_PROTOCOL_ERROR;
}
pid_t pid = getpid();
if (ldb_kv->pid != pid) {
- ldb_asprintf_errstring(
- ldb_module_get_ctx(ldb_kv->module),
- __location__": Reusing ldb opend by pid %d in "
- "process %d\n",
- ldb_kv->pid,
- pid);
+ ldb_asprintf_errstring(ldb_module_get_ctx(ldb_kv->module),
+ __location__
+ ": Reusing ldb opend by pid %d in "
+ "process %d\n",
+ ldb_kv->pid,
+ pid);
return LDB_ERR_PROTOCOL_ERROR;
}
static int ldb_kv_start_trans(struct ldb_module *module)
{
void *data = ldb_module_get_private(module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
pid_t pid = getpid();
if (ldb_kv->pid != pid) {
- ldb_asprintf_errstring(
- ldb_module_get_ctx(ldb_kv->module),
- __location__": Reusing ldb opend by pid %d in "
- "process %d\n",
- ldb_kv->pid,
- pid);
+ ldb_asprintf_errstring(ldb_module_get_ctx(ldb_kv->module),
+ __location__
+ ": Reusing ldb opend by pid %d in "
+ "process %d\n",
+ ldb_kv->pid,
+ pid);
return LDB_ERR_PROTOCOL_ERROR;
}
{
int ret;
void *data = ldb_module_get_private(module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
pid_t pid = getpid();
if (ldb_kv->pid != pid) {
- ldb_asprintf_errstring(
- ldb_module_get_ctx(module),
- __location__": Reusing ldb opend by pid %d in "
- "process %d\n",
- ldb_kv->pid,
- pid);
+ ldb_asprintf_errstring(ldb_module_get_ctx(module),
+ __location__
+ ": Reusing ldb opend by pid %d in "
+ "process %d\n",
+ ldb_kv->pid,
+ pid);
return LDB_ERR_PROTOCOL_ERROR;
}
{
int ret;
void *data = ldb_module_get_private(module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
if (!ldb_kv->prepared_commit) {
ret = ldb_kv_prepare_commit(module);
if (ldb_kv->kv_ops->finish_write(ldb_kv) != 0) {
ret = ldb_kv->kv_ops->error(ldb_kv);
- ldb_asprintf_errstring(ldb_module_get_ctx(module),
- "Failure during tdb_transaction_commit(): %s -> %s",
- ldb_kv->kv_ops->errorstr(ldb_kv),
- ldb_strerror(ret));
+ ldb_asprintf_errstring(
+ ldb_module_get_ctx(module),
+ "Failure during tdb_transaction_commit(): %s -> %s",
+ ldb_kv->kv_ops->errorstr(ldb_kv),
+ ldb_strerror(ret));
return ret;
}
static int ldb_kv_del_trans(struct ldb_module *module)
{
void *data = ldb_module_get_private(module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
if (ldb_kv_index_transaction_cancel(module) != 0) {
ldb_kv->kv_ops->abort_write(ldb_kv);
struct ldb_module *module = ctx->module;
struct ldb_request *req = ctx->req;
void *data = ldb_module_get_private(module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
TALLOC_CTX *tmp_ctx = NULL;
struct ldb_seqnum_request *seq;
struct ldb_seqnum_result *res;
void *ctx)
{
struct kv_ctx kv_ctx = {
- .kv_traverse_fn = fn,
- .ctx = ctx,
- .ldb_kv = ldb_kv
- };
+ .kv_traverse_fn = fn, .ctx = ctx, .ldb_kv = ldb_kv};
if (tdb_transaction_active(ldb_kv->tdb)) {
return tdb_traverse(
ldb_kv->tdb, ltdb_traverse_fn_wrapper, &kv_ctx);
tdb_ret = tdb_delete(ldb_kv->tdb, key);
if (tdb_ret != 0) {
- ldb_debug(ldb, LDB_DEBUG_ERROR,
+ ldb_debug(ldb,
+ LDB_DEBUG_ERROR,
"Failed to delete %*.*s "
"for rekey as %*.*s: %s",
- (int)key.dsize, (int)key.dsize,
+ (int)key.dsize,
+ (int)key.dsize,
(const char *)key.dptr,
- (int)key2.dsize, (int)key2.dsize,
+ (int)key2.dsize,
+ (int)key2.dsize,
(const char *)key.dptr,
tdb_errorstr(ldb_kv->tdb));
ctx->error = ltdb_err_map(tdb_error(ldb_kv->tdb));
}
tdb_ret = tdb_store(ldb_kv->tdb, key2, data, 0);
if (tdb_ret != 0) {
- ldb_debug(ldb, LDB_DEBUG_ERROR,
+ ldb_debug(ldb,
+ LDB_DEBUG_ERROR,
"Failed to rekey %*.*s as %*.*s: %s",
- (int)key.dsize, (int)key.dsize,
+ (int)key.dsize,
+ (int)key.dsize,
(const char *)key.dptr,
- (int)key2.dsize, (int)key2.dsize,
+ (int)key2.dsize,
+ (int)key2.dsize,
(const char *)key.dptr,
tdb_errorstr(ldb_kv->tdb));
ctx->error = ltdb_err_map(tdb_error(ldb_kv->tdb));
void *private_data),
void *ctx)
{
- struct kv_ctx kv_ctx = {
- .parser = parser,
- .ctx = ctx,
- .ldb_kv = ldb_kv
- };
+ struct kv_ctx kv_ctx = {.parser = parser, .ctx = ctx, .ldb_kv = ldb_kv};
TDB_DATA key = {
.dptr = ldb_key.data,
.dsize = ldb_key.length
static int ldb_kv_lock_read(struct ldb_module *module)
{
void *data = ldb_module_get_private(module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
return ldb_kv->kv_ops->lock_read(module);
}
static int ldb_kv_unlock_read(struct ldb_module *module)
{
void *data = ldb_module_get_private(module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
return ldb_kv->kv_ops->unlock_read(module);
}
errno = 0;
/* note that we use quite a large default hash size */
- ldb_kv->tdb = ltdb_wrap_open(ldb_kv, path, 10000,
- tdb_flags, open_flags,
- ldb_get_create_perms(ldb), ldb);
+ ldb_kv->tdb = ltdb_wrap_open(ldb_kv,
+ path,
+ 10000,
+ tdb_flags,
+ open_flags,
+ ldb_get_create_perms(ldb),
+ ldb);
if (!ldb_kv->tdb) {
ldb_asprintf_errstring(ldb,
"Unable to open tdb '%s': %s", path, strerror(errno));
struct ldb_kv_private;
typedef int (*ldb_kv_traverse_fn)(struct ldb_kv_private *ldb_kv,
- struct ldb_val key, struct ldb_val data,
+ struct ldb_val key,
+ struct ldb_val data,
void *ctx);
struct kv_db_ops {
- int (*store)(struct ldb_kv_private *ldb_kv, struct ldb_val key, struct ldb_val data, int flags);
+ int (*store)(struct ldb_kv_private *ldb_kv,
+ struct ldb_val key,
+ struct ldb_val data,
+ int flags);
int (*delete)(struct ldb_kv_private *ldb_kv, struct ldb_val key);
- int (*iterate)(struct ldb_kv_private *ldb_kv, ldb_kv_traverse_fn fn, void *ctx);
- int (*update_in_iterate)(struct ldb_kv_private *ldb_kv, struct ldb_val key,
- struct ldb_val key2, struct ldb_val data, void *ctx);
- int (*fetch_and_parse)(struct ldb_kv_private *ldb_kv, struct ldb_val key,
- int (*parser)(struct ldb_val key, struct ldb_val data,
- void *private_data),
- void *ctx);
+ int (*iterate)(struct ldb_kv_private *ldb_kv,
+ ldb_kv_traverse_fn fn,
+ void *ctx);
+ int (*update_in_iterate)(struct ldb_kv_private *ldb_kv,
+ struct ldb_val key,
+ struct ldb_val key2,
+ struct ldb_val data,
+ void *ctx);
+ int (*fetch_and_parse)(struct ldb_kv_private *ldb_kv,
+ struct ldb_val key,
+ int (*parser)(struct ldb_val key,
+ struct ldb_val data,
+ void *private_data),
+ void *ctx);
int (*lock_read)(struct ldb_module *);
int (*unlock_read)(struct ldb_module *);
int (*begin_write)(struct ldb_kv_private *);
int (*abort_write)(struct ldb_kv_private *);
int (*finish_write)(struct ldb_kv_private *);
int (*error)(struct ldb_kv_private *ldb_kv);
- const char * (*errorstr)(struct ldb_kv_private *ldb_kv);
- const char * (*name)(struct ldb_kv_private *ldb_kv);
+ const char *(*errorstr)(struct ldb_kv_private *ldb_kv);
+ const char *(*name)(struct ldb_kv_private *ldb_kv);
bool (*has_changed)(struct ldb_kv_private *ldb_kv);
bool (*transaction_active)(struct ldb_kv_private *ldb_kv);
};
/*
* Now delete it.
*/
- ret = ldb_kv->kv_ops->delete(ldb_kv, key);
+ ret = ldb_kv->kv_ops->delete (ldb_kv, key);
assert_int_equal(ret, 0);
/*
/*
* Now delete it.
*/
- ret = ldb_kv->kv_ops->delete(ldb_kv, key);
+ ret = ldb_kv->kv_ops->delete (ldb_kv, key);
assert_int_equal(ret, 0);
/*
/*
* Now attempt to delete a record
*/
- ret = ldb_kv->kv_ops->delete(ldb_kv, key);
+ ret = ldb_kv->kv_ops->delete (ldb_kv, key);
assert_int_equal(ret, LDB_ERR_PROTOCOL_ERROR);
/*
static int traverse_fn(struct ldb_kv_private *ldb_kv,
struct ldb_val key,
struct ldb_val data,
- void *ctx) {
+ void *ctx)
+{
int *visits = ctx;
int i;
static int update_fn(struct ldb_kv_private *ldb_kv,
struct ldb_val key,
struct ldb_val data,
- void *ctx) {
+ void *ctx)
+{
struct ldb_val new_key;
struct ldb_module *module = NULL;
new_key.length = key.length;
new_key.data[0] = 'K';
- ret = ldb_kv->kv_ops->update_in_iterate(ldb_kv,
- key,
- new_key,
- data,
- &module);
+ ret = ldb_kv->kv_ops->update_in_iterate(
+ ldb_kv, key, new_key, data, &module);
}
TALLOC_FREE(tmp_ctx);
return ret;
key.data = (uint8_t *)talloc_strdup(tmp_ctx, KEY2);
key.length = strlen(KEY2) + 1;
- ret = ldb_kv->kv_ops->delete(ldb_kv, key);
+ ret = ldb_kv->kv_ops->delete (ldb_kv, key);
assert_int_equal(ret, 0);
/*
* Signal the child process