[SCM] Samba Shared Repository - branch master updated

Günther Deschner gd at samba.org
Wed Feb 17 03:29:59 MST 2010


The branch, master has been updated
       via  3a9dc49... s4-smbtorture: unify test list to run against single created printers in RPC-SPOOLSS-PRINTER.
       via  b32c1e2... s4-smbtorture: also test level 2 sets for devicemodes and see if they persist.
       via  ff5bfb9... s4-smbtorture: refactor setprinter devicemode calls in RPC-SPOOLSS-PRINTER.
      from  986627c... s4-provision: freeze the DNS zone before creating the zone file

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 3a9dc490b459514c2117572824dca3830c3a9951
Author: Günther Deschner <gd at samba.org>
Date:   Wed Feb 17 11:21:56 2010 +0100

    s4-smbtorture: unify test list to run against single created printers in RPC-SPOOLSS-PRINTER.
    
    This is to make sure we run the same tests for printers created via AddPrinter
    and via AddPrinterEx.
    
    Guenther

commit b32c1e2975bc00ce94e8d02460d98ca3277cf5b6
Author: Günther Deschner <gd at samba.org>
Date:   Tue Feb 16 17:42:58 2010 +0100

    s4-smbtorture: also test level 2 sets for devicemodes and see if they persist.
    
    Guenther

commit ff5bfb9708962e2d30d3edc2c8a186ccd5dfddd1
Author: Günther Deschner <gd at samba.org>
Date:   Tue Feb 16 17:42:19 2010 +0100

    s4-smbtorture: refactor setprinter devicemode calls in RPC-SPOOLSS-PRINTER.
    
    Guenther

-----------------------------------------------------------------------

Summary of changes:
 source4/torture/rpc/spoolss.c |  147 ++++++++++++++++++++++++++++++++---------
 1 files changed, 115 insertions(+), 32 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index ec72335..0c9c076 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,32 @@ 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;
+	torture_assert(tctx, test_devmode_set_level(tctx, p, handle, 8, devmode), "");
 
-		info8.devmode_ptr = 0;
+	torture_assert(tctx, test_GetPrinter_level(tctx, p, handle, 8, &info), "");
 
-		info_ctr.level = 8;
-		info_ctr.info.info8 = &info8;
+	devmode2 = info.info8.devmode;
 
-		devmode_ctr.devmode = devmode;
+	torture_assert(tctx, test_devicemode_equal(tctx, devmode, devmode2), "");
 
-		ZERO_STRUCT(secdesc_ctr);
+	torture_assert(tctx, test_GetPrinter_level(tctx, p, handle, 2, &info), "");
+
+	devmode2 = info.info2.devmode;
+
+	torture_assert(tctx, test_devicemode_equal(tctx, devmode, devmode2), "");
 
-		torture_assert(tctx,
-			test_SetPrinter(tctx, p, handle, &info_ctr, &devmode_ctr, &secdesc_ctr, 0), "");
-	}
+
+	/* set devicemode level 2 and see if it persists */
+
+	devmode->copies = 39;
+	devmode->formname = talloc_strdup(tctx, "Letter");
+
+	torture_assert(tctx, test_devmode_set_level(tctx, p, handle, 8, devmode), "");
 
 	torture_assert(tctx, test_GetPrinter_level(tctx, p, handle, 8, &info), "");
 
@@ -1921,6 +1993,7 @@ static bool test_PrinterInfo_DevModes(struct torture_context *tctx,
 
 	torture_assert(tctx, test_devicemode_equal(tctx, devmode, devmode2), "");
 
+
 	return true;
 }
 
@@ -4249,6 +4322,32 @@ bool test_printer_keys(struct torture_context *tctx,
 	return true;
 }
 
+static bool test_one_printer(struct torture_context *tctx,
+			     struct dcerpc_pipe *p,
+			     struct policy_handle *handle,
+			     const char *name)
+{
+	bool ret = true;
+
+	if (!test_printer_info(tctx, p, handle)) {
+		ret = false;
+	}
+
+	if (!test_PrinterInfo_SD(tctx, p, handle)) {
+		ret = false;
+	}
+
+	if (!test_PrinterInfo_DevMode(tctx, p, handle, name)) {
+		ret = false;
+	}
+
+	if (!test_printer_keys(tctx, p, handle)) {
+		ret = false;
+	}
+
+	return ret;
+}
+
 static bool test_printer(struct torture_context *tctx,
 			 struct dcerpc_pipe *p)
 {
@@ -4264,19 +4363,7 @@ static bool test_printer(struct torture_context *tctx,
 		return false;
 	}
 
-	if (!test_printer_info(tctx, p, &handle[0])) {
-		ret = false;
-	}
-
-	if (!test_PrinterInfo_SD(tctx, p, &handle[0])) {
-		ret = false;
-	}
-
-	if (!test_PrinterInfo_DevMode(tctx, p, &handle[0], TORTURE_PRINTER)) {
-		ret = false;
-	}
-
-	if (!test_printer_keys(tctx, p, &handle[0])) {
+	if (!test_one_printer(tctx, p, &handle[0], TORTURE_PRINTER)) {
 		ret = false;
 	}
 
@@ -4297,11 +4384,7 @@ static bool test_printer(struct torture_context *tctx,
 		return false;
 	}
 
-	if (!test_printer_info(tctx, p, &handle[1])) {
-		ret = false;
-	}
-
-	if (!test_printer_keys(tctx, p, &handle[1])) {
+	if (!test_one_printer(tctx, p, &handle[1], TORTURE_PRINTER_EX)) {
 		ret = false;
 	}
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list