summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/modules
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/ldb/modules')
-rw-r--r--source4/lib/ldb/modules/asq.c21
-rw-r--r--source4/lib/ldb/modules/objectclass.c16
-rw-r--r--source4/lib/ldb/modules/operational.c37
-rw-r--r--source4/lib/ldb/modules/paged_results.c46
-rw-r--r--source4/lib/ldb/modules/rdn_name.c16
-rw-r--r--source4/lib/ldb/modules/schema.c16
-rw-r--r--source4/lib/ldb/modules/skel.c46
-rw-r--r--source4/lib/ldb/modules/sort.c21
8 files changed, 66 insertions, 153 deletions
diff --git a/source4/lib/ldb/modules/asq.c b/source4/lib/ldb/modules/asq.c
index 2975f4d832..33ba9bed04 100644
--- a/source4/lib/ldb/modules/asq.c
+++ b/source4/lib/ldb/modules/asq.c
@@ -210,7 +210,7 @@ static int asq(struct ldb_module *module, struct ldb_request *req)
}
}
-static int asq_init_2(struct ldb_module *module)
+static int asq_init(struct ldb_module *module)
{
struct ldb_request request;
int ret;
@@ -225,28 +225,17 @@ static int asq_init_2(struct ldb_module *module)
return LDB_ERR_OTHER;
}
- return ldb_next_second_stage_init(module);
+ return ldb_next_init(module);
}
static const struct ldb_module_ops asq_ops = {
.name = "asq",
.request = asq,
- .second_stage_init = asq_init_2
+ .init_context = asq_init
};
-struct ldb_module *asq_module_init(struct ldb_context *ldb, const char *options[])
+int ldb_asq_init(void)
{
- struct ldb_module *ctx;
-
- ctx = talloc(ldb, struct ldb_module);
- if (!ctx)
- return NULL;
-
- ctx->ldb = ldb;
- ctx->prev = ctx->next = NULL;
- ctx->ops = &asq_ops;
- ctx->private_data = NULL;
-
- return ctx;
+ return ldb_register_module(&asq_ops);
}
diff --git a/source4/lib/ldb/modules/objectclass.c b/source4/lib/ldb/modules/objectclass.c
index 8b4ad598cc..a9c51341a8 100644
--- a/source4/lib/ldb/modules/objectclass.c
+++ b/source4/lib/ldb/modules/objectclass.c
@@ -302,19 +302,7 @@ static const struct ldb_module_ops objectclass_ops = {
.request = objectclass_request,
};
-struct ldb_module *objectclass_module_init(struct ldb_context *ldb, const char *options[])
+int ldb_objectclass_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 = &objectclass_ops;
-
- return ctx;
+ return ldb_register_module(&objectclass_ops);
}
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);
}
diff --git a/source4/lib/ldb/modules/paged_results.c b/source4/lib/ldb/modules/paged_results.c
index c4aad4500e..9d6a50e27f 100644
--- a/source4/lib/ldb/modules/paged_results.c
+++ b/source4/lib/ldb/modules/paged_results.c
@@ -247,10 +247,20 @@ static int paged_request(struct ldb_module *module, struct ldb_request *req)
}
}
-static int paged_request_init_2(struct ldb_module *module)
+static int paged_request_init(struct ldb_module *module)
{
struct ldb_request request;
int ret;
+ struct private_data *data;
+
+ data = talloc(module, struct private_data);
+ if (data == NULL) {
+ return LDB_ERR_OTHER;
+ }
+
+ data->next_free_id = 1;
+ data->store = NULL;
+ module->private_data = data;
request.operation = LDB_REQ_REGISTER;
request.op.reg.oid = LDB_CONTROL_PAGED_RESULTS_OID;
@@ -262,37 +272,17 @@ static int paged_request_init_2(struct ldb_module *module)
return LDB_ERR_OTHER;
}
- return ldb_next_second_stage_init(module);
+ return ldb_next_init(module);
}
static const struct ldb_module_ops paged_ops = {
- .name = "paged_results",
- .request = paged_request,
- .second_stage_init = paged_request_init_2
+ .name = "paged_results",
+ .request = paged_request,
+ .init_context = paged_request_init
};
-struct ldb_module *paged_results_module_init(struct ldb_context *ldb, const char *options[])
+int ldb_paged_results_init(void)
{
- struct ldb_module *ctx;
- struct private_data *data;
-
- ctx = talloc(ldb, struct ldb_module);
- if (!ctx)
- return NULL;
-
- data = talloc(ctx, struct private_data);
- if (data == NULL) {
- talloc_free(ctx);
- return NULL;
- }
-
- data->next_free_id = 1;
- data->store = NULL;
- ctx->private_data = data;
-
- ctx->ldb = ldb;
- ctx->prev = ctx->next = NULL;
- ctx->ops = &paged_ops;
-
- return ctx;
+ return ldb_register_module(&paged_ops);
}
+
diff --git a/source4/lib/ldb/modules/rdn_name.c b/source4/lib/ldb/modules/rdn_name.c
index 2e4e250755..59930046ce 100644
--- a/source4/lib/ldb/modules/rdn_name.c
+++ b/source4/lib/ldb/modules/rdn_name.c
@@ -211,19 +211,7 @@ static const struct ldb_module_ops rdn_name_ops = {
};
-/* the init function */
-struct ldb_module *rdn_name_module_init(struct ldb_context *ldb, const char *options[])
+int ldb_rdn_name_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 = &rdn_name_ops;
-
- return ctx;
+ return ldb_register_module(&rdn_name_ops);
}
diff --git a/source4/lib/ldb/modules/schema.c b/source4/lib/ldb/modules/schema.c
index 9bf9a4d2c5..73b07023da 100644
--- a/source4/lib/ldb/modules/schema.c
+++ b/source4/lib/ldb/modules/schema.c
@@ -482,19 +482,7 @@ static const struct ldb_module_ops schema_ops = {
.request = schema_request
};
-struct ldb_module *schema_module_init(struct ldb_context *ldb, const char *options[])
+int ldb_schema_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 = &schema_ops;
-
- return ctx;
+ return ldb_register_module(&schema_ops);
}
diff --git a/source4/lib/ldb/modules/skel.c b/source4/lib/ldb/modules/skel.c
index e9b76be2ba..0089433b37 100644
--- a/source4/lib/ldb/modules/skel.c
+++ b/source4/lib/ldb/modules/skel.c
@@ -122,45 +122,33 @@ static int skel_request(struct ldb_module *module, struct ldb_request *req)
}
}
-static int skel_init_2(struct ldb_module *module)
+static int skel_init(struct ldb_module *ctx)
{
- /* second stage init stuff */
- /* see control modules as example */
- return ldb_next_second_stage_init(module);
-}
-
-static const struct ldb_module_ops skel_ops = {
- .name = "skel",
- .request = skel_request,
- .start_transaction = skel_start_trans,
- .end_transaction = skel_end_trans,
- .del_transaction = skel_del_trans,
- .second_stage_init = skel_init_2
-};
-
-struct ldb_module *skel_module_init(struct ldb_context *ldb, const char *options[])
-{
- struct ldb_module *ctx;
struct private_data *data;
- ctx = talloc(ldb, struct ldb_module);
- if (!ctx)
- return NULL;
-
data = talloc(ctx, struct private_data);
if (data == NULL) {
- talloc_free(ctx);
- return NULL;
+ return 1;
}
data->some_private_data = NULL;
ctx->private_data = data;
- ctx->ldb = ldb;
- ctx->prev = ctx->next = NULL;
- ctx->ops = &skel_ops;
-
talloc_set_destructor (ctx, skel_destructor);
- return ctx;
+ return ldb_next_init(ctx);
+}
+
+static const struct ldb_module_ops skel_ops = {
+ .name = "skel",
+ .init_context = skel_init,
+ .request = skel_request,
+ .start_transaction = skel_start_trans,
+ .end_transaction = skel_end_trans,
+ .del_transaction = skel_del_trans,
+};
+
+int ldb_skel_init(void)
+{
+ return ldb_register_module(&skel_ops);
}
diff --git a/source4/lib/ldb/modules/sort.c b/source4/lib/ldb/modules/sort.c
index ac9f1081de..d01e468956 100644
--- a/source4/lib/ldb/modules/sort.c
+++ b/source4/lib/ldb/modules/sort.c
@@ -228,7 +228,7 @@ static int server_sort(struct ldb_module *module, struct ldb_request *req)
}
}
-static int server_sort_init_2(struct ldb_module *module)
+static int server_sort_init(struct ldb_module *module)
{
struct ldb_request request;
int ret;
@@ -243,27 +243,16 @@ static int server_sort_init_2(struct ldb_module *module)
return LDB_ERR_OTHER;
}
- return ldb_next_second_stage_init(module);
+ return ldb_next_init(module);
}
static const struct ldb_module_ops server_sort_ops = {
.name = "server_sort",
.request = server_sort,
- .second_stage_init = server_sort_init_2
+ .init_context = server_sort_init
};
-struct ldb_module *server_sort_module_init(struct ldb_context *ldb, const char *options[])
+int ldb_sort_init(void)
{
- struct ldb_module *ctx;
-
- ctx = talloc(ldb, struct ldb_module);
- if (!ctx)
- return NULL;
-
- ctx->ldb = ldb;
- ctx->prev = ctx->next = NULL;
- ctx->ops = &server_sort_ops;
- ctx->private_data = NULL;
-
- return ctx;
+ return ldb_register_module(&server_sort_ops);
}