From ec5c83c0dba28516d5c92f57dd7c88c99b17d4ab Mon Sep 17 00:00:00 2001 From: =?utf8?q?G=C3=BCnther=20Deschner?= Date: Fri, 26 Jun 2009 16:51:53 +0200 Subject: [PATCH] s4-smbtorture: add torture_suite_add_machine_workstation_rpc_iface_tcase. Unlike torture_suite_add_machine_bdc_rpc_iface_tcase() which joins as a BDC (ACB_SRVTRUST) this joins as a member workstation (ACB_WSTRUST). Guenther --- source4/torture/rpc/netlogon.c | 2 +- source4/torture/rpc/remote_pac.c | 2 +- source4/torture/rpc/rpc.c | 58 +++++++++++++++++++++++++++++--- source4/torture/rpc/rpc.h | 7 +++- source4/torture/rpc/samr.c | 6 ++-- 5 files changed, 65 insertions(+), 10 deletions(-) diff --git a/source4/torture/rpc/netlogon.c b/source4/torture/rpc/netlogon.c index 57bfcbfb7a9f..2fd8b94dbb46 100644 --- a/source4/torture/rpc/netlogon.c +++ b/source4/torture/rpc/netlogon.c @@ -2337,7 +2337,7 @@ struct torture_suite *torture_rpc_netlogon(TALLOC_CTX *mem_ctx) struct torture_rpc_tcase *tcase; struct torture_test *test; - tcase = torture_suite_add_machine_rpc_iface_tcase(suite, "netlogon", + tcase = torture_suite_add_machine_bdc_rpc_iface_tcase(suite, "netlogon", &ndr_table_netlogon, TEST_MACHINE_NAME); torture_rpc_tcase_add_test(tcase, "LogonUasLogon", test_LogonUasLogon); diff --git a/source4/torture/rpc/remote_pac.c b/source4/torture/rpc/remote_pac.c index 6d638d18689e..cae98d9b6fd3 100644 --- a/source4/torture/rpc/remote_pac.c +++ b/source4/torture/rpc/remote_pac.c @@ -330,7 +330,7 @@ struct torture_suite *torture_rpc_remote_pac(TALLOC_CTX *mem_ctx) struct torture_suite *suite = torture_suite_create(mem_ctx, "PAC"); struct torture_rpc_tcase *tcase; - tcase = torture_suite_add_machine_rpc_iface_tcase(suite, "netlogon", + tcase = torture_suite_add_machine_bdc_rpc_iface_tcase(suite, "netlogon", &ndr_table_netlogon, TEST_MACHINE_NAME); torture_rpc_tcase_add_test_creds(tcase, "verify", test_PACVerify); diff --git a/source4/torture/rpc/rpc.c b/source4/torture/rpc/rpc.c index 19b223beba25..d7aafefda144 100644 --- a/source4/torture/rpc/rpc.c +++ b/source4/torture/rpc/rpc.c @@ -124,8 +124,40 @@ NTSTATUS torture_rpc_connection_transport(struct torture_context *tctx, return status; } -static bool torture_rpc_setup_machine(struct torture_context *tctx, - void **data) +static bool torture_rpc_setup_machine_workstation(struct torture_context *tctx, + void **data) +{ + NTSTATUS status; + struct dcerpc_binding *binding; + struct torture_rpc_tcase *tcase = talloc_get_type(tctx->active_tcase, + struct torture_rpc_tcase); + struct torture_rpc_tcase_data *tcase_data; + + status = torture_rpc_binding(tctx, &binding); + if (NT_STATUS_IS_ERR(status)) + return false; + + *data = tcase_data = talloc_zero(tctx, struct torture_rpc_tcase_data); + tcase_data->credentials = cmdline_credentials; + tcase_data->join_ctx = torture_join_domain(tctx, tcase->machine_name, + ACB_WSTRUST, + &tcase_data->credentials); + if (tcase_data->join_ctx == NULL) + torture_fail(tctx, "Failed to join as WORKSTATION"); + + status = dcerpc_pipe_connect_b(tctx, + &(tcase_data->pipe), + binding, + tcase->table, + tcase_data->credentials, tctx->ev, tctx->lp_ctx); + + torture_assert_ntstatus_ok(tctx, status, "Error connecting to server"); + + return true; +} + +static bool torture_rpc_setup_machine_bdc(struct torture_context *tctx, + void **data) { NTSTATUS status; struct dcerpc_binding *binding; @@ -156,7 +188,25 @@ static bool torture_rpc_setup_machine(struct torture_context *tctx, return true; } -_PUBLIC_ struct torture_rpc_tcase *torture_suite_add_machine_rpc_iface_tcase( +_PUBLIC_ struct torture_rpc_tcase *torture_suite_add_machine_workstation_rpc_iface_tcase( + struct torture_suite *suite, + const char *name, + const struct ndr_interface_table *table, + const char *machine_name) +{ + struct torture_rpc_tcase *tcase = talloc(suite, + struct torture_rpc_tcase); + + torture_suite_init_rpc_tcase(suite, tcase, name, table); + + tcase->machine_name = talloc_strdup(tcase, machine_name); + tcase->tcase.setup = torture_rpc_setup_machine_workstation; + tcase->tcase.teardown = torture_rpc_teardown; + + return tcase; +} + +_PUBLIC_ struct torture_rpc_tcase *torture_suite_add_machine_bdc_rpc_iface_tcase( struct torture_suite *suite, const char *name, const struct ndr_interface_table *table, @@ -168,7 +218,7 @@ _PUBLIC_ struct torture_rpc_tcase *torture_suite_add_machine_rpc_iface_tcase( torture_suite_init_rpc_tcase(suite, tcase, name, table); tcase->machine_name = talloc_strdup(tcase, machine_name); - tcase->tcase.setup = torture_rpc_setup_machine; + tcase->tcase.setup = torture_rpc_setup_machine_bdc; tcase->tcase.teardown = torture_rpc_teardown; return tcase; diff --git a/source4/torture/rpc/rpc.h b/source4/torture/rpc/rpc.h index 9fd64f18b5f1..ddb737c2decb 100644 --- a/source4/torture/rpc/rpc.h +++ b/source4/torture/rpc/rpc.h @@ -69,7 +69,12 @@ struct torture_test *torture_rpc_tcase_add_test_ex( bool (*fn) (struct torture_context *, struct dcerpc_pipe *, void *), void *userdata); -struct torture_rpc_tcase *torture_suite_add_machine_rpc_iface_tcase( +struct torture_rpc_tcase *torture_suite_add_machine_bdc_rpc_iface_tcase( + struct torture_suite *suite, + const char *name, + const struct ndr_interface_table *table, + const char *machine_name); +struct torture_rpc_tcase *torture_suite_add_machine_workstation_rpc_iface_tcase( struct torture_suite *suite, const char *name, const struct ndr_interface_table *table, diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c index e3d12453ee1c..be2bfefab1f0 100644 --- a/source4/torture/rpc/samr.c +++ b/source4/torture/rpc/samr.c @@ -6867,7 +6867,7 @@ struct torture_suite *torture_rpc_samr_passwords_pwdlastset(TALLOC_CTX *mem_ctx) struct torture_suite *suite = torture_suite_create(mem_ctx, "SAMR-PASSWORDS-PWDLASTSET"); struct torture_rpc_tcase *tcase; - tcase = torture_suite_add_machine_rpc_iface_tcase(suite, "samr", + tcase = torture_suite_add_machine_bdc_rpc_iface_tcase(suite, "samr", &ndr_table_samr, TEST_ACCOUNT_NAME_PWD); @@ -6907,7 +6907,7 @@ struct torture_suite *torture_rpc_samr_user_privileges(TALLOC_CTX *mem_ctx) struct torture_suite *suite = torture_suite_create(mem_ctx, "SAMR-USERS-PRIVILEGES"); struct torture_rpc_tcase *tcase; - tcase = torture_suite_add_machine_rpc_iface_tcase(suite, "samr", + tcase = torture_suite_add_machine_bdc_rpc_iface_tcase(suite, "samr", &ndr_table_samr, TEST_ACCOUNT_NAME_PWD); @@ -6997,7 +6997,7 @@ struct torture_suite *torture_rpc_samr_large_dc(TALLOC_CTX *mem_ctx) struct torture_suite *suite = torture_suite_create(mem_ctx, "SAMR-LARGE-DC"); struct torture_rpc_tcase *tcase; - tcase = torture_suite_add_machine_rpc_iface_tcase(suite, "samr", + tcase = torture_suite_add_machine_bdc_rpc_iface_tcase(suite, "samr", &ndr_table_samr, TEST_ACCOUNT_NAME); -- 2.34.1