From 534ddef376b9fffe42fa5a10b5f0f529d04a057b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnther=20Deschner?= Date: Wed, 6 Jan 2010 17:51:34 +0100 Subject: s4-smbtorture: refactor test_GetPrinter in RPC-SPOOLSS. Guenther (cherry picked from commit 0457cf915b724e3afd54ab1b5c8b96dcb5b7550a) (cherry picked from commit d5eac5b8dccd2d940044c3d06603554740dd3ac3) --- source4/torture/rpc/spoolss.c | 78 +++++++++++++++++++++++++++---------------- 1 file changed, 50 insertions(+), 28 deletions(-) diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c index 65bc3619caf..d37384201b4 100644 --- a/source4/torture/rpc/spoolss.c +++ b/source4/torture/rpc/spoolss.c @@ -5,7 +5,7 @@ Copyright (C) Tim Potter 2003 Copyright (C) Stefan Metzmacher 2005 Copyright (C) Jelmer Vernooij 2007 - Copyright (C) Guenther Deschner 2009 + Copyright (C) Guenther Deschner 2009-2010 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -865,45 +865,67 @@ static bool test_GetPrinterDriver2(struct torture_context *tctx, struct policy_handle *handle, const char *driver_name); -static bool test_GetPrinter(struct torture_context *tctx, - struct dcerpc_pipe *p, - struct policy_handle *handle) +static bool test_GetPrinter_level(struct torture_context *tctx, + struct dcerpc_pipe *p, + struct policy_handle *handle, + uint32_t level, + union spoolss_PrinterInfo *info) { - NTSTATUS status; struct spoolss_GetPrinter r; - uint16_t levels[] = {0, 1, 2, 3, 4, 5, 6, 7, 8}; - int i; uint32_t needed; - for (i=0;ilp_ctx), needed, 4); + + if (info && r.out.info) { + *info = *r.out.info; + } + + return true; +} + + +static bool test_GetPrinter(struct torture_context *tctx, + struct dcerpc_pipe *p, + struct policy_handle *handle) +{ + uint32_t levels[] = {0, 1, 2, 3, 4, 5, 6, 7, 8}; + int i; + + for (i=0;ilp_ctx), needed, 4); + torture_assert(tctx, test_GetPrinter_level(tctx, p, handle, levels[i], &info), + "failed to call GetPrinter"); - if ((r.in.level == 2) && r.out.info->info2.drivername && strlen(r.out.info->info2.drivername)) { + if ((levels[i] == 2) && info.info2.drivername && strlen(info.info2.drivername)) { torture_assert(tctx, - test_GetPrinterDriver2(tctx, p, handle, r.out.info->info2.drivername), + test_GetPrinterDriver2(tctx, p, handle, info.info2.drivername), "failed to call test_GetPrinterDriver2"); } } -- cgit v1.2.1