summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/dsdb/repl/drepl_out_helpers.c10
-rw-r--r--source4/dsdb/repl/replicated_objects.c13
-rw-r--r--source4/libnet/libnet_vampire.c9
-rw-r--r--source4/torture/drs/rpc/dssync.c1
4 files changed, 26 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);
diff --git a/source4/libnet/libnet_vampire.c b/source4/libnet/libnet_vampire.c
index 164dcdec76..1d7d7268ae 100644
--- a/source4/libnet/libnet_vampire.c
+++ b/source4/libnet/libnet_vampire.c
@@ -419,6 +419,7 @@ static NTSTATUS libnet_vampire_cb_apply_schema(struct libnet_vampire_cb_state *s
/* Now convert the schema elements again, using the schema we finalised, ready to actually import */
status = dsdb_replicated_objects_convert(s->ldb,
+ s->schema,
c->partition->nc.dn,
mapping_ctr,
object_count,
@@ -606,6 +607,7 @@ NTSTATUS libnet_vampire_cb_store_chunk(void *private_data,
{
struct libnet_vampire_cb_state *s = talloc_get_type(private_data, struct libnet_vampire_cb_state);
WERROR status;
+ struct dsdb_schema *schema;
const struct drsuapi_DsReplicaOIDMapping_Ctr *mapping_ctr;
uint32_t nc_object_count;
uint32_t object_count;
@@ -685,7 +687,14 @@ NTSTATUS libnet_vampire_cb_store_chunk(void *private_data,
}
+ schema = dsdb_get_schema(s->ldb, NULL);
+ if (!schema) {
+ DEBUG(0,(__location__ ": Schema is not loaded yet!\n"));
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+
status = dsdb_replicated_objects_convert(s->ldb,
+ schema,
c->partition->nc.dn,
mapping_ctr,
object_count,
diff --git a/source4/torture/drs/rpc/dssync.c b/source4/torture/drs/rpc/dssync.c
index 9c65b91719..cd9a733492 100644
--- a/source4/torture/drs/rpc/dssync.c
+++ b/source4/torture/drs/rpc/dssync.c
@@ -341,6 +341,7 @@ static bool test_analyse_objects(struct torture_context *tctx,
ldap_schema = dsdb_get_schema(ldb, NULL);
status = dsdb_replicated_objects_convert(ldb,
+ ldap_schema,
partition,
mapping_ctr,
object_count,