message matching logic generic
*/
-#include "ldb_includes.h"
+#include "ldb_private.h"
+#include "ldb_handlers.h"
/*
add a attribute to the ldb_schema
/*
return the attribute handlers for a given attribute
*/
-const struct ldb_schema_attribute *ldb_schema_attribute_by_name(struct ldb_context *ldb,
- const char *name)
+static const struct ldb_schema_attribute *ldb_schema_attribute_by_name_internal(
+ struct ldb_context *ldb,
+ const char *name)
{
int i, e, b = 0, r;
const struct ldb_schema_attribute *def = &ldb_attribute_default;
return def;
}
+/*
+ return the attribute handlers for a given attribute
+*/
+const struct ldb_schema_attribute *ldb_schema_attribute_by_name(struct ldb_context *ldb,
+ const char *name)
+{
+ if (ldb->schema.attribute_handler_override) {
+ const struct ldb_schema_attribute *ret =
+ ldb->schema.attribute_handler_override(ldb,
+ ldb->schema.attribute_handler_override_private,
+ name);
+ if (ret) {
+ return ret;
+ }
+ }
+
+ return ldb_schema_attribute_by_name_internal(ldb, name);
+}
+
/*
add to the list of ldif handlers for this ldb context
const struct ldb_schema_attribute *a;
int i;
- a = ldb_schema_attribute_by_name(ldb, name);
+ a = ldb_schema_attribute_by_name_internal(ldb, name);
if (a == NULL || a->name == NULL) {
return;
}
return NULL;
}
+/*
+ set an attribute handler override function - used to delegate schema handling
+ to external code
+ */
+void ldb_schema_attribute_set_override_handler(struct ldb_context *ldb,
+ ldb_attribute_handler_override_fn_t override,
+ void *private_data)
+{
+ ldb->schema.attribute_handler_override_private = private_data;
+ ldb->schema.attribute_handler_override = override;
+}