[SCM] Samba Shared Repository - branch master updated

Günther Deschner gd at samba.org
Tue Apr 20 11:40:17 MDT 2010


The branch, master has been updated
       via  0833c96... s4-smbtorture: add function to get a printserver's environment.
       via  545ef2c... s4-smbtorture: simplify macros used in PrinterInfo winreg consistency teste.
       via  e647b8c... s4-smbtorture: refactor test_GetPrinterDriver2().
      from  7e9e529... s4:dynconfig: fix the autoconf build and pass -DPYTHONDIR=\"$(pythondir)\"

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


- Log -----------------------------------------------------------------
commit 0833c9639e3e7fb7e14dc25d90f4a9973e717cbc
Author: Günther Deschner <gd at samba.org>
Date:   Tue Apr 20 19:29:12 2010 +0200

    s4-smbtorture: add function to get a printserver's environment.
    
    Guenther

commit 545ef2ca7636507f86f370ae57937de7a6bd5d2e
Author: Günther Deschner <gd at samba.org>
Date:   Tue Apr 20 18:16:03 2010 +0200

    s4-smbtorture: simplify macros used in PrinterInfo winreg consistency teste.
    
    Guenther

commit e647b8c61f9b65e4c4d07eae7f1a4c2be711b8de
Author: Günther Deschner <gd at samba.org>
Date:   Tue Apr 20 16:25:27 2010 +0200

    s4-smbtorture: refactor test_GetPrinterDriver2().
    
    Guenther

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

Summary of changes:
 source4/torture/rpc/spoolss.c |  166 ++++++++++++++++++++++++++--------------
 1 files changed, 108 insertions(+), 58 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index 55af920..9203a72 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -3284,6 +3284,28 @@ static bool test_GetPrinterDataEx(struct torture_context *tctx,
 	return true;
 }
 
+static bool test_get_environment(struct torture_context *tctx,
+				 struct dcerpc_binding_handle *b,
+				 struct policy_handle *handle,
+				 const char **architecture)
+{
+	DATA_BLOB blob;
+	enum winreg_Type type;
+	uint8_t *data;
+	uint32_t needed;
+
+	torture_assert(tctx,
+		test_GetPrinterData(tctx, b, handle, "Architecture", &type, &data, &needed),
+		"failed to get Architecture");
+
+	torture_assert_int_equal(tctx, type, REG_SZ, "unexpected type");
+
+	blob = data_blob_const(data, needed);
+	*architecture = reg_val_data_string(tctx, lp_iconv_convenience(tctx->lp_ctx), REG_SZ, blob);
+
+	return true;
+}
+
 static bool test_GetPrinterData_list(struct torture_context *tctx,
 				     struct dcerpc_pipe *p,
 				     struct policy_handle *handle,
@@ -3956,7 +3978,7 @@ static bool test_GetPrinterInfo_winreg(struct torture_context *tctx,
 	printername = strip_unc(info.info2.printername);
 	sharename = strip_unc(info.info2.sharename);
 
-#define test_sz(key, wname, iname) \
+#define test_sz(wname, iname) \
 do {\
 	DATA_BLOB blob;\
 	const char *str;\
@@ -3979,7 +4001,7 @@ do {\
 	}\
 } while(0);
 
-#define test_dword(key, wname, iname) \
+#define test_dword(wname, iname) \
 do {\
 	uint32_t value;\
 	enum winreg_Type w_type;\
@@ -3998,7 +4020,7 @@ do {\
 		talloc_asprintf(tctx, "%s - %s mismatch", #wname, #iname));\
 } while(0);
 
-#define test_dm(key, wname, iname) \
+#define test_dm(wname, iname) \
 do {\
 	DATA_BLOB blob;\
 	struct spoolss_DeviceMode dm;\
@@ -4020,7 +4042,7 @@ do {\
 		"dm unequal");\
 } while(0);
 
-#define test_sd(key, wname, iname) \
+#define test_sd(wname, iname) \
 do {\
 	DATA_BLOB blob;\
 	struct security_descriptor sd;\
@@ -4062,27 +4084,27 @@ do {\
 		torture_assert(tctx,
 			test_winreg_OpenKey(tctx, winreg_handle, hive_handle, printer_key, &key_handle), "");
 
-		test_sz(keys[i], "Name", printername);
-		test_sz(keys[i], "Share Name", sharename);
-		test_sz(keys[i], "Port", info.info2.portname);
-		test_sz(keys[i], "Printer Driver", info.info2.drivername);
-		test_sz(keys[i], "Description", info.info2.comment);
-		test_sz(keys[i], "Location", info.info2.location);
-		test_sz(keys[i], "Separator File", info.info2.sepfile);
-		test_sz(keys[i], "Print Processor", info.info2.printprocessor);
-		test_sz(keys[i], "Datatype", info.info2.datatype);
-		test_sz(keys[i], "Parameters", info.info2.parameters);
+		test_sz("Name", printername);
+		test_sz("Share Name", sharename);
+		test_sz("Port", info.info2.portname);
+		test_sz("Printer Driver", info.info2.drivername);
+		test_sz("Description", info.info2.comment);
+		test_sz("Location", info.info2.location);
+		test_sz("Separator File", info.info2.sepfile);
+		test_sz("Print Processor", info.info2.printprocessor);
+		test_sz("Datatype", info.info2.datatype);
+		test_sz("Parameters", info.info2.parameters);
 		/* winreg: 0, spoolss not */
-/*		test_dword(keys[i], "Attributes", info.info2.attributes); */
-		test_dword(keys[i], "Priority", info.info2.priority);
-		test_dword(keys[i], "Default Priority", info.info2.defaultpriority);
+/*		test_dword("Attributes", info.info2.attributes); */
+		test_dword("Priority", info.info2.priority);
+		test_dword("Default Priority", info.info2.defaultpriority);
 		/* winreg: 60, spoolss: 0 */
-/*		test_dword(keys[i], "StartTime", info.info2.starttime); */
-/*		test_dword(keys[i], "UntilTime", info.info2.untiltime); */
+/*		test_dword("StartTime", info.info2.starttime); */
+/*		test_dword("UntilTime", info.info2.untiltime); */
 		/* winreg != spoolss */
-/*		test_dword(keys[i], "Status", info.info2.status); */
-		test_dm(keys[i], "Default DevMode", info.info2.devmode);
-		test_sd(keys[i], "Security", info.info2.secdesc);
+/*		test_dword("Status", info.info2.status); */
+		test_dm("Default DevMode", info.info2.devmode);
+		test_sd("Security", info.info2.secdesc);
 
 		torture_assert(tctx,
 			test_winreg_CloseKey(tctx, winreg_handle, &key_handle), "");
@@ -5158,60 +5180,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;i<ARRAY_SIZE(levels);i++) {
-
-		r.in.buffer = NULL;
-		r.in.offered = 0;
-		r.in.level = levels[i];
+	torture_comment(tctx, "Testing GetPrinterDriver2(%s) level %d\n",
+		driver_name, r.in.level);
 
-		torture_comment(tctx, "Testing GetPrinterDriver2(%s) level %d\n",
-			driver_name, r.in.level);
-
-		torture_assert_ntstatus_ok(tctx, dcerpc_spoolss_GetPrinterDriver2_r(b, tctx, &r),
+	torture_assert_ntstatus_ok(tctx,
+		dcerpc_spoolss_GetPrinterDriver2_r(b, tctx, &r),
+		"failed to call GetPrinterDriver2");
+	if (W_ERROR_EQUAL(r.out.result, WERR_INSUFFICIENT_BUFFER)) {
+		DATA_BLOB blob = data_blob_talloc_zero(tctx, needed);
+		r.in.buffer = &blob;
+		r.in.offered = needed;
+		torture_assert_ntstatus_ok(tctx,
+			dcerpc_spoolss_GetPrinterDriver2_r(b, tctx, &r),
 			"failed to call GetPrinterDriver2");
-		if (W_ERROR_EQUAL(r.out.result, WERR_INSUFFICIENT_BUFFER)) {
-			DATA_BLOB blob = data_blob_talloc_zero(tctx, needed);
-			r.in.buffer = &blob;
-			r.in.offered = needed;
-			torture_assert_ntstatus_ok(tctx, dcerpc_spoolss_GetPrinterDriver2_r(b, tctx, &r),
-				"failed to call GetPrinterDriver2");
-		}
+	}
 
-		if (W_ERROR_EQUAL(r.out.result, WERR_INVALID_LEVEL)) {
-			switch (r.in.level) {
-			case 101:
-			case 8:
-				continue;
-			default:
-				break;
-			}
+	if (W_ERROR_EQUAL(r.out.result, WERR_INVALID_LEVEL)) {
+		switch (r.in.level) {
+		case 101:
+		case 8:
+			torture_comment(tctx,
+				"level %d not implemented, not considering as an error\n",
+				r.in.level);
+			return true;
+		default:
+			break;
 		}
+	}
 
-		torture_assert_werr_ok(tctx, r.out.result,
-			"failed to call GetPrinterDriver2");
+	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);
+
+	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;
 
-		CHECK_NEEDED_SIZE_LEVEL(spoolss_DriverInfo, r.out.info, r.in.level, lp_iconv_convenience(tctx->lp_ctx), needed, 4);
+
+	for (i=0;i<ARRAY_SIZE(levels);i++) {
+
+		torture_assert(tctx,
+			test_GetPrinterDriver2_level(tctx, b, handle, driver_name, architecture, levels[i], 3, 0, NULL),
+			"");
 	}
 
 	return true;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list