summaryrefslogtreecommitdiff
path: root/source4/torture/rpc
diff options
context:
space:
mode:
Diffstat (limited to 'source4/torture/rpc')
-rw-r--r--source4/torture/rpc/drsuapi.c190
-rw-r--r--source4/torture/rpc/drsuapi_cracknames.c177
-rw-r--r--source4/torture/rpc/dssync.c185
-rw-r--r--source4/torture/rpc/eventlog.c9
-rw-r--r--source4/torture/rpc/initshutdown.c4
-rw-r--r--source4/torture/rpc/netlogon.c71
-rw-r--r--source4/torture/rpc/rpc.c2
-rw-r--r--source4/torture/rpc/samr.c182
-rw-r--r--source4/torture/rpc/samr_accessmask.c2
-rw-r--r--source4/torture/rpc/samsync.c2
-rw-r--r--source4/torture/rpc/spoolss_notify.c2
-rw-r--r--source4/torture/rpc/winreg.c11
-rw-r--r--source4/torture/rpc/wkssvc.c26
13 files changed, 578 insertions, 285 deletions
diff --git a/source4/torture/rpc/drsuapi.c b/source4/torture/rpc/drsuapi.c
index e5cb3d7ddf..da6ce2b5f5 100644
--- a/source4/torture/rpc/drsuapi.c
+++ b/source4/torture/rpc/drsuapi.c
@@ -62,6 +62,8 @@ static bool test_DsGetDomainControllerInfo(struct dcerpc_pipe *p, struct torture
{
NTSTATUS status;
struct drsuapi_DsGetDomainControllerInfo r;
+ union drsuapi_DsGetDCInfoCtr ctr;
+ int32_t level_out = 0;
bool found = false;
int i, j, k;
@@ -91,16 +93,21 @@ static bool test_DsGetDomainControllerInfo(struct dcerpc_pipe *p, struct torture
for (i=0; i < ARRAY_SIZE(levels); i++) {
for (j=0; j < ARRAY_SIZE(names); j++) {
+ union drsuapi_DsGetDCInfoRequest req;
level = levels[i];
r.in.bind_handle = &priv->bind_handle;
r.in.level = 1;
+ r.in.req = &req;
- r.in.req.req1.domain_name = names[j].name;
- r.in.req.req1.level = level;
+ r.in.req->req1.domain_name = names[j].name;
+ r.in.req->req1.level = level;
+
+ r.out.ctr = &ctr;
+ r.out.level_out = &level_out;
torture_comment(torture,
"testing DsGetDomainControllerInfo level %d on domainname '%s'\n",
- r.in.req.req1.level, r.in.req.req1.domain_name);
+ r.in.req->req1.level, r.in.req->req1.domain_name);
status = dcerpc_drsuapi_DsGetDomainControllerInfo(p, torture, &r);
torture_assert_ntstatus_ok(torture, status,
@@ -115,13 +122,13 @@ static bool test_DsGetDomainControllerInfo(struct dcerpc_pipe *p, struct torture
}
torture_assert_int_equal(torture,
- r.in.req.req1.level, r.out.level_out,
+ r.in.req->req1.level, *r.out.level_out,
"dcerpc_drsuapi_DsGetDomainControllerInfo level");
switch (level) {
case 1:
- for (k=0; k < r.out.ctr.ctr1.count; k++) {
- if (strcasecmp_m(r.out.ctr.ctr1.array[k].netbios_name,
+ for (k=0; k < r.out.ctr->ctr1.count; k++) {
+ if (strcasecmp_m(r.out.ctr->ctr1.array[k].netbios_name,
torture_join_netbios_name(priv->join)) == 0) {
found = true;
break;
@@ -129,11 +136,11 @@ static bool test_DsGetDomainControllerInfo(struct dcerpc_pipe *p, struct torture
}
break;
case 2:
- for (k=0; k < r.out.ctr.ctr2.count; k++) {
- if (strcasecmp_m(r.out.ctr.ctr2.array[k].netbios_name,
+ for (k=0; k < r.out.ctr->ctr2.count; k++) {
+ if (strcasecmp_m(r.out.ctr->ctr2.array[k].netbios_name,
torture_join_netbios_name(priv->join)) == 0) {
found = true;
- priv->dcinfo = r.out.ctr.ctr2.array[k];
+ priv->dcinfo = r.out.ctr->ctr2.array[k];
break;
}
}
@@ -146,12 +153,15 @@ static bool test_DsGetDomainControllerInfo(struct dcerpc_pipe *p, struct torture
r.in.bind_handle = &priv->bind_handle;
r.in.level = 1;
-
- r.in.req.req1.domain_name = "__UNKNOWN_DOMAIN__"; /* This is clearly ignored for this level */
- r.in.req.req1.level = -1;
+
+ r.out.ctr = &ctr;
+ r.out.level_out = &level_out;
+
+ r.in.req->req1.domain_name = "__UNKNOWN_DOMAIN__"; /* This is clearly ignored for this level */
+ r.in.req->req1.level = -1;
printf("testing DsGetDomainControllerInfo level %d on domainname '%s'\n",
- r.in.req.req1.level, r.in.req.req1.domain_name);
+ r.in.req->req1.level, r.in.req->req1.domain_name);
status = dcerpc_drsuapi_DsGetDomainControllerInfo(p, torture, &r);
@@ -164,8 +174,8 @@ static bool test_DsGetDomainControllerInfo(struct dcerpc_pipe *p, struct torture
const char *dc_account = talloc_asprintf(torture, "%s\\%s$",
torture_join_dom_netbios_name(priv->join),
priv->dcinfo.netbios_name);
- for (k=0; k < r.out.ctr.ctr01.count; k++) {
- if (strcasecmp_m(r.out.ctr.ctr01.array[k].client_account,
+ for (k=0; k < r.out.ctr->ctr01.count; k++) {
+ if (strcasecmp_m(r.out.ctr->ctr01.array[k].client_account,
dc_account)) {
found = true;
break;
@@ -184,22 +194,29 @@ static bool test_DsWriteAccountSpn(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
{
NTSTATUS status;
struct drsuapi_DsWriteAccountSpn r;
+ union drsuapi_DsWriteAccountSpnRequest req;
struct drsuapi_DsNameString names[2];
+ union drsuapi_DsWriteAccountSpnResult res;
+ int32_t level_out;
bool ret = true;
r.in.bind_handle = &priv->bind_handle;
r.in.level = 1;
+ r.in.req = &req;
printf("testing DsWriteAccountSpn\n");
- r.in.req.req1.operation = DRSUAPI_DS_SPN_OPERATION_ADD;
- r.in.req.req1.unknown1 = 0;
- r.in.req.req1.object_dn = priv->dcinfo.computer_dn;
- r.in.req.req1.count = 2;
- r.in.req.req1.spn_names = names;
+ r.in.req->req1.operation = DRSUAPI_DS_SPN_OPERATION_ADD;
+ r.in.req->req1.unknown1 = 0;
+ r.in.req->req1.object_dn = priv->dcinfo.computer_dn;
+ r.in.req->req1.count = 2;
+ r.in.req->req1.spn_names = names;
names[0].str = talloc_asprintf(mem_ctx, "smbtortureSPN/%s",priv->dcinfo.netbios_name);
names[1].str = talloc_asprintf(mem_ctx, "smbtortureSPN/%s",priv->dcinfo.dns_name);
+ r.out.res = &res;
+ r.out.level_out = &level_out;
+
status = dcerpc_drsuapi_DsWriteAccountSpn(p, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
const char *errstr = nt_errstr(status);
@@ -213,8 +230,8 @@ static bool test_DsWriteAccountSpn(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
ret = false;
}
- r.in.req.req1.operation = DRSUAPI_DS_SPN_OPERATION_DELETE;
- r.in.req.req1.unknown1 = 0;
+ r.in.req->req1.operation = DRSUAPI_DS_SPN_OPERATION_DELETE;
+ r.in.req->req1.unknown1 = 0;
status = dcerpc_drsuapi_DsWriteAccountSpn(p, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
@@ -237,6 +254,9 @@ static bool test_DsReplicaGetInfo(struct dcerpc_pipe *p, struct torture_context
{
NTSTATUS status;
struct drsuapi_DsReplicaGetInfo r;
+ union drsuapi_DsReplicaGetInfoRequest req;
+ union drsuapi_DsReplicaInfo info;
+ enum drsuapi_DsReplicaInfoType info_type;
bool ret = true;
int i;
struct {
@@ -313,6 +333,7 @@ static bool test_DsReplicaGetInfo(struct dcerpc_pipe *p, struct torture_context
}
r.in.bind_handle = &priv->bind_handle;
+ r.in.req = &req;
for (i=0; i < ARRAY_SIZE(array); i++) {
const char *object_dn;
@@ -325,21 +346,24 @@ static bool test_DsReplicaGetInfo(struct dcerpc_pipe *p, struct torture_context
r.in.level = array[i].level;
switch(r.in.level) {
case DRSUAPI_DS_REPLICA_GET_INFO:
- r.in.req.req1.info_type = array[i].infotype;
- r.in.req.req1.object_dn = object_dn;
- ZERO_STRUCT(r.in.req.req1.guid1);
+ r.in.req->req1.info_type = array[i].infotype;
+ r.in.req->req1.object_dn = object_dn;
+ ZERO_STRUCT(r.in.req->req1.guid1);
break;
case DRSUAPI_DS_REPLICA_GET_INFO2:
- r.in.req.req2.info_type = array[i].infotype;
- r.in.req.req2.object_dn = object_dn;
- ZERO_STRUCT(r.in.req.req1.guid1);
- r.in.req.req2.unknown1 = 0;
- r.in.req.req2.string1 = NULL;
- r.in.req.req2.string2 = NULL;
- r.in.req.req2.unknown2 = 0;
+ r.in.req->req2.info_type = array[i].infotype;
+ r.in.req->req2.object_dn = object_dn;
+ ZERO_STRUCT(r.in.req->req2.guid1);
+ r.in.req->req2.unknown1 = 0;
+ r.in.req->req2.string1 = NULL;
+ r.in.req->req2.string2 = NULL;
+ r.in.req->req2.unknown2 = 0;
break;
}
+ r.out.info = &info;
+ r.out.info_type = &info_type;
+
status = dcerpc_drsuapi_DsReplicaGetInfo(p, tctx, &r);
if (!NT_STATUS_IS_OK(status)) {
const char *errstr = nt_errstr(status);
@@ -501,9 +525,12 @@ static bool test_DsGetNCChanges(struct dcerpc_pipe *p, struct torture_context *t
bool ret = true;
int i;
struct drsuapi_DsGetNCChanges r;
+ union drsuapi_DsGetNCChangesRequest req;
+ union drsuapi_DsGetNCChangesCtr ctr;
struct drsuapi_DsReplicaObjectIdentifier nc;
struct GUID null_guid;
struct dom_sid null_sid;
+ int32_t level_out;
struct {
int32_t level;
} array[] = {
@@ -528,29 +555,32 @@ static bool test_DsGetNCChanges(struct dcerpc_pipe *p, struct torture_context *t
array[i].level);
r.in.bind_handle = &priv->bind_handle;
- r.in.level = &array[i].level;
+ r.in.level = array[i].level;
+ r.out.level_out = &level_out;
+ r.out.ctr = &ctr;
- switch (*r.in.level) {
+ switch (r.in.level) {
case 5:
nc.guid = null_guid;
nc.sid = null_sid;
nc.dn = priv->domain_obj_dn?priv->domain_obj_dn:"";
- r.in.req.req5.destination_dsa_guid = GUID_random();
- 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 = 0;
- r.in.req.req5.highwatermark.reserved_usn = 0;
- r.in.req.req5.highwatermark.highest_usn = 0;
- 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 = GUID_random();
+ 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 = 0;
+ r.in.req->req5.highwatermark.reserved_usn = 0;
+ r.in.req->req5.highwatermark.highest_usn = 0;
+ r.in.req->req5.uptodateness_vector = NULL;
+ r.in.req->req5.replica_flags = 0;
if (lp_parm_bool(tctx->lp_ctx, NULL, "drsuapi","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;
}
- r.in.req.req5.max_object_count = 0;
- r.in.req.req5.max_ndr_size = 0;
- r.in.req.req5.extended_op = DRSUAPI_EXOP_NONE;
- r.in.req.req5.fsmo_info = 0;
+ r.in.req->req5.max_object_count = 0;
+ r.in.req->req5.max_ndr_size = 0;
+ r.in.req->req5.extended_op = DRSUAPI_EXOP_NONE;
+ r.in.req->req5.fsmo_info = 0;
break;
case 8:
@@ -558,33 +588,34 @@ static bool test_DsGetNCChanges(struct dcerpc_pipe *p, struct torture_context *t
nc.sid = null_sid;
nc.dn = priv->domain_obj_dn?priv->domain_obj_dn:"";
- r.in.req.req8.destination_dsa_guid = GUID_random();
- 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 = 0;
- r.in.req.req8.highwatermark.reserved_usn = 0;
- r.in.req.req8.highwatermark.highest_usn = 0;
- 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 = GUID_random();
+ 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 = 0;
+ r.in.req->req8.highwatermark.reserved_usn = 0;
+ r.in.req->req8.highwatermark.highest_usn = 0;
+ r.in.req->req8.uptodateness_vector = NULL;
+ r.in.req->req8.replica_flags = 0;
if (lp_parm_bool(tctx->lp_ctx, NULL, "drsuapi", "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, "drsuapi", "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.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.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;
break;
}
@@ -611,20 +642,23 @@ bool test_QuerySitesByCost(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
{
NTSTATUS status;
struct drsuapi_QuerySitesByCost r;
+ union drsuapi_QuerySitesByCostRequest req;
bool ret = true;
const char *my_site = "Default-First-Site-Name";
const char *remote_site1 = "smbtorture-nonexisting-site1";
const char *remote_site2 = "smbtorture-nonexisting-site2";
+ req.req1.site_from = talloc_strdup(mem_ctx, my_site);
+ req.req1.num_req = 2;
+ req.req1.site_to = talloc_zero_array(mem_ctx, const char *, 2);
+ req.req1.site_to[0] = talloc_strdup(mem_ctx, remote_site1);
+ req.req1.site_to[1] = talloc_strdup(mem_ctx, remote_site2);
+ req.req1.flags = 0;
+
r.in.bind_handle = &priv->bind_handle;
r.in.level = 1;
- r.in.req.req1.site_from = talloc_strdup(mem_ctx, my_site);
- r.in.req.req1.num_req = 2;
- r.in.req.req1.site_to = talloc_zero_array(mem_ctx, const char *, r.in.req.req1.num_req);
- r.in.req.req1.site_to[0] = talloc_strdup(mem_ctx, remote_site1);
- r.in.req.req1.site_to[1] = talloc_strdup(mem_ctx, remote_site2);
- r.in.req.req1.flags = 0;
+ r.in.req = &req;
status = dcerpc_drsuapi_QuerySitesByCost(p, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
@@ -641,17 +675,17 @@ bool test_QuerySitesByCost(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
if (W_ERROR_IS_OK(r.out.result)) {
- if (!W_ERROR_EQUAL(r.out.ctr.ctr1.info[0].error_code, WERR_DS_OBJ_NOT_FOUND) ||
- !W_ERROR_EQUAL(r.out.ctr.ctr1.info[1].error_code, WERR_DS_OBJ_NOT_FOUND)) {
+ if (!W_ERROR_EQUAL(r.out.ctr->ctr1.info[0].error_code, WERR_DS_OBJ_NOT_FOUND) ||
+ !W_ERROR_EQUAL(r.out.ctr->ctr1.info[1].error_code, WERR_DS_OBJ_NOT_FOUND)) {
printf("expected error_code WERR_DS_OBJ_NOT_FOUND, got %s\n",
- win_errstr(r.out.ctr.ctr1.info[0].error_code));
+ win_errstr(r.out.ctr->ctr1.info[0].error_code));
ret = false;
}
- if ((r.out.ctr.ctr1.info[0].site_cost != (uint32_t) -1) ||
- (r.out.ctr.ctr1.info[1].site_cost != (uint32_t) -1)) {
+ if ((r.out.ctr->ctr1.info[0].site_cost != (uint32_t) -1) ||
+ (r.out.ctr->ctr1.info[1].site_cost != (uint32_t) -1)) {
printf("expected site_cost %d, got %d\n",
- (uint32_t) -1, r.out.ctr.ctr1.info[0].site_cost);
+ (uint32_t) -1, r.out.ctr->ctr1.info[0].site_cost);
ret = false;
}
}
diff --git a/source4/torture/rpc/drsuapi_cracknames.c b/source4/torture/rpc/drsuapi_cracknames.c
index a9a614953d..dabd4125c7 100644
--- a/source4/torture/rpc/drsuapi_cracknames.c
+++ b/source4/torture/rpc/drsuapi_cracknames.c
@@ -38,6 +38,10 @@ static bool test_DsCrackNamesMatrix(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
NTSTATUS status;
bool ret = true;
struct drsuapi_DsCrackNames r;
+ union drsuapi_DsNameRequest req;
+ int32_t level_out;
+ union drsuapi_DsNameCtr ctr;
+
enum drsuapi_DsNameFormat formats[] = {
DRSUAPI_DS_NAME_FORMAT_UNKNOWN,
DRSUAPI_DS_NAME_FORMAT_FQDN_1779,
@@ -60,17 +64,21 @@ static bool test_DsCrackNamesMatrix(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
ZERO_STRUCT(r);
r.in.bind_handle = &priv->bind_handle;
r.in.level = 1;
- r.in.req.req1.codepage = 1252; /* german */
- 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 = &req;
+ r.in.req->req1.codepage = 1252; /* german */
+ 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.out.level_out = &level_out;
+ r.out.ctr = &ctr;
n_matrix[0][0] = dn;
for (i = 0; i < ARRAY_SIZE(formats); i++) {
- r.in.req.req1.format_offered = DRSUAPI_DS_NAME_FORMAT_FQDN_1779;
- r.in.req.req1.format_desired = formats[i];
+ r.in.req->req1.format_offered = DRSUAPI_DS_NAME_FORMAT_FQDN_1779;
+ r.in.req->req1.format_desired = formats[i];
names[0].str = dn;
status = dcerpc_drsuapi_DsCrackNames(p, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
@@ -79,13 +87,13 @@ static bool test_DsCrackNamesMatrix(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
}
printf("testing DsCrackNames (matrix prep) with name '%s' from format: %d desired format:%d ",
- names[0].str, r.in.req.req1.format_offered, r.in.req.req1.format_desired);
+ names[0].str, r.in.req->req1.format_offered, r.in.req->req1.format_desired);
printf("dcerpc_drsuapi_DsCrackNames failed - %s\n", errstr);
ret = false;
} else if (!W_ERROR_IS_OK(r.out.result)) {
printf("testing DsCrackNames (matrix prep) with name '%s' from format: %d desired format:%d ",
- names[0].str, r.in.req.req1.format_offered, r.in.req.req1.format_desired);
+ names[0].str, r.in.req->req1.format_offered, r.in.req->req1.format_desired);
printf("DsCrackNames failed - %s\n", win_errstr(r.out.result));
ret = false;
@@ -96,33 +104,33 @@ static bool test_DsCrackNamesMatrix(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
}
switch (formats[i]) {
case DRSUAPI_DS_NAME_FORMAT_SERVICE_PRINCIPAL:
- if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_NOT_UNIQUE) {
+ if (r.out.ctr->ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_NOT_UNIQUE) {
printf(__location__ ": Unexpected error (%d): This name lookup should fail\n",
- r.out.ctr.ctr1->array[0].status);
+ r.out.ctr->ctr1->array[0].status);
return false;
}
printf ("(expected) error\n");
break;
case DRSUAPI_DS_NAME_FORMAT_USER_PRINCIPAL:
- if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_NO_MAPPING) {
+ if (r.out.ctr->ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_NO_MAPPING) {
printf(__location__ ": Unexpected error (%d): This name lookup should fail\n",
- r.out.ctr.ctr1->array[0].status);
+ r.out.ctr->ctr1->array[0].status);
return false;
}
printf ("(expected) error\n");
break;
case DRSUAPI_DS_NAME_FORMAT_DNS_DOMAIN:
case DRSUAPI_DS_NAME_FORMAT_SID_OR_SID_HISTORY:
- if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_RESOLVE_ERROR) {
+ if (r.out.ctr->ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_RESOLVE_ERROR) {
printf(__location__ ": Unexpected error (%d): This name lookup should fail\n",
- r.out.ctr.ctr1->array[0].status);
+ r.out.ctr->ctr1->array[0].status);
return false;
}
printf ("(expected) error\n");
break;
default:
- if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) {
- printf("Error: %d\n", r.out.ctr.ctr1->array[0].status);
+ if (r.out.ctr->ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) {
+ printf("Error: %d\n", r.out.ctr->ctr1->array[0].status);
return false;
}
}
@@ -139,15 +147,15 @@ static bool test_DsCrackNamesMatrix(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
n_from[i] = NULL;
break;
default:
- n_from[i] = r.out.ctr.ctr1->array[0].result_name;
+ n_from[i] = r.out.ctr->ctr1->array[0].result_name;
printf("%s\n", n_from[i]);
}
}
for (i = 0; i < ARRAY_SIZE(formats); i++) {
for (j = 0; j < ARRAY_SIZE(formats); j++) {
- r.in.req.req1.format_offered = formats[i];
- r.in.req.req1.format_desired = formats[j];
+ r.in.req->req1.format_offered = formats[i];
+ r.in.req->req1.format_desired = formats[j];
if (!n_from[i]) {
n_matrix[i][j] = NULL;
continue;
@@ -160,11 +168,11 @@ static bool test_DsCrackNamesMatrix(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
}
printf("testing DsCrackNames (matrix) with name '%s' from format: %d desired format:%d failed - %s",
- names[0].str, r.in.req.req1.format_offered, r.in.req.req1.format_desired, errstr);
+ names[0].str, r.in.req->req1.format_offered, r.in.req->req1.format_desired, errstr);
ret = false;
} else if (!W_ERROR_IS_OK(r.out.result)) {
printf("testing DsCrackNames (matrix) with name '%s' from format: %d desired format:%d failed - %s",
- names[0].str, r.in.req.req1.format_offered, r.in.req.req1.format_desired,
+ names[0].str, r.in.req->req1.format_offered, r.in.req->req1.format_desired,
win_errstr(r.out.result));
ret = false;
}
@@ -172,8 +180,8 @@ static bool test_DsCrackNamesMatrix(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
if (!ret) {
return ret;
}
- if (r.out.ctr.ctr1->array[0].status == DRSUAPI_DS_NAME_STATUS_OK) {
- n_matrix[i][j] = r.out.ctr.ctr1->array[0].result_name;
+ if (r.out.ctr->ctr1->array[0].status == DRSUAPI_DS_NAME_STATUS_OK) {
+ n_matrix[i][j] = r.out.ctr->ctr1->array[0].result_name;
} else {
n_matrix[i][j] = NULL;
}
@@ -211,6 +219,9 @@ bool test_DsCrackNames(struct torture_context *tctx,
{
NTSTATUS status;
struct drsuapi_DsCrackNames r;
+ union drsuapi_DsNameRequest req;
+ int32_t level_out;
+ union drsuapi_DsNameCtr ctr;
struct drsuapi_DsNameString names[1];
bool ret = true;
const char *dns_domain;
@@ -233,21 +244,25 @@ bool test_DsCrackNames(struct torture_context *tctx,
ZERO_STRUCT(r);
r.in.bind_handle = &priv->bind_handle;
r.in.level = 1;
- r.in.req.req1.codepage = 1252; /* german */
- 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 = &req;
+ r.in.req->req1.codepage = 1252; /* german */
+ 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_SID_OR_SID_HISTORY;
+ r.in.req->req1.format_desired = DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT;
- r.in.req.req1.format_offered = DRSUAPI_DS_NAME_FORMAT_SID_OR_SID_HISTORY;
- r.in.req.req1.format_desired = DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT;
+ r.out.level_out = &level_out;
+ r.out.ctr = &ctr;
dom_sid = dom_sid_string(mem_ctx, torture_join_sid(priv->join));
names[0].str = dom_sid;
printf("testing DsCrackNames with name '%s' desired format:%d\n",
- names[0].str, r.in.req.req1.format_desired);
+ names[0].str, r.in.req->req1.format_desired);
status = dcerpc_drsuapi_DsCrackNames(p, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
@@ -260,8 +275,8 @@ bool test_DsCrackNames(struct torture_context *tctx,
} else if (!W_ERROR_IS_OK(r.out.result)) {
printf("DsCrackNames failed - %s\n", win_errstr(r.out.result));
ret = false;
- } else if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) {
- printf("DsCrackNames failed on name - %d\n", r.out.ctr.ctr1->array[0].status);
+ } else if (r.out.ctr->ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) {
+ printf("DsCrackNames failed on name - %d\n", r.out.ctr->ctr1->array[0].status);
ret = false;
}
@@ -269,13 +284,13 @@ bool test_DsCrackNames(struct torture_context *tctx,
return ret;
}
- dns_domain = r.out.ctr.ctr1->array[0].dns_domain_name;
- nt4_domain = r.out.ctr.ctr1->array[0].result_name;
+ dns_domain = r.out.ctr->ctr1->array[0].dns_domain_name;
+ nt4_domain = r.out.ctr->ctr1->array[0].result_name;
- r.in.req.req1.format_desired = DRSUAPI_DS_NAME_FORMAT_GUID;
+ r.in.req->req1.format_desired = DRSUAPI_DS_NAME_FORMAT_GUID;
printf("testing DsCrackNames with name '%s' desired format:%d\n",
- names[0].str, r.in.req.req1.format_desired);
+ names[0].str, r.in.req->req1.format_desired);
status = dcerpc_drsuapi_DsCrackNames(p, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
@@ -288,8 +303,8 @@ bool test_DsCrackNames(struct torture_context *tctx,
} else if (!W_ERROR_IS_OK(r.out.result)) {
printf("DsCrackNames failed - %s\n", win_errstr(r.out.result));
ret = false;
- } else if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) {
- printf("DsCrackNames failed on name - %d\n", r.out.ctr.ctr1->array[0].status);
+ } else if (r.out.ctr->ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) {
+ printf("DsCrackNames failed on name - %d\n", r.out.ctr->ctr1->array[0].status);
ret = false;
}
@@ -297,14 +312,14 @@ bool test_DsCrackNames(struct torture_context *tctx,
return ret;
}
- priv->domain_dns_name = r.out.ctr.ctr1->array[0].dns_domain_name;
- priv->domain_guid_str = r.out.ctr.ctr1->array[0].result_name;
+ priv->domain_dns_name = r.out.ctr->ctr1->array[0].dns_domain_name;
+ priv->domain_guid_str = r.out.ctr->ctr1->array[0].result_name;
GUID_from_string(priv->domain_guid_str, &priv->domain_guid);
- r.in.req.req1.format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779;
+ r.in.req->req1.format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779;
printf("testing DsCrackNames with name '%s' desired format:%d\n",
- names[0].str, r.in.req.req1.format_desired);
+ names[0].str, r.in.req->req1.format_desired);
status = dcerpc_drsuapi_DsCrackNames(p, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
@@ -317,8 +332,8 @@ bool test_DsCrackNames(struct torture_context *tctx,
} else if (!W_ERROR_IS_OK(r.out.result)) {
printf("DsCrackNames failed - %s\n", win_errstr(r.out.result));
ret = false;
- } else if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) {
- printf("DsCrackNames failed on name - %d\n", r.out.ctr.ctr1->array[0].status);
+ } else if (r.out.ctr->ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) {
+ printf("DsCrackNames failed on name - %d\n", r.out.ctr->ctr1->array[0].status);
ret = false;
}
@@ -328,7 +343,7 @@ bool test_DsCrackNames(struct torture_context *tctx,
ldb = ldb_init(mem_ctx, tctx->ev);
- realm_dn_str = r.out.ctr.ctr1->array[0].result_name;
+ realm_dn_str = r.out.ctr->ctr1->array[0].result_name;
realm_dn = ldb_dn_new(mem_ctx, ldb, realm_dn_str);
realm_canonical = ldb_dn_canonical_string(mem_ctx, realm_dn);
@@ -350,12 +365,12 @@ bool test_DsCrackNames(struct torture_context *tctx,
return false;
};
- 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->req1.format_offered = DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT;
+ r.in.req->req1.format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779;
names[0].str = nt4_domain;
printf("testing DsCrackNames with name '%s' desired format:%d\n",
- names[0].str, r.in.req.req1.format_desired);
+ names[0].str, r.in.req->req1.format_desired);
status = dcerpc_drsuapi_DsCrackNames(p, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
@@ -368,8 +383,8 @@ bool test_DsCrackNames(struct torture_context *tctx,
} else if (!W_ERROR_IS_OK(r.out.result)) {
printf("DsCrackNames failed - %s\n", win_errstr(r.out.result));
ret = false;
- } else if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) {
- printf("DsCrackNames failed on name - %d\n", r.out.ctr.ctr1->array[0].status);
+ } else if (r.out.ctr->ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) {
+ printf("DsCrackNames failed on name - %d\n", r.out.ctr->ctr1->array[0].status);
ret = false;
}
@@ -377,14 +392,14 @@ bool test_DsCrackNames(struct torture_context *tctx,
return ret;
}
- priv->domain_obj_dn = r.out.ctr.ctr1->array[0].result_name;
+ priv->domain_obj_dn = r.out.ctr->ctr1->array[0].result_name;
- 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->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(mem_ctx, "%s%s$", nt4_domain, test_dc);
printf("testing DsCrackNames with name '%s' desired format:%d\n",
- names[0].str, r.in.req.req1.format_desired);
+ names[0].str, r.in.req->req1.format_desired);
status = dcerpc_drsuapi_DsCrackNames(p, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
@@ -397,8 +412,8 @@ bool test_DsCrackNames(struct torture_context *tctx,
} else if (!W_ERROR_IS_OK(r.out.result)) {
printf("DsCrackNames failed - %s\n", win_errstr(r.out.result));
ret = false;
- } else if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) {
- printf("DsCrackNames failed on name - %d\n", r.out.ctr.ctr1->array[0].status);
+ } else if (r.out.ctr->ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) {
+ printf("DsCrackNames failed on name - %d\n", r.out.ctr->ctr1->array[0].status);
ret = false;
}
@@ -406,14 +421,14 @@ bool test_DsCrackNames(struct torture_context *tctx,
return ret;
}
- FQDN_1779_name = r.out.ctr.ctr1->array[0].result_name;
+ FQDN_1779_name = r.out.ctr->ctr1->array[0].result_name;
- r.in.req.req1.format_offered = DRSUAPI_DS_NAME_FORMAT_GUID;
- r.in.req.req1.format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779;
+ r.in.req->req1.format_offered = DRSUAPI_DS_NAME_FORMAT_GUID;
+ r.in.req->req1.format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779;
names[0].str = priv->domain_guid_str;
printf("testing DsCrackNames with name '%s' desired format:%d\n",
- names[0].str, r.in.req.req1.format_desired);
+ names[0].str, r.in.req->req1.format_desired);
status = dcerpc_drsuapi_DsCrackNames(p, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
@@ -426,8 +441,8 @@ bool test_DsCrackNames(struct torture_context *tctx,
} else if (!W_ERROR_IS_OK(r.out.result)) {
printf("DsCrackNames failed - %s\n", win_errstr(r.out.result));
ret = false;
- } else if (r.out.ctr.ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) {
- printf("DsCrackNames failed on name - %d\n", r.out.ctr.ctr1->array[0].status);
+ } else if (r.out.ctr->ctr1->array[0].status != DRSUAPI_DS_NAME_STATUS_OK) {
+ printf("DsCrackNames failed on name - %d\n", r.out.ctr->ctr1->array[0].status);
ret = false;
}
@@ -435,8 +450,8 @@ bool test_DsCrackNames(struct torture_context *tctx,
return ret;
}
- if (strcmp(priv->domain_dns_name, r.out.ctr.ctr1->array[0].dns_domain_name) != 0) {
- printf("DsCrackNames failed to return same DNS name - expected %s got %s\n", priv->domain_dns_name, r.out.ctr.ctr1->array[0].dns_domain_name);
+ if (strcmp(priv->domain_dns_name, r.out.ctr->ctr1->array[0].dns_domain_name) != 0) {
+ printf("DsCrackNames failed to return same DNS name - expected %s got %s\n", priv->domain_dns_name, r.out.ctr->ctr1->array[0].dns_domain_name);
return false;
}
@@ -920,17 +935,17 @@ bool test_DsCrackNames(struct torture_context *tctx,
for (i=0; i < ARRAY_SIZE(crack); i++) {
const char *comment;
- r.in.req.req1.format_flags = crack[i].flags;
- r.in.req.req1.format_offered = crack[i].format_offered;
- r.in.req.req1.format_desired = crack[i].format_desired;
+ r.in.req->req1.format_flags = crack[i].flags;
+ r.in.req->req1.format_offered = crack[i].format_offered;
+ r.in.req->req1.format_desired = crack[i].format_desired;
names[0].str = crack[i].str;
if (crack[i].comment) {
comment = talloc_asprintf(mem_ctx, "'%s' with name '%s' desired format:%d\n",
- crack[i].comment, names[0].str, r.in.req.req1.format_desired);
+ crack[i].comment, names[0].str, r.in.req->req1.format_desired);
} else {
comment = talloc_asprintf(mem_ctx, "'%s' desired format:%d\n",
- names[0].str, r.in.req.req1.format_desired);
+ names[0].str, r.in.req->req1.format_desired);
}
if (crack[i].skip) {
printf("skipping: %s", comment);
@@ -947,11 +962,11 @@ bool test_DsCrackNames(struct torture_context *tctx,
} else if (!W_ERROR_IS_OK(r.out.result)) {
printf("DsCrackNames failed - %s\n", win_errstr(r.out.result));
ret = false;
- } else if (r.out.ctr.ctr1->array[0].status != crack[i].status) {
+ } else if (r.out.ctr->ctr1->array[0].status != crack[i].status) {
if (crack[i].alternate_status) {
- if (r.out.ctr.ctr1->array[0].status != crack[i].alternate_status) {
+ if (r.out.ctr->ctr1->array[0].status != crack[i].alternate_status) {
printf("DsCrackNames unexpected status %d, wanted %d or %d on: %s\n",
- r.out.ctr.ctr1->array[0].status,
+ r.out.ctr->ctr1->array[0].status,
crack[i].status,
crack[i].alternate_status,
comment);
@@ -959,30 +974,30 @@ bool test_DsCrackNames(struct torture_context *tctx,
}
} else {
printf("DsCrackNames unexpected status %d, wanted %d on: %s\n",
- r.out.ctr.ctr1->array[0].status,
+ r.out.ctr->ctr1->array[0].status,
crack[i].status,
comment);
ret = false;
}
} else if (crack[i].expected_str
- && (strcmp(r.out.ctr.ctr1->array[0].result_name,
+ && (strcmp(r.out.ctr->ctr1->array[0].result_name,
crack[i].expected_str) != 0)) {
- if (strcasecmp(r.out.ctr.ctr1->array[0].result_name,
+ if (strcasecmp(r.out.ctr->ctr1->array[0].result_name,
crack[i].expected_str) != 0) {
printf("DsCrackNames failed - got %s, expected %s on %s\n",
- r.out.ctr.ctr1->array[0].result_name,
+ r.out.ctr->ctr1->array[0].result_name,
crack[i].expected_str, comment);
ret = false;
} else {
printf("(warning) DsCrackNames returned different case - got %s, expected %s on %s\n",
- r.out.ctr.ctr1->array[0].result_name,
+ r.out.ctr->ctr1->array[0].result_name,
crack[i].expected_str, comment);
}
} else if (crack[i].expected_dns
- && (strcmp(r.out.ctr.ctr1->array[0].dns_domain_name,
+ && (strcmp(r.out.ctr->ctr1->array[0].dns_domain_name,
crack[i].expected_dns) != 0)) {
printf("DsCrackNames failed - got DNS name %s, expected %s on %s\n",
- r.out.ctr.ctr1->array[0].result_name,
+ r.out.ctr->ctr1->array[0].result_name,
crack[i].expected_str, comment);
ret = false;
}
diff --git a/source4/torture/rpc/dssync.c b/source4/torture/rpc/dssync.c
index 41bb168619..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;
}
}
@@ -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;
}
diff --git a/source4/torture/rpc/eventlog.c b/source4/torture/rpc/eventlog.c
index feeeb9330b..d5665ad07d 100644
--- a/source4/torture/rpc/eventlog.c
+++ b/source4/torture/rpc/eventlog.c
@@ -40,13 +40,16 @@ static bool get_policy_handle(struct torture_context *tctx,
{
struct eventlog_OpenEventLogW r;
struct eventlog_OpenUnknown0 unknown0;
+ struct lsa_String logname, servername;
unknown0.unknown0 = 0x005c;
unknown0.unknown1 = 0x0001;
r.in.unknown0 = &unknown0;
- init_lsa_String(&r.in.logname, "dns server");
- init_lsa_String(&r.in.servername, NULL);
+ init_lsa_String(r.in.logname, "dns server");
+ init_lsa_String(r.in.servername, NULL);
+ r.in.logname = &logname;
+ r.in.servername = &servername;
r.in.unknown2 = 0x00000001;
r.in.unknown3 = 0x00000001;
r.out.handle = handle;
@@ -205,7 +208,7 @@ static bool test_ClearEventLog(struct torture_context *tctx,
return false;
r.in.handle = &handle;
- r.in.unknown = NULL;
+ r.in.backupfile = NULL;
torture_assert_ntstatus_ok(tctx,
dcerpc_eventlog_ClearEventLogW(p, tctx, &r),
diff --git a/source4/torture/rpc/initshutdown.c b/source4/torture/rpc/initshutdown.c
index 92fec5be0c..149fae6c26 100644
--- a/source4/torture/rpc/initshutdown.c
+++ b/source4/torture/rpc/initshutdown.c
@@ -61,7 +61,7 @@ static bool test_Init(struct torture_context *tctx,
init_lsa_StringLarge(r.in.message, "spottyfood");
r.in.force_apps = 1;
r.in.timeout = 30;
- r.in.reboot = 1;
+ r.in.do_reboot = 1;
status = dcerpc_initshutdown_Init(p, tctx, &r);
@@ -83,7 +83,7 @@ static bool test_InitEx(struct torture_context *tctx,
init_lsa_StringLarge(r.in.message, "spottyfood");
r.in.force_apps = 1;
r.in.timeout = 30;
- r.in.reboot = 1;
+ r.in.do_reboot = 1;
r.in.reason = 0;
status = dcerpc_initshutdown_InitEx(p, tctx, &r);
diff --git a/source4/torture/rpc/netlogon.c b/source4/torture/rpc/netlogon.c
index 3d4c594d05..f4ae5b35eb 100644
--- a/source4/torture/rpc/netlogon.c
+++ b/source4/torture/rpc/netlogon.c
@@ -29,6 +29,7 @@
#include "lib/cmdline/popt_common.h"
#include "torture/rpc/rpc.h"
#include "torture/rpc/netlogon.h"
+#include "../lib/crypto/crypto.h"
#include "libcli/auth/libcli_auth.h"
#include "librpc/gen_ndr/ndr_netlogon_c.h"
#include "librpc/gen_ndr/ndr_lsa_c.h"
@@ -77,11 +78,10 @@ static bool test_SetupCredentials(struct dcerpc_pipe *p, struct torture_context
struct netr_ServerAuthenticate a;
struct netr_Credential credentials1, credentials2, credentials3;
struct creds_CredentialState *creds;
- struct samr_Password mach_password;
- const char *plain_pass;
- const char *machine_name;
+ const struct samr_Password *mach_password;
+ const char *machine_name;
- plain_pass = cli_credentials_get_password(credentials);
+ mach_password = cli_credentials_get_nt_hash(credentials, tctx);
machine_name = cli_credentials_get_workstation(credentials);
torture_comment(tctx, "Testing ServerReqChallenge\n");
@@ -99,8 +99,6 @@ static bool test_SetupCredentials(struct dcerpc_pipe *p, struct torture_context
status = dcerpc_netr_ServerReqChallenge(p, tctx, &r);
torture_assert_ntstatus_ok(tctx, status, "ServerReqChallenge");
- E_md4hash(plain_pass, mach_password.hash);
-
a.in.server_name = NULL;
a.in.account_name = talloc_asprintf(tctx, "%s$", machine_name);
a.in.secure_channel_type = SEC_CHAN_BDC;
@@ -109,7 +107,7 @@ static bool test_SetupCredentials(struct dcerpc_pipe *p, struct torture_context
a.out.credentials = &credentials3;
creds_client_init(creds, &credentials1, &credentials2,
- &mach_password, &credentials3,
+ mach_password, &credentials3,
0);
torture_comment(tctx, "Testing ServerAuthenticate\n");
@@ -142,12 +140,12 @@ bool test_SetupCredentials2(struct dcerpc_pipe *p, struct torture_context *tctx,
struct netr_ServerAuthenticate2 a;
struct netr_Credential credentials1, credentials2, credentials3;
struct creds_CredentialState *creds;
- struct samr_Password mach_password;
+ const struct samr_Password *mach_password;
const char *machine_name;
const char *plain_pass;
+ mach_password = cli_credentials_get_nt_hash(machine_credentials, tctx);
machine_name = cli_credentials_get_workstation(machine_credentials);
- plain_pass = cli_credentials_get_password(machine_credentials);
torture_comment(tctx, "Testing ServerReqChallenge\n");
@@ -164,8 +162,6 @@ bool test_SetupCredentials2(struct dcerpc_pipe *p, struct torture_context *tctx,
status = dcerpc_netr_ServerReqChallenge(p, tctx, &r);
torture_assert_ntstatus_ok(tctx, status, "ServerReqChallenge");
- E_md4hash(plain_pass, mach_password.hash);
-
a.in.server_name = NULL;
a.in.account_name = talloc_asprintf(tctx, "%s$", machine_name);
a.in.secure_channel_type = sec_chan_type;
@@ -176,7 +172,7 @@ bool test_SetupCredentials2(struct dcerpc_pipe *p, struct torture_context *tctx,
a.out.credentials = &credentials3;
creds_client_init(creds, &credentials1, &credentials2,
- &mach_password, &credentials3,
+ mach_password, &credentials3,
negotiate_flags);
torture_comment(tctx, "Testing ServerAuthenticate2\n");
@@ -326,6 +322,24 @@ static bool test_SetPassword(struct torture_context *tctx,
}
/*
+ generate a random password for password change tests
+*/
+static DATA_BLOB netlogon_very_rand_pass(TALLOC_CTX *mem_ctx, int len)
+{
+ int i;
+ DATA_BLOB password = data_blob_talloc(mem_ctx, NULL, len * 2 /* number of unicode chars */);
+ generate_random_buffer(password.data, password.length);
+
+ for (i=0; i < len; i++) {
+ if (((uint16_t *)password.data)[i] == 0) {
+ ((uint16_t *)password.data)[i] = 1;
+ }
+ }
+
+ return password;
+}
+
+/*
try a change password for our machine account
*/
static bool test_SetPassword2(struct torture_context *tctx,
@@ -335,8 +349,10 @@ static bool test_SetPassword2(struct torture_context *tctx,
NTSTATUS status;
struct netr_ServerPasswordSet2 r;
const char *password;
+ DATA_BLOB new_random_pass;
struct creds_CredentialState *creds;
struct samr_CryptPassword password_buf;
+ struct samr_Password nt_hash;
if (!test_SetupCredentials(p, tctx, machine_credentials, &creds)) {
return false;
@@ -448,6 +464,37 @@ static bool test_SetPassword2(struct torture_context *tctx,
test_SetupCredentials(p, tctx, machine_credentials, &creds),
"ServerPasswordSet failed to actually change the password");
+ new_random_pass = netlogon_very_rand_pass(tctx, 128);
+
+ /* now try a random stream of bytes for a password */
+ set_pw_in_buffer(password_buf.data, &new_random_pass);
+
+ creds_arcfour_crypt(creds, password_buf.data, 516);
+
+ memcpy(r.in.new_password.data, password_buf.data, 512);
+ r.in.new_password.length = IVAL(password_buf.data, 512);
+
+ torture_comment(tctx,
+ "Testing a third ServerPasswordSet2 on machine account, with a compleatly random password\n");
+
+ creds_client_authenticator(creds, &r.in.credential);
+
+ status = dcerpc_netr_ServerPasswordSet2(p, tctx, &r);
+ torture_assert_ntstatus_ok(tctx, status, "ServerPasswordSet (3)");
+
+ if (!creds_client_check(creds, &r.out.return_authenticator.cred)) {
+ torture_comment(tctx, "Credential chaining failed\n");
+ }
+
+ mdfour(nt_hash.hash, new_random_pass.data, new_random_pass.length);
+
+ cli_credentials_set_password(machine_credentials, NULL, CRED_UNINITIALISED);
+ cli_credentials_set_nt_hash(machine_credentials, &nt_hash, CRED_SPECIFIED);
+
+ torture_assert (tctx,
+ test_SetupCredentials(p, tctx, machine_credentials, &creds),
+ "ServerPasswordSet failed to actually change the password");
+
return true;
}
diff --git a/source4/torture/rpc/rpc.c b/source4/torture/rpc/rpc.c
index c35f93e3f9..3e5d2d4323 100644
--- a/source4/torture/rpc/rpc.c
+++ b/source4/torture/rpc/rpc.c
@@ -25,7 +25,7 @@
#include "torture/rpc/rpc.h"
#include "torture/smbtorture.h"
#include "librpc/ndr/ndr_table.h"
-#include "lib/util/dlinklist.h"
+#include "../lib/util/dlinklist.h"
static bool torture_rpc_teardown (struct torture_context *tcase,
void *data)
diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c
index d0aee057d3..1f19b8ec3f 100644
--- a/source4/torture/rpc/samr.c
+++ b/source4/torture/rpc/samr.c
@@ -498,6 +498,24 @@ static char *samr_rand_pass(TALLOC_CTX *mem_ctx, int min_len)
}
/*
+ generate a random password for password change tests
+*/
+static DATA_BLOB samr_very_rand_pass(TALLOC_CTX *mem_ctx, int len)
+{
+ int i;
+ DATA_BLOB password = data_blob_talloc(mem_ctx, NULL, len * 2 /* number of unicode chars */);
+ generate_random_buffer(password.data, password.length);
+
+ for (i=0; i < len; i++) {
+ if (((uint16_t *)password.data)[i] == 0) {
+ ((uint16_t *)password.data)[i] = 1;
+ }
+ }
+
+ return password;
+}
+
+/*
generate a random password for password change tests (fixed length)
*/
static char *samr_rand_pass_fixed_len(TALLOC_CTX *mem_ctx, int len)
@@ -1841,6 +1859,156 @@ bool test_ChangePasswordUser3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return ret;
}
+bool test_ChangePasswordRandomBytes(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+ const char *account_string,
+ struct policy_handle *handle,
+ char **password)
+{
+ NTSTATUS status;
+ struct samr_ChangePasswordUser3 r;
+ struct samr_SetUserInfo s;
+ union samr_UserInfo u;
+ DATA_BLOB session_key;
+ DATA_BLOB confounded_session_key = data_blob_talloc(mem_ctx, NULL, 16);
+ uint8_t confounder[16];
+ struct MD5Context ctx;
+
+ bool ret = true;
+ struct lsa_String server, account;
+ struct samr_CryptPassword nt_pass;
+ struct samr_Password nt_verifier;
+ DATA_BLOB new_random_pass;
+ char *newpass;
+ char *oldpass;
+ uint8_t old_nt_hash[16], new_nt_hash[16];
+ NTTIME t;
+
+ new_random_pass = samr_very_rand_pass(mem_ctx, 128);
+
+ if (!*password) {
+ printf("Failing ChangePasswordUser3 as old password was NULL. Previous test failed?\n");
+ return false;
+ }
+
+ oldpass = *password;
+ server.string = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p));
+ init_lsa_String(&account, account_string);
+
+ s.in.user_handle = handle;
+ s.in.info = &u;
+ s.in.level = 25;
+
+ ZERO_STRUCT(u);
+
+ u.info25.info.fields_present = SAMR_FIELD_PASSWORD;
+
+ set_pw_in_buffer(u.info25.password.data, &new_random_pass);
+
+ status = dcerpc_fetch_session_key(p, &session_key);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("SetUserInfo level %u - no session key - %s\n",
+ s.in.level, nt_errstr(status));
+ return false;
+ }
+
+ generate_random_buffer((uint8_t *)confounder, 16);
+
+ MD5Init(&ctx);
+ MD5Update(&ctx, confounder, 16);
+ MD5Update(&ctx, session_key.data, session_key.length);
+ MD5Final(confounded_session_key.data, &ctx);
+
+ arcfour_crypt_blob(u.info25.password.data, 516, &confounded_session_key);
+ memcpy(&u.info25.password.data[516], confounder, 16);
+
+ printf("Testing SetUserInfo level 25 (set password ex) with a password made up of only random bytes\n");
+
+ status = dcerpc_samr_SetUserInfo(p, mem_ctx, &s);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("SetUserInfo level %u failed - %s\n",
+ s.in.level, nt_errstr(status));
+ ret = false;
+ }
+
+ printf("Testing ChangePasswordUser3 with a password made up of only random bytes\n");
+
+ mdfour(old_nt_hash, new_random_pass.data, new_random_pass.length);
+
+ new_random_pass = samr_very_rand_pass(mem_ctx, 128);
+
+ mdfour(new_nt_hash, new_random_pass.data, new_random_pass.length);
+
+ set_pw_in_buffer(nt_pass.data, &new_random_pass);
+ arcfour_crypt(nt_pass.data, old_nt_hash, 516);
+ E_old_pw_hash(new_nt_hash, old_nt_hash, nt_verifier.hash);
+
+ r.in.server = &server;
+ r.in.account = &account;
+ r.in.nt_password = &nt_pass;
+ r.in.nt_verifier = &nt_verifier;
+ r.in.lm_change = 0;
+ r.in.lm_password = NULL;
+ r.in.lm_verifier = NULL;
+ r.in.password3 = NULL;
+
+ unix_to_nt_time(&t, time(NULL));
+
+ status = dcerpc_samr_ChangePasswordUser3(p, mem_ctx, &r);
+
+ if (NT_STATUS_EQUAL(status, NT_STATUS_PASSWORD_RESTRICTION)) {
+ if (r.out.reject && r.out.reject->reason != SAMR_REJECT_OTHER) {
+ printf("expected SAMR_REJECT_OTHER (%d), got %d\n",
+ SAMR_REJECT_OTHER, r.out.reject->reason);
+ return false;
+ }
+ /* Perhaps the server has a 'min password age' set? */
+
+ } else if (!NT_STATUS_IS_OK(status)) {
+ printf("ChangePasswordUser3 failed - %s\n", nt_errstr(status));
+ ret = false;
+ }
+
+ newpass = samr_rand_pass(mem_ctx, 128);
+
+ mdfour(old_nt_hash, new_random_pass.data, new_random_pass.length);
+
+ E_md4hash(newpass, new_nt_hash);
+
+ encode_pw_buffer(nt_pass.data, newpass, STR_UNICODE);
+ arcfour_crypt(nt_pass.data, old_nt_hash, 516);
+ E_old_pw_hash(new_nt_hash, old_nt_hash, nt_verifier.hash);
+
+ r.in.server = &server;
+ r.in.account = &account;
+ r.in.nt_password = &nt_pass;
+ r.in.nt_verifier = &nt_verifier;
+ r.in.lm_change = 0;
+ r.in.lm_password = NULL;
+ r.in.lm_verifier = NULL;
+ r.in.password3 = NULL;
+
+ unix_to_nt_time(&t, time(NULL));
+
+ status = dcerpc_samr_ChangePasswordUser3(p, mem_ctx, &r);
+
+ if (NT_STATUS_EQUAL(status, NT_STATUS_PASSWORD_RESTRICTION)) {
+ if (r.out.reject && r.out.reject->reason != SAMR_REJECT_OTHER) {
+ printf("expected SAMR_REJECT_OTHER (%d), got %d\n",
+ SAMR_REJECT_OTHER, r.out.reject->reason);
+ return false;
+ }
+ /* Perhaps the server has a 'min password age' set? */
+
+ } else if (!NT_STATUS_IS_OK(status)) {
+ printf("ChangePasswordUser3 (on second random password) failed - %s\n", nt_errstr(status));
+ ret = false;
+ } else {
+ *password = talloc_strdup(mem_ctx, newpass);
+ }
+
+ return ret;
+}
+
static bool test_GetMembersInAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
struct policy_handle *alias_handle)
@@ -2061,7 +2229,11 @@ static bool test_user_ops(struct dcerpc_pipe *p,
if (!test_ChangePasswordUser2(p, tctx, base_acct_name, &password, samr_rand_pass(tctx, 4), false)) {
ret = false;
}
-
+
+ /* Try a compleatly random password */
+ if (!test_ChangePasswordRandomBytes(p, tctx, base_acct_name, user_handle, &password)) {
+ ret = false;
+ }
}
for (i = 0; password_fields[i]; i++) {
@@ -2554,7 +2726,7 @@ static bool test_CreateUser(struct dcerpc_pipe *p, struct torture_context *tctx,
status = dcerpc_samr_CreateUser(p, user_ctx, &r);
if (dom_sid_equal(domain_sid, dom_sid_parse_talloc(tctx, SID_BUILTIN))) {
- if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) {
+ if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED) || NT_STATUS_EQUAL(status, NT_STATUS_INVALID_PARAMETER)) {
printf("Server correctly refused create of '%s'\n", r.in.account_name->string);
return true;
} else {
@@ -2678,7 +2850,7 @@ static bool test_CreateUser2(struct dcerpc_pipe *p, struct torture_context *tctx
status = dcerpc_samr_CreateUser2(p, user_ctx, &r);
if (dom_sid_equal(domain_sid, dom_sid_parse_talloc(tctx, SID_BUILTIN))) {
- if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) {
+ if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED) || NT_STATUS_EQUAL(status, NT_STATUS_INVALID_PARAMETER)) {
printf("Server correctly refused create of '%s'\n", r.in.account_name->string);
continue;
} else {
@@ -4525,7 +4697,7 @@ static bool test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
printf("testing samr_Connect4\n");
r4.in.system_name = "";
- r4.in.unknown = 0;
+ r4.in.client_version = 0;
r4.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
r4.out.connect_handle = &h;
@@ -4543,7 +4715,7 @@ static bool test_Connect(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
printf("testing samr_Connect5\n");
- info.info1.unknown1 = 0;
+ info.info1.client_version = 0;
info.info1.unknown2 = 0;
r5.in.system_name = "";
diff --git a/source4/torture/rpc/samr_accessmask.c b/source4/torture/rpc/samr_accessmask.c
index f496f6300c..bfff8c9267 100644
--- a/source4/torture/rpc/samr_accessmask.c
+++ b/source4/torture/rpc/samr_accessmask.c
@@ -53,7 +53,7 @@ static NTSTATUS torture_samr_Connect5(struct torture_context *tctx,
struct samr_Connect5 r5;
union samr_ConnectInfo info;
- info.info1.unknown1 = 0;
+ info.info1.client_version = 0;
info.info1.unknown2 = 0;
r5.in.system_name = "";
r5.in.level = 1;
diff --git a/source4/torture/rpc/samsync.c b/source4/torture/rpc/samsync.c
index 6a02af5bb5..2d2aaa80d6 100644
--- a/source4/torture/rpc/samsync.c
+++ b/source4/torture/rpc/samsync.c
@@ -24,7 +24,7 @@
#include "includes.h"
#include "torture/torture.h"
#include "auth/auth.h"
-#include "lib/util/dlinklist.h"
+#include "../lib/util/dlinklist.h"
#include "../lib/crypto/crypto.h"
#include "system/time.h"
#include "torture/rpc/rpc.h"
diff --git a/source4/torture/rpc/spoolss_notify.c b/source4/torture/rpc/spoolss_notify.c
index ab6309d55f..dc2a82414b 100644
--- a/source4/torture/rpc/spoolss_notify.c
+++ b/source4/torture/rpc/spoolss_notify.c
@@ -29,7 +29,7 @@
#include "smb_server/smb_server.h"
#include "librpc/rpc/dcerpc_proto.h"
#include "lib/socket/netif.h"
-#include "util/dlinklist.h"
+#include "../lib/util/dlinklist.h"
#include "ntvfs/ntvfs.h"
#include "param/param.h"
diff --git a/source4/torture/rpc/winreg.c b/source4/torture/rpc/winreg.c
index 898813f807..bd897f0ada 100644
--- a/source4/torture/rpc/winreg.c
+++ b/source4/torture/rpc/winreg.c
@@ -1539,10 +1539,11 @@ static bool test_QueryValue(struct dcerpc_pipe *p,
ZERO_STRUCT(r);
r.in.handle = handle;
r.in.data = NULL;
- r.in.value_name.name = valuename;
+ r.in.value_name = talloc_zero(tctx, struct winreg_String);
+ r.in.value_name->name = valuename;
r.in.type = &zero_type;
- r.in.size = &offered;
- r.in.length = &zero;
+ r.in.data_size = &offered;
+ r.in.data_length = &zero;
status = dcerpc_winreg_QueryValue(p, tctx, &r);
if (NT_STATUS_IS_ERR(status)) {
@@ -1630,7 +1631,7 @@ static bool test_InitiateSystemShutdown(struct torture_context *tctx,
init_lsa_StringLarge(r.in.message, "spottyfood");
r.in.force_apps = 1;
r.in.timeout = 30;
- r.in.reboot = 1;
+ r.in.do_reboot = 1;
torture_assert_ntstatus_ok(tctx,
dcerpc_winreg_InitiateSystemShutdown(p, tctx, &r),
@@ -1655,7 +1656,7 @@ static bool test_InitiateSystemShutdownEx(struct torture_context *tctx,
init_lsa_StringLarge(r.in.message, "spottyfood");
r.in.force_apps = 1;
r.in.timeout = 30;
- r.in.reboot = 1;
+ r.in.do_reboot = 1;
r.in.reason = 0;
torture_assert_ntstatus_ok(tctx,
diff --git a/source4/torture/rpc/wkssvc.c b/source4/torture/rpc/wkssvc.c
index 6e9937086e..015f20f6e2 100644
--- a/source4/torture/rpc/wkssvc.c
+++ b/source4/torture/rpc/wkssvc.c
@@ -1218,12 +1218,12 @@ static bool test_NetrJoinDomain2(struct torture_context *tctx,
}
switch (join_status) {
- case NetSetupDomainName:
+ case NET_SETUP_DOMAIN_NAME:
expected_err = WERR_SETUP_ALREADY_JOINED;
break;
- case NetSetupUnknownStatus:
- case NetSetupUnjoined:
- case NetSetupWorkgroupName:
+ case NET_SETUP_UNKNOWN_STATUS:
+ case NET_SETUP_UNJOINED:
+ case NET_SETUP_WORKGROUP_NAME:
default:
expected_err = WERR_OK;
break;
@@ -1271,7 +1271,7 @@ static bool test_NetrJoinDomain2(struct torture_context *tctx,
return false;
}
- if (join_status != NetSetupDomainName) {
+ if (join_status != NET_SETUP_DOMAIN_NAME) {
torture_comment(tctx,
"Join verify failed: got %d\n", join_status);
return false;
@@ -1302,12 +1302,12 @@ static bool test_NetrUnjoinDomain2(struct torture_context *tctx,
}
switch (join_status) {
- case NetSetupUnjoined:
+ case NET_SETUP_UNJOINED:
expected_err = WERR_SETUP_NOT_JOINED;
break;
- case NetSetupDomainName:
- case NetSetupUnknownStatus:
- case NetSetupWorkgroupName:
+ case NET_SETUP_DOMAIN_NAME:
+ case NET_SETUP_UNKNOWN_STATUS:
+ case NET_SETUP_WORKGROUP_NAME:
default:
expected_err = WERR_OK;
break;
@@ -1350,11 +1350,11 @@ static bool test_NetrUnjoinDomain2(struct torture_context *tctx,
}
switch (join_status) {
- case NetSetupUnjoined:
- case NetSetupWorkgroupName:
+ case NET_SETUP_UNJOINED:
+ case NET_SETUP_WORKGROUP_NAME:
break;
- case NetSetupUnknown:
- case NetSetupDomainName:
+ case NET_SETUP_UNKNOWN_STATUS:
+ case NET_SETUP_DOMAIN_NAME:
default:
torture_comment(tctx,
"Unjoin verify failed: got %d\n", join_status);