svn commit: samba r20847 - in branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules: .

metze at samba.org metze at samba.org
Wed Jan 17 13:46:18 GMT 2007


Author: metze
Date: 2007-01-17 13:46:16 +0000 (Wed, 17 Jan 2007)
New Revision: 20847

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=20847

Log:
- split some code out into a new function find_partition()
- make all functions static

metze
Modified:
   branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/partition.c


Changeset:
Modified: branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/partition.c
===================================================================
--- branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/partition.c	2007-01-17 12:59:14 UTC (rev 20846)
+++ branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/partition.c	2007-01-17 13:46:16 UTC (rev 20847)
@@ -84,9 +84,9 @@
 	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,24 +102,43 @@
 	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);
+};
+
+
 /*
   fire the caller's callback for every entry, but only send 'done' once.
 */



More information about the samba-cvs mailing list