diff options
author | Stefan Metzmacher <metze@samba.org> | 2007-01-07 19:11:27 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:37:12 -0500 |
commit | a04a3b8bc21101e6a11bad04c3d5c9655fa606b4 (patch) | |
tree | 00e0e951d7745815583da34ab11b4dc0beb2e869 /source4/dsdb/samdb/ldb_modules | |
parent | 22f473b22bc2b2aae2b53a180b78c2e891ab956e (diff) | |
download | samba-a04a3b8bc21101e6a11bad04c3d5c9655fa606b4.tar.gz samba-a04a3b8bc21101e6a11bad04c3d5c9655fa606b4.tar.bz2 samba-a04a3b8bc21101e6a11bad04c3d5c9655fa606b4.zip |
r20599: - 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
(This used to be commit 0ed53c6d0f4a4e43ff9c8943730eeb57c735201b)
Diffstat (limited to 'source4/dsdb/samdb/ldb_modules')
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/partition.c | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/partition.c b/source4/dsdb/samdb/ldb_modules/partition.c index 278b727df7..3face5f051 100644 --- a/source4/dsdb/samdb/ldb_modules/partition.c +++ b/source4/dsdb/samdb/ldb_modules/partition.c @@ -2,6 +2,7 @@ Partitions ldb module Copyright (C) Andrew Bartlett <abartlet@samba.org> 2006 + Copyright (C) Stefan Metzmacher <metze@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 @@ static struct ldb_handle *partition_init_handle(struct ldb_request *req, struct 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 @@ static int partition_sequence_number(struct ldb_module *module, struct ldb_reque 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 @@ static const struct ldb_module_ops partition_ops = { .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 }; |