From 899fc0ddde8307e7af218b37a21404e4285da7e6 Mon Sep 17 00:00:00 2001 From: Kamen Mazdrashki Date: Fri, 28 Aug 2009 18:34:40 +0300 Subject: tort: DsCrackNames - propagate torture context to all tests. --- source4/torture/rpc/drsuapi.c | 58 +++++++++---------------------------------- 1 file changed, 12 insertions(+), 46 deletions(-) (limited to 'source4/torture/rpc/drsuapi.c') diff --git a/source4/torture/rpc/drsuapi.c b/source4/torture/rpc/drsuapi.c index 88d6b78124..2075fa7a80 100644 --- a/source4/torture/rpc/drsuapi.c +++ b/source4/torture/rpc/drsuapi.c @@ -57,7 +57,7 @@ bool test_DsBind(struct dcerpc_pipe *p, struct torture_context *tctx, return true; } -static bool test_DsGetDomainControllerInfo(struct dcerpc_pipe *p, struct torture_context *torture, +static bool test_DsGetDomainControllerInfo(struct dcerpc_pipe *p, struct torture_context *torture, struct DsPrivate *priv) { NTSTATUS status; @@ -747,13 +747,16 @@ bool torture_rpc_drsuapi(struct torture_context *torture) torture_fail(torture, "Unable to connect to DRSUAPI pipe"); } + /* cache pipe handle */ + priv.pipe = p; + ret &= test_DsBind(p, torture, &priv); #if 0 ret &= test_QuerySitesByCost(p, torture, &priv); #endif ret &= test_DsGetDomainControllerInfo(p, torture, &priv); - ret &= test_DsCrackNames(torture, p, torture, &priv); + ret &= test_DsCrackNames(torture, &priv); ret &= test_DsWriteAccountSpn(p, torture, &priv); @@ -851,9 +854,16 @@ bool torture_rpc_drsuapi_tcase_setup(struct torture_context *tctx, void **data) torture_fail(tctx, "Failed execute test_DsBind()"); } + /* try collect some information for testing */ + torture_rpc_drsuapi_get_dcinfo(tctx, priv); + return true; } +/** + * Common test case teardown function to be used + * in DRS suit of test when appropriate + */ bool torture_rpc_drsuapi_tcase_teardown(struct torture_context *tctx, void *data) { struct DsPrivate *priv = (struct DsPrivate *)data; @@ -867,47 +877,3 @@ bool torture_rpc_drsuapi_tcase_teardown(struct torture_context *tctx, void *data return true; } - -/* -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(torture, 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(torture, 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(torture, p, torture, &priv); - - ret &= test_DsUnbind(p, torture, &priv); - } - - torture_leave_domain(torture, priv.join); - - return ret; -} - -- cgit