From 5def19e4dc0b9f15fa30f7895a2b016c4e59abb0 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 7 Jun 2010 12:41:39 +0200 Subject: s4-smbtorture: test workstation auth as well in RPC-SPOOLSS-ACCESS. Guenther --- source4/torture/rpc/spoolss_access.c | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) (limited to 'source4/torture') diff --git a/source4/torture/rpc/spoolss_access.c b/source4/torture/rpc/spoolss_access.c index 2bf03317c2..412366435f 100644 --- a/source4/torture/rpc/spoolss_access.c +++ b/source4/torture/rpc/spoolss_access.c @@ -36,6 +36,7 @@ #define TORTURE_USER_PRINTOPGROUP "torture_user_550" #define TORTURE_USER_PRINTOPPRIV "torture_user_priv" #define TORTURE_USER_SD "torture_user_sd" +#define TORTURE_WORKSTATION "torture_workstation" struct torture_user { const char *username; @@ -414,6 +415,7 @@ static bool torture_rpc_spoolss_access_setup_common(struct torture_context *tctx struct dcerpc_pipe *p; const char *printername; const char *binding = torture_setting_string(tctx, "binding", NULL); + struct dcerpc_pipe *spoolss_pipe; testuser = torture_create_testuser_max_pwlen(tctx, t->user.username, torture_setting_string(tctx, "workgroup", NULL), @@ -460,8 +462,6 @@ static bool torture_rpc_spoolss_access_setup_common(struct torture_context *tctx talloc_free(lsa_pipe); } - struct dcerpc_pipe *spoolss_pipe; - torture_assert_ntstatus_ok(tctx, torture_rpc_connection(tctx, &spoolss_pipe, &ndr_table_spoolss), "Error connecting to server"); @@ -701,10 +701,36 @@ static bool test_openprinter_admin(struct torture_context *tctx, return ret; } +static bool test_openprinter_wrap(struct torture_context *tctx, + struct dcerpc_pipe *p) +{ + struct torture_access_context *t; + const char *printername; + bool ret = true; + + t = talloc_zero(tctx, struct torture_access_context); + + t->user.username = talloc_strdup(tctx, "dummy"); + t->spoolss_pipe = p; + + torture_assert(tctx, + test_EnumPrinters_findone(tctx, p, &printername), + "failed to enumerate printers"); + + t->printername = printername; + + ret = test_openprinter(tctx, (void *)t); + + talloc_free(t); + + return true; +} + struct torture_suite *torture_rpc_spoolss_access(TALLOC_CTX *mem_ctx) { struct torture_suite *suite = torture_suite_create(mem_ctx, "SPOOLSS-ACCESS"); struct torture_tcase *tcase; + struct torture_rpc_tcase *rpc_tcase; tcase = torture_suite_add_tcase(suite, "normaluser"); @@ -750,5 +776,11 @@ struct torture_suite *torture_rpc_spoolss_access(TALLOC_CTX *mem_ctx) torture_tcase_add_simple_test(tcase, "openprinter", test_openprinter); torture_tcase_add_simple_test(tcase, "openprinter_admin", test_openprinter_admin); + rpc_tcase = torture_suite_add_machine_workstation_rpc_iface_tcase(suite, "workstation", + &ndr_table_spoolss, + TORTURE_WORKSTATION); + + torture_rpc_tcase_add_test(rpc_tcase, "openprinter", test_openprinter_wrap); + return suite; } -- cgit