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

metze at samba.org metze at samba.org
Sun Jan 7 19:11:27 GMT 2007


Author: metze
Date: 2007-01-07 19:11:27 +0000 (Sun, 07 Jan 2007)
New Revision: 20599

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

Log:
- forward extended operations in the partitions module
- by default the operations goes to all partitions
- but some wellkown ones will go to just one partition
  (DSDB_EXTENDED_REPLICATED_OBJECTS_OID for now)

I'll soon change the partitions module so that it'll attach a
DSDB_CONTROL_PARTITION_CONTEXT_OID control to give
the repl_meta_data or other partition specific modules a chance to
to know for which partition it should work.

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


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-07 19:04:40 UTC (rev 20598)
+++ branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/partition.c	2007-01-07 19:11:27 UTC (rev 20599)
@@ -2,6 +2,7 @@
    Partitions ldb module
 
    Copyright (C) Andrew Bartlett <abartlet at samba.org> 2006
+   Copyright (C) Stefan Metzmacher <metze at samba.org> 2007
 
    * NOTICE: this module is NOT released under the GNU LGPL license as
    * other ldb code. This module is release under the GNU GPL v2 or
@@ -30,10 +31,12 @@
  *  Description: Implement LDAP partitions
  *
  *  Author: Andrew Bartlett
+ *  Author: Stefan Metzmacher
  */
 
 #include "includes.h"
 #include "ldb/include/includes.h"
+#include "dsdb/samdb/samdb.h"
 
 struct partition {
 	struct ldb_module *module;
@@ -84,7 +87,7 @@
 
 struct ldb_module *make_module_for_next_request(TALLOC_CTX *mem_ctx, 
 						struct ldb_context *ldb,
-						struct ldb_module *module) 
+						struct ldb_module *module)
 {
 	struct ldb_module *current;
 	static const struct ldb_module_ops ops; /* zero */
@@ -568,6 +571,45 @@
 	return LDB_SUCCESS;
 }
 
+static int partition_extended_replicated_objects(struct ldb_module *module, struct ldb_request *req)
+{
+	struct dsdb_extended_replicated_objects *ext;
+
+	ext = talloc_get_type(req->op.extended.data, struct dsdb_extended_replicated_objects);
+	if (!ext) {
+		return LDB_ERR_OTHER;
+	}
+
+	return partition_replicate(module, req, ext->partition_dn);
+}
+
+/* extended */
+static int partition_extended(struct ldb_module *module, struct ldb_request *req)
+{
+	struct ldb_handle *h;
+	struct partition_context *ac;
+
+	if (strcmp(req->op.extended.oid, DSDB_EXTENDED_REPLICATED_OBJECTS_OID) == 0) {
+		return partition_extended_replicated_objects(module, req);
+	}
+
+	/* 
+	 * as the extended operation has no dn
+	 * we need to send it to all partitions
+	 */
+
+	h = partition_init_handle(req, module);
+	if (!h) {
+		return LDB_ERR_OPERATIONS_ERROR;
+	}
+	/* return our own handle to deal with this call */
+	req->handle = h;
+			
+	ac = talloc_get_type(h->private_data, struct partition_context);
+			
+	return partition_send_all(module, ac, req);
+}
+
 static int sort_compare(void *void1,
 			void *void2, void *opaque)
 {
@@ -878,10 +920,11 @@
 	.modify            = partition_modify,
 	.del               = partition_delete,
 	.rename            = partition_rename,
+	.extended          = partition_extended,
+	.sequence_number   = partition_sequence_number,
 	.start_transaction = partition_start_trans,
 	.end_transaction   = partition_end_trans,
 	.del_transaction   = partition_del_trans,
-	.sequence_number   = partition_sequence_number,
 	.wait              = partition_wait
 };
 

Modified: branches/SAMBA_4_0/source/dsdb/samdb/samdb.h
===================================================================
--- branches/SAMBA_4_0/source/dsdb/samdb/samdb.h	2007-01-07 19:04:40 UTC (rev 20598)
+++ branches/SAMBA_4_0/source/dsdb/samdb/samdb.h	2007-01-07 19:11:27 UTC (rev 20599)
@@ -28,6 +28,7 @@
 struct drsuapi_DsReplicaObject;
 struct drsuapi_DsReplicaOIDMapping_Ctr;
 struct drsuapi_DsReplicaAttribute;
+struct ldb_dn;
 
 #define DSDB_CONTROL_REPLICATED_OBJECT_OID "1.3.6.1.4.1.7165.4.3.1"
 struct dsdb_control_replicated_object {
@@ -36,7 +37,7 @@
 
 #define DSDB_EXTENDED_REPLICATED_OBJECTS_OID "1.3.6.1.4.1.7165.4.4.1"
 struct dsdb_extended_replicated_objects {
-	uint8_t __dummy;
+	struct ldb_dn *partition_dn;
 };
 
 #include "librpc/gen_ndr/security.h"



More information about the samba-cvs mailing list