summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2007-01-17 13:46:16 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:43:39 -0500
commit7730ff44afea09f8765f8efdb7a4e5ad61f19ff4 (patch)
tree20b91fdb07f30bd264f061de2ff0e720274bd4a6 /source4
parent652f0a7ef8986acc26381c05b16c55c9f8c31e3a (diff)
downloadsamba-7730ff44afea09f8765f8efdb7a4e5ad61f19ff4.tar.gz
samba-7730ff44afea09f8765f8efdb7a4e5ad61f19ff4.tar.bz2
samba-7730ff44afea09f8765f8efdb7a4e5ad61f19ff4.zip
r20847: - split some code out into a new function find_partition()
- make all functions static metze (This used to be commit 3d313f08c7d6b201011f3b4744c8e54b1d0640c7)
Diffstat (limited to 'source4')
-rw-r--r--source4/dsdb/samdb/ldb_modules/partition.c35
1 files changed, 27 insertions, 8 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/partition.c b/source4/dsdb/samdb/ldb_modules/partition.c
index a7456c48f1..8a497411df 100644
--- a/source4/dsdb/samdb/ldb_modules/partition.c
+++ b/source4/dsdb/samdb/ldb_modules/partition.c
@@ -84,9 +84,9 @@ static struct partition_context *partition_init_handle(struct ldb_request *req,
return ac;
}
-struct ldb_module *make_module_for_next_request(TALLOC_CTX *mem_ctx,
- struct ldb_context *ldb,
- struct ldb_module *module)
+static struct ldb_module *make_module_for_next_request(TALLOC_CTX *mem_ctx,
+ struct ldb_context *ldb,
+ struct ldb_module *module)
{
struct ldb_module *current;
static const struct ldb_module_ops ops; /* zero */
@@ -102,21 +102,40 @@ struct ldb_module *make_module_for_next_request(TALLOC_CTX *mem_ctx,
return current;
}
-struct ldb_module *find_backend(struct ldb_module *module, struct ldb_request *req, struct ldb_dn *dn)
+static struct dsdb_control_current_partition *find_partition(struct partition_private_data *data,
+ struct ldb_dn *dn)
{
int i;
- struct partition_private_data *data = talloc_get_type(module->private_data,
- struct partition_private_data);
+
/* Look at base DN */
/* Figure out which partition it is under */
/* Skip the lot if 'data' isn't here yet (initialistion) */
for (i=0; data && data->partitions && data->partitions[i]; i++) {
if (ldb_dn_compare_base(data->partitions[i]->dn, dn) == 0) {
- return make_module_for_next_request(req, module->ldb, data->partitions[i]->module);
+ return data->partitions[i];
}
}
- return module;
+ return NULL;
+};
+
+static struct ldb_module *find_backend(struct ldb_module *module, struct ldb_request *req, struct ldb_dn *dn)
+{
+ struct dsdb_control_current_partition *partition;
+ struct partition_private_data *data = talloc_get_type(module->private_data,
+ struct partition_private_data);
+
+ /* Skip the lot if 'data' isn't here yet (initialistion) */
+ if (!data) {
+ return module;
+ }
+
+ partition = find_partition(data, dn);
+ if (!partition) {
+ return module;
+ }
+
+ return make_module_for_next_request(req, module->ldb, partition->module);
};