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;
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,
}
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,
{
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;
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);
/* 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,
{
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;
}
+ 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,
ldap_schema = dsdb_get_schema(ldb, NULL);
status = dsdb_replicated_objects_convert(ldb,
+ ldap_schema,
partition,
mapping_ctr,
object_count,