diff options
author | Andrew Bartlett <abartlet@samba.org> | 2016-03-21 15:49:33 +1300 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2016-06-06 08:50:09 +0200 |
commit | 65a35acbf33dd6dfd6ba6b2fb76580126829b597 (patch) | |
tree | 156239cd3b6c59b846e1e56300342fbb4dde7be9 /source4/libnet/libnet_vampire.c | |
parent | 5967852aa085cd13784b4f994122a78d2ab64845 (diff) | |
download | samba-65a35acbf33dd6dfd6ba6b2fb76580126829b597.tar.gz |
repl: Pass in the full partition DN to dsdb_replicated_objects_convert()
When we were processing an EXOP, we would pass in a DN specific to that
operation, but this stopped repl_meta_data from finding the parent object
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Diffstat (limited to 'source4/libnet/libnet_vampire.c')
-rw-r--r-- | source4/libnet/libnet_vampire.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/source4/libnet/libnet_vampire.c b/source4/libnet/libnet_vampire.c index 97c6d1a009d..0d4d69f7cf2 100644 --- a/source4/libnet/libnet_vampire.c +++ b/source4/libnet/libnet_vampire.c @@ -232,6 +232,7 @@ static NTSTATUS libnet_vampire_cb_apply_schema(struct libnet_vampire_cb_state *s struct repsFromTo1 *s_dsa; char *tmp_dns_name; struct ldb_context *schema_ldb; + struct ldb_dn *partition_dn; struct ldb_message *msg; struct ldb_message_element *prefixMap_el; uint32_t i; @@ -361,10 +362,16 @@ static NTSTATUS libnet_vampire_cb_apply_schema(struct libnet_vampire_cb_state *s s->schema = s->self_made_schema; s->self_made_schema = NULL; + partition_dn = ldb_dn_new(s, s->ldb, c->partition->nc.dn); + if (partition_dn == NULL) { + DEBUG(0,("Failed to parse partition DN from DRS.\n")); + return NT_STATUS_FOOBAR; + } + /* 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, + partition_dn, mapping_ctr, object_count, first_object, @@ -559,6 +566,8 @@ NTSTATUS libnet_vampire_cb_store_chunk(void *private_data, uint32_t i; uint64_t seq_num; bool is_exop = false; + struct ldb_dn *partition_dn = NULL; + struct ldb_dn *nc_root = NULL; s_dsa = talloc_zero(s, struct repsFromTo1); NT_STATUS_HAVE_NO_MEMORY(s_dsa); @@ -653,7 +662,14 @@ NTSTATUS libnet_vampire_cb_store_chunk(void *private_data, } s->total_objects += object_count; + partition_dn = ldb_dn_new(s, s->ldb, c->partition->nc.dn); + if (partition_dn == NULL) { + DEBUG(0,("Failed to parse partition DN from DRS.\n")); + return NT_STATUS_FOOBAR; + } + if (is_exop) { + int ret; if (nc_object_count) { DEBUG(0,("Exop on[%s] objects[%u/%u] linked_values[%u/%u]\n", c->partition->nc.dn, s->total_objects, nc_object_count, @@ -662,6 +678,13 @@ NTSTATUS libnet_vampire_cb_store_chunk(void *private_data, DEBUG(0,("Exop on[%s] objects[%u] linked_values[%u]\n", c->partition->nc.dn, s->total_objects, linked_attributes_count)); } + ret = dsdb_find_nc_root(s->ldb, s, + partition_dn, &nc_root); + if (ret != LDB_SUCCESS) { + DEBUG(0,(__location__ ": Failed to find nc_root for %s\n", + ldb_dn_get_linearized(partition_dn))); + return NT_STATUS_INTERNAL_ERROR; + } } else { if (nc_object_count) { DEBUG(0,("Partition[%s] objects[%u/%u] linked_values[%u/%u]\n", @@ -671,6 +694,7 @@ NTSTATUS libnet_vampire_cb_store_chunk(void *private_data, DEBUG(0,("Partition[%s] objects[%u] linked_values[%u]\n", c->partition->nc.dn, s->total_objects, linked_attributes_count)); } + nc_root = partition_dn; } @@ -690,7 +714,7 @@ NTSTATUS libnet_vampire_cb_store_chunk(void *private_data, status = dsdb_replicated_objects_convert(s->ldb, schema, - c->partition->nc.dn, + nc_root, mapping_ctr, object_count, first_object, |