1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

s4:dsdb/repl: make sure the working_schema prefix map is populated with the remote prefix map

We should create the working_schema prefix map before we try to
resolve the schema. This allows getting the same mapping (if there's not already
a conflict) and allows us to remove the implicit prefix mapping creation
in the prefix mapping lookup functions.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12128

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Stefan Metzmacher 2016-08-08 11:07:18 +02:00 committed by Jeremy Allison
parent f905ddc104
commit edeb577a59

View File

@ -291,6 +291,7 @@ WERROR dsdb_repl_make_working_schema(struct ldb_context *ldb,
{
WERROR werr;
struct dsdb_schema_prefixmap *pfm_remote;
uint32_t r;
struct dsdb_schema *working_schema;
/* make a copy of the iniatial_scheam so we don't mess with it */
@ -310,6 +311,40 @@ WERROR dsdb_repl_make_working_schema(struct ldb_context *ldb,
return werr;
}
for (r=0; r < pfm_remote->length; r++) {
const struct dsdb_schema_prefixmap_oid *rm = &pfm_remote->prefixes[r];
bool found_oid = false;
uint32_t l;
for (l=0; l < working_schema->prefixmap->length; l++) {
const struct dsdb_schema_prefixmap_oid *lm = &working_schema->prefixmap->prefixes[l];
int cmp;
cmp = data_blob_cmp(&rm->bin_oid, &lm->bin_oid);
if (cmp == 0) {
found_oid = true;
break;
}
}
if (found_oid) {
continue;
}
/*
* We prefer the same is as we got from the remote peer
* if there's no conflict.
*/
werr = dsdb_schema_pfm_add_entry(working_schema->prefixmap,
rm->bin_oid, &rm->id, NULL);
if (!W_ERROR_IS_OK(werr)) {
DEBUG(0,(__location__ ": Failed to merge remote prefixMap: %s",
win_errstr(werr)));
talloc_free(working_schema);
return werr;
}
}
werr = dsdb_repl_resolve_working_schema(ldb,
pfm_remote,
0, /* cycle_before_switching */