summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2010-10-02 21:53:54 +0200
committerGünther Deschner <gd@samba.org>2010-10-07 17:25:50 +0200
commitf5554fe75c8962987b886468dd1b33f5fbc35fe2 (patch)
treef96b0ba3d0d9ed084d6a1968e40128b1ac1c3470
parent3b213f6138e21e1c8b2ecac934716f964cf56940 (diff)
downloadsamba-f5554fe75c8962987b886468dd1b33f5fbc35fe2.tar.gz
samba-f5554fe75c8962987b886468dd1b33f5fbc35fe2.tar.bz2
samba-f5554fe75c8962987b886468dd1b33f5fbc35fe2.zip
s4-smbtorture: re-arrange openprinterex tests.
Guenther
-rw-r--r--source4/torture/rpc/spoolss.c67
1 files changed, 46 insertions, 21 deletions
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index 99f23769ed..de4ca83b0b 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -5738,6 +5738,39 @@ static bool test_OpenPrinter(struct torture_context *tctx,
return ret;
}
+static bool test_OpenPrinterEx(struct torture_context *tctx,
+ struct dcerpc_binding_handle *b,
+ const char *printername,
+ const char *datatype,
+ struct spoolss_DeviceMode *devmode,
+ uint32_t access_mask,
+ uint32_t level,
+ union spoolss_UserLevel *userlevel,
+ struct policy_handle *handle,
+ WERROR expected_result)
+{
+ struct spoolss_OpenPrinterEx r;
+
+ r.in.printername = printername;
+ r.in.datatype = datatype;
+ r.in.devmode_ctr.devmode= devmode;
+ r.in.access_mask = access_mask;
+ r.in.level = level;
+ r.in.userlevel = *userlevel;
+ r.out.handle = handle;
+
+ torture_comment(tctx, "Testing OpenPrinterEx(%s)\n", r.in.printername);
+
+ torture_assert_ntstatus_ok(tctx,
+ dcerpc_spoolss_OpenPrinterEx_r(b, tctx, &r),
+ "OpenPrinterEx failed");
+
+ torture_assert_werr_equal(tctx, r.out.result, expected_result,
+ "OpenPrinterEx failed");
+
+ return true;
+}
+
static bool call_OpenPrinterEx(struct torture_context *tctx,
struct dcerpc_pipe *p,
const char *name,
@@ -5745,18 +5778,11 @@ static bool call_OpenPrinterEx(struct torture_context *tctx,
struct policy_handle *handle)
{
struct spoolss_OpenPrinterEx r;
+ union spoolss_UserLevel userlevel;
struct spoolss_UserLevel1 userlevel1;
NTSTATUS status;
struct dcerpc_binding_handle *b = p->binding_handle;
- r.in.printername = name;
- r.in.datatype = NULL;
- r.in.devmode_ctr.devmode= devmode;
- r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
- r.in.level = 1;
- r.in.userlevel.level1 = &userlevel1;
- r.out.handle = handle;
-
userlevel1.size = 1234;
userlevel1.client = "hello";
userlevel1.user = "spottyfoot!";
@@ -5765,15 +5791,14 @@ static bool call_OpenPrinterEx(struct torture_context *tctx,
userlevel1.minor = 3;
userlevel1.processor = 4;
- torture_comment(tctx, "Testing OpenPrinterEx(%s)\n", r.in.printername);
+ userlevel.level1 = &userlevel1;
- status = dcerpc_spoolss_OpenPrinterEx_r(b, tctx, &r);
-
- torture_assert_ntstatus_ok(tctx, status, "OpenPrinterEx failed");
-
- torture_assert_werr_ok(tctx, r.out.result, "OpenPrinterEx failed");
-
- return true;
+ return test_OpenPrinterEx(tctx, b, name, NULL, devmode,
+ SEC_FLAG_MAXIMUM_ALLOWED,
+ 1,
+ &userlevel,
+ handle,
+ WERR_OK);
}
static bool test_printer_rename(struct torture_context *tctx,
@@ -5872,10 +5897,10 @@ static bool test_printer_rename(struct torture_context *tctx,
}
-static bool test_OpenPrinterEx(struct torture_context *tctx,
- struct dcerpc_pipe *p,
- const char *name,
- const char *environment)
+static bool test_existing_printer_openprinterex(struct torture_context *tctx,
+ struct dcerpc_pipe *p,
+ const char *name,
+ const char *environment)
{
struct policy_handle handle;
bool ret = true;
@@ -6029,7 +6054,7 @@ static bool test_EnumPrinters_old(struct torture_context *tctx,
if (!test_OpenPrinter(tctx, p, name, ctx->environment, false)) {
ret = false;
}
- if (!test_OpenPrinterEx(tctx, p, name, ctx->environment)) {
+ if (!test_existing_printer_openprinterex(tctx, p, name, ctx->environment)) {
ret = false;
}
}