From e647b8c61f9b65e4c4d07eae7f1a4c2be711b8de Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 20 Apr 2010 16:25:27 +0200 Subject: s4-smbtorture: refactor test_GetPrinterDriver2(). Guenther --- source4/torture/rpc/spoolss.c | 100 +++++++++++++++++++++++++++--------------- 1 file changed, 64 insertions(+), 36 deletions(-) (limited to 'source4/torture') diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c index 55af920f4d..d5940bc5c1 100644 --- a/source4/torture/rpc/spoolss.c +++ b/source4/torture/rpc/spoolss.c @@ -5158,60 +5158,88 @@ static bool test_GetPrinterDriver(struct torture_context *tctx, return true; } -static bool test_GetPrinterDriver2(struct torture_context *tctx, - struct dcerpc_binding_handle *b, - struct policy_handle *handle, - const char *driver_name, - const char *architecture) +static bool test_GetPrinterDriver2_level(struct torture_context *tctx, + struct dcerpc_binding_handle *b, + struct policy_handle *handle, + const char *driver_name, + const char *architecture, + uint32_t level, + uint32_t client_major_version, + uint32_t client_minor_version, + union spoolss_DriverInfo *info_p) + { struct spoolss_GetPrinterDriver2 r; - uint16_t levels[] = {1, 2, 3, 4, 5, 6, 8, 101 }; uint32_t needed; uint32_t server_major_version; uint32_t server_minor_version; - int i; r.in.handle = handle; r.in.architecture = architecture; - r.in.client_major_version = 3; - r.in.client_minor_version = 0; + r.in.client_major_version = client_major_version; + r.in.client_minor_version = client_minor_version; + r.in.buffer = NULL; + r.in.offered = 0; + r.in.level = level; r.out.needed = &needed; r.out.server_major_version = &server_major_version; r.out.server_minor_version = &server_minor_version; - for (i=0;ilp_ctx), needed, 4); + + if (info_p) { + *info_p = *r.out.info; + } + + return true; +} + +static bool test_GetPrinterDriver2(struct torture_context *tctx, + struct dcerpc_binding_handle *b, + struct policy_handle *handle, + const char *driver_name, + const char *architecture) +{ + uint16_t levels[] = {1, 2, 3, 4, 5, 6, 8, 101 }; + int i; - torture_assert_werr_ok(tctx, r.out.result, - "failed to call GetPrinterDriver2"); - CHECK_NEEDED_SIZE_LEVEL(spoolss_DriverInfo, r.out.info, r.in.level, lp_iconv_convenience(tctx->lp_ctx), needed, 4); + for (i=0;i