From 26af14c39b88b0e7eb53657b89be65d865804688 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 2 Mar 2006 16:32:53 +0000 Subject: r13786: [merge] Add registration functions for LDB modules Applications that use LDB modules will now have to run ldb_global_init() before they can use LDB. The next step will be adding support for loading LDB modules from .so files. This will also allow us to use one LDB without difference between the standalone and the Samba-specific build (This used to be commit 52a235650514039bf8ffee99a784bbc1b6ae6b92) --- source4/lib/ldb/modules/operational.c | 37 ++++++++++++++--------------------- 1 file changed, 15 insertions(+), 22 deletions(-) (limited to 'source4/lib/ldb/modules/operational.c') diff --git a/source4/lib/ldb/modules/operational.c b/source4/lib/ldb/modules/operational.c index 51f0ce25e4..441c899a58 100644 --- a/source4/lib/ldb/modules/operational.c +++ b/source4/lib/ldb/modules/operational.c @@ -400,31 +400,24 @@ static int operational_request(struct ldb_module *module, struct ldb_request *re } } +static int operational_init(struct ldb_module *ctx) +{ + /* setup some standard attribute handlers */ + ldb_set_attrib_handler_syntax(ctx->ldb, "whenCreated", LDB_SYNTAX_UTC_TIME); + ldb_set_attrib_handler_syntax(ctx->ldb, "whenChanged", LDB_SYNTAX_UTC_TIME); + ldb_set_attrib_handler_syntax(ctx->ldb, "subschemaSubentry", LDB_SYNTAX_DN); + ldb_set_attrib_handler_syntax(ctx->ldb, "structuralObjectClass", LDB_SYNTAX_OBJECTCLASS); + + return ldb_next_init(ctx); +} + static const struct ldb_module_ops operational_ops = { .name = "operational", - .request = operational_request + .request = operational_request, + .init_context = operational_init }; - -/* the init function */ -struct ldb_module *operational_module_init(struct ldb_context *ldb, const char *options[]) +int ldb_operational_init(void) { - struct ldb_module *ctx; - - ctx = talloc(ldb, struct ldb_module); - if (!ctx) - return NULL; - - ctx->private_data = NULL; - ctx->ldb = ldb; - ctx->prev = ctx->next = NULL; - ctx->ops = &operational_ops; - - /* setup some standard attribute handlers */ - ldb_set_attrib_handler_syntax(ldb, "whenCreated", LDB_SYNTAX_UTC_TIME); - ldb_set_attrib_handler_syntax(ldb, "whenChanged", LDB_SYNTAX_UTC_TIME); - ldb_set_attrib_handler_syntax(ldb, "subschemaSubentry", LDB_SYNTAX_DN); - ldb_set_attrib_handler_syntax(ldb, "structuralObjectClass", LDB_SYNTAX_OBJECTCLASS); - - return ctx; + return ldb_register_module(&operational_ops); } -- cgit