summaryrefslogtreecommitdiff
path: root/source4/torture/libnet/libnet_BecomeDC.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2007-01-12 16:02:10 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:40:29 -0500
commit18f81804696c0916652acc1f9491e96fda0d25fc (patch)
treec9a5783413ce8961f14b23ead21c05e58d26febf /source4/torture/libnet/libnet_BecomeDC.c
parentfaf57b1dc5a451109d4b2b64965d87ee3c6c04eb (diff)
downloadsamba-18f81804696c0916652acc1f9491e96fda0d25fc.tar.gz
samba-18f81804696c0916652acc1f9491e96fda0d25fc.tar.bz2
samba-18f81804696c0916652acc1f9491e96fda0d25fc.zip
r20709: pass a repsFromTo1 struct down as it contains all needed info for the source dsa
and the highwater mark vector metze (This used to be commit a31e017e5388e5abd6ed9d09adcf26d2527954a6)
Diffstat (limited to 'source4/torture/libnet/libnet_BecomeDC.c')
-rw-r--r--source4/torture/libnet/libnet_BecomeDC.c124
1 files changed, 80 insertions, 44 deletions
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++) {