summaryrefslogtreecommitdiff
path: root/source4/torture/rpc/dssync.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/torture/rpc/dssync.c')
-rw-r--r--source4/torture/rpc/dssync.c156
1 files changed, 85 insertions, 71 deletions
diff --git a/source4/torture/rpc/dssync.c b/source4/torture/rpc/dssync.c
index 2070485a19..bee2658816 100644
--- a/source4/torture/rpc/dssync.c
+++ b/source4/torture/rpc/dssync.c
@@ -265,6 +265,9 @@ static bool test_GetInfo(struct torture_context *tctx, struct DsSyncTest *ctx)
{
NTSTATUS status;
struct drsuapi_DsCrackNames r;
+ union drsuapi_DsNameRequest req;
+ union drsuapi_DsNameCtr ctr;
+ int32_t level_out = 0;
struct drsuapi_DsNameString names[1];
bool ret = true;
struct cldap_socket *cldap;
@@ -274,15 +277,19 @@ static bool test_GetInfo(struct torture_context *tctx, struct DsSyncTest *ctx)
r.in.bind_handle = &ctx->admin.drsuapi.bind_handle;
r.in.level = 1;
- r.in.req.req1.codepage = 1252; /* western european */
- r.in.req.req1.language = 0x00000407; /* german */
- r.in.req.req1.count = 1;
- r.in.req.req1.names = names;
- r.in.req.req1.format_flags = DRSUAPI_DS_NAME_FLAG_NO_FLAGS;
- r.in.req.req1.format_offered = DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT;
- r.in.req.req1.format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779;
+ r.in.req = &req;
+ r.in.req->req1.codepage = 1252; /* western european */
+ r.in.req->req1.language = 0x00000407; /* german */
+ r.in.req->req1.count = 1;
+ r.in.req->req1.names = names;
+ r.in.req->req1.format_flags = DRSUAPI_DS_NAME_FLAG_NO_FLAGS;
+ r.in.req->req1.format_offered = DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT;
+ r.in.req->req1.format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779;
names[0].str = talloc_asprintf(ctx, "%s\\", lp_workgroup(tctx->lp_ctx));
+ r.out.level_out = &level_out;
+ r.out.ctr = &ctr;
+
status = dcerpc_drsuapi_DsCrackNames(ctx->admin.drsuapi.pipe, ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
const char *errstr = nt_errstr(status);
@@ -296,7 +303,7 @@ static bool test_GetInfo(struct torture_context *tctx, struct DsSyncTest *ctx)
return false;
}
- ctx->domain_dn = r.out.ctr.ctr1->array[0].result_name;
+ ctx->domain_dn = r.out.ctr->ctr1->array[0].result_name;
ZERO_STRUCT(search);
search.in.dest_address = ctx->drsuapi_binding->host;
@@ -592,6 +599,7 @@ static bool test_FetchData(struct torture_context *tctx, struct DsSyncTest *ctx)
uint64_t highest_usn = 0;
const char *partition = NULL;
struct drsuapi_DsGetNCChanges r;
+ union drsuapi_DsGetNCChangesRequest req;
struct drsuapi_DsReplicaObjectIdentifier nc;
struct drsuapi_DsGetNCChangesCtr1 *ctr1 = NULL;
struct drsuapi_DsGetNCChangesCtr6 *ctr6 = NULL;
@@ -642,37 +650,38 @@ static bool test_FetchData(struct torture_context *tctx, struct DsSyncTest *ctx)
array[i].level);
r.in.bind_handle = &ctx->new_dc.drsuapi.bind_handle;
- r.in.level = &array[i].level;
+ r.in.level = array[i].level;
- switch (*r.in.level) {
+ switch (r.in.level) {
case 5:
nc.guid = null_guid;
nc.sid = null_sid;
nc.dn = partition;
- r.in.req.req5.destination_dsa_guid = ctx->new_dc.invocation_id;
- r.in.req.req5.source_dsa_invocation_id = null_guid;
- r.in.req.req5.naming_context = &nc;
- r.in.req.req5.highwatermark.tmp_highest_usn = highest_usn;
- r.in.req.req5.highwatermark.reserved_usn = 0;
- r.in.req.req5.highwatermark.highest_usn = highest_usn;
- r.in.req.req5.uptodateness_vector = NULL;
- r.in.req.req5.replica_flags = 0;
+ r.in.req = &req;
+ r.in.req->req5.destination_dsa_guid = ctx->new_dc.invocation_id;
+ r.in.req->req5.source_dsa_invocation_id = null_guid;
+ r.in.req->req5.naming_context = &nc;
+ r.in.req->req5.highwatermark.tmp_highest_usn = highest_usn;
+ r.in.req->req5.highwatermark.reserved_usn = 0;
+ r.in.req->req5.highwatermark.highest_usn = highest_usn;
+ r.in.req->req5.uptodateness_vector = NULL;
+ r.in.req->req5.replica_flags = 0;
if (lp_parm_bool(tctx->lp_ctx, NULL, "dssync", "compression", false)) {
- r.in.req.req5.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES;
+ r.in.req->req5.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES;
}
if (lp_parm_bool(tctx->lp_ctx, NULL, "dssync", "neighbour_writeable", true)) {
- r.in.req.req5.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE;
+ r.in.req->req5.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE;
}
- r.in.req.req5.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP
+ r.in.req->req5.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP
| DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS
| DRSUAPI_DS_REPLICA_NEIGHBOUR_RETURN_OBJECT_PARENTS
| DRSUAPI_DS_REPLICA_NEIGHBOUR_NEVER_SYNCED
;
- r.in.req.req5.max_object_count = 133;
- r.in.req.req5.max_ndr_size = 1336770;
- r.in.req.req5.extended_op = DRSUAPI_EXOP_NONE;
- r.in.req.req5.fsmo_info = 0;
+ r.in.req->req5.max_object_count = 133;
+ r.in.req->req5.max_ndr_size = 1336770;
+ r.in.req->req5.extended_op = DRSUAPI_EXOP_NONE;
+ r.in.req->req5.fsmo_info = 0;
break;
case 8:
@@ -680,35 +689,36 @@ static bool test_FetchData(struct torture_context *tctx, struct DsSyncTest *ctx)
nc.sid = null_sid;
nc.dn = partition;
/* nc.dn can be set to any other ad partition */
-
- r.in.req.req8.destination_dsa_guid = ctx->new_dc.invocation_id;
- r.in.req.req8.source_dsa_invocation_id = null_guid;
- r.in.req.req8.naming_context = &nc;
- r.in.req.req8.highwatermark.tmp_highest_usn = highest_usn;
- r.in.req.req8.highwatermark.reserved_usn = 0;
- r.in.req.req8.highwatermark.highest_usn = highest_usn;
- r.in.req.req8.uptodateness_vector = NULL;
- r.in.req.req8.replica_flags = 0;
+
+ r.in.req = &req;
+ r.in.req->req8.destination_dsa_guid = ctx->new_dc.invocation_id;
+ r.in.req->req8.source_dsa_invocation_id = null_guid;
+ r.in.req->req8.naming_context = &nc;
+ r.in.req->req8.highwatermark.tmp_highest_usn = highest_usn;
+ r.in.req->req8.highwatermark.reserved_usn = 0;
+ r.in.req->req8.highwatermark.highest_usn = highest_usn;
+ r.in.req->req8.uptodateness_vector = NULL;
+ r.in.req->req8.replica_flags = 0;
if (lp_parm_bool(tctx->lp_ctx, NULL, "dssync", "compression", false)) {
- r.in.req.req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES;
+ r.in.req->req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES;
}
if (lp_parm_bool(tctx->lp_ctx, NULL, "dssync", "neighbour_writeable", true)) {
- r.in.req.req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE;
+ r.in.req->req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE;
}
- r.in.req.req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP
+ r.in.req->req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP
| DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS
| DRSUAPI_DS_REPLICA_NEIGHBOUR_RETURN_OBJECT_PARENTS
| DRSUAPI_DS_REPLICA_NEIGHBOUR_NEVER_SYNCED
;
- r.in.req.req8.max_object_count = 402;
- r.in.req.req8.max_ndr_size = 402116;
+ r.in.req->req8.max_object_count = 402;
+ r.in.req->req8.max_ndr_size = 402116;
- r.in.req.req8.extended_op = DRSUAPI_EXOP_NONE;
- r.in.req.req8.fsmo_info = 0;
- r.in.req.req8.partial_attribute_set = NULL;
- r.in.req.req8.partial_attribute_set_ex = NULL;
- r.in.req.req8.mapping_ctr.num_mappings = 0;
- r.in.req.req8.mapping_ctr.mappings = NULL;
+ r.in.req->req8.extended_op = DRSUAPI_EXOP_NONE;
+ r.in.req->req8.fsmo_info = 0;
+ r.in.req->req8.partial_attribute_set = NULL;
+ r.in.req->req8.partial_attribute_set_ex = NULL;
+ r.in.req->req8.mapping_ctr.num_mappings = 0;
+ r.in.req->req8.mapping_ctr.mappings = NULL;
break;
}
@@ -716,19 +726,23 @@ static bool test_FetchData(struct torture_context *tctx, struct DsSyncTest *ctx)
printf("Dumping AD partition: %s\n", nc.dn);
for (y=0; ;y++) {
int32_t _level = 0;
+ union drsuapi_DsGetNCChangesCtr ctr;
+
ZERO_STRUCT(r.out);
- r.out.level = &_level;
- if (*r.in.level == 5) {
+ r.out.level_out = &_level;
+ r.out.ctr = &ctr;
+
+ if (r.in.level == 5) {
DEBUG(0,("start[%d] tmp_higest_usn: %llu , highest_usn: %llu\n",y,
- (long long)r.in.req.req5.highwatermark.tmp_highest_usn,
- (long long)r.in.req.req5.highwatermark.highest_usn));
+ (long long)r.in.req->req5.highwatermark.tmp_highest_usn,
+ (long long)r.in.req->req5.highwatermark.highest_usn));
}
- if (*r.in.level == 8) {
+ if (r.in.level == 8) {
DEBUG(0,("start[%d] tmp_higest_usn: %llu , highest_usn: %llu\n",y,
- (long long)r.in.req.req8.highwatermark.tmp_highest_usn,
- (long long)r.in.req.req8.highwatermark.highest_usn));
+ (long long)r.in.req->req8.highwatermark.tmp_highest_usn,
+ (long long)r.in.req->req8.highwatermark.highest_usn));
}
status = dcerpc_drsuapi_DsGetNCChanges(ctx->new_dc.drsuapi.pipe, ctx, &r);
@@ -744,13 +758,13 @@ static bool test_FetchData(struct torture_context *tctx, struct DsSyncTest *ctx)
ret = false;
}
- if (ret == true && *r.out.level == 1) {
+ if (ret == true && *r.out.level_out == 1) {
out_level = 1;
- ctr1 = &r.out.ctr.ctr1;
- } else if (ret == true && *r.out.level == 2 &&
- r.out.ctr.ctr2.mszip1.ts) {
+ ctr1 = &r.out.ctr->ctr1;
+ } else if (ret == true && *r.out.level_out == 2 &&
+ r.out.ctr->ctr2.mszip1.ts) {
out_level = 1;
- ctr1 = &r.out.ctr.ctr2.mszip1.ts->ctr1;
+ ctr1 = &r.out.ctr->ctr2.mszip1.ts->ctr1;
}
if (out_level == 1) {
@@ -761,26 +775,26 @@ static bool test_FetchData(struct torture_context *tctx, struct DsSyncTest *ctx)
test_analyse_objects(tctx, ctx, &gensec_skey, ctr1->first_object);
if (ctr1->more_data) {
- r.in.req.req5.highwatermark = ctr1->new_highwatermark;
+ r.in.req->req5.highwatermark = ctr1->new_highwatermark;
continue;
}
}
- if (ret == true && *r.out.level == 6) {
+ if (ret == true && *r.out.level_out == 6) {
out_level = 6;
- ctr6 = &r.out.ctr.ctr6;
- } else if (ret == true && *r.out.level == 7
- && r.out.ctr.ctr7.level == 6
- && r.out.ctr.ctr7.type == DRSUAPI_COMPRESSION_TYPE_MSZIP
- && r.out.ctr.ctr7.ctr.mszip6.ts) {
+ ctr6 = &r.out.ctr->ctr6;
+ } else if (ret == true && *r.out.level_out == 7
+ && r.out.ctr->ctr7.level == 6
+ && r.out.ctr->ctr7.type == DRSUAPI_COMPRESSION_TYPE_MSZIP
+ && r.out.ctr->ctr7.ctr.mszip6.ts) {
out_level = 6;
- ctr6 = &r.out.ctr.ctr7.ctr.mszip6.ts->ctr6;
- } else if (ret == true && *r.out.level == 7
- && r.out.ctr.ctr7.level == 6
- && r.out.ctr.ctr7.type == DRSUAPI_COMPRESSION_TYPE_XPRESS
- && r.out.ctr.ctr7.ctr.xpress6.ts) {
+ ctr6 = &r.out.ctr->ctr7.ctr.mszip6.ts->ctr6;
+ } else if (ret == true && *r.out.level_out == 7
+ && r.out.ctr->ctr7.level == 6
+ && r.out.ctr->ctr7.type == DRSUAPI_COMPRESSION_TYPE_XPRESS
+ && r.out.ctr->ctr7.ctr.xpress6.ts) {
out_level = 6;
- ctr6 = &r.out.ctr.ctr7.ctr.xpress6.ts->ctr6;
+ ctr6 = &r.out.ctr->ctr7.ctr.xpress6.ts->ctr6;
}
if (out_level == 6) {
@@ -791,7 +805,7 @@ static bool test_FetchData(struct torture_context *tctx, struct DsSyncTest *ctx)
test_analyse_objects(tctx, ctx, &gensec_skey, ctr6->first_object);
if (ctr6->more_data) {
- r.in.req.req8.highwatermark = ctr6->new_highwatermark;
+ r.in.req->req8.highwatermark = ctr6->new_highwatermark;
continue;
}
}