diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-09-10 23:47:29 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 15:06:24 -0500 |
commit | 45d0b9a0a3750bfe98e274df456d6d50631a91ed (patch) | |
tree | d704591d53c4e64e1f43a8a9a70b4e8bbd124ad1 | |
parent | a43dd8b956790985b8541011d41ce21bb76f1c1b (diff) | |
download | samba-45d0b9a0a3750bfe98e274df456d6d50631a91ed.tar.gz samba-45d0b9a0a3750bfe98e274df456d6d50631a91ed.tar.bz2 samba-45d0b9a0a3750bfe98e274df456d6d50631a91ed.zip |
r25070: Revert DRSUAPI conversion to new API, as it broke some tests.
(This used to be commit cfb33df2d0eb36704d4702948a78102153663131)
-rw-r--r-- | source4/samba4-knownfail | 7 | ||||
-rw-r--r-- | source4/torture/rpc/drsuapi.c | 487 | ||||
-rw-r--r-- | source4/torture/rpc/drsuapi_cracknames.c | 436 | ||||
-rw-r--r-- | source4/torture/rpc/rpc.c | 4 |
4 files changed, 605 insertions, 329 deletions
diff --git a/source4/samba4-knownfail b/source4/samba4-knownfail index bd74746f67..56c2672b06 100644 --- a/source4/samba4-knownfail +++ b/source4/samba4-knownfail @@ -13,6 +13,7 @@ RPC-HANDLES.*/mixed-shared RPC-EPMAPPER.*/Insert RPC-EPMAPPER.*/InqObject RPC-DFS.* +RPC-DRSUAPI.* RPC-LSALOOKUP RPC-CRACKNAMES blackbox.smbclient.*USER and PASSWD @@ -26,11 +27,5 @@ RPC-NETLOGON.*/LogonControl2 RPC-NETLOGON.*/GetAnyDCName RPC-NETLOGON.*/DsrEnumerateDomainTrusts RPC-NETLOGON.*/DsrGetDcSiteCoverageW -RPC-DRSUAPI.*/DsReplicaUpdateRefs -RPC-DRSUAPI.*/DsReplicaGetInfo -RPC-DRSUAPI.*/DsCrackNames -RPC-DRSUAPI.*/DsGetDomainControllerInfo -RPC-DRSUAPI.*/QuerySitesByCost -RPC-DRSUAPI.*/DsGetNCChange BASE-CHARSET.*/Testing partial surrogate .*NET-API-DELSHARE.* # DelShare isn't implemented yet diff --git a/source4/torture/rpc/drsuapi.c b/source4/torture/rpc/drsuapi.c index 3f59f1d56d..42c0cc8bda 100644 --- a/source4/torture/rpc/drsuapi.c +++ b/source4/torture/rpc/drsuapi.c @@ -25,7 +25,6 @@ #include "torture/torture.h" #include "librpc/gen_ndr/ndr_drsuapi_c.h" #include "torture/rpc/rpc.h" -#include "dlinklist.h" #include "param/param.h" #define TEST_MACHINE_NAME "torturetest" @@ -35,7 +34,6 @@ bool test_DsBind(struct dcerpc_pipe *p, struct torture_context *tctx, { NTSTATUS status; struct drsuapi_DsBind r; - struct torture_rpc_tcase_data *rpc_tcase; GUID_from_string(DRSUAPI_DS_BIND_GUID, &priv->bind_guid); @@ -43,87 +41,28 @@ bool test_DsBind(struct dcerpc_pipe *p, struct torture_context *tctx, r.in.bind_info = NULL; r.out.bind_handle = &priv->bind_handle; - status = dcerpc_drsuapi_DsBind(p, tctx, &r); - torture_assert_ntstatus_ok(tctx, status, "DsBind"); - torture_assert_werr_ok(tctx, r.out.result, "DsBind"); - - rpc_tcase = (struct torture_rpc_tcase_data *)tctx->active_tcase->data; + torture_comment(tctx, "testing DsBind\n"); - priv->join = rpc_tcase->join_ctx; + status = dcerpc_drsuapi_DsBind(p, tctx, &r); + if (!NT_STATUS_IS_OK(status)) { + const char *errstr = nt_errstr(status); + if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) { + errstr = dcerpc_errstr(tctx, p->last_fault_code); + } + torture_fail(tctx, "dcerpc_drsuapi_DsBind failed"); + } else if (!W_ERROR_IS_OK(r.out.result)) { + torture_fail(tctx, "DsBind failed"); + } return true; } -bool test_DsUnbind(struct dcerpc_pipe *p, struct torture_context *tctx, - struct DsPrivate *priv) -{ - NTSTATUS status; - struct drsuapi_DsUnbind r; - - r.in.bind_handle = &priv->bind_handle; - r.out.bind_handle = &priv->bind_handle; - - status = dcerpc_drsuapi_DsUnbind(p, tctx, &r); - torture_assert_ntstatus_ok(tctx, status, - "dcerpc_drsuapi_DsUnbind failed"); - torture_assert_werr_ok(tctx, r.out.result, "DsBind failed"); - - return true; -} - -static bool wrap_test_drsuapi(struct torture_context *tctx, - struct torture_tcase *tcase, - struct torture_test *test) -{ - bool (*fn) (struct torture_context *, struct dcerpc_pipe *, struct DsPrivate *); - struct torture_rpc_tcase_data *tcase_data = - (struct torture_rpc_tcase_data *)tcase->data; - bool ret; - struct DsPrivate priv; - - ZERO_STRUCT(priv); - - fn = test->fn; - - if (!test_DsBind(tcase_data->pipe, tctx, &priv)) - return false; - - ret = fn(tctx, tcase_data->pipe, &priv); - - if (!test_DsUnbind(tcase_data->pipe, tctx, &priv)) - return false; - - return ret; -} - -static struct torture_test *torture_rpc_tcase_add_drsuapi_test( - struct torture_rpc_tcase *tcase, - const char *name, - bool (*fn) (struct torture_context *, struct dcerpc_pipe *, struct DsPrivate *priv)) -{ - struct torture_test *test; - - test = talloc(tcase, struct torture_test); - - test->name = talloc_strdup(test, name); - test->description = NULL; - test->run = wrap_test_drsuapi; - test->dangerous = false; - test->data = NULL; - test->fn = fn; - - DLIST_ADD(tcase->tcase.tests, test); - - return test; -} - -static bool test_DsGetDomainControllerInfo(struct torture_context *torture, - struct dcerpc_pipe *p, - struct DsPrivate *priv) +static bool test_DsGetDomainControllerInfo(struct dcerpc_pipe *p, struct torture_context *torture, + struct DsPrivate *priv) { NTSTATUS status; struct drsuapi_DsGetDomainControllerInfo r; - bool found = false; + BOOL found = False; int i, j, k; struct { @@ -176,15 +115,15 @@ static bool test_DsGetDomainControllerInfo(struct torture_context *torture, } torture_assert_int_equal(torture, - r.in.req.req1.level, r.out.level_out, - "dcerpc_drsuapi_DsGetDomainControllerInfo level"); + 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, torture_join_netbios_name(priv->join)) == 0) { - found = true; + found = True; break; } } @@ -193,7 +132,7 @@ static bool test_DsGetDomainControllerInfo(struct torture_context *torture, 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; + found = True; priv->dcinfo = r.out.ctr.ctr2.array[k]; break; } @@ -211,8 +150,7 @@ static bool test_DsGetDomainControllerInfo(struct torture_context *torture, r.in.req.req1.domain_name = "__UNKNOWN_DOMAIN__"; /* This is clearly ignored for this level */ r.in.req.req1.level = -1; - torture_comment(torture, - "testing DsGetDomainControllerInfo level %d on domainname '%s'\n", + printf("testing DsGetDomainControllerInfo level %d on domainname '%s'\n", r.in.req.req1.level, r.in.req.req1.domain_name); status = dcerpc_drsuapi_DsGetDomainControllerInfo(p, torture, &r); @@ -229,7 +167,7 @@ static bool test_DsGetDomainControllerInfo(struct torture_context *torture, 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; + found = True; break; } } @@ -241,47 +179,65 @@ static bool test_DsGetDomainControllerInfo(struct torture_context *torture, return true; } -static bool test_DsWriteAccountSpn(struct torture_context *tctx, - struct dcerpc_pipe *p, +static BOOL test_DsWriteAccountSpn(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct DsPrivate *priv) { NTSTATUS status; struct drsuapi_DsWriteAccountSpn r; struct drsuapi_DsNameString names[2]; + BOOL ret = True; r.in.bind_handle = &priv->bind_handle; r.in.level = 1; + 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; - names[0].str = talloc_asprintf(tctx, "smbtortureSPN/%s",priv->dcinfo.netbios_name); - names[1].str = talloc_asprintf(tctx, "smbtortureSPN/%s",priv->dcinfo.dns_name); - - status = dcerpc_drsuapi_DsWriteAccountSpn(p, tctx, &r); - torture_assert_ntstatus_ok(tctx, status, - "dcerpc_drsuapi_DsWriteAccountSpn failed"); - torture_assert_werr_ok(tctx, r.out.result, "DsWriteAccountSpn failed"); + 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); + + status = dcerpc_drsuapi_DsWriteAccountSpn(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + const char *errstr = nt_errstr(status); + if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) { + errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); + } + printf("dcerpc_drsuapi_DsWriteAccountSpn failed - %s\n", errstr); + ret = False; + } else if (!W_ERROR_IS_OK(r.out.result)) { + printf("DsWriteAccountSpn failed - %s\n", win_errstr(r.out.result)); + ret = False; + } r.in.req.req1.operation = DRSUAPI_DS_SPN_OPERATION_DELETE; r.in.req.req1.unknown1 = 0; - status = dcerpc_drsuapi_DsWriteAccountSpn(p, tctx, &r); - torture_assert_ntstatus_ok(tctx, status, - "dcerpc_drsuapi_DsWriteAccountSpn failed"); - torture_assert_werr_ok(tctx, r.out.result, "DsWriteAccountSpn failed"); + status = dcerpc_drsuapi_DsWriteAccountSpn(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + const char *errstr = nt_errstr(status); + if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) { + errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); + } + printf("dcerpc_drsuapi_DsWriteAccountSpn failed - %s\n", errstr); + ret = False; + } else if (!W_ERROR_IS_OK(r.out.result)) { + printf("DsWriteAccountSpn failed - %s\n", win_errstr(r.out.result)); + ret = False; + } - return true; + return ret; } -static bool test_DsReplicaGetInfo(struct torture_context *tctx, - struct dcerpc_pipe *p, - struct DsPrivate *priv) +static BOOL test_DsReplicaGetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, + struct DsPrivate *priv) { NTSTATUS status; struct drsuapi_DsReplicaGetInfo r; + BOOL ret = True; int i; struct { int32_t level; @@ -351,13 +307,17 @@ static bool test_DsReplicaGetInfo(struct torture_context *tctx, } }; + if (lp_parm_bool(NULL, "torture", "samba4", False)) { + printf("skipping DsReplicaGetInfo test against Samba4\n"); + return True; + } + r.in.bind_handle = &priv->bind_handle; for (i=0; i < ARRAY_SIZE(array); i++) { const char *object_dn; - torture_comment(tctx, - "testing DsReplicaGetInfo level %d infotype %d\n", + printf("testing DsReplicaGetInfo level %d infotype %d\n", array[i].level, array[i].infotype); object_dn = (array[i].obj_dn ? array[i].obj_dn : priv->domain_obj_dn); @@ -380,21 +340,33 @@ static bool test_DsReplicaGetInfo(struct torture_context *tctx, break; } - status = dcerpc_drsuapi_DsReplicaGetInfo(p, tctx, &r); - torture_assert_ntstatus_ok(tctx, status, - "dcerpc_drsuapi_DsReplicaGetInfo failed"); - torture_assert_werr_ok(tctx, r.out.result, - "DsReplicaGetInfo failed"); + status = dcerpc_drsuapi_DsReplicaGetInfo(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + const char *errstr = nt_errstr(status); + if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) { + errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); + } + if (p->last_fault_code != DCERPC_FAULT_INVALID_TAG) { + printf("dcerpc_drsuapi_DsReplicaGetInfo failed - %s\n", errstr); + ret = False; + } else { + printf("DsReplicaGetInfo level %d and/or infotype %d not supported by server\n", + array[i].level, array[i].infotype); + } + } else if (!W_ERROR_IS_OK(r.out.result)) { + printf("DsReplicaGetInfo failed - %s\n", win_errstr(r.out.result)); + ret = False; + } } - return true; + return ret; } -static bool test_DsReplicaSync(struct torture_context *tctx, - struct dcerpc_pipe *p, - struct DsPrivate *priv) +static BOOL test_DsReplicaSync(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, + struct DsPrivate *priv) { NTSTATUS status; + BOOL ret = True; int i; struct drsuapi_DsReplicaSync r; struct drsuapi_DsReplicaObjectIdentifier nc; @@ -408,14 +380,24 @@ static bool test_DsReplicaSync(struct torture_context *tctx, } }; + if (!lp_parm_bool(NULL, "torture", "dangerous", False)) { + printf("DsReplicaSync disabled - enable dangerous tests to use\n"); + return True; + } + + if (lp_parm_bool(NULL, "torture", "samba4", False)) { + printf("skipping DsReplicaSync test against Samba4\n"); + return True; + } + ZERO_STRUCT(null_guid); ZERO_STRUCT(null_sid); r.in.bind_handle = &priv->bind_handle; for (i=0; i < ARRAY_SIZE(array); i++) { - torture_comment(tctx, "testing DsReplicaSync level %d\n", - array[i].level); + printf("testing DsReplicaSync level %d\n", + array[i].level); r.in.level = array[i].level; switch(r.in.level) { @@ -431,21 +413,28 @@ static bool test_DsReplicaSync(struct torture_context *tctx, break; } - status = dcerpc_drsuapi_DsReplicaSync(p, tctx, &r); - torture_assert_ntstatus_ok(tctx, status, - "dcerpc_drsuapi_DsReplicaSync failed"); - torture_assert_werr_ok(tctx, r.out.result, - "DsReplicaSync failed"); + status = dcerpc_drsuapi_DsReplicaSync(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + const char *errstr = nt_errstr(status); + if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) { + errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); + } + printf("dcerpc_drsuapi_DsReplicaSync failed - %s\n", errstr); + ret = False; + } else if (!W_ERROR_IS_OK(r.out.result)) { + printf("DsReplicaSync failed - %s\n", win_errstr(r.out.result)); + ret = False; + } } - return true; + return ret; } -static bool test_DsReplicaUpdateRefs(struct torture_context *tctx, - struct dcerpc_pipe *p, - struct DsPrivate *priv) +static BOOL test_DsReplicaUpdateRefs(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, + struct DsPrivate *priv) { NTSTATUS status; + BOOL ret = True; int i; struct drsuapi_DsReplicaUpdateRefs r; struct drsuapi_DsReplicaObjectIdentifier nc; @@ -459,13 +448,18 @@ static bool test_DsReplicaUpdateRefs(struct torture_context *tctx, } }; + if (lp_parm_bool(NULL, "torture", "samba4", False)) { + printf("skipping DsReplicaUpdateRefs test against Samba4\n"); + return True; + } + ZERO_STRUCT(null_guid); ZERO_STRUCT(null_sid); r.in.bind_handle = &priv->bind_handle; for (i=0; i < ARRAY_SIZE(array); i++) { - torture_comment(tctx, "testing DsReplicaUpdateRefs level %d\n", + printf("testing DsReplicaUpdateRefs level %d\n", array[i].level); r.in.level = array[i].level; @@ -476,28 +470,35 @@ static bool test_DsReplicaUpdateRefs(struct torture_context *tctx, nc.dn = priv->domain_obj_dn?priv->domain_obj_dn:""; r.in.req.req1.naming_context = &nc; - r.in.req.req1.dest_dsa_dns_name = talloc_asprintf(tctx, "__some_dest_dsa_guid_string._msdn.%s", + r.in.req.req1.dest_dsa_dns_name = talloc_asprintf(mem_ctx, "__some_dest_dsa_guid_string._msdn.%s", priv->domain_dns_name); r.in.req.req1.dest_dsa_guid = null_guid; r.in.req.req1.options = 0; break; } - status = dcerpc_drsuapi_DsReplicaUpdateRefs(p, tctx, &r); - torture_assert_ntstatus_ok(tctx, status, - "dcerpc_drsuapi_DsReplicaUpdateRefs failed"); - torture_assert_werr_ok(tctx, r.out.result, - "DsReplicaUpdateRefs failed"); + status = dcerpc_drsuapi_DsReplicaUpdateRefs(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + const char *errstr = nt_errstr(status); + if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) { + errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); + } + printf("dcerpc_drsuapi_DsReplicaUpdateRefs failed - %s\n", errstr); + ret = False; + } else if (!W_ERROR_IS_OK(r.out.result)) { + printf("DsReplicaUpdateRefs failed - %s\n", win_errstr(r.out.result)); + ret = False; + } } - return true; + return ret; } -static bool test_DsGetNCChanges(struct torture_context *tctx, - struct dcerpc_pipe *p, - struct DsPrivate *priv) +static BOOL test_DsGetNCChanges(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, + struct DsPrivate *priv) { NTSTATUS status; + BOOL ret = True; int i; struct drsuapi_DsGetNCChanges r; struct drsuapi_DsReplicaObjectIdentifier nc; @@ -514,11 +515,16 @@ static bool test_DsGetNCChanges(struct torture_context *tctx, } }; + if (lp_parm_bool(NULL, "torture", "samba4", False)) { + printf("skipping DsGetNCChanges test against Samba4\n"); + return True; + } + ZERO_STRUCT(null_guid); ZERO_STRUCT(null_sid); for (i=0; i < ARRAY_SIZE(array); i++) { - torture_comment(tctx, "testing DsGetNCChanges level %d\n", + printf("testing DsGetNCChanges level %d\n", array[i].level); r.in.bind_handle = &priv->bind_handle; @@ -538,7 +544,7 @@ static bool test_DsGetNCChanges(struct torture_context *tctx, 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(NULL, "drsuapi", "compression", false)) { + if (lp_parm_bool(NULL, "drsuapi","compression", False)) { r.in.req.req5.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES; } r.in.req.req5.max_object_count = 0; @@ -560,10 +566,10 @@ static bool test_DsGetNCChanges(struct torture_context *tctx, 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(NULL, "drsuapi", "compression", false)) { + if (lp_parm_bool(NULL,"drsuapi","compression",False)) { r.in.req.req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES; } - if (lp_parm_bool(NULL, "drsuapi", "neighbour_writeable",true)) { + if (lp_parm_bool(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_SYNC_ON_STARTUP @@ -583,21 +589,29 @@ static bool test_DsGetNCChanges(struct torture_context *tctx, break; } - status = dcerpc_drsuapi_DsGetNCChanges(p, tctx, &r); - torture_assert_ntstatus_ok(tctx, status, - "dcerpc_drsuapi_DsGetNCChanges failed"); - torture_assert_werr_ok(tctx, r.out.result, - "DsGetNCChanges failed"); + status = dcerpc_drsuapi_DsGetNCChanges(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + const char *errstr = nt_errstr(status); + if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) { + errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); + } + printf("dcerpc_drsuapi_DsGetNCChanges failed - %s\n", errstr); + ret = False; + } else if (!W_ERROR_IS_OK(r.out.result)) { + printf("DsGetNCChanges failed - %s\n", win_errstr(r.out.result)); + ret = False; + } } - return true; + return ret; } -bool test_QuerySitesByCost(struct torture_context *tctx, struct dcerpc_pipe *p, +BOOL test_QuerySitesByCost(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct DsPrivate *priv) { NTSTATUS status; struct drsuapi_QuerySitesByCost r; + BOOL ret = True; const char *my_site = "Default-First-Site-Name"; const char *remote_site1 = "smbtorture-nonexisting-site1"; @@ -605,60 +619,165 @@ bool test_QuerySitesByCost(struct torture_context *tctx, struct dcerpc_pipe *p, r.in.bind_handle = &priv->bind_handle; r.in.level = 1; - r.in.req.req1.site_from = talloc_strdup(tctx, my_site); + 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(tctx, const char *, r.in.req.req1.num_req); - r.in.req.req1.site_to[0] = talloc_strdup(tctx, remote_site1); - r.in.req.req1.site_to[1] = talloc_strdup(tctx, remote_site2); + 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; - status = dcerpc_drsuapi_QuerySitesByCost(p, tctx, &r); - torture_assert_ntstatus_ok(tctx, status, "drsuapi_QuerySitesByCost"); - torture_assert_werr_ok(tctx, r.out.result, "QuerySitesByCost failed"); + status = dcerpc_drsuapi_QuerySitesByCost(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + const char *errstr = nt_errstr(status); + if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) { + errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); + } + printf("drsuapi_QuerySitesByCost - %s\n", errstr); + ret = False; + } else if (!W_ERROR_IS_OK(r.out.result)) { + printf("QuerySitesByCost failed - %s\n", win_errstr(r.out.result)); + ret = False; + } - torture_assert_werr_equal(tctx, r.out.ctr.ctr1.info[0].error_code, - WERR_DS_OBJ_NOT_FOUND, "expected not found error"); - torture_assert_werr_equal(tctx, r.out.ctr.ctr1.info[1].error_code, - WERR_DS_OBJ_NOT_FOUND, "expected not found error"); + 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)) { + printf("expected error_code WERR_DS_OBJ_NOT_FOUND, got %s\n", + 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)) { + printf("expected site_cost %d, got %d\n", + (uint32_t) -1, r.out.ctr.ctr1.info[0].site_cost); + ret = False; + } + } + + return ret; - torture_assert_int_equal(tctx, r.out.ctr.ctr1.info[0].site_cost, - (uint32_t) -1, "unexpected site cost"); - - torture_assert_int_equal(tctx, r.out.ctr.ctr1.info[1].site_cost, - (uint32_t) -1, "unexpected site cost"); - return true; } -struct torture_suite *torture_rpc_drsuapi(TALLOC_CTX *mem_ctx) +BOOL test_DsUnbind(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, + struct DsPrivate *priv) { - struct torture_suite *suite = torture_suite_create(mem_ctx, "DRSUAPI"); - struct torture_test *test; - struct torture_rpc_tcase *tcase = torture_suite_add_machine_rpc_iface_tcase(suite, "drsuapi", - &ndr_table_drsuapi, TEST_MACHINE_NAME); - - torture_rpc_tcase_add_drsuapi_test(tcase, "QuerySitesByCost", test_QuerySitesByCost); - torture_rpc_tcase_add_drsuapi_test(tcase, "DsGetDomainControllerInfo", test_DsGetDomainControllerInfo); - torture_rpc_tcase_add_drsuapi_test(tcase, "DsCrackNames", test_DsCrackNames); - torture_rpc_tcase_add_drsuapi_test(tcase, "DsWriteAccountSpn", test_DsWriteAccountSpn); - torture_rpc_tcase_add_drsuapi_test(tcase, "DsReplicaGetInfo", test_DsReplicaGetInfo); - test = torture_rpc_tcase_add_drsuapi_test(tcase, "DsReplicaSync", test_DsReplicaSync); - test->dangerous = true; - torture_rpc_tcase_add_drsuapi_test(tcase, "DsReplicaUpdateRefs", test_DsReplicaUpdateRefs); - torture_rpc_tcase_add_drsuapi_test(tcase, "DsGetNCChange", test_DsGetNCChanges); - - return suite; + NTSTATUS status; + struct drsuapi_DsUnbind r; + BOOL ret = True; + + r.in.bind_handle = &priv->bind_handle; + r.out.bind_handle = &priv->bind_handle; + + printf("testing DsUnbind\n"); + + status = dcerpc_drsuapi_DsUnbind(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + const char *errstr = nt_errstr(status); + if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) { + errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); + } + printf("dcerpc_drsuapi_DsUnbind failed - %s\n", errstr); + ret = False; + } else if (!W_ERROR_IS_OK(r.out.result)) { + printf("DsBind failed - %s\n", win_errstr(r.out.result)); + ret = False; + } + + return ret; } -struct torture_suite *torture_rpc_drsuapi_cracknames(TALLOC_CTX *mem_ctx) +bool torture_rpc_drsuapi(struct torture_context *torture) { - struct torture_suite *suite = torture_suite_create(mem_ctx, "CRACKNAMES"); - struct torture_rpc_tcase *tcase = torture_suite_add_machine_rpc_iface_tcase(suite, "drsuapi", - &ndr_table_drsuapi, TEST_MACHINE_NAME); + NTSTATUS status; + struct dcerpc_pipe *p; + bool ret = true; + struct DsPrivate priv; + struct cli_credentials *machine_credentials; + + ZERO_STRUCT(priv); - torture_rpc_tcase_add_drsuapi_test(tcase, "DsGetDomainControllerInfo", test_DsGetDomainControllerInfo); - torture_rpc_tcase_add_drsuapi_test(tcase, "DsCrackNames", test_DsCrackNames); + priv.join = torture_join_domain(TEST_MACHINE_NAME, ACB_SVRTRUST, + &machine_credentials); + if (!priv.join) { + torture_fail(torture, "Failed to join as BDC"); + } - return suite; + status = torture_rpc_connection(torture, + &p, + &ndr_table_drsuapi); + if (!NT_STATUS_IS_OK(status)) { + torture_leave_domain(priv.join); + torture_fail(torture, "Unable to connect to DRSUAPI pipe"); + } + + ret &= test_DsBind(p, torture, &priv); +#if 0 + ret &= test_QuerySitesByCost(p, torture, &priv); +#endif + ret &= test_DsGetDomainControllerInfo(p, torture, &priv); + + ret &= test_DsCrackNames(p, torture, &priv); + + ret &= test_DsWriteAccountSpn(p, torture, &priv); + + ret &= test_DsReplicaGetInfo(p, torture, &priv); + + ret &= test_DsReplicaSync(p, torture, &priv); + + ret &= test_DsReplicaUpdateRefs(p, torture, &priv); + + ret &= test_DsGetNCChanges(p, torture, &priv); + + ret &= test_DsUnbind(p, torture, &priv); + + torture_leave_domain(priv.join); + + return ret; +} + + +bool torture_rpc_drsuapi_cracknames(struct torture_context *torture) +{ + NTSTATUS status; + struct dcerpc_pipe *p; + bool ret = true; + struct DsPrivate priv; + struct cli_credentials *machine_credentials; + + torture_comment(torture, "Connected to DRSUAPI pipe\n"); + + ZERO_STRUCT(priv); + + priv.join = torture_join_domain(TEST_MACHINE_NAME, ACB_SVRTRUST, + &machine_credentials); + if (!priv.join) { + torture_fail(torture, "Failed to join as BDC\n"); + } + + status = torture_rpc_connection(torture, + &p, + &ndr_table_drsuapi); + if (!NT_STATUS_IS_OK(status)) { + torture_leave_domain(priv.join); + torture_fail(torture, "Unable to connect to DRSUAPI pipe"); + } + + ret &= test_DsBind(p, torture, &priv); + + if (ret) { + /* We don't care if this fails, we just need some info from it */ + test_DsGetDomainControllerInfo(p, torture, &priv); + + ret &= test_DsCrackNames(p, torture, &priv); + + ret &= test_DsUnbind(p, torture, &priv); + } + + torture_leave_domain(priv.join); + + return ret; } diff --git a/source4/torture/rpc/drsuapi_cracknames.c b/source4/torture/rpc/drsuapi_cracknames.c index 08c102c400..0747f12d28 100644 --- a/source4/torture/rpc/drsuapi_cracknames.c +++ b/source4/torture/rpc/drsuapi_cracknames.c @@ -27,14 +27,16 @@ #include "torture/rpc/rpc.h" #include "ldb/include/ldb.h" #include "libcli/security/security.h" +#include "param/param.h" -static bool test_DsCrackNamesMatrix(struct dcerpc_pipe *p, struct torture_context *tctx, +static BOOL test_DsCrackNamesMatrix(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct DsPrivate *priv, const char *dn, const char *user_principal_name, const char *service_principal_name) { NTSTATUS status; + BOOL ret = True; struct drsuapi_DsCrackNames r; enum drsuapi_DsNameFormat formats[] = { DRSUAPI_DS_NAME_FORMAT_FQDN_1779, @@ -69,34 +71,59 @@ static bool test_DsCrackNamesMatrix(struct dcerpc_pipe *p, struct torture_contex 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, tctx, &r); - - torture_comment(tctx, "testing DsCrackNames (matrix prep) with name '%s' from format: %d desired format:%d ", + status = dcerpc_drsuapi_DsCrackNames(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + const char *errstr = nt_errstr(status); + if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) { + 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); + + 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); - torture_assert_ntstatus_ok(tctx, status, "dcerpc_drsuapi_DsCrackNames failed"); - torture_assert_werr_ok(tctx, r.out.result, "DsCrackNames failed"); + + printf("DsCrackNames failed - %s\n", win_errstr(r.out.result)); + ret = False; + } + if (!ret) { + return ret; + } switch (formats[i]) { case DRSUAPI_DS_NAME_FORMAT_SERVICE_PRINCIPAL: - torture_assert_int_equal(tctx, r.out.ctr.ctr1->array[0].status, DRSUAPI_DS_NAME_STATUS_NOT_UNIQUE, - "Unexpected error: This name lookup should fail"); - torture_comment(tctx, "(expected) error\n"); + 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); + return False; + } + printf ("(expected) error\n"); break; case DRSUAPI_DS_NAME_FORMAT_USER_PRINCIPAL: - torture_assert_int_equal(tctx, r.out.ctr.ctr1->array[0].status, DRSUAPI_DS_NAME_STATUS_NO_MAPPING, - "Unexpected error: This name lookup should fail"); - torture_comment(tctx, "(expected) error\n"); + 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); + return False; + } + printf ("(expected) error\n"); break; case DRSUAPI_DS_NAME_FORMAT_DNS_DOMAIN: case DRSUAPI_DS_NAME_FORMAT_SID_OR_SID_HISTORY: - torture_assert_int_equal(tctx, r.out.ctr.ctr1->array[0].status, - DRSUAPI_DS_NAME_STATUS_RESOLVE_ERROR, - "Unexpected error: This name lookup should fail"); - torture_comment(tctx, "(expected) error\n"); + 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); + return False; + } + printf ("(expected) error\n"); break; default: - torture_assert_int_equal(tctx, r.out.ctr.ctr1->array[0].status, DRSUAPI_DS_NAME_STATUS_OK, - "Error"); + 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; + } } switch (formats[i]) { @@ -112,7 +139,7 @@ static bool test_DsCrackNamesMatrix(struct dcerpc_pipe *p, struct torture_contex break; default: n_from[i] = r.out.ctr.ctr1->array[0].result_name; - torture_comment(tctx, "%s\n", n_from[i]); + printf("%s\n", n_from[i]); } } @@ -125,12 +152,25 @@ static bool test_DsCrackNamesMatrix(struct dcerpc_pipe *p, struct torture_contex continue; } names[0].str = n_from[i]; - status = dcerpc_drsuapi_DsCrackNames(p, tctx, &r); - torture_comment(tctx, "testing DsCrackNames (matrix) with name '%s' from format: %d desired format:%d", - names[0].str, r.in.req.req1.format_offered, r.in.req.req1.format_desired); - torture_assert_ntstatus_ok(tctx, status, "DsCrackNames failed"); - torture_assert_werr_ok(tctx, r.out.result, "DsCrackNames failed"); - + status = dcerpc_drsuapi_DsCrackNames(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + const char *errstr = nt_errstr(status); + if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) { + 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); + 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, + win_errstr(r.out.result)); + ret = False; + } + + 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; } else { @@ -149,22 +189,28 @@ static bool test_DsCrackNamesMatrix(struct dcerpc_pipe *p, struct torture_contex /* we can't map to these two */ } else if (n_matrix[i][j] == NULL && formats[j] == DRSUAPI_DS_NAME_FORMAT_USER_PRINCIPAL) { } else if (n_matrix[i][j] == NULL && formats[j] == DRSUAPI_DS_NAME_FORMAT_SERVICE_PRINCIPAL) { - } else { - torture_assert_str_equal(tctx, n_matrix[i][j], n_from[j], - "dcerpc_drsuapi_DsCrackNames mismatch"); + } else if (n_matrix[i][j] == NULL && n_from[j] != NULL) { + printf("dcerpc_drsuapi_DsCrackNames mismatch - from %d to %d: %s should be %s\n", formats[i], formats[j], n_matrix[i][j], n_from[j]); + ret = False; + } else if (n_matrix[i][j] != NULL && n_from[j] == NULL) { + printf("dcerpc_drsuapi_DsCrackNames mismatch - from %d to %d: %s should be %s\n", formats[i], formats[j], n_matrix[i][j], n_from[j]); + ret = False; + } else if (strcmp(n_matrix[i][j], n_from[j]) != 0) { + printf("dcerpc_drsuapi_DsCrackNames mismatch - from %d to %d: %s should be %s\n", formats[i], formats[j], n_matrix[i][j], n_from[j]); + ret = False; } } } - return true; + return ret; } -bool test_DsCrackNames(struct torture_context *tctx, - struct dcerpc_pipe *p, - struct DsPrivate *priv) +BOOL test_DsCrackNames(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, + struct DsPrivate *priv) { NTSTATUS status; struct drsuapi_DsCrackNames r; struct drsuapi_DsNameString names[1]; + BOOL ret = True; const char *dns_domain; const char *nt4_domain; const char *FQDN_1779_name; @@ -194,18 +240,32 @@ bool test_DsCrackNames(struct torture_context *tctx, 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; - dom_sid = dom_sid_string(tctx, torture_join_sid(priv->join)); + 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); - status = dcerpc_drsuapi_DsCrackNames(p, tctx, &r); - torture_assert_ntstatus_ok(tctx, status, "DsCrackNames"); - torture_assert_werr_ok(tctx, r.out.result, "DsCrackNames failed"); - torture_assert_int_equal(tctx, r.out.ctr.ctr1->array[0].status, DRSUAPI_DS_NAME_STATUS_OK, - "DsCrackNames failed on name"); + status = dcerpc_drsuapi_DsCrackNames(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + const char *errstr = nt_errstr(status); + if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) { + errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); + } + printf("dcerpc_drsuapi_DsCrackNames failed - %s\n", errstr); + ret = False; + } 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); + ret = False; + } + + if (!ret) { + return ret; + } dns_domain = r.out.ctr.ctr1->array[0].dns_domain_name; nt4_domain = r.out.ctr.ctr1->array[0].result_name; @@ -215,11 +275,25 @@ bool test_DsCrackNames(struct torture_context *tctx, printf("testing DsCrackNames with name '%s' desired format:%d\n", names[0].str, r.in.req.req1.format_desired); - status = dcerpc_drsuapi_DsCrackNames(p, tctx, &r); - torture_assert_ntstatus_ok(tctx, status, "dcerpc_drsuapi_DsCrackNames failed"); - torture_assert_werr_ok(tctx, r.out.result, "DsCrackNames failed"); - torture_assert_int_equal(tctx, r.out.ctr.ctr1->array[0].status, DRSUAPI_DS_NAME_STATUS_OK, - "DsCrackNames failed on name"); + status = dcerpc_drsuapi_DsCrackNames(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + const char *errstr = nt_errstr(status); + if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) { + errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); + } + printf("dcerpc_drsuapi_DsCrackNames failed - %s\n", errstr); + ret = False; + } 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); + ret = False; + } + + if (!ret) { + 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; @@ -227,56 +301,108 @@ bool test_DsCrackNames(struct torture_context *tctx, r.in.req.req1.format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779; - torture_comment(tctx, "testing DsCrackNames with name '%s' desired format:%d\n", + printf("testing DsCrackNames with name '%s' desired format:%d\n", names[0].str, r.in.req.req1.format_desired); - status = dcerpc_drsuapi_DsCrackNames(p, tctx, &r); - torture_assert_ntstatus_ok(tctx, status, "dcerpc_drsuapi_DsCrackNames failed"); - torture_assert_werr_ok(tctx, r.out.result, "DsCrackNames failed"); - torture_assert_int_equal(tctx, r.out.ctr.ctr1->array[0].status, DRSUAPI_DS_NAME_STATUS_OK, - "DsCrackNames failed on name"); + status = dcerpc_drsuapi_DsCrackNames(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + const char *errstr = nt_errstr(status); + if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) { + errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); + } + printf("dcerpc_drsuapi_DsCrackNames failed - %s\n", errstr); + ret = False; + } 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); + ret = False; + } + + if (!ret) { + return ret; + } - ldb = ldb_init(tctx); + ldb = ldb_init(mem_ctx); realm_dn_str = r.out.ctr.ctr1->array[0].result_name; - realm_dn = ldb_dn_new(tctx, ldb, realm_dn_str); - realm_canonical = ldb_dn_canonical_string(tctx, realm_dn); - - torture_assert_str_equal(tctx, realm_canonical, - talloc_asprintf(tctx, "%s/", dns_domain), "local Round trip on canonical name failed"); + realm_dn = ldb_dn_new(mem_ctx, ldb, realm_dn_str); + realm_canonical = ldb_dn_canonical_string(mem_ctx, realm_dn); + + if (strcmp(realm_canonical, + talloc_asprintf(mem_ctx, "%s/", dns_domain))!= 0) { + printf("local Round trip on canonical name failed: %s != %s!\n", + realm_canonical, + talloc_asprintf(mem_ctx, "%s/", dns_domain)); + return False; + }; - realm_canonical_ex = ldb_dn_canonical_ex_string(tctx, realm_dn); + realm_canonical_ex = ldb_dn_canonical_ex_string(mem_ctx, realm_dn); - torture_assert_str_equal(tctx, realm_canonical_ex, talloc_asprintf(tctx, "%s\n", dns_domain), - "local Round trip on canonical ex name failed"); + if (strcmp(realm_canonical_ex, + talloc_asprintf(mem_ctx, "%s\n", dns_domain))!= 0) { + printf("local Round trip on canonical ex name failed: %s != %s!\n", + realm_canonical, + talloc_asprintf(mem_ctx, "%s\n", dns_domain)); + 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; names[0].str = nt4_domain; - torture_comment(tctx, "testing DsCrackNames with name '%s' desired format:%d\n", + printf("testing DsCrackNames with name '%s' desired format:%d\n", names[0].str, r.in.req.req1.format_desired); - status = dcerpc_drsuapi_DsCrackNames(p, tctx, &r); - torture_assert_ntstatus_ok(tctx, status, "dcerpc_drsuapi_DsCrackNames failed"); - torture_assert_werr_ok(tctx, r.out.result, "DsCrackNames failed"); - torture_assert_int_equal(tctx, r.out.ctr.ctr1->array[0].status, DRSUAPI_DS_NAME_STATUS_OK, - "DsCrackNames failed on name"); + status = dcerpc_drsuapi_DsCrackNames(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + const char *errstr = nt_errstr(status); + if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) { + errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); + } + printf("dcerpc_drsuapi_DsCrackNames failed - %s\n", errstr); + ret = False; + } 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); + ret = False; + } + + if (!ret) { + return ret; + } 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; - names[0].str = talloc_asprintf(tctx, "%s%s$", nt4_domain, test_dc); + names[0].str = talloc_asprintf(mem_ctx, "%s%s$", nt4_domain, test_dc); - torture_comment(tctx, "testing DsCrackNames with name '%s' desired format:%d\n", + printf("testing DsCrackNames with name '%s' desired format:%d\n", names[0].str, r.in.req.req1.format_desired); - status = dcerpc_drsuapi_DsCrackNames(p, tctx, &r); - torture_assert_ntstatus_ok(tctx, status, "dcerpc_drsuapi_DsCrackNames failed"); - torture_assert_werr_ok(tctx, r.out.result, "DsCrackNames failed"); - torture_assert_int_equal(tctx, r.out.ctr.ctr1->array[0].status, DRSUAPI_DS_NAME_STATUS_OK, - "DsCrackNames failed on name"); + status = dcerpc_drsuapi_DsCrackNames(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + const char *errstr = nt_errstr(status); + if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) { + errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); + } + printf("dcerpc_drsuapi_DsCrackNames failed - %s\n", errstr); + ret = False; + } 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); + ret = False; + } + + if (!ret) { + return ret; + } FQDN_1779_name = r.out.ctr.ctr1->array[0].result_name; @@ -284,31 +410,47 @@ bool test_DsCrackNames(struct torture_context *tctx, r.in.req.req1.format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779; names[0].str = priv->domain_guid_str; - torture_comment(tctx, "testing DsCrackNames with name '%s' desired format:%d\n", + printf("testing DsCrackNames with name '%s' desired format:%d\n", names[0].str, r.in.req.req1.format_desired); - status = dcerpc_drsuapi_DsCrackNames(p, tctx, &r); - torture_assert_ntstatus_ok(tctx, status, "dcerpc_drsuapi_DsCrackNames failed"); - torture_assert_werr_ok(tctx, r.out.result, "DsCrackNames failed"); - torture_assert_int_equal(tctx, r.out.ctr.ctr1->array[0].status, DRSUAPI_DS_NAME_STATUS_OK, - "DsCrackNames failed on name"); + status = dcerpc_drsuapi_DsCrackNames(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + const char *errstr = nt_errstr(status); + if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) { + errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); + } + printf("dcerpc_drsuapi_DsCrackNames failed - %s\n", errstr); + ret = False; + } 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); + ret = False; + } + + if (!ret) { + return ret; + } - torture_assert_str_equal(tctx, priv->domain_dns_name, r.out.ctr.ctr1->array[0].dns_domain_name, - "DsCrackNames failed to return same DNS 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; + } - FQDN_1779_dn = ldb_dn_new(tctx, ldb, FQDN_1779_name); + FQDN_1779_dn = ldb_dn_new(mem_ctx, ldb, FQDN_1779_name); - canonical_name = ldb_dn_canonical_string(tctx, FQDN_1779_dn); - canonical_ex_name = ldb_dn_canonical_ex_string(tctx, FQDN_1779_dn); + canonical_name = ldb_dn_canonical_string(mem_ctx, FQDN_1779_dn); + canonical_ex_name = ldb_dn_canonical_ex_string(mem_ctx, FQDN_1779_dn); - user_principal_name = talloc_asprintf(tctx, "%s$@%s", test_dc, dns_domain); + user_principal_name = talloc_asprintf(mem_ctx, "%s$@%s", test_dc, dns_domain); /* form up a user@DOMAIN */ - user_principal_name_short = talloc_asprintf(tctx, "%s$@%s", test_dc, nt4_domain); + user_principal_name_short = talloc_asprintf(mem_ctx, "%s$@%s", test_dc, nt4_domain); /* variable nt4_domain includs a trailing \ */ user_principal_name_short[strlen(user_principal_name_short) - 1] = '\0'; - service_principal_name = talloc_asprintf(tctx, "HOST/%s", test_dc); + service_principal_name = talloc_asprintf(mem_ctx, "HOST/%s", test_dc); { struct { @@ -321,7 +463,7 @@ bool test_DsCrackNames(struct torture_context *tctx, enum drsuapi_DsNameStatus status; enum drsuapi_DsNameStatus alternate_status; enum drsuapi_DsNameFlags flags; - bool skip; + BOOL skip; } crack[] = { { .format_offered = DRSUAPI_DS_NAME_FORMAT_USER_PRINCIPAL, @@ -353,7 +495,7 @@ bool test_DsCrackNames(struct torture_context *tctx, { .format_offered = DRSUAPI_DS_NAME_FORMAT_SERVICE_PRINCIPAL, .format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779, - .str = talloc_asprintf(tctx, "cifs/%s.%s", test_dc, dns_domain), + .str = talloc_asprintf(mem_ctx, "cifs/%s.%s", test_dc, dns_domain), .comment = "ServicePrincipal Name", .expected_str = FQDN_1779_name, .status = DRSUAPI_DS_NAME_STATUS_OK @@ -429,7 +571,7 @@ bool test_DsCrackNames(struct torture_context *tctx, .format_desired = DRSUAPI_DS_NAME_FORMAT_CANONICAL, .str = priv->domain_guid_str, .comment = "Domain GUID to Canonical", - .expected_str = talloc_asprintf(tctx, "%s/", dns_domain), + .expected_str = talloc_asprintf(mem_ctx, "%s/", dns_domain), .status = DRSUAPI_DS_NAME_STATUS_OK }, { @@ -437,7 +579,7 @@ bool test_DsCrackNames(struct torture_context *tctx, .format_desired = DRSUAPI_DS_NAME_FORMAT_CANONICAL_EX, .str = priv->domain_guid_str, .comment = "Domain GUID to Canonical EX", - .expected_str = talloc_asprintf(tctx, "%s\n", dns_domain), + .expected_str = talloc_asprintf(mem_ctx, "%s\n", dns_domain), .status = DRSUAPI_DS_NAME_STATUS_OK }, { @@ -447,12 +589,12 @@ bool test_DsCrackNames(struct torture_context *tctx, .comment = "display name for Microsoft Support Account", .status = DRSUAPI_DS_NAME_STATUS_OK, .alternate_status = DRSUAPI_DS_NAME_STATUS_NOT_UNIQUE, - .skip = torture_setting_bool(tctx, "samba4", False) + .skip = lp_parm_bool(NULL, "torture", "samba4", False) }, { .format_offered = DRSUAPI_DS_NAME_FORMAT_GUID, .format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779, - .str = GUID_string2(tctx, torture_join_user_guid(priv->join)), + .str = GUID_string2(mem_ctx, torture_join_user_guid(priv->join)), .comment = "Account GUID -> DN", .expected_str = FQDN_1779_name, .status = DRSUAPI_DS_NAME_STATUS_OK @@ -460,15 +602,15 @@ bool test_DsCrackNames(struct torture_context *tctx, { .format_offered = DRSUAPI_DS_NAME_FORMAT_GUID, .format_desired = DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT, - .str = GUID_string2(tctx, torture_join_user_guid(priv->join)), + .str = GUID_string2(mem_ctx, torture_join_user_guid(priv->join)), .comment = "Account GUID -> NT4 Account", - .expected_str = talloc_asprintf(tctx, "%s%s$", nt4_domain, test_dc), + .expected_str = talloc_asprintf(mem_ctx, "%s%s$", nt4_domain, test_dc), .status = DRSUAPI_DS_NAME_STATUS_OK }, { .format_offered = DRSUAPI_DS_NAME_FORMAT_GUID, .format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779, - .str = GUID_string2(tctx, &priv->dcinfo.site_guid), + .str = GUID_string2(mem_ctx, &priv->dcinfo.site_guid), .comment = "Site GUID", .expected_str = priv->dcinfo.site_dn, .status = DRSUAPI_DS_NAME_STATUS_OK @@ -476,7 +618,7 @@ bool test_DsCrackNames(struct torture_context *tctx, { .format_offered = DRSUAPI_DS_NAME_FORMAT_GUID, .format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779, - .str = GUID_string2(tctx, &priv->dcinfo.computer_guid), + .str = GUID_string2(mem_ctx, &priv->dcinfo.computer_guid), .comment = "Computer GUID", .expected_str = priv->dcinfo.computer_dn, .status = DRSUAPI_DS_NAME_STATUS_OK @@ -484,14 +626,14 @@ bool test_DsCrackNames(struct torture_context *tctx, { .format_offered = DRSUAPI_DS_NAME_FORMAT_GUID, .format_desired = DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT, - .str = GUID_string2(tctx, &priv->dcinfo.computer_guid), + .str = GUID_string2(mem_ctx, &priv->dcinfo.computer_guid), .comment = "Computer GUID -> NT4 Account", .status = DRSUAPI_DS_NAME_STATUS_OK }, { .format_offered = DRSUAPI_DS_NAME_FORMAT_GUID, .format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779, - .str = GUID_string2(tctx, &priv->dcinfo.server_guid), + .str = GUID_string2(mem_ctx, &priv->dcinfo.server_guid), .comment = "Server GUID", .expected_str = priv->dcinfo.server_dn, .status = DRSUAPI_DS_NAME_STATUS_OK @@ -499,7 +641,7 @@ bool test_DsCrackNames(struct torture_context *tctx, { .format_offered = DRSUAPI_DS_NAME_FORMAT_GUID, .format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779, - .str = GUID_string2(tctx, &priv->dcinfo.ntds_guid), + .str = GUID_string2(mem_ctx, &priv->dcinfo.ntds_guid), .comment = "NTDS GUID", .expected_str = priv->dcinfo.ntds_dn, .status = DRSUAPI_DS_NAME_STATUS_OK, @@ -515,7 +657,7 @@ bool test_DsCrackNames(struct torture_context *tctx, { .format_offered = DRSUAPI_DS_NAME_FORMAT_SERVICE_PRINCIPAL, .format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779, - .str = talloc_asprintf(tctx, "krbtgt/%s", dns_domain), + .str = talloc_asprintf(mem_ctx, "krbtgt/%s", dns_domain), .comment = "Looking for KRBTGT as a serivce principal", .status = DRSUAPI_DS_NAME_STATUS_DOMAIN_ONLY, .expected_dns = dns_domain @@ -523,7 +665,7 @@ bool test_DsCrackNames(struct torture_context *tctx, { .format_offered = DRSUAPI_DS_NAME_FORMAT_SERVICE_PRINCIPAL, .format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779, - .str = talloc_asprintf(tctx, "bogus/%s", dns_domain), + .str = talloc_asprintf(mem_ctx, "bogus/%s", dns_domain), .comment = "Looking for bogus serivce principal", .status = DRSUAPI_DS_NAME_STATUS_DOMAIN_ONLY, .expected_dns = dns_domain @@ -531,30 +673,30 @@ bool test_DsCrackNames(struct torture_context *tctx, { .format_offered = DRSUAPI_DS_NAME_FORMAT_SERVICE_PRINCIPAL, .format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779, - .str = talloc_asprintf(tctx, "bogus/%s.%s", test_dc, dns_domain), + .str = talloc_asprintf(mem_ctx, "bogus/%s.%s", test_dc, dns_domain), .comment = "Looking for bogus serivce on test DC", .status = DRSUAPI_DS_NAME_STATUS_DOMAIN_ONLY, - .expected_dns = talloc_asprintf(tctx, "%s.%s", test_dc, dns_domain) + .expected_dns = talloc_asprintf(mem_ctx, "%s.%s", test_dc, dns_domain) }, { .format_offered = DRSUAPI_DS_NAME_FORMAT_SERVICE_PRINCIPAL, .format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779, - .str = talloc_asprintf(tctx, "krbtgt"), + .str = talloc_asprintf(mem_ctx, "krbtgt"), .status = DRSUAPI_DS_NAME_STATUS_NOT_FOUND }, { .format_offered = DRSUAPI_DS_NAME_FORMAT_SERVICE_PRINCIPAL, .format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779, .comment = "Looking for the kadmin/changepw service as a serivce principal", - .str = talloc_asprintf(tctx, "kadmin/changepw"), + .str = talloc_asprintf(mem_ctx, "kadmin/changepw"), .status = DRSUAPI_DS_NAME_STATUS_OK, - .expected_str = talloc_asprintf(tctx, "CN=krbtgt,CN=Users,%s", realm_dn_str), + .expected_str = talloc_asprintf(mem_ctx, "CN=krbtgt,CN=Users,%s", realm_dn_str), .alternate_status = DRSUAPI_DS_NAME_STATUS_NOT_UNIQUE }, { .format_offered = DRSUAPI_DS_NAME_FORMAT_SERVICE_PRINCIPAL, .format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779, - .str = talloc_asprintf(tctx, "cifs/%s.%s@%s", + .str = talloc_asprintf(mem_ctx, "cifs/%s.%s@%s", test_dc, dns_domain, dns_domain), .status = DRSUAPI_DS_NAME_STATUS_DOMAIN_ONLY @@ -562,7 +704,7 @@ bool test_DsCrackNames(struct torture_context *tctx, { .format_offered = DRSUAPI_DS_NAME_FORMAT_SERVICE_PRINCIPAL, .format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779, - .str = talloc_asprintf(tctx, "cifs/%s.%s@%s", + .str = talloc_asprintf(mem_ctx, "cifs/%s.%s@%s", test_dc, dns_domain, "BOGUS"), .status = DRSUAPI_DS_NAME_STATUS_DOMAIN_ONLY, @@ -571,7 +713,7 @@ bool test_DsCrackNames(struct torture_context *tctx, { .format_offered = DRSUAPI_DS_NAME_FORMAT_SERVICE_PRINCIPAL, .format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779, - .str = talloc_asprintf(tctx, "cifs/%s.%s@%s", + .str = talloc_asprintf(mem_ctx, "cifs/%s.%s@%s", test_dc, "REALLY", "BOGUS"), .status = DRSUAPI_DS_NAME_STATUS_DOMAIN_ONLY, @@ -580,14 +722,14 @@ bool test_DsCrackNames(struct torture_context *tctx, { .format_offered = DRSUAPI_DS_NAME_FORMAT_SERVICE_PRINCIPAL, .format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779, - .str = talloc_asprintf(tctx, "cifs/%s.%s", + .str = talloc_asprintf(mem_ctx, "cifs/%s.%s", test_dc, dns_domain), .status = DRSUAPI_DS_NAME_STATUS_OK }, { .format_offered = DRSUAPI_DS_NAME_FORMAT_SERVICE_PRINCIPAL, .format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779, - .str = talloc_asprintf(tctx, "cifs/%s", + .str = talloc_asprintf(mem_ctx, "cifs/%s", test_dc), .status = DRSUAPI_DS_NAME_STATUS_OK }, @@ -634,21 +776,21 @@ bool test_DsCrackNames(struct torture_context *tctx, .format_offered = DRSUAPI_DS_NAME_FORMAT_GUID, .format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779, .comment = "BIND GUID (ie, not in the directory)", - .str = GUID_string2(tctx, &priv->bind_guid), + .str = GUID_string2(mem_ctx, &priv->bind_guid), .status = DRSUAPI_DS_NAME_STATUS_NOT_FOUND }, { .format_offered = DRSUAPI_DS_NAME_FORMAT_USER_PRINCIPAL, .format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779, .comment = "Unqualified Machine account as user principal", - .str = talloc_asprintf(tctx, "%s$", test_dc), + .str = talloc_asprintf(mem_ctx, "%s$", test_dc), .status = DRSUAPI_DS_NAME_STATUS_NOT_FOUND }, { .format_offered = DRSUAPI_DS_NAME_FORMAT_SERVICE_PRINCIPAL, .format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779, .comment = "Machine account as service principal", - .str = talloc_asprintf(tctx, "%s$", test_dc), + .str = talloc_asprintf(mem_ctx, "%s$", test_dc), .status = DRSUAPI_DS_NAME_STATUS_NOT_FOUND }, { @@ -662,7 +804,7 @@ bool test_DsCrackNames(struct torture_context *tctx, .format_offered = DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT, .format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779, .comment = "Realm as an NT4 domain lookup", - .str = talloc_asprintf(tctx, "%s\\", dns_domain), + .str = talloc_asprintf(mem_ctx, "%s\\", dns_domain), .status = DRSUAPI_DS_NAME_STATUS_NOT_FOUND }, { @@ -686,7 +828,7 @@ bool test_DsCrackNames(struct torture_context *tctx, .str = SID_BUILTIN, .comment = "Builtin Domain SID -> DN", .status = DRSUAPI_DS_NAME_STATUS_OK, - .expected_str = talloc_asprintf(tctx, "CN=Builtin,%s", realm_dn_str), + .expected_str = talloc_asprintf(mem_ctx, "CN=Builtin,%s", realm_dn_str), .alternate_status = DRSUAPI_DS_NAME_STATUS_NOT_UNIQUE }, { @@ -733,7 +875,7 @@ bool test_DsCrackNames(struct torture_context *tctx, .format_offered = DRSUAPI_DS_NAME_FORMAT_USER_PRINCIPAL, .format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779, .comment = "invalid user principal name in valid domain", - .str = talloc_asprintf(tctx, "invalidusername@%s", dns_domain), + .str = talloc_asprintf(mem_ctx, "invalidusername@%s", dns_domain), .status = DRSUAPI_DS_NAME_STATUS_NOT_FOUND } }; @@ -747,53 +889,73 @@ bool test_DsCrackNames(struct torture_context *tctx, names[0].str = crack[i].str; if (crack[i].comment) { - comment = talloc_asprintf(tctx, "'%s' with name '%s' desired format:%d\n", + 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); } else { - comment = talloc_asprintf(tctx, "'%s' desired format:%d\n", + comment = talloc_asprintf(mem_ctx, "'%s' desired format:%d\n", names[0].str, r.in.req.req1.format_desired); } - torture_comment(tctx, "Running DsCrackNames on %s", comment); if (crack[i].skip) { printf("skipping: %s", comment); continue; } - status = dcerpc_drsuapi_DsCrackNames(p, tctx, &r); - torture_assert_ntstatus_ok(tctx, status, "dcerpc_drsuapi_DsCrackNames failed"); - torture_assert_werr_ok(tctx, r.out.result, "DsCrackNames failed"); - if (r.out.ctr.ctr1->array[0].status != crack[i].status) { + status = dcerpc_drsuapi_DsCrackNames(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + const char *errstr = nt_errstr(status); + if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) { + errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); + } + printf("dcerpc_drsuapi_DsCrackNames failed on %s - %s\n", comment, errstr); + ret = False; + } 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) { if (crack[i].alternate_status) { - torture_assert_int_equal(tctx, r.out.ctr.ctr1->array[0].status, - crack[i].alternate_status, - "DsCrackNames unexpected 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, + crack[i].status, + crack[i].alternate_status, + comment); + ret = False; + } } else { - torture_fail(tctx, "DsCrackNames unexpected status"); + printf("DsCrackNames unexpected status %d, wanted %d on: %s\n", + 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, crack[i].expected_str) != 0)) { if (strcasecmp(r.out.ctr.ctr1->array[0].result_name, crack[i].expected_str) != 0) { - torture_comment(tctx, "DsCrackNames failed - got %s, expected %s on %s\n", + printf("DsCrackNames failed - got %s, expected %s on %s\n", r.out.ctr.ctr1->array[0].result_name, crack[i].expected_str, comment); - return False; + ret = False; } else { - torture_comment(tctx, - "(warning) DsCrackNames returned different case - got %s, expected %s on %s\n", + printf("(warning) DsCrackNames returned different case - got %s, expected %s on %s\n", r.out.ctr.ctr1->array[0].result_name, crack[i].expected_str, comment); } - } else if (crack[i].expected_dns) - torture_assert_str_equal(tctx, r.out.ctr.ctr1->array[0].dns_domain_name, - crack[i].expected_dns, "DsCrackNames failed"); + } else if (crack[i].expected_dns + && (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, + crack[i].expected_str, comment); + ret = False; + } } } - if (!test_DsCrackNamesMatrix(p, tctx, priv, FQDN_1779_name, + if (!test_DsCrackNamesMatrix(p, mem_ctx, priv, FQDN_1779_name, user_principal_name, service_principal_name)) { - return false; + ret = False; } - return true; + return ret; } diff --git a/source4/torture/rpc/rpc.c b/source4/torture/rpc/rpc.c index 9c61e85ae6..7de17a6060 100644 --- a/source4/torture/rpc/rpc.c +++ b/source4/torture/rpc/rpc.c @@ -421,8 +421,8 @@ NTSTATUS torture_rpc_init(void) torture_suite_add_simple_test(suite, "SAMBA3-SPOOLSS", torture_samba3_rpc_spoolss); torture_suite_add_simple_test(suite, "SAMBA3-WKSSVC", torture_samba3_rpc_wkssvc); torture_suite_add_simple_test(suite, "SAMBA3-WINREG", torture_samba3_rpc_winreg); - torture_suite_add_suite(suite, torture_rpc_drsuapi(suite)); - torture_suite_add_suite(suite, torture_rpc_drsuapi_cracknames(suite)); + torture_suite_add_simple_test(suite, "DRSUAPI", torture_rpc_drsuapi); + torture_suite_add_simple_test(suite, "DRSUAPI-CRACKNAMES", torture_rpc_drsuapi_cracknames); torture_suite_add_suite(suite, torture_rpc_dssetup(suite)); torture_suite_add_simple_test(suite, "ALTERCONTEXT", torture_rpc_alter_context); torture_suite_add_simple_test(suite, "JOIN", torture_rpc_join); |