summaryrefslogtreecommitdiff
path: root/source4/dsdb
diff options
context:
space:
mode:
Diffstat (limited to 'source4/dsdb')
-rw-r--r--source4/dsdb/samdb/ldb_modules/config.mk9
-rw-r--r--source4/dsdb/samdb/ldb_modules/extended_dn.c21
-rw-r--r--source4/dsdb/samdb/ldb_modules/kludge_acl.c39
-rw-r--r--source4/dsdb/samdb/ldb_modules/objectguid.c16
-rw-r--r--source4/dsdb/samdb/ldb_modules/password_hash.c16
-rw-r--r--source4/dsdb/samdb/ldb_modules/proxy.c19
-rw-r--r--source4/dsdb/samdb/ldb_modules/rootdse.c34
-rw-r--r--source4/dsdb/samdb/ldb_modules/samba3sam.c4
-rw-r--r--source4/dsdb/samdb/ldb_modules/samldb.c25
9 files changed, 59 insertions, 124 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/config.mk b/source4/dsdb/samdb/ldb_modules/config.mk
index c53c7c1606..e14b9bfecf 100644
--- a/source4/dsdb/samdb/ldb_modules/config.mk
+++ b/source4/dsdb/samdb/ldb_modules/config.mk
@@ -2,6 +2,7 @@
# Start MODULE libldb_objectguid
[MODULE::libldb_objectguid]
SUBSYSTEM = LIBLDB
+INIT_FUNCTION = objectguid_module_init
OUTPUT_TYPE = MERGEDOBJ
OBJ_FILES = \
objectguid.o
@@ -14,6 +15,7 @@ REQUIRED_SUBSYSTEMS = \
# Start MODULE libldb_samldb
[MODULE::libldb_samldb]
SUBSYSTEM = LIBLDB
+INIT_FUNCTION = samldb_module_init
OUTPUT_TYPE = MERGEDOBJ
OBJ_FILES = \
samldb.o
@@ -26,6 +28,8 @@ REQUIRED_SUBSYSTEMS = SAMDB
# Start MODULE libldb_samba3sam
[MODULE::libldb_samba3sam]
SUBSYSTEM = LIBLDB
+INIT_FUNCTION = ldb_samba3sam_module_init
+ENABLE = NO
OUTPUT_TYPE = MERGEDOBJ
OBJ_FILES = \
samba3sam.o
@@ -37,6 +41,7 @@ OBJ_FILES = \
# Start MODULE libldb_proxy
[MODULE::libldb_proxy]
SUBSYSTEM = LIBLDB
+INIT_FUNCTION = proxy_module_init
OUTPUT_TYPE = MERGEDOBJ
OBJ_FILES = \
proxy.o
@@ -49,6 +54,7 @@ OBJ_FILES = \
# Start MODULE libldb_rootdse
[MODULE::libldb_rootdse]
SUBSYSTEM = LIBLDB
+INIT_FUNCTION = rootdse_module_init
OUTPUT_TYPE = MERGEDOBJ
OBJ_FILES = \
rootdse.o
@@ -60,6 +66,7 @@ OBJ_FILES = \
# Start MODULE libldb_password_hash
[MODULE::libldb_password_hash]
SUBSYSTEM = LIBLDB
+INIT_FUNCTION = password_hash_module_init
OUTPUT_TYPE = MERGEDOBJ
OBJ_FILES = \
password_hash.o
@@ -73,6 +80,7 @@ REQUIRED_SUBSYSTEMS = \
# Start MODULE libldb_cludge_acl
[MODULE::libldb_kludge_acl]
SUBSYSTEM = LIBLDB
+INIT_FUNCTION = ldb_kludge_acl_init
OUTPUT_TYPE = MERGEDOBJ
OBJ_FILES = \
kludge_acl.o
@@ -86,6 +94,7 @@ REQUIRED_SUBSYSTEMS = \
# Start MODULE libldb_extended_dn
[MODULE::libldb_extended_dn]
SUBSYSTEM = LIBLDB
+INIT_FUNCTION = ldb_extended_dn_init
OUTPUT_TYPE = MERGEDOBJ
OBJ_FILES = \
extended_dn.o
diff --git a/source4/dsdb/samdb/ldb_modules/extended_dn.c b/source4/dsdb/samdb/ldb_modules/extended_dn.c
index 9795758dc2..5b288aa311 100644
--- a/source4/dsdb/samdb/ldb_modules/extended_dn.c
+++ b/source4/dsdb/samdb/ldb_modules/extended_dn.c
@@ -269,7 +269,7 @@ static int extended_request(struct ldb_module *module, struct ldb_request *req)
}
}
-static int extended_init_2(struct ldb_module *module)
+static int extended_init(struct ldb_module *module)
{
struct ldb_request request;
int ret;
@@ -284,27 +284,16 @@ static int extended_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 extended_dn_ops = {
.name = "extended_dn",
.request = extended_request,
- .second_stage_init = extended_init_2
+ .init_context = extended_init
};
-struct ldb_module *extended_dn_module_init(struct ldb_context *ldb, const char *options[])
+int ldb_extended_dn_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 = &extended_dn_ops;
- ctx->private_data = NULL;
-
- return ctx;
+ return ldb_register_module(&extended_dn_ops);
}
diff --git a/source4/dsdb/samdb/ldb_modules/kludge_acl.c b/source4/dsdb/samdb/ldb_modules/kludge_acl.c
index 9ce3217104..4c680df3e6 100644
--- a/source4/dsdb/samdb/ldb_modules/kludge_acl.c
+++ b/source4/dsdb/samdb/ldb_modules/kludge_acl.c
@@ -175,7 +175,7 @@ static int kludge_acl_request(struct ldb_module *module, struct ldb_request *req
}
}
-static int kludge_acl_init_2(struct ldb_module *module)
+static int kludge_acl_init(struct ldb_module *module)
{
int ret, i;
TALLOC_CTX *mem_ctx = talloc_new(module);
@@ -184,8 +184,15 @@ static int kludge_acl_init_2(struct ldb_module *module)
struct ldb_message *msg;
struct ldb_message_element *password_attributes;
- struct kludge_private_data *data = talloc_get_type(module->private_data, struct kludge_private_data);
+ struct kludge_private_data *data;
+
+ data = talloc(module, struct kludge_private_data);
+ if (data == NULL) {
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+
data->password_attrs = NULL;
+ module->private_data = data;
if (!mem_ctx) {
return LDB_ERR_OPERATIONS_ERROR;
@@ -227,7 +234,7 @@ static int kludge_acl_init_2(struct ldb_module *module)
done:
talloc_free(mem_ctx);
- return ldb_next_second_stage_init(module);
+ return ldb_next_init(module);
}
static const struct ldb_module_ops kludge_acl_ops = {
@@ -236,30 +243,10 @@ static const struct ldb_module_ops kludge_acl_ops = {
.start_transaction = kludge_acl_start_trans,
.end_transaction = kludge_acl_end_trans,
.del_transaction = kludge_acl_del_trans,
- .second_stage_init = kludge_acl_init_2
+ .init_context = kludge_acl_init
};
-struct ldb_module *kludge_acl_module_init(struct ldb_context *ldb, const char *options[])
+int ldb_kludge_acl_init(void)
{
- struct ldb_module *ctx;
- struct kludge_private_data *data;
-
- ctx = talloc(ldb, struct ldb_module);
- if (!ctx)
- return NULL;
-
- data = talloc(ctx, struct kludge_private_data);
- if (data == NULL) {
- talloc_free(ctx);
- return NULL;
- }
-
- data->password_attrs = NULL;
- ctx->private_data = data;
-
- ctx->ldb = ldb;
- ctx->prev = ctx->next = NULL;
- ctx->ops = &kludge_acl_ops;
-
- return ctx;
+ return ldb_register_module(&kludge_acl_ops);
}
diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c
index c9063af6ef..7169aa6842 100644
--- a/source4/dsdb/samdb/ldb_modules/objectguid.c
+++ b/source4/dsdb/samdb/ldb_modules/objectguid.c
@@ -127,19 +127,7 @@ static const struct ldb_module_ops objectguid_ops = {
};
-/* the init function */
-struct ldb_module *objectguid_module_init(struct ldb_context *ldb, const char *options[])
+int objectguid_module_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 = &objectguid_ops;
-
- return ctx;
+ return ldb_register_module(&objectguid_ops);
}
diff --git a/source4/dsdb/samdb/ldb_modules/password_hash.c b/source4/dsdb/samdb/ldb_modules/password_hash.c
index e28c85ae37..414f79ea10 100644
--- a/source4/dsdb/samdb/ldb_modules/password_hash.c
+++ b/source4/dsdb/samdb/ldb_modules/password_hash.c
@@ -731,19 +731,7 @@ static const struct ldb_module_ops password_hash_ops = {
};
-/* the init function */
-struct ldb_module *password_hash_module_init(struct ldb_context *ldb, const char *options[])
+int password_hash_module_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 = &password_hash_ops;
-
- return ctx;
+ return ldb_register_module(&password_hash_ops);
}
diff --git a/source4/dsdb/samdb/ldb_modules/proxy.c b/source4/dsdb/samdb/ldb_modules/proxy.c
index 511f9aeec5..85b40b62d1 100644
--- a/source4/dsdb/samdb/ldb_modules/proxy.c
+++ b/source4/dsdb/samdb/ldb_modules/proxy.c
@@ -333,22 +333,7 @@ static const struct ldb_module_ops proxy_ops = {
.request = proxy_request
};
-struct ldb_module *proxy_module_init(struct ldb_context *ldb, const char *options[])
+int proxy_module_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 = &proxy_ops;
-
- ctx->private_data = talloc_zero(ctx, struct proxy_data);
- if (ctx->private_data == NULL) {
- return NULL;
- }
-
- return ctx;
+ return ldb_register_module(&proxy_ops);
}
diff --git a/source4/dsdb/samdb/ldb_modules/rootdse.c b/source4/dsdb/samdb/ldb_modules/rootdse.c
index 987fd7a7f1..69b1648040 100644
--- a/source4/dsdb/samdb/ldb_modules/rootdse.c
+++ b/source4/dsdb/samdb/ldb_modules/rootdse.c
@@ -199,34 +199,30 @@ static int rootdse_request(struct ldb_module *module, struct ldb_request *req)
return ldb_next_request(module, req);
}
-static const struct ldb_module_ops rootdse_ops = {
- .name = "rootdse",
- .request = rootdse_request
-};
-
-struct ldb_module *rootdse_module_init(struct ldb_context *ldb, const char *options[])
+static int rootdse_init(struct ldb_module *module)
{
- struct ldb_module *ctx;
struct private_data *data;
- ctx = talloc(ldb, struct ldb_module);
- if (!ctx)
- return NULL;
-
- data = talloc(ctx, struct private_data);
+ data = talloc(module, struct private_data);
if (data == NULL) {
- talloc_free(ctx);
- return NULL;
+ return -1;
}
data->num_controls = 0;
data->controls = NULL;
- ctx->private_data = data;
+ module->private_data = data;
- ctx->ldb = ldb;
- ctx->prev = ctx->next = NULL;
- ctx->ops = &rootdse_ops;
+ return ldb_next_init(module);
+}
- return ctx;
+static const struct ldb_module_ops rootdse_ops = {
+ .name = "rootdse",
+ .init_context = rootdse_init,
+ .request = rootdse_request
+};
+
+int rootdse_module_init(void)
+{
+ return ldb_register_module(&rootdse_ops);
}
diff --git a/source4/dsdb/samdb/ldb_modules/samba3sam.c b/source4/dsdb/samdb/ldb_modules/samba3sam.c
index 3f593235fa..06774780a1 100644
--- a/source4/dsdb/samdb/ldb_modules/samba3sam.c
+++ b/source4/dsdb/samdb/ldb_modules/samba3sam.c
@@ -855,8 +855,8 @@ const struct ldb_map_attribute samba3_attributes[] =
}
};
- /* the init function */
-struct ldb_module *ldb_samba3sam_module_init(struct ldb_context *ldb, const char *options[])
+/* the init function */
+int ldb_samba3sam_module_init(void)
{
return ldb_map_init(ldb, samba3_attributes, samba3_objectclasses, "samba3sam");
}
diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c
index a582127bbe..3355df4e23 100644
--- a/source4/dsdb/samdb/ldb_modules/samldb.c
+++ b/source4/dsdb/samdb/ldb_modules/samldb.c
@@ -819,27 +819,20 @@ static int samldb_request(struct ldb_module *module, struct ldb_request *req)
}
}
+static int samldb_init(struct ldb_module *module)
+{
+ talloc_set_destructor(module, samldb_destructor);
+ return ldb_next_init(module);
+}
+
static const struct ldb_module_ops samldb_ops = {
.name = "samldb",
+ .init_context = samldb_init,
.request = samldb_request
};
-/* the init function */
-struct ldb_module *samldb_module_init(struct ldb_context *ldb, const char *options[])
+int samldb_module_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 = &samldb_ops;
-
- talloc_set_destructor(ctx, samldb_destructor);
-
- return ctx;
+ return ldb_register_module(&samldb_ops);
}