[SCM] Samba Shared Repository - branch master updated

Günther Deschner gd at samba.org
Wed Nov 10 08:08:02 MST 2010


The branch, master has been updated
       via  ec50db6 s4-smbtorture: use test_GetPrinterData{Ex}_checktype calls in RPC-SPOOLSS tests.
       via  1c57931 s3-spoolss: fix spoolss GetPrinterData behaviour
       via  fa0b44e s4-smbtorture: allow to test returned type after specific error code in PrinterData tests.
      from  fa203f4 s3/time_audit: fix a change that was just for debuggin purposeѕ

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


- Log -----------------------------------------------------------------
commit ec50db61fa6f3cf026c1f0f40528587b3dec8da3
Author: Günther Deschner <gd at samba.org>
Date:   Wed Nov 10 15:21:15 2010 +0100

    s4-smbtorture: use test_GetPrinterData{Ex}_checktype calls in RPC-SPOOLSS tests.
    
    Guenther
    
    Autobuild-User: Günther Deschner <gd at samba.org>
    Autobuild-Date: Wed Nov 10 15:07:12 UTC 2010 on sn-devel-104

commit 1c579318ae2d2480ee4cc998443c0d1661b39846
Author: David Disseldorp <ddiss at suse.de>
Date:   Fri Nov 5 15:24:22 2010 +0100

    s3-spoolss: fix spoolss GetPrinterData behaviour
    
    Windows sends spoolss GetPrinterData requests with an offered buffer
    size of zero, Model and TrayFormTable data is commonly requested in
    this way.
    
    Samba's GetPrinterData response for the above case includes the correct
    error code (WERR_MORE_DATA), however the type field is set to REG_NONE.
    This causes Windows (seen on XP and 2k3) to give up on the request.
    
    If the type field is retained (not set to REG_NONE) when responding with
    WERR_MORE_DATA, Windows reissues the GetPrinterData request with an
    increased offered buffer size.
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit fa0b44ed9c31baf19c70aa47a25233c947c0ae05
Author: Günther Deschner <gd at samba.org>
Date:   Wed Nov 10 10:19:01 2010 +0100

    s4-smbtorture: allow to test returned type after specific error code in PrinterData tests.
    
    Guenther

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

Summary of changes:
 source3/rpc_server/srv_spoolss_nt.c |    2 +-
 source4/torture/rpc/spoolss.c       |   69 ++++++++++++++++++++++++++---------
 2 files changed, 52 insertions(+), 19 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index aafba01..c0f953b 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -9222,7 +9222,7 @@ WERROR _spoolss_GetPrinterDataEx(struct pipes_struct *p,
 	}
 
  done:
-	*r->out.type    = SPOOLSS_BUFFER_OK(*r->out.type, REG_NONE);
+	/* retain type when returning WERR_MORE_DATA */
 	r->out.data     = SPOOLSS_BUFFER_OK(r->out.data, r->out.data);
 
 	return SPOOLSS_BUFFER_OK(WERR_OK, WERR_MORE_DATA);
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index 8154cd2..6530a85 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -3474,13 +3474,14 @@ static bool test_ResumePrinter(struct torture_context *tctx,
 	return true;
 }
 
-static bool test_GetPrinterData(struct torture_context *tctx,
-				struct dcerpc_binding_handle *b,
-				struct policy_handle *handle,
-				const char *value_name,
-				enum winreg_Type *type_p,
-				uint8_t **data_p,
-				uint32_t *needed_p)
+static bool test_GetPrinterData_checktype(struct torture_context *tctx,
+					  struct dcerpc_binding_handle *b,
+					  struct policy_handle *handle,
+					  const char *value_name,
+					  enum winreg_Type *expected_type,
+					  enum winreg_Type *type_p,
+					  uint8_t **data_p,
+					  uint32_t *needed_p)
 {
 	NTSTATUS status;
 	struct spoolss_GetPrinterData r;
@@ -3501,6 +3502,9 @@ static bool test_GetPrinterData(struct torture_context *tctx,
 	torture_assert_ntstatus_ok(tctx, status, "GetPrinterData failed");
 
 	if (W_ERROR_EQUAL(r.out.result, WERR_MORE_DATA)) {
+		if (expected_type) {
+			torture_assert_int_equal(tctx, type, *expected_type, "unexpected type");
+		}
 		r.in.offered = needed;
 		r.out.data = talloc_zero_array(tctx, uint8_t, r.in.offered);
 		status = dcerpc_spoolss_GetPrinterData_r(b, tctx, &r);
@@ -3527,14 +3531,27 @@ static bool test_GetPrinterData(struct torture_context *tctx,
 	return true;
 }
 
-static bool test_GetPrinterDataEx(struct torture_context *tctx,
-				  struct dcerpc_pipe *p,
-				  struct policy_handle *handle,
-				  const char *key_name,
-				  const char *value_name,
-				  enum winreg_Type *type_p,
-				  uint8_t **data_p,
-				  uint32_t *needed_p)
+static bool test_GetPrinterData(struct torture_context *tctx,
+				struct dcerpc_binding_handle *b,
+				struct policy_handle *handle,
+				const char *value_name,
+				enum winreg_Type *type_p,
+				uint8_t **data_p,
+				uint32_t *needed_p)
+{
+	return test_GetPrinterData_checktype(tctx, b, handle, value_name,
+					     NULL, type_p, data_p, needed_p);
+}
+
+static bool test_GetPrinterDataEx_checktype(struct torture_context *tctx,
+					    struct dcerpc_pipe *p,
+					    struct policy_handle *handle,
+					    const char *key_name,
+					    const char *value_name,
+					    enum winreg_Type *expected_type,
+					    enum winreg_Type *type_p,
+					    uint8_t **data_p,
+					    uint32_t *needed_p)
 {
 	NTSTATUS status;
 	struct spoolss_GetPrinterDataEx r;
@@ -3563,6 +3580,9 @@ static bool test_GetPrinterDataEx(struct torture_context *tctx,
 	}
 
 	if (W_ERROR_EQUAL(r.out.result, WERR_MORE_DATA)) {
+		if (expected_type) {
+			torture_assert_int_equal(tctx, type, *expected_type, "unexpected type");
+		}
 		r.in.offered = needed;
 		r.out.data = talloc_zero_array(tctx, uint8_t, r.in.offered);
 		status = dcerpc_spoolss_GetPrinterDataEx_r(b, tctx, &r);
@@ -3589,6 +3609,19 @@ static bool test_GetPrinterDataEx(struct torture_context *tctx,
 	return true;
 }
 
+static bool test_GetPrinterDataEx(struct torture_context *tctx,
+				  struct dcerpc_pipe *p,
+				  struct policy_handle *handle,
+				  const char *key_name,
+				  const char *value_name,
+				  enum winreg_Type *type_p,
+				  uint8_t **data_p,
+				  uint32_t *needed_p)
+{
+	return test_GetPrinterDataEx_checktype(tctx, p, handle, key_name, value_name,
+					       NULL, type_p, data_p, needed_p);
+}
+
 static bool test_get_environment(struct torture_context *tctx,
 				 struct dcerpc_binding_handle *b,
 				 struct policy_handle *handle,
@@ -4751,7 +4784,7 @@ static bool test_SetPrinterData_matrix(struct torture_context *tctx,
 
 	for (i=0; i < ARRAY_SIZE(values); i++) {
 
-		enum winreg_Type type;
+		enum winreg_Type type, expected_type = REG_SZ;
 		DATA_BLOB blob;
 		uint8_t *data;
 		uint32_t needed;
@@ -4764,7 +4797,7 @@ static bool test_SetPrinterData_matrix(struct torture_context *tctx,
 			"SetPrinterData failed");
 
 		torture_assert(tctx,
-			test_GetPrinterData(tctx, b, handle, values[i], &type, &data, &needed),
+			test_GetPrinterData_checktype(tctx, b, handle, values[i], &expected_type, &type, &data, &needed),
 			"GetPrinterData failed");
 
 		torture_assert_int_equal(tctx, type, REG_SZ, "type mismatch");
@@ -5087,7 +5120,7 @@ static bool test_SetPrinterDataEx_matrix(struct torture_context *tctx,
 			"failed to call SetPrinterDataEx");
 
 		torture_assert(tctx,
-			test_GetPrinterDataEx(tctx, p, handle, key_name, value_name, &type, &data_out, &needed),
+			test_GetPrinterDataEx_checktype(tctx, p, handle, key_name, value_name, &types[t], &type, &data_out, &needed),
 			"failed to call GetPrinterDataEx");
 
 		torture_assert(tctx,


-- 
Samba Shared Repository


More information about the samba-cvs mailing list