summaryrefslogtreecommitdiff
path: root/source4/torture/rpc
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2010-02-16 17:42:19 +0100
committerGünther Deschner <gd@samba.org>2010-02-17 11:29:36 +0100
commitff5bfb9708962e2d30d3edc2c8a186ccd5dfddd1 (patch)
treec842e25379445e2318e0f68ba3deed60b20eba66 /source4/torture/rpc
parent986627cd67f4ff48152fa5147977813e2b190a93 (diff)
downloadsamba-ff5bfb9708962e2d30d3edc2c8a186ccd5dfddd1.tar.gz
samba-ff5bfb9708962e2d30d3edc2c8a186ccd5dfddd1.tar.bz2
samba-ff5bfb9708962e2d30d3edc2c8a186ccd5dfddd1.zip
s4-smbtorture: refactor setprinter devicemode calls in RPC-SPOOLSS-PRINTER.
Guenther
Diffstat (limited to 'source4/torture/rpc')
-rw-r--r--source4/torture/rpc/spoolss.c90
1 files changed, 71 insertions, 19 deletions
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index ec7233516c..53b1fe4e82 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -1767,6 +1767,75 @@ static bool test_PrinterInfo_SD(struct torture_context *tctx,
return ret;
}
+static bool test_devmode_set_level(struct torture_context *tctx,
+ struct dcerpc_pipe *p,
+ struct policy_handle *handle,
+ uint32_t level,
+ struct spoolss_DeviceMode *devmode)
+{
+ struct spoolss_SetPrinterInfoCtr info_ctr;
+ struct spoolss_DevmodeContainer devmode_ctr;
+ struct sec_desc_buf secdesc_ctr;
+
+ ZERO_STRUCT(devmode_ctr);
+ ZERO_STRUCT(secdesc_ctr);
+
+ switch (level) {
+ case 2: {
+ union spoolss_PrinterInfo info;
+ struct spoolss_SetPrinterInfo2 info2;
+ torture_assert(tctx, test_GetPrinter_level(tctx, p, handle, 2, &info), "");
+
+ info2.servername = info.info2.servername;
+ info2.printername = info.info2.printername;
+ info2.sharename = info.info2.sharename;
+ info2.portname = info.info2.portname;
+ info2.drivername = info.info2.drivername;
+ info2.comment = info.info2.comment;
+ info2.location = info.info2.location;
+ info2.devmode_ptr = 0;
+ info2.sepfile = info.info2.sepfile;
+ info2.printprocessor = info.info2.printprocessor;
+ info2.datatype = info.info2.datatype;
+ info2.parameters = info.info2.parameters;
+ info2.secdesc_ptr = 0;
+ info2.attributes = info.info2.attributes;
+ info2.priority = info.info2.priority;
+ info2.defaultpriority = info.info2.defaultpriority;
+ info2.starttime = info.info2.starttime;
+ info2.untiltime = info.info2.untiltime;
+ info2.status = info.info2.status;
+ info2.cjobs = info.info2.cjobs;
+ info2.averageppm = info.info2.averageppm;
+
+ info_ctr.level = 2;
+ info_ctr.info.info2 = &info2;
+
+ break;
+ }
+ case 8: {
+ struct spoolss_SetPrinterInfo8 info8;
+
+ info8.devmode_ptr = 0;
+
+ info_ctr.level = 8;
+ info_ctr.info.info8 = &info8;
+
+ break;
+ }
+ default:
+ return false;
+ }
+
+ devmode_ctr.devmode = devmode;
+
+ torture_assert(tctx,
+ test_SetPrinter(tctx, p, handle, &info_ctr, &devmode_ctr, &secdesc_ctr, 0), "");
+
+ return true;
+}
+
+
static bool test_devicemode_equal(struct torture_context *tctx,
const struct spoolss_DeviceMode *d1,
const struct spoolss_DeviceMode *d2)
@@ -1885,29 +1954,12 @@ static bool test_PrinterInfo_DevModes(struct torture_context *tctx,
test_ClosePrinter(tctx, p, &handle_devmode);
- /* set devicemode and see if it persists */
+ /* set devicemode level 8 and see if it persists */
devmode->copies = 93;
devmode->formname = talloc_strdup(tctx, "Legal");
- {
- struct spoolss_SetPrinterInfoCtr info_ctr;
- struct spoolss_SetPrinterInfo8 info8;
- struct spoolss_DevmodeContainer devmode_ctr;
- struct sec_desc_buf secdesc_ctr;
-
- info8.devmode_ptr = 0;
-
- info_ctr.level = 8;
- info_ctr.info.info8 = &info8;
-
- devmode_ctr.devmode = devmode;
-
- ZERO_STRUCT(secdesc_ctr);
-
- torture_assert(tctx,
- test_SetPrinter(tctx, p, handle, &info_ctr, &devmode_ctr, &secdesc_ctr, 0), "");
- }
+ torture_assert(tctx, test_devmode_set_level(tctx, p, handle, 8, devmode), "");
torture_assert(tctx, test_GetPrinter_level(tctx, p, handle, 8, &info), "");