NTSTATUS status;
uint32_t replica_flags;
struct drsuapi_DsReplicaHighWaterMark highwatermark;
+ struct ldb_dn *schema_dn = ldb_get_schema_basedn(service->samdb);
r = talloc(state, struct drsuapi_DsGetNCChanges);
if (tevent_req_nomem(r, req)) {
replica_flags &= ~DRSUAPI_DRS_WRIT_REP;
} else if (partition->rodc_replica) {
bool for_schema = false;
- if (ldb_dn_compare_base(ldb_get_schema_basedn(service->samdb), partition->dn) == 0) {
+ if (ldb_dn_compare_base(schema_dn, partition->dn) == 0) {
for_schema = true;
}
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 ldb_dn *schema_dn = ldb_get_schema_basedn(service->samdb);
struct dsdb_schema *schema;
struct dsdb_schema *working_schema = NULL;
const struct drsuapi_DsReplicaOIDMapping_Ctr *mapping_ctr;
* Decide what working schema to use for object conversion.
* We won't need a working schema for empty replicas sent.
*/
- if (first_object && ldb_dn_compare(partition->dn, schema->base_dn) == 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\n",
- win_errstr(status)));
- tevent_req_nterror(req, NT_STATUS_INTERNAL_ERROR);
- return;
+ if (first_object) {
+ bool is_schema = ldb_dn_compare(partition->dn, schema_dn) == 0;
+ if (is_schema) {
+ /* 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\n",
+ win_errstr(status)));
+ tevent_req_nterror(req, NT_STATUS_INTERNAL_ERROR);
+ return;
+ }
}
}
uint64_t mod_usn;
uint64_t mod_usn_urgent;
} *ncs;
+ struct ldb_dn *schema_dn;
};
struct la_entry {
}
ldb_module_set_private(module, replmd_private);
+ replmd_private->schema_dn = ldb_get_schema_basedn(ldb);
+
return ldb_next_init(module);
}
bool remove_current_guid = false;
bool is_urgent = false;
struct ldb_message_element *objectclass_el;
+ struct replmd_private *replmd_private =
+ talloc_get_type_abort(ldb_module_get_private(module), struct replmd_private);
/* check if there's a show relax control (used by provision to say 'I know what I'm doing') */
control = ldb_request_get_control(req, LDB_CONTROL_RELAX_OID);
if (control) {
control->critical = 0;
}
- if (ldb_dn_compare_base(ac->schema->base_dn, req->op.add.message->dn) != 0) {
+ if (ldb_dn_compare_base(replmd_private->schema_dn, req->op.add.message->dn) != 0) {
/* Update the usn in the SAMLDB_MSDS_INTID_OPAQUE opaque */
msds_intid_struct = (struct samldb_msds_intid_persistant *) ldb_get_opaque(ldb, SAMLDB_MSDS_INTID_OPAQUE);
unsigned int functional_level;
const DATA_BLOB *guid_blob;
struct ldb_control *sd_propagation_control;
+ struct replmd_private *replmd_private =
+ talloc_get_type(ldb_module_get_private(module), struct replmd_private);
/* do not manipulate our control entries */
if (ldb_dn_is_special(req->op.mod.message->dn)) {
}
}
- if (!ldb_dn_compare_base(ac->schema->base_dn, msg->dn)) {
+ if (!ldb_dn_compare_base(replmd_private->schema_dn, msg->dn)) {
/* Update the usn in the SAMLDB_MSDS_INTID_OPAQUE opaque */
msds_intid_struct = (struct samldb_msds_intid_persistant *) ldb_get_opaque(ldb, SAMLDB_MSDS_INTID_OPAQUE);
if (msds_intid_struct) {
continue;
}
- ret = dsdb_module_load_partition_usn(ac->module, schema->base_dn, ¤t_usn, NULL, NULL);
+ ret = dsdb_module_load_partition_usn(ac->module, schema_dn,
+ ¤t_usn, NULL, NULL);
if (ret != LDB_SUCCESS) {
ldb_debug_set(ldb, LDB_DEBUG_ERROR,
__location__": Searching for schema USN failed: %s\n",
WERROR status;
bool rodc = false;
int ret;
+ struct schema_data_private_data *mc;
+ mc = talloc_get_type(ldb_module_get_private(module), struct schema_data_private_data);
ldb = ldb_module_get_ctx(module);
return ldb_next_request(module, req);
}
- if (schema->base_dn == NULL) {
- ldb_debug_set(ldb, LDB_DEBUG_FATAL,
- "schema_data_add: base_dn NULL\n");
- return LDB_ERR_OPERATIONS_ERROR;
- }
-
ret = samdb_rodc(ldb, &rodc);
if (ret != LDB_SUCCESS) {
DEBUG(4, (__location__ ": unable to tell if we are an RODC \n"));
* the provision code needs to create
* the schema root object.
*/
- cmp = ldb_dn_compare(req->op.add.message->dn, schema->base_dn);
+ cmp = ldb_dn_compare(req->op.add.message->dn, mc->schema_dn);
if (cmp == 0) {
return ldb_next_request(module, req);
}
return ldb_oom(ldb);
}
- cmp = ldb_dn_compare(parent_dn, schema->base_dn);
+ cmp = ldb_dn_compare(parent_dn, mc->schema_dn);
if (cmp != 0) {
ldb_debug_set(ldb, LDB_DEBUG_ERROR,
"schema_data_add: no direct child :%s\n",
bool rodc = false;
int ret;
struct ldb_control *sd_propagation_control;
+ struct schema_data_private_data *mc;
+ mc = talloc_get_type(ldb_module_get_private(module), struct schema_data_private_data);
ldb = ldb_module_get_ctx(module);
return ldb_next_request(module, req);
}
- cmp = ldb_dn_compare(req->op.mod.message->dn, schema->base_dn);
+ cmp = ldb_dn_compare(req->op.mod.message->dn, mc->schema_dn);
if (cmp == 0) {
static const char * const constrained_attrs[] = {
"schemaInfo",
int ret;
struct ldb_context *ldb = ldb_module_get_ctx(module);
struct dsdb_schema *new_schema;
+ struct ldb_dn *schema_dn = ldb_get_schema_basedn(ldb);
time_t ts, lastts;
struct schema_load_private_data *private_data = talloc_get_type(ldb_module_get_private(module), struct schema_load_private_data);
}
schema->last_refresh = ts;
- ret = dsdb_module_load_partition_usn(module, schema->base_dn, ¤t_usn, NULL, NULL);
+ ret = dsdb_module_load_partition_usn(module, schema_dn, ¤t_usn, NULL, NULL);
if (ret != LDB_SUCCESS || current_usn == schema->loaded_usn) {
return schema;
}
- ret = dsdb_schema_from_db(module, schema->base_dn, current_usn, &new_schema);
+ ret = dsdb_schema_from_db(module, schema_dn, current_usn, &new_schema);
if (ret != LDB_SUCCESS) {
return schema;
}
struct dsdb_schema {
- struct ldb_dn *base_dn;
-
struct dsdb_schema_prefixmap *prefixmap;
/*
return NULL;
}
- /* schema base_dn */
- schema_copy->base_dn = ldb_dn_copy(schema_copy, schema->base_dn);
- if (!schema_copy->base_dn) {
- goto failed;
- }
-
/* copy prexiMap & schemaInfo */
schema_copy->prefixmap = dsdb_schema_pfm_copy_shallow(schema_copy,
schema->prefixmap);
false);
}
- schema->base_dn = talloc_steal(schema, schema_res->msgs[0]->dn);
-
prefix_val = ldb_msg_find_ldb_val(schema_res->msgs[0], "prefixMap");
if (!prefix_val) {
*error_string = talloc_asprintf(mem_ctx,
if (!schema) {
goto nomem;
}
- schema->base_dn = ldb_dn_new(schema, ldb, dn);
- if (!schema->base_dn) {
- goto nomem;
- }
schema->fsmo.we_are_master = true;
schema->fsmo.update_allowed = true;
schema->fsmo.master_dn = ldb_dn_new(schema, ldb, "@PROVISION_SCHEMA_MASTER");
s->self_made_schema = dsdb_new_schema(s);
NT_STATUS_HAVE_NO_MEMORY(s->self_made_schema);
- s->self_made_schema->base_dn = ldb_dn_new(s->self_made_schema,
- s->ldb,
- c->forest->schema_dn_str);
- NT_STATUS_HAVE_NO_MEMORY(s->self_made_schema->base_dn);
-
status = dsdb_load_prefixmap_from_drsuapi(s->self_made_schema, mapping_ctr);
if (!W_ERROR_IS_OK(status)) {
return werror_to_ntstatus(status);