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.c193
1 files changed, 107 insertions, 86 deletions
diff --git a/source4/torture/rpc/dssync.c b/source4/torture/rpc/dssync.c
index e9346f9605..bee2658816 100644
--- a/source4/torture/rpc/dssync.c
+++ b/source4/torture/rpc/dssync.c
@@ -29,7 +29,7 @@
#include "torture/torture.h"
#include "torture/ldap/proto.h"
#include "libcli/auth/libcli_auth.h"
-#include "lib/crypto/crypto.h"
+#include "../lib/crypto/crypto.h"
#include "auth/credentials/credentials.h"
#include "libcli/auth/libcli_auth.h"
#include "auth/gensec/gensec.h"
@@ -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;
@@ -310,14 +317,14 @@ static bool test_GetInfo(struct torture_context *tctx, struct DsSyncTest *ctx)
ctx->site_name = talloc_asprintf(ctx, "%s", "Default-First-Site-Name");
printf("cldap_netlogon() returned %s. Defaulting to Site-Name: %s\n", errstr, ctx->site_name);
} else {
- ctx->site_name = talloc_steal(ctx, search.out.netlogon.nt5_ex.client_site);
+ ctx->site_name = talloc_steal(ctx, search.out.netlogon.data.nt5_ex.client_site);
printf("cldap_netlogon() returned Client Site-Name: %s.\n",ctx->site_name);
- printf("cldap_netlogon() returned Server Site-Name: %s.\n",search.out.netlogon.nt5_ex.server_site);
+ printf("cldap_netlogon() returned Server Site-Name: %s.\n",search.out.netlogon.data.nt5_ex.server_site);
}
if (!ctx->domain_dn) {
struct ldb_context *ldb = ldb_init(ctx, tctx->ev);
- struct ldb_dn *dn = samdb_dns_domain_to_dn(ldb, ctx, search.out.netlogon.nt5_ex.dns_domain);
+ struct ldb_dn *dn = samdb_dns_domain_to_dn(ldb, ctx, search.out.netlogon.data.nt5_ex.dns_domain);
ctx->domain_dn = ldb_dn_alloc_linearized(ctx, dn);
talloc_free(dn);
talloc_free(ldb);
@@ -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;
}
}
@@ -809,6 +823,9 @@ static bool test_FetchNT4Data(struct torture_context *tctx,
NTSTATUS status;
bool ret = true;
struct drsuapi_DsGetNT4ChangeLog r;
+ union drsuapi_DsGetNT4ChangeLogRequest req;
+ union drsuapi_DsGetNT4ChangeLogInfo info;
+ int32_t level_out = 0;
struct GUID null_guid;
struct dom_sid null_sid;
DATA_BLOB cookie;
@@ -820,13 +837,17 @@ static bool test_FetchNT4Data(struct torture_context *tctx,
ZERO_STRUCT(r);
r.in.bind_handle = &ctx->new_dc.drsuapi.bind_handle;
r.in.level = 1;
+ r.out.info = &info;
+ r.out.level_out = &level_out;
- r.in.req.req1.unknown1 = lp_parm_int(tctx->lp_ctx, NULL, "dssync", "nt4-1", 3);
- r.in.req.req1.unknown2 = lp_parm_int(tctx->lp_ctx, NULL, "dssync", "nt4-2", 0x00004000);
+ req.req1.unknown1 = lp_parm_int(tctx->lp_ctx, NULL, "dssync", "nt4-1", 3);
+ req.req1.unknown2 = lp_parm_int(tctx->lp_ctx, NULL, "dssync", "nt4-2", 0x00004000);
while (1) {
- r.in.req.req1.length = cookie.length;
- r.in.req.req1.data = cookie.data;
+ req.req1.length = cookie.length;
+ req.req1.data = cookie.data;
+
+ r.in.req = &req;
status = dcerpc_drsuapi_DsGetNT4ChangeLog(ctx->new_dc.drsuapi.pipe, ctx, &r);
if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_IMPLEMENTED)) {
@@ -845,16 +866,16 @@ static bool test_FetchNT4Data(struct torture_context *tctx,
} else if (!W_ERROR_IS_OK(r.out.result)) {
printf("DsGetNT4ChangeLog failed - %s\n", win_errstr(r.out.result));
ret = false;
- } else if (r.out.level != 1) {
- printf("DsGetNT4ChangeLog unknown level - %u\n", r.out.level);
+ } else if (*r.out.level_out != 1) {
+ printf("DsGetNT4ChangeLog unknown level - %u\n", *r.out.level_out);
ret = false;
- } else if (NT_STATUS_IS_OK(r.out.info.info1.status)) {
- } else if (NT_STATUS_EQUAL(r.out.info.info1.status, STATUS_MORE_ENTRIES)) {
- cookie.length = r.out.info.info1.length1;
- cookie.data = r.out.info.info1.data1;
+ } else if (NT_STATUS_IS_OK(r.out.info->info1.status)) {
+ } else if (NT_STATUS_EQUAL(r.out.info->info1.status, STATUS_MORE_ENTRIES)) {
+ cookie.length = r.out.info->info1.length1;
+ cookie.data = r.out.info->info1.data1;
continue;
} else {
- printf("DsGetNT4ChangeLog failed - %s\n", nt_errstr(r.out.info.info1.status));
+ printf("DsGetNT4ChangeLog failed - %s\n", nt_errstr(r.out.info->info1.status));
ret = false;
}