The branch, master has been updated via 6acaa70... s4-smbtorture: add test_PrintProcessors_winreg. via 4a10635... s4-smbtorture: refactor test_EnumPrintProcessors(). via 3948876... s4-smbtorture: only test data up to a length of 9 bytes in test_SetPrinterDataEx_matrix(). from 614e010... s3: remove authdata.h
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 6acaa70d6439eb206ab3c6fb1b81f12efc7b5f94 Author: Günther Deschner <g...@samba.org> Date: Thu Jun 3 13:01:40 2010 +0200 s4-smbtorture: add test_PrintProcessors_winreg. This does cross reference checks between spoolss PrintProcessors and entries stored in winreg. Guenther commit 4a10635371a794281114e0e227ed174a518792ee Author: Günther Deschner <g...@samba.org> Date: Thu Jun 3 13:01:16 2010 +0200 s4-smbtorture: refactor test_EnumPrintProcessors(). Guenther commit 3948876f66955a7b9a657937c0d7926b3578dd3d Author: Günther Deschner <g...@samba.org> Date: Thu Jun 3 11:46:44 2010 +0200 s4-smbtorture: only test data up to a length of 9 bytes in test_SetPrinterDataEx_matrix(). Guenther ----------------------------------------------------------------------- Summary of changes: source4/torture/rpc/spoolss.c | 162 ++++++++++++++++++++++++++++++++--------- 1 files changed, 126 insertions(+), 36 deletions(-) Changeset truncated at 500 lines: diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c index 07b7994..b785ebd 100644 --- a/source4/torture/rpc/spoolss.c +++ b/source4/torture/rpc/spoolss.c @@ -787,53 +787,72 @@ static bool test_EnumMonitors(struct torture_context *tctx, return true; } +static bool test_EnumPrintProcessors_level(struct torture_context *tctx, + struct dcerpc_binding_handle *b, + const char *environment, + uint32_t level, + uint32_t *count_p, + union spoolss_PrintProcessorInfo **info_p) +{ + struct spoolss_EnumPrintProcessors r; + DATA_BLOB blob; + uint32_t needed; + uint32_t count; + union spoolss_PrintProcessorInfo *info; + + r.in.servername = ""; + r.in.environment = environment; + r.in.level = level; + r.in.buffer = NULL; + r.in.offered = 0; + r.out.needed = &needed; + r.out.count = &count; + r.out.info = &info; + + torture_comment(tctx, "Testing EnumPrintProcessors level %u\n", r.in.level); + + torture_assert_ntstatus_ok(tctx, + dcerpc_spoolss_EnumPrintProcessors_r(b, tctx, &r), + "EnumPrintProcessors failed"); + if (W_ERROR_EQUAL(r.out.result, WERR_INSUFFICIENT_BUFFER)) { + blob = data_blob_talloc_zero(tctx, needed); + r.in.buffer = &blob; + r.in.offered = needed; + torture_assert_ntstatus_ok(tctx, + dcerpc_spoolss_EnumPrintProcessors_r(b, tctx, &r), + "EnumPrintProcessors failed"); + } + torture_assert_werr_ok(tctx, r.out.result, + "EnumPrintProcessors failed"); + + CHECK_NEEDED_SIZE_ENUM_LEVEL(spoolss_EnumPrintProcessors, info, level, count, needed, 4); + + if (count_p) { + *count_p = count; + } + if (info_p) { + *info_p = info; + } + + return true; +} + static bool test_EnumPrintProcessors(struct torture_context *tctx, struct dcerpc_binding_handle *b, struct test_spoolss_context *ctx, const char *environment) { - NTSTATUS status; - struct spoolss_EnumPrintProcessors r; uint16_t levels[] = { 1 }; int i, j; for (i=0;i<ARRAY_SIZE(levels);i++) { int level = levels[i]; - DATA_BLOB blob; - uint32_t needed; - uint32_t count; union spoolss_PrintProcessorInfo *info; + uint32_t count; - r.in.servername = ""; - r.in.environment = environment; - r.in.level = level; - r.in.buffer = NULL; - r.in.offered = 0; - r.out.needed = &needed; - r.out.count = &count; - r.out.info = &info; - - torture_comment(tctx, "Testing EnumPrintProcessors level %u\n", r.in.level); - - status = dcerpc_spoolss_EnumPrintProcessors_r(b, ctx, &r); - torture_assert_ntstatus_ok(tctx, status, "dcerpc_spoolss_EnumPrintProcessors failed"); - if (W_ERROR_IS_OK(r.out.result)) { - /* TODO: do some more checks here */ - continue; - } - torture_assert_werr_equal(tctx, r.out.result, WERR_INSUFFICIENT_BUFFER, - "EnumPrintProcessors unexpected return code"); - - blob = data_blob_talloc_zero(ctx, needed); - r.in.buffer = &blob; - r.in.offered = needed; - - status = dcerpc_spoolss_EnumPrintProcessors_r(b, ctx, &r); - torture_assert_ntstatus_ok(tctx, status, "dcerpc_spoolss_EnumPrintProcessors failed"); - - torture_assert_werr_ok(tctx, r.out.result, "EnumPrintProcessors failed"); - - CHECK_NEEDED_SIZE_ENUM_LEVEL(spoolss_EnumPrintProcessors, info, r.in.level, count, needed, 4); + torture_assert(tctx, + test_EnumPrintProcessors_level(tctx, b, environment, level, &count, &info), + "test_EnumPrintProcessors_level failed"); ctx->print_processor_count[level] = count; ctx->print_processors[level] = info; @@ -4344,6 +4363,47 @@ do {\ return true; } +static bool test_PrintProcessors(struct torture_context *tctx, + struct dcerpc_binding_handle *b, + struct policy_handle *handle, + const char *environment, + struct dcerpc_binding_handle *winreg_handle, + struct policy_handle *hive_handle) +{ + union spoolss_PrintProcessorInfo *info; + uint32_t count; + int i; + + torture_comment(tctx, "Testing Print Processor Info and winreg consistency\n"); + + torture_assert(tctx, + test_EnumPrintProcessors_level(tctx, b, environment, 1, &count, &info), + "failed to enum print processors level 1"); + + for (i=0; i < count; i++) { + + const char *processor_key; + struct policy_handle key_handle; + + processor_key = talloc_asprintf(tctx, "%s\\%s\\Print Processors\\%s", + TOP_LEVEL_CONTROL_ENVIRONMENTS_KEY, + environment, + info[i].info1.print_processor_name); + + torture_assert(tctx, + test_winreg_OpenKey(tctx, winreg_handle, hive_handle, processor_key, &key_handle), ""); + + /* nothing to check in there so far */ + + torture_assert(tctx, + test_winreg_CloseKey(tctx, winreg_handle, &key_handle), ""); + } + + torture_comment(tctx, "Print Processor Info and winreg consistency test succeeded\n\n"); + + return true; +} + static bool test_GetPrinterDriver2_level(struct torture_context *tctx, struct dcerpc_binding_handle *b, struct policy_handle *handle, @@ -4736,7 +4796,7 @@ static bool test_SetPrinterDataEx_matrix(struct torture_context *tctx, REG_DWORD, REG_BINARY }; - const char *str = "abcdefghijklmnopqrstuvwxzy"; + const char *str = "abcdefghi"; int i, t, s; @@ -4992,6 +5052,32 @@ static bool test_DriverInfo_winreg(struct torture_context *tctx, return ret; } +static bool test_PrintProcessors_winreg(struct torture_context *tctx, + struct dcerpc_binding_handle *b, + struct policy_handle *handle, + const char *environment) +{ + struct dcerpc_pipe *p2; + bool ret = true; + struct policy_handle hive_handle; + struct dcerpc_binding_handle *b2; + + torture_assert_ntstatus_ok(tctx, + torture_rpc_connection(tctx, &p2, &ndr_table_winreg), + "could not open winreg pipe"); + b2 = p2->binding_handle; + + torture_assert(tctx, test_winreg_OpenHKLM(tctx, b2, &hive_handle), ""); + + ret = test_PrintProcessors(tctx, b, handle, environment, b2, &hive_handle); + + test_winreg_CloseKey(tctx, b2, &hive_handle); + + talloc_free(p2); + + return ret; +} + static bool test_PrinterData_DsSpooler(struct torture_context *tctx, struct dcerpc_pipe *p, struct policy_handle *handle, @@ -6424,6 +6510,10 @@ static bool test_one_printer(struct torture_context *tctx, ret = false; } + if (!test_PrintProcessors_winreg(tctx, b, handle, environment)) { + ret = false; + } + if (!test_PrinterData_DsSpooler(tctx, p, handle, name)) { ret = false; } -- Samba Shared Repository