summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb/ldb_modules
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2008-09-27 02:27:54 +0200
committerStefan Metzmacher <metze@samba.org>2008-09-29 04:15:11 +0200
commitee2bcfacdf32b0c55c6a78ae1ad7b55699611d1b (patch)
treebeea7055dd44caa69024cd1efdcee9f0391a9b6c /source4/dsdb/samdb/ldb_modules
parenta9a59f5f3d7f82a8065424310d3b32d796a43e75 (diff)
downloadsamba-ee2bcfacdf32b0c55c6a78ae1ad7b55699611d1b.tar.gz
samba-ee2bcfacdf32b0c55c6a78ae1ad7b55699611d1b.tar.bz2
samba-ee2bcfacdf32b0c55c6a78ae1ad7b55699611d1b.zip
s4:dsdb: passdown DSDB_CONTROL_REPLICATED_UPDATE_OID for replicated updates
We need to make sure replicated updates are handled differently in some situations, e.g. we should bypass the schema checks. metze
Diffstat (limited to 'source4/dsdb/samdb/ldb_modules')
-rw-r--r--source4/dsdb/samdb/ldb_modules/repl_meta_data.c27
-rw-r--r--source4/dsdb/samdb/ldb_modules/schema_fsmo.c10
2 files changed, 34 insertions, 3 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
index dd5faf837a..fbaf461a3f 100644
--- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
+++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
@@ -58,6 +58,9 @@ struct replmd_replicated_request {
struct dsdb_extended_replicated_objects *objs;
+ /* the controls we pass down */
+ struct ldb_control **controls;
+
uint32_t index_current;
struct {
@@ -700,7 +703,7 @@ static int replmd_replicated_apply_add(struct replmd_replicated_request *ar)
ar->module->ldb,
ar->sub.mem_ctx,
msg,
- NULL,
+ ar->controls,
ar,
replmd_replicated_apply_add_callback);
if (ret != LDB_SUCCESS) return replmd_replicated_request_error(ar, ret);
@@ -951,7 +954,7 @@ static int replmd_replicated_apply_merge(struct replmd_replicated_request *ar)
ar->module->ldb,
ar->sub.mem_ctx,
msg,
- NULL,
+ ar->controls,
ar,
replmd_replicated_apply_merge_callback);
if (ret != LDB_SUCCESS) return replmd_replicated_request_error(ar, ret);
@@ -1379,7 +1382,7 @@ static int replmd_replicated_uptodate_modify(struct replmd_replicated_request *a
ar->module->ldb,
ar->sub.mem_ctx,
msg,
- NULL,
+ ar->controls,
ar,
replmd_replicated_uptodate_modify_callback);
if (ret != LDB_SUCCESS) return replmd_replicated_request_error(ar, ret);
@@ -1491,6 +1494,8 @@ static int replmd_extended_replicated_objects(struct ldb_module *module, struct
{
struct dsdb_extended_replicated_objects *objs;
struct replmd_replicated_request *ar;
+ struct ldb_control **ctrls;
+ int ret;
ldb_debug(module->ldb, LDB_DEBUG_TRACE, "replmd_extended_replicated_objects\n");
@@ -1511,6 +1516,22 @@ static int replmd_extended_replicated_objects(struct ldb_module *module, struct
return LDB_ERR_OPERATIONS_ERROR;
}
+ ctrls = req->controls;
+
+ if (req->controls) {
+ req->controls = talloc_memdup(ar, req->controls,
+ talloc_get_size(req->controls));
+ if (!req->controls) return replmd_replicated_request_werror(ar, WERR_NOMEM);
+ }
+
+ ret = ldb_request_add_control(req, DSDB_CONTROL_REPLICATED_UPDATE_OID, false, NULL);
+ if (ret != LDB_SUCCESS) {
+ return ret;
+ }
+
+ ar->controls = req->controls;
+ req->controls = ctrls;
+
#ifdef REPLMD_FULL_ASYNC /* TODO: activate this code when ldb support full async code */
return replmd_replicated_apply_next(ar);
#else
diff --git a/source4/dsdb/samdb/ldb_modules/schema_fsmo.c b/source4/dsdb/samdb/ldb_modules/schema_fsmo.c
index 968b19c038..4b6e9e1d47 100644
--- a/source4/dsdb/samdb/ldb_modules/schema_fsmo.c
+++ b/source4/dsdb/samdb/ldb_modules/schema_fsmo.c
@@ -152,6 +152,16 @@ static int schema_fsmo_add(struct ldb_module *module, struct ldb_request *req)
uint32_t id32;
WERROR status;
+ /* special objects should always go through */
+ if (ldb_dn_is_special(req->op.add.message->dn)) {
+ return ldb_next_request(module, req);
+ }
+
+ /* replicated update should always go through */
+ if (ldb_request_get_control(req, DSDB_CONTROL_REPLICATED_UPDATE_OID)) {
+ return ldb_next_request(module, req);
+ }
+
schema = dsdb_get_schema(module->ldb);
if (!schema) {
return ldb_next_request(module, req);