ldb_schema_attribute_remove: void (struct ldb_context *, const char *)
ldb_schema_attribute_remove_flagged: void (struct ldb_context *, unsigned int)
ldb_schema_attribute_set_override_handler: void (struct ldb_context *, ldb_attribute_handler_override_fn_t, void *)
+ldb_schema_set_override_indexlist: void (struct ldb_context *, bool)
ldb_search: int (struct ldb_context *, TALLOC_CTX *, struct ldb_result **, struct ldb_dn *, enum ldb_scope, const char * const *, const char *, ...)
ldb_search_default_callback: int (struct ldb_request *, struct ldb_reply *)
ldb_sequence_number: int (struct ldb_context *, enum ldb_sequence_type, uint64_t *)
ldb->schema.attribute_handler_override_private = private_data;
ldb->schema.attribute_handler_override = override;
}
+
+/*
+ set that the attribute handler override function - used to delegate
+ schema handling to external code, is handling setting
+ LDB_ATTR_FLAG_INDEXED
+ */
+void ldb_schema_set_override_indexlist(struct ldb_context *ldb,
+ bool one_level_indexes)
+{
+ ldb->schema.index_handler_override = true;
+ ldb->schema.one_level_indexes = one_level_indexes;
+}
*/
#define LDB_ATTR_FLAG_FROM_DB (1<<6)
+/*
+ * The attribute was loaded from a DB, rather than via the C API
+ */
+#define LDB_ATTR_FLAG_INDEXED (1<<7)
+
/**
LDAP attribute syntax for a DN
void ldb_schema_attribute_set_override_handler(struct ldb_context *ldb,
ldb_attribute_handler_override_fn_t override,
void *private_data);
+void ldb_schema_set_override_indexlist(struct ldb_context *ldb,
+ bool one_level_indexes);
/* A useful function to build comparison functions with */
int ldb_any_comparison(struct ldb_context *ldb, void *mem_ctx,
unsigned num_dn_extended_syntax;
struct ldb_dn_extended_syntax *dn_extended_syntax;
+
+ /*
+ * If set, the attribute_handler_override has the details of
+ * what attributes have an index
+ */
+ bool index_handler_override;
+ bool one_level_indexes;
};
/*
struct ltdb_private *ltdb,
const char *attr)
{
+ struct ldb_context *ldb = ldb_module_get_ctx(module);
unsigned int i;
struct ldb_message_element *el;
+ if (ldb->schema.index_handler_override) {
+ const struct ldb_schema_attribute *a
+ = ldb_schema_attribute_by_name(ldb, attr);
+
+ if (a == NULL) {
+ return false;
+ }
+
+ if (a->flags & LDB_ATTR_FLAG_INDEXED) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
if (!ltdb->cache->attribute_indexes) {
return false;
}