{
struct dn_list *list;
if (rec.dsize != sizeof(void *)) {
- ldb_asprintf_errstring(ldb_module_get_ctx(module),
+ ldb_asprintf_errstring(ldb_module_get_ctx(module),
"Bad data size for idxptr %u", (unsigned)rec.dsize);
return NULL;
}
memcpy(&list, rec.dptr, sizeof(void *));
list = talloc_get_type(list, struct dn_list);
if (list == NULL) {
- ldb_asprintf_errstring(ldb_module_get_ctx(module),
- "Bad type '%s' for idxptr",
+ ldb_asprintf_errstring(ldb_module_get_ctx(module),
+ "Bad type '%s' for idxptr",
talloc_get_name(list));
return NULL;
}
if (check_parent && list->dn && talloc_parent(list->dn) != list) {
- ldb_asprintf_errstring(ldb_module_get_ctx(module),
- "Bad parent '%s' for idxptr",
+ ldb_asprintf_errstring(ldb_module_get_ctx(module),
+ "Bad parent '%s' for idxptr",
talloc_get_name(talloc_parent(list->dn)));
return NULL;
}
}
/*
- return the @IDX list in an index entry for a dn as a
+ return the @IDX list in an index entry for a dn as a
struct dn_list
*/
static int ltdb_dn_list_load(struct ldb_module *module,
/*
save a dn_list into a full @IDX style record
*/
-static int ltdb_dn_list_store_full(struct ldb_module *module, struct ldb_dn *dn,
+static int ltdb_dn_list_store_full(struct ldb_module *module, struct ldb_dn *dn,
struct dn_list *list)
{
struct ldb_message *msg;
/*
save a dn_list into the database, in either @IDX or internal format
*/
-static int ltdb_dn_list_store(struct ldb_module *module, struct ldb_dn *dn,
+static int ltdb_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);
r = a->syntax->canonicalise_fn(ldb, ldb, value, &v);
if (r != LDB_SUCCESS) {
const char *errstr = ldb_errstring(ldb);
- /* canonicalisation can be refused. For example,
+ /* canonicalisation can be refused. For example,
a attribute that takes wildcards will refuse to canonicalise
if the value contains a wildcard */
ldb_asprintf_errstring(ldb, "Failed to create index key for attribute '%s':%s%s%s",
return LDB_ERR_OPERATIONS_ERROR;
}
- /* the attribute is indexed. Pull the list of DNs that match the
+ /* the attribute is indexed. Pull the list of DNs that match the
search criterion */
dn = ltdb_index_key(ldb, tree->u.equality.attr, &tree->u.equality.value, NULL);
if (!dn) return LDB_ERR_OPERATIONS_ERROR;
!ltdb_index_unique(ldb, subtree->u.equality.attr)) {
continue;
}
-
+
ret = ltdb_index_dn(module, subtree, index_list, list);
if (ret == LDB_ERR_NO_SUCH_OBJECT) {
/* 0 && X == 0 */
* filtering */
return LDB_SUCCESS;
}
- }
+ }
/* now do a full intersection */
found = false;
if (list2 == NULL) {
return ldb_module_oom(module);
}
-
+
ret = ltdb_index_dn(module, subtree, index_list, list2);
if (ret == LDB_ERR_NO_SUCH_OBJECT) {
talloc_free(list2);
return LDB_ERR_NO_SUCH_OBJECT;
}
-
+
if (ret != LDB_SUCCESS) {
/* this didn't adding anything */
talloc_free(list2);
talloc_free(list2);
return LDB_ERR_OPERATIONS_ERROR;
}
-
+
if (list->count == 0) {
list->dn = NULL;
return LDB_ERR_NO_SUCH_OBJECT;
}
-
+
if (list->count < 2) {
/* it isn't worth loading the next part of the tree */
return LDB_SUCCESS;
}
- }
+ }
if (!found) {
/* none of the attributes were indexed */
return LDB_SUCCESS;
}
-
+
/*
return a list of matching objects using a one-level index
*/
extracting just the given attributes
*/
static int ltdb_index_filter(const struct dn_list *dn_list,
- struct ltdb_context *ac,
+ struct ltdb_context *ac,
uint32_t *match_count)
{
struct ldb_context *ldb;
new_count++;
}
}
-
+
list->count = new_count;
}
int ret;
/* see if indexing is enabled */
- if (!ltdb->cache->attribute_indexes &&
+ if (!ltdb->cache->attribute_indexes &&
!ltdb->cache->one_level_indexes &&
ac->scope != LDB_SCOPE_BASE) {
/* fallback to a full search */
}
dn_list->dn[0].length = strlen((char *)dn_list->dn[0].data);
dn_list->count = 1;
- break;
+ break;
case LDB_SCOPE_ONELEVEL:
if (!ltdb->cache->one_level_indexes) {
talloc_free(list);
ldb_asprintf_errstring(ldb, __location__ ": unique index violation on %s in %s",
el->name, dn);
- return LDB_ERR_ENTRY_ALREADY_EXISTS;
+ return LDB_ERR_ENTRY_ALREADY_EXISTS;
}
/* If we are doing an ADD, then this can not already be in the index,
}
/* overallocate the list a bit, to reduce the number of
- * realloc trigered copies */
+ * realloc trigered copies */
alloc_len = ((list->count+1)+7) & ~7;
list->dn = talloc_realloc(list, list->dn, struct ldb_val, alloc_len);
if (list->dn == NULL) {
add the index entries for a new element in a record
The caller guarantees that these element values are not yet indexed
*/
-int ltdb_index_add_element(struct ldb_module *module, struct ldb_dn *dn,
+int ltdb_index_add_element(struct ldb_module *module, struct ldb_dn *dn,
struct ldb_message_element *el)
{
struct ltdb_private *ltdb = talloc_get_type(ldb_module_get_private(module), struct ltdb_private);
if (i == -1) {
/* nothing to delete */
talloc_free(dn_key);
- return LDB_SUCCESS;
+ return LDB_SUCCESS;
}
j = (unsigned int) i;
dn = ldb_dn_from_ldb_val(ltdb, ldb_module_get_ctx(module), &v);
ret = ltdb_dn_list_store(module, dn, &list);
if (ret != LDB_SUCCESS) {
- ldb_asprintf_errstring(ldb_module_get_ctx(module),
+ ldb_asprintf_errstring(ldb_module_get_ctx(module),
"Unable to store null index for %s\n",
ldb_dn_get_linearized(dn));
talloc_free(dn);