summaryrefslogtreecommitdiff
path: root/source4/dsdb/repl
diff options
context:
space:
mode:
authorKamen Mazdrashki <kamenim@samba.org>2010-11-26 02:38:39 +0200
committerKamen Mazdrashki <kamenim@samba.org>2010-12-01 13:01:16 +0200
commit4041791d01b10b250dab5b356f0477fb8a40907e (patch)
tree23352a1fd93e391d72ac3bb5ead4acd0861552dc /source4/dsdb/repl
parent4cd16dde148662700311501e62ba3ee9bf80765a (diff)
downloadsamba-4041791d01b10b250dab5b356f0477fb8a40907e.tar.gz
samba-4041791d01b10b250dab5b356f0477fb8a40907e.tar.bz2
samba-4041791d01b10b250dab5b356f0477fb8a40907e.zip
s4-repl: Let dsdb_replicated_objects_convert() to accept schema from caller
This allows us to use schema that is different than the one set to 'ldb' to decode objects.
Diffstat (limited to 'source4/dsdb/repl')
-rw-r--r--source4/dsdb/repl/drepl_out_helpers.c10
-rw-r--r--source4/dsdb/repl/replicated_objects.c13
2 files changed, 16 insertions, 7 deletions
diff --git a/source4/dsdb/repl/drepl_out_helpers.c b/source4/dsdb/repl/drepl_out_helpers.c
index 2cbf0088a5..d6d9cafdb4 100644
--- a/source4/dsdb/repl/drepl_out_helpers.c
+++ b/source4/dsdb/repl/drepl_out_helpers.c
@@ -541,6 +541,7 @@ static void dreplsrv_op_pull_source_apply_changes_trigger(struct tevent_req *req
struct dreplsrv_service *service = state->op->service;
struct dreplsrv_partition *partition = state->op->source_dsa->partition;
struct dreplsrv_drsuapi_connection *drsuapi = state->op->source_dsa->conn->drsuapi;
+ struct dsdb_schema *schema;
const struct drsuapi_DsReplicaOIDMapping_Ctr *mapping_ctr;
uint32_t object_count;
struct drsuapi_DsReplicaObjectListItemEx *first_object;
@@ -579,7 +580,16 @@ static void dreplsrv_op_pull_source_apply_changes_trigger(struct tevent_req *req
return;
}
+ schema = dsdb_get_schema(service->samdb, NULL);
+ if (!schema) {
+ DEBUG(0,(__location__ ": Schema is not loaded yet!\n"));
+ tevent_req_nterror(req, NT_STATUS_INTERNAL_ERROR);
+ return;
+ }
+ /* TODO (kim): Create working dsdb_schema in case we replicate Schema NC */
+
status = dsdb_replicated_objects_convert(service->samdb,
+ schema,
partition->nc.dn,
mapping_ctr,
object_count,
diff --git a/source4/dsdb/repl/replicated_objects.c b/source4/dsdb/repl/replicated_objects.c
index 58243349b9..8864706934 100644
--- a/source4/dsdb/repl/replicated_objects.c
+++ b/source4/dsdb/repl/replicated_objects.c
@@ -199,6 +199,7 @@ WERROR dsdb_convert_object_ex(struct ldb_context *ldb,
}
WERROR dsdb_replicated_objects_convert(struct ldb_context *ldb,
+ const struct dsdb_schema *schema,
const char *partition_dn_str,
const struct drsuapi_DsReplicaOIDMapping_Ctr *mapping_ctr,
uint32_t object_count,
@@ -213,7 +214,6 @@ WERROR dsdb_replicated_objects_convert(struct ldb_context *ldb,
{
WERROR status;
struct ldb_dn *partition_dn;
- const struct dsdb_schema *schema;
struct dsdb_schema_prefixmap *pfm_remote;
struct dsdb_extended_replicated_objects *out;
const struct drsuapi_DsReplicaObjectListItemEx *cur;
@@ -223,12 +223,11 @@ WERROR dsdb_replicated_objects_convert(struct ldb_context *ldb,
W_ERROR_HAVE_NO_MEMORY(out);
out->version = DSDB_EXTENDED_REPLICATED_OBJECTS_VERSION;
- /* Get the schema, and ensure it's kept valid for as long as 'out' which may contain pointers to it */
- schema = dsdb_get_schema(ldb, out);
- if (!schema) {
- talloc_free(out);
- return WERR_DS_SCHEMA_NOT_LOADED;
- }
+ /*
+ * Ensure schema is kept valid for as long as 'out'
+ * which may contain pointers to it
+ */
+ talloc_reference(out, schema);
partition_dn = ldb_dn_new(out, ldb, partition_dn_str);
W_ERROR_HAVE_NO_MEMORY_AND_FREE(partition_dn, out);