summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2006-01-06 16:12:45 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:49:48 -0500
commitdbef4d76de92c3388f4e1819a76d6febf90be290 (patch)
tree9de9afa682085de347e6cdd632a9d0e06baa26c7 /source4/dsdb/samdb
parent8f4dc51345dc48f5a6bfb1a49297f205ba53ef0a (diff)
downloadsamba-dbef4d76de92c3388f4e1819a76d6febf90be290.tar.gz
samba-dbef4d76de92c3388f4e1819a76d6febf90be290.tar.bz2
samba-dbef4d76de92c3388f4e1819a76d6febf90be290.zip
r12743: Remove the ugly way we had to make a second stage init and introduce
a second_stage_init private function for modules that need a second stage init. Simo. (This used to be commit 5e8b365fa2d93801a5de1d9ea76ce9d5546bd248)
Diffstat (limited to 'source4/dsdb/samdb')
-rw-r--r--source4/dsdb/samdb/ldb_modules/extended_dn.c41
-rw-r--r--source4/dsdb/samdb/ldb_modules/objectguid.c4
-rw-r--r--source4/dsdb/samdb/ldb_modules/password_hash.c4
-rw-r--r--source4/dsdb/samdb/ldb_modules/proxy.c4
-rw-r--r--source4/dsdb/samdb/ldb_modules/rootdse.c4
-rw-r--r--source4/dsdb/samdb/ldb_modules/samba3sam.c4
-rw-r--r--source4/dsdb/samdb/ldb_modules/samldb.c4
7 files changed, 26 insertions, 39 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/extended_dn.c b/source4/dsdb/samdb/ldb_modules/extended_dn.c
index 49af8604d5..839c190a8e 100644
--- a/source4/dsdb/samdb/ldb_modules/extended_dn.c
+++ b/source4/dsdb/samdb/ldb_modules/extended_dn.c
@@ -266,35 +266,34 @@ static int extended_request(struct ldb_module *module, struct ldb_request *req)
}
}
+static int extended_init_2(struct ldb_module *module)
+{
+ struct ldb_request request;
+ int ret;
+
+ request.operation = LDB_REQ_REGISTER;
+ request.op.reg.oid = LDB_CONTROL_EXTENDED_DN_OID;
+ request.controls = NULL;
+
+ ret = ldb_request(module->ldb, &request);
+ if (ret != LDB_SUCCESS) {
+ ldb_debug(module->ldb, LDB_DEBUG_ERROR, "extended_dn: Unable to register control with rootdse!\n");
+ return LDB_ERR_OTHER;
+ }
+
+ return ldb_next_second_stage_init(module);
+}
+
static const struct ldb_module_ops extended_dn_ops = {
.name = "extended_dn",
.request = extended_request,
+ .second_stage_init = extended_init_2
};
-#ifdef HAVE_DLOPEN_DISABLED
-struct ldb_module *init_module(struct ldb_context *ldb, int stage, const char *options[])
-#else
-struct ldb_module *extended_dn_module_init(struct ldb_context *ldb, int stage, const char *options[])
-#endif
+struct ldb_module *extended_dn_module_init(struct ldb_context *ldb, const char *options[])
{
struct ldb_module *ctx;
- if (stage == LDB_MODULES_INIT_STAGE_2) {
- struct ldb_request request;
- int ret;
-
- request.operation = LDB_REQ_REGISTER;
- request.op.reg.oid = LDB_CONTROL_EXTENDED_DN_OID;
- request.controls = NULL;
-
- ret = ldb_request(ldb, &request);
- if (ret != LDB_SUCCESS) {
- ldb_debug(ldb, LDB_DEBUG_ERROR, "extended_dn: Unable to register control with rootdse!\n");
- }
-
- return NULL;
- }
-
ctx = talloc(ldb, struct ldb_module);
if (!ctx)
return NULL;
diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c
index 935f92c55b..c9063af6ef 100644
--- a/source4/dsdb/samdb/ldb_modules/objectguid.c
+++ b/source4/dsdb/samdb/ldb_modules/objectguid.c
@@ -128,12 +128,10 @@ static const struct ldb_module_ops objectguid_ops = {
/* the init function */
-struct ldb_module *objectguid_module_init(struct ldb_context *ldb, int stage, const char *options[])
+struct ldb_module *objectguid_module_init(struct ldb_context *ldb, const char *options[])
{
struct ldb_module *ctx;
- if (stage != LDB_MODULES_INIT_STAGE_1) return NULL;
-
ctx = talloc(ldb, struct ldb_module);
if (!ctx)
return NULL;
diff --git a/source4/dsdb/samdb/ldb_modules/password_hash.c b/source4/dsdb/samdb/ldb_modules/password_hash.c
index 82e4639a23..2b979857d9 100644
--- a/source4/dsdb/samdb/ldb_modules/password_hash.c
+++ b/source4/dsdb/samdb/ldb_modules/password_hash.c
@@ -717,12 +717,10 @@ static const struct ldb_module_ops password_hash_ops = {
/* the init function */
-struct ldb_module *password_hash_module_init(struct ldb_context *ldb, int stage, const char *options[])
+struct ldb_module *password_hash_module_init(struct ldb_context *ldb, const char *options[])
{
struct ldb_module *ctx;
- if (stage != LDB_MODULES_INIT_STAGE_1) return NULL;
-
ctx = talloc(ldb, struct ldb_module);
if (!ctx)
return NULL;
diff --git a/source4/dsdb/samdb/ldb_modules/proxy.c b/source4/dsdb/samdb/ldb_modules/proxy.c
index 540f4241b9..2c66d2c1ec 100644
--- a/source4/dsdb/samdb/ldb_modules/proxy.c
+++ b/source4/dsdb/samdb/ldb_modules/proxy.c
@@ -333,12 +333,10 @@ static const struct ldb_module_ops proxy_ops = {
.request = proxy_request
};
-struct ldb_module *proxy_module_init(struct ldb_context *ldb, int stage, const char *options[])
+struct ldb_module *proxy_module_init(struct ldb_context *ldb, const char *options[])
{
struct ldb_module *ctx;
- if (stage != LDB_MODULES_INIT_STAGE_1) return NULL;
-
ctx = talloc(ldb, struct ldb_module);
if (!ctx)
return NULL;
diff --git a/source4/dsdb/samdb/ldb_modules/rootdse.c b/source4/dsdb/samdb/ldb_modules/rootdse.c
index 8e0c231301..68de8c884c 100644
--- a/source4/dsdb/samdb/ldb_modules/rootdse.c
+++ b/source4/dsdb/samdb/ldb_modules/rootdse.c
@@ -187,13 +187,11 @@ static const struct ldb_module_ops rootdse_ops = {
.request = rootdse_request
};
-struct ldb_module *rootdse_module_init(struct ldb_context *ldb, int stage, const char *options[])
+struct ldb_module *rootdse_module_init(struct ldb_context *ldb, const char *options[])
{
struct ldb_module *ctx;
struct private_data *data;
- if (stage != LDB_MODULES_INIT_STAGE_1) return NULL;
-
ctx = talloc(ldb, struct ldb_module);
if (!ctx)
return NULL;
diff --git a/source4/dsdb/samdb/ldb_modules/samba3sam.c b/source4/dsdb/samdb/ldb_modules/samba3sam.c
index 035321a90b..429710c2c5 100644
--- a/source4/dsdb/samdb/ldb_modules/samba3sam.c
+++ b/source4/dsdb/samdb/ldb_modules/samba3sam.c
@@ -878,9 +878,7 @@ const struct ldb_map_attribute samba3_attributes[] =
};
/* the init function */
-struct ldb_module *ldb_samba3sam_module_init(struct ldb_context *ldb, int stage, const char *options[])
+struct ldb_module *ldb_samba3sam_module_init(struct ldb_context *ldb, const char *options[])
{
- if (stage != LDB_MODULES_INIT_STAGE_1) return NULL;
-
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 82c2d4d0cc..7bf25994e2 100644
--- a/source4/dsdb/samdb/ldb_modules/samldb.c
+++ b/source4/dsdb/samdb/ldb_modules/samldb.c
@@ -583,12 +583,10 @@ static const struct ldb_module_ops samldb_ops = {
/* the init function */
-struct ldb_module *samldb_module_init(struct ldb_context *ldb, int stage, const char *options[])
+struct ldb_module *samldb_module_init(struct ldb_context *ldb, const char *options[])
{
struct ldb_module *ctx;
- if (stage != LDB_MODULES_INIT_STAGE_1) return NULL;
-
ctx = talloc(ldb, struct ldb_module);
if (!ctx)
return NULL;