summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamen Mazdrashki <kamenim@samba.org>2010-11-30 01:38:16 +0200
committerKamen Mazdrashki <kamenim@samba.org>2010-12-01 13:01:17 +0200
commitcf8ffc37b42b9b880ba1a0058bd5d0ab984f82b6 (patch)
tree5bde4cc25d4b4ac806032b87807343de3e878f38
parenta42e267105544e63ae28a3c40d96c0ff36b2d070 (diff)
downloadsamba-cf8ffc37b42b9b880ba1a0058bd5d0ab984f82b6.tar.gz
samba-cf8ffc37b42b9b880ba1a0058bd5d0ab984f82b6.tar.bz2
samba-cf8ffc37b42b9b880ba1a0058bd5d0ab984f82b6.zip
s4-dreplsrv: Use working_schema when replicating from Schema NC
Schema is changed and it is quite possible we won't be able to decode replicated objects using current Schema cache we have. Thus, when replicating Schema, we will make a temporary Schema cache, working_schema, so that we can fully decode objects we recieve.
-rw-r--r--source4/dsdb/repl/drepl_out_helpers.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/source4/dsdb/repl/drepl_out_helpers.c b/source4/dsdb/repl/drepl_out_helpers.c
index d6d9cafdb4..f02fae9510 100644
--- a/source4/dsdb/repl/drepl_out_helpers.c
+++ b/source4/dsdb/repl/drepl_out_helpers.c
@@ -542,6 +542,7 @@ static void dreplsrv_op_pull_source_apply_changes_trigger(struct tevent_req *req
struct dreplsrv_partition *partition = state->op->source_dsa->partition;
struct dreplsrv_drsuapi_connection *drsuapi = state->op->source_dsa->conn->drsuapi;
struct dsdb_schema *schema;
+ struct dsdb_schema *working_schema;
const struct drsuapi_DsReplicaOIDMapping_Ctr *mapping_ctr;
uint32_t object_count;
struct drsuapi_DsReplicaObjectListItemEx *first_object;
@@ -586,10 +587,29 @@ static void dreplsrv_op_pull_source_apply_changes_trigger(struct tevent_req *req
tevent_req_nterror(req, NT_STATUS_INTERNAL_ERROR);
return;
}
- /* TODO (kim): Create working dsdb_schema in case we replicate Schema NC */
+
+ /* Decide what working schema to use for object conversion */
+ if (ldb_dn_compare(partition->dn, ldb_get_schema_basedn(service->samdb)) == 0) {
+ /* create working schema to convert objects with */
+ status = dsdb_repl_make_working_schema(service->samdb,
+ schema,
+ mapping_ctr,
+ object_count,
+ first_object,
+ &drsuapi->gensec_skey,
+ state, &working_schema);
+ if (!W_ERROR_IS_OK(status)) {
+ DEBUG(0,("Failed to create working schema: %s",
+ win_errstr(status)));
+ tevent_req_nterror(req, NT_STATUS_INTERNAL_ERROR);
+ return;
+ }
+ } else {
+ working_schema = schema;
+ }
status = dsdb_replicated_objects_convert(service->samdb,
- schema,
+ working_schema,
partition->nc.dn,
mapping_ctr,
object_count,