summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/dsdb/repl/replicated_objects.c8
-rw-r--r--source4/dsdb/samdb/ldb_modules/repl_meta_data.c11
-rw-r--r--source4/dsdb/samdb/samdb.h3
-rw-r--r--source4/torture/libnet/libnet_BecomeDC.c124
4 files changed, 91 insertions, 55 deletions
diff --git a/source4/dsdb/repl/replicated_objects.c b/source4/dsdb/repl/replicated_objects.c
index da3f6d0461..1e032b4c80 100644
--- a/source4/dsdb/repl/replicated_objects.c
+++ b/source4/dsdb/repl/replicated_objects.c
@@ -183,8 +183,7 @@ WERROR dsdb_extended_replicated_objects_commit(struct ldb_context *ldb,
const struct drsuapi_DsReplicaObjectListItemEx *first_object,
uint32_t linked_attributes_count,
const struct drsuapi_DsReplicaLinkedAttribute *linked_attributes,
- const struct GUID *source_dsa_invocation_id,
- const struct drsuapi_DsReplicaHighWaterMark *new_highwatermark,
+ const struct repsFromTo1 *source_dsa,
const struct drsuapi_DsReplicaCursor2CtrEx *uptodateness_vector,
TALLOC_CTX *mem_ctx,
struct dsdb_extended_replicated_objects **_out)
@@ -205,9 +204,8 @@ WERROR dsdb_extended_replicated_objects_commit(struct ldb_context *ldb,
out->partition_dn = ldb_dn_new(out, ldb, partition_dn);
W_ERROR_HAVE_NO_MEMORY(out->partition_dn);
- out->source_dsa_invocation_id = source_dsa_invocation_id;
- out->new_highwatermark = new_highwatermark;
- out->uptodateness_vector = uptodateness_vector;
+ out->source_dsa = source_dsa;
+ out->uptodateness_vector= uptodateness_vector;
out->num_objects = object_count;
out->objects = talloc_array(out,
diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
index 7998d5466c..a1fe2e7eb5 100644
--- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
+++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
@@ -677,6 +677,9 @@ static int replmd_replicated_uptodate_modify(struct replmd_replicated_request *a
return replmd_replicated_request_error(ar, ret);
}
+ /*
+ * first create the new replUpToDateVector
+ */
ouv_value = ldb_msg_find_ldb_val(ar->sub.search_msg, "replUpToDateVector");
if (ouv_value) {
nt_status = ndr_pull_struct_blob(ouv_value, ar->sub.mem_ctx, &ouv,
@@ -743,7 +746,7 @@ static int replmd_replicated_uptodate_modify(struct replmd_replicated_request *a
*/
found = false;
for (j=0; j < ni; j++) {
- if (!GUID_equal(ar->objs->source_dsa_invocation_id,
+ if (!GUID_equal(&ar->objs->source_dsa->source_dsa_invocation_id,
&nuv.ctr.ctr2.cursors[j].source_dsa_invocation_id)) {
continue;
}
@@ -757,7 +760,7 @@ static int replmd_replicated_uptodate_modify(struct replmd_replicated_request *a
* and use the tmp_highest_usn because this is what we have just applied
* to our ldb
*/
- nuv.ctr.ctr2.cursors[j].highest_usn = ar->objs->new_highwatermark->tmp_highest_usn;
+ nuv.ctr.ctr2.cursors[j].highest_usn = ar->objs->source_dsa->highwatermark.tmp_highest_usn;
nuv.ctr.ctr2.cursors[j].last_sync_success = now;
break;
}
@@ -769,8 +772,8 @@ static int replmd_replicated_uptodate_modify(struct replmd_replicated_request *a
* and use the tmp_highest_usn because this is what we have just applied
* to our ldb
*/
- nuv.ctr.ctr2.cursors[ni].source_dsa_invocation_id= *ar->objs->source_dsa_invocation_id;
- nuv.ctr.ctr2.cursors[ni].highest_usn = ar->objs->new_highwatermark->tmp_highest_usn;
+ nuv.ctr.ctr2.cursors[ni].source_dsa_invocation_id= ar->objs->source_dsa->source_dsa_invocation_id;
+ nuv.ctr.ctr2.cursors[ni].highest_usn = ar->objs->source_dsa->highwatermark.tmp_highest_usn;
nuv.ctr.ctr2.cursors[ni].last_sync_success = now;
ni++;
}
diff --git a/source4/dsdb/samdb/samdb.h b/source4/dsdb/samdb/samdb.h
index 73e40183aa..0a4804dfb3 100644
--- a/source4/dsdb/samdb/samdb.h
+++ b/source4/dsdb/samdb/samdb.h
@@ -50,8 +50,7 @@ struct dsdb_extended_replicated_object {
struct dsdb_extended_replicated_objects {
struct ldb_dn *partition_dn;
- const struct GUID *source_dsa_invocation_id;
- const struct drsuapi_DsReplicaHighWaterMark *new_highwatermark;
+ const struct repsFromTo1 *source_dsa;
const struct drsuapi_DsReplicaCursor2CtrEx *uptodateness_vector;
uint32_t num_objects;
diff --git a/source4/torture/libnet/libnet_BecomeDC.c b/source4/torture/libnet/libnet_BecomeDC.c
index d6fd89b7f3..1af840891e 100644
--- a/source4/torture/libnet/libnet_BecomeDC.c
+++ b/source4/torture/libnet/libnet_BecomeDC.c
@@ -259,39 +259,57 @@ static NTSTATUS test_apply_schema(struct test_become_dc_state *s,
struct drsuapi_DsReplicaObjectListItemEx *cur;
uint32_t linked_attributes_count;
struct drsuapi_DsReplicaLinkedAttribute *linked_attributes;
- const struct GUID *source_dsa_invocation_id;
- const struct drsuapi_DsReplicaHighWaterMark *new_highwatermark;
const struct drsuapi_DsReplicaCursor2CtrEx *uptodateness_vector;
struct dsdb_extended_replicated_objects *objs;
+ struct repsFromTo1 *s_dsa;
+ char *tmp_dns_name;
uint32_t i;
+ s_dsa = talloc_zero(s, struct repsFromTo1);
+ NT_STATUS_HAVE_NO_MEMORY(s_dsa);
+ s_dsa->other_info = talloc(s_dsa, struct repsFromTo1OtherInfo);
+ NT_STATUS_HAVE_NO_MEMORY(s_dsa->other_info);
+
switch (c->ctr_level) {
case 1:
- mapping_ctr = &c->ctr1->mapping_ctr;
- total_object_count = c->ctr1->total_object_count;
- object_count = s->schema_part.object_count;
- first_object = s->schema_part.first_object;
- linked_attributes_count = 0;
- linked_attributes = NULL;
- source_dsa_invocation_id= &c->ctr1->source_dsa_invocation_id;
- new_highwatermark = &c->ctr1->new_highwatermark;
- uptodateness_vector = NULL; /* TODO: map it */
+ mapping_ctr = &c->ctr1->mapping_ctr;
+ total_object_count = c->ctr1->total_object_count;
+ object_count = s->schema_part.object_count;
+ first_object = s->schema_part.first_object;
+ linked_attributes_count = 0;
+ linked_attributes = NULL;
+ s_dsa->highwatermark = c->ctr1->new_highwatermark;
+ s_dsa->source_dsa_obj_guid = c->ctr1->source_dsa_guid;
+ s_dsa->source_dsa_invocation_id = c->ctr1->source_dsa_invocation_id;
+ uptodateness_vector = NULL; /* TODO: map it */
break;
case 6:
- mapping_ctr = &c->ctr6->mapping_ctr;
- total_object_count = c->ctr6->total_object_count;
- object_count = s->schema_part.object_count;
- first_object = s->schema_part.first_object;
- linked_attributes_count = 0; /* TODO: ! */
- linked_attributes = NULL; /* TODO: ! */;
- source_dsa_invocation_id= &c->ctr6->source_dsa_invocation_id;
- new_highwatermark = &c->ctr6->new_highwatermark;
- uptodateness_vector = c->ctr6->uptodateness_vector;
+ mapping_ctr = &c->ctr6->mapping_ctr;
+ total_object_count = c->ctr6->total_object_count;
+ object_count = s->schema_part.object_count;
+ first_object = s->schema_part.first_object;
+ linked_attributes_count = 0; /* TODO: ! */
+ linked_attributes = NULL; /* TODO: ! */;
+ s_dsa->highwatermark = c->ctr6->new_highwatermark;
+ s_dsa->source_dsa_obj_guid = c->ctr6->source_dsa_guid;
+ s_dsa->source_dsa_invocation_id = c->ctr6->source_dsa_invocation_id;
+ uptodateness_vector = c->ctr6->uptodateness_vector;
break;
default:
return NT_STATUS_INVALID_PARAMETER;
}
+ s_dsa->replica_flags = DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE
+ | DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP
+ | DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS;
+ memset(s_dsa->schedule, 0x11, sizeof(s_dsa->schedule));
+
+ tmp_dns_name = GUID_string(s_dsa->other_info, &s_dsa->source_dsa_obj_guid);
+ NT_STATUS_HAVE_NO_MEMORY(tmp_dns_name);
+ tmp_dns_name = talloc_asprintf_append(tmp_dns_name, "._msdcs.%s", c->forest->dns_name);
+ NT_STATUS_HAVE_NO_MEMORY(tmp_dns_name);
+ s_dsa->other_info->dns_name = tmp_dns_name;
+
for (cur = first_object; cur; cur = cur->next_object) {
bool is_attr = false;
bool is_class = false;
@@ -368,8 +386,7 @@ static NTSTATUS test_apply_schema(struct test_become_dc_state *s,
first_object,
linked_attributes_count,
linked_attributes,
- source_dsa_invocation_id,
- new_highwatermark,
+ s_dsa,
uptodateness_vector,
s, &objs);
if (!W_ERROR_IS_OK(status)) {
@@ -388,6 +405,7 @@ static NTSTATUS test_apply_schema(struct test_become_dc_state *s,
}
}
+ talloc_free(s_dsa);
talloc_free(objs);
return NT_STATUS_OK;
}
@@ -472,39 +490,57 @@ static NTSTATUS test_become_dc_store_chunk(void *private_data,
struct drsuapi_DsReplicaObjectListItemEx *first_object;
uint32_t linked_attributes_count;
struct drsuapi_DsReplicaLinkedAttribute *linked_attributes;
- const struct GUID *source_dsa_invocation_id;
- const struct drsuapi_DsReplicaHighWaterMark *new_highwatermark;
const struct drsuapi_DsReplicaCursor2CtrEx *uptodateness_vector;
struct dsdb_extended_replicated_objects *objs;
+ struct repsFromTo1 *s_dsa;
+ char *tmp_dns_name;
uint32_t i;
+ s_dsa = talloc_zero(s, struct repsFromTo1);
+ NT_STATUS_HAVE_NO_MEMORY(s_dsa);
+ s_dsa->other_info = talloc(s_dsa, struct repsFromTo1OtherInfo);
+ NT_STATUS_HAVE_NO_MEMORY(s_dsa->other_info);
+
switch (c->ctr_level) {
case 1:
- mapping_ctr = &c->ctr1->mapping_ctr;
- total_object_count = c->ctr1->total_object_count;
- object_count = c->ctr1->object_count;
- first_object = c->ctr1->first_object;
- linked_attributes_count = 0;
- linked_attributes = NULL;
- source_dsa_invocation_id= &c->ctr1->source_dsa_invocation_id;
- new_highwatermark = &c->ctr1->new_highwatermark;
- uptodateness_vector = NULL; /* TODO: map it */
+ mapping_ctr = &c->ctr1->mapping_ctr;
+ total_object_count = c->ctr1->total_object_count;
+ object_count = c->ctr1->object_count;
+ first_object = c->ctr1->first_object;
+ linked_attributes_count = 0;
+ linked_attributes = NULL;
+ s_dsa->highwatermark = c->ctr1->new_highwatermark;
+ s_dsa->source_dsa_obj_guid = c->ctr1->source_dsa_guid;
+ s_dsa->source_dsa_invocation_id = c->ctr1->source_dsa_invocation_id;
+ uptodateness_vector = NULL; /* TODO: map it */
break;
case 6:
- mapping_ctr = &c->ctr6->mapping_ctr;
- total_object_count = c->ctr6->total_object_count;
- object_count = c->ctr6->object_count;
- first_object = c->ctr6->first_object;
- linked_attributes_count = c->ctr6->linked_attributes_count;
- linked_attributes = c->ctr6->linked_attributes;
- source_dsa_invocation_id= &c->ctr6->source_dsa_invocation_id;
- new_highwatermark = &c->ctr6->new_highwatermark;
- uptodateness_vector = c->ctr6->uptodateness_vector;
+ mapping_ctr = &c->ctr6->mapping_ctr;
+ total_object_count = c->ctr6->total_object_count;
+ object_count = c->ctr6->object_count;
+ first_object = c->ctr6->first_object;
+ linked_attributes_count = c->ctr6->linked_attributes_count;
+ linked_attributes = c->ctr6->linked_attributes;
+ s_dsa->highwatermark = c->ctr6->new_highwatermark;
+ s_dsa->source_dsa_obj_guid = c->ctr6->source_dsa_guid;
+ s_dsa->source_dsa_invocation_id = c->ctr6->source_dsa_invocation_id;
+ uptodateness_vector = c->ctr6->uptodateness_vector;
break;
default:
return NT_STATUS_INVALID_PARAMETER;
}
+ s_dsa->replica_flags = DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE
+ | DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP
+ | DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS;
+ memset(s_dsa->schedule, 0x11, sizeof(s_dsa->schedule));
+
+ tmp_dns_name = GUID_string(s_dsa->other_info, &s_dsa->source_dsa_obj_guid);
+ NT_STATUS_HAVE_NO_MEMORY(tmp_dns_name);
+ tmp_dns_name = talloc_asprintf_append(tmp_dns_name, "._msdcs.%s", c->forest->dns_name);
+ NT_STATUS_HAVE_NO_MEMORY(tmp_dns_name);
+ s_dsa->other_info->dns_name = tmp_dns_name;
+
if (total_object_count) {
DEBUG(0,("Partition[%s] objects[%u/%u]\n",
c->partition->nc.dn, object_count, total_object_count));
@@ -521,8 +557,7 @@ static NTSTATUS test_become_dc_store_chunk(void *private_data,
first_object,
linked_attributes_count,
linked_attributes,
- source_dsa_invocation_id,
- new_highwatermark,
+ s_dsa,
uptodateness_vector,
s, &objs);
if (!W_ERROR_IS_OK(status)) {
@@ -540,6 +575,7 @@ static NTSTATUS test_become_dc_store_chunk(void *private_data,
NDR_PRINT_DEBUG(replPropertyMetaDataBlob, objs->objects[i].meta_data);
}
}
+ talloc_free(s_dsa);
talloc_free(objs);
for (i=0; i < linked_attributes_count; i++) {