[SCM] Samba Shared Repository - branch master updated

Günther Deschner gd at samba.org
Wed Sep 7 01:01:04 UTC 2016


The branch, master has been updated
       via  d8b57e3 s3-spoolss: fix _spoolss_GetPrinterDataEx by moving the keyname lengthcheck.
       via  518b2a3 s4-torture: test GetPrinterData with server handle and 0 keylength.
       via  d569bda pidl: support HRESULT as return code in wireshark autogenerated dissectors.
      from  fee1f4c tevent: fix confused documentation

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


- Log -----------------------------------------------------------------
commit d8b57e3828eac084ad302a90b33c35ff4e918e5a
Author: Günther Deschner <gd at samba.org>
Date:   Thu Sep 1 19:55:40 2016 +0200

    s3-spoolss: fix _spoolss_GetPrinterDataEx by moving the keyname lengthcheck.
    
    Guenther
    
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    
    Autobuild-User(master): Günther Deschner <gd at samba.org>
    Autobuild-Date(master): Wed Sep  7 03:00:14 CEST 2016 on sn-devel-144

commit 518b2a3f5f3a4814e96546505487b775b5dbca40
Author: Günther Deschner <gd at samba.org>
Date:   Thu Sep 1 19:54:46 2016 +0200

    s4-torture: test GetPrinterData with server handle and 0 keylength.
    
    This is what e.g. Windows 10 does a lot.
    
    Guenther
    
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit d569bda1e5452e13aa3dcf63a501aa581930589f
Author: Günther Deschner <gd at samba.org>
Date:   Mon Sep 28 07:28:28 2015 +0200

    pidl: support HRESULT as return code in wireshark autogenerated dissectors.
    
    Guenther
    
    Change-Id: I68b7c579c5a519e429d2f4c2b3f63247e02f24e3
    Signed-off-by: Günther Deschner <gd at samba.org>
    Reviewed-on: https://code.wireshark.org/review/16718
    Reviewed-by: Michael Mann <mmann78 at netscape.net>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

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

Summary of changes:
 pidl/lib/Parse/Pidl/Wireshark/NDR.pm        |  9 ++++++++-
 source3/rpc_server/spoolss/srv_spoolss_nt.c | 12 ++++++------
 source4/torture/rpc/spoolss.c               | 22 +++++++++++++++-------
 3 files changed, 29 insertions(+), 14 deletions(-)


Changeset truncated at 500 lines:

diff --git a/pidl/lib/Parse/Pidl/Wireshark/NDR.pm b/pidl/lib/Parse/Pidl/Wireshark/NDR.pm
index 8161646..21ef714 100644
--- a/pidl/lib/Parse/Pidl/Wireshark/NDR.pm
+++ b/pidl/lib/Parse/Pidl/Wireshark/NDR.pm
@@ -571,7 +571,7 @@ sub Function($$$)
 	$self->pidl_code("{");
 	$self->indent;
 	if ( not defined($fn->{RETURN_TYPE})) {
-	} elsif ($fn->{RETURN_TYPE} eq "NTSTATUS" or $fn->{RETURN_TYPE} eq "WERROR")
+	} elsif ($fn->{RETURN_TYPE} eq "NTSTATUS" or $fn->{RETURN_TYPE} eq "WERROR" or $fn->{RETURN_TYPE} eq "HRESULT")
 	{
 		$self->pidl_code("guint32 status;\n");
 	} elsif (my $type = getType($fn->{RETURN_TYPE})) {
@@ -607,6 +607,11 @@ sub Function($$$)
 		$self->pidl_code("\tcol_append_fstr(pinfo->cinfo, COL_INFO, \", Error: %s\", val_to_str(status, WERR_errors, \"Unknown DOS error 0x%08x\"));\n");
 
 		$return_types{$ifname}->{"werror"} = ["WERROR", "Windows Error"];
+	} elsif ($fn->{RETURN_TYPE} eq "HRESULT") {
+		$self->pidl_code("offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, hf\_$ifname\_hresult, &status);\n");
+		$self->pidl_code("if (status != 0)");
+		$self->pidl_code("\tcol_append_fstr(pinfo->cinfo, COL_INFO, \", Error: %s\", val_to_str(status, HRES_errors, \"Unknown HRES error 0x%08x\"));\n");
+		$return_types{$ifname}->{"hresult"} = ["HRESULT", "HRES Windows Error"];
 	} elsif (my $type = getType($fn->{RETURN_TYPE})) {
 		if ($type->{DATA}->{TYPE} eq "ENUM") {
 			my $return_type = "g".Parse::Pidl::Typelist::enum_type_fn($type->{DATA});
@@ -1099,6 +1104,8 @@ sub Initialize($$)
 		"offset = PIDL_dissect_uint32(tvb, offset, pinfo, tree, di, drep, \@HF\@, \@PARAM\@);","FT_UINT32", "BASE_DEC", 0, "VALS(WERR_errors)", 4);
 	$self->register_type("NTSTATUS",
 		"offset = PIDL_dissect_uint32(tvb, offset, pinfo, tree, di, drep, \@HF\@, \@PARAM\@);","FT_UINT32", "BASE_DEC", 0, "VALS(NT_errors)", 4);
+	$self->register_type("HRESULT",
+		"offset = PIDL_dissect_uint32(tvb, offset, pinfo, tree, di, drep, \@HF\@, \@PARAM\@);","FT_UINT32", "BASE_DEC", 0, "VALS(HRES_errors)", 4);
 	$self->register_type("ipv6address", "proto_tree_add_item(tree, \@HF\@, tvb, offset, 16, ENC_NA); offset += 16;", "FT_IPv6", "BASE_NONE", 0, "NULL", 16);
 	$self->register_type("ipv4address", "proto_tree_add_item(tree, \@HF\@, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4;", "FT_IPv4", "BASE_NONE", 0, "NULL", 4);
 
diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c
index 0dcae46..7413d9d 100644
--- a/source3/rpc_server/spoolss/srv_spoolss_nt.c
+++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c
@@ -9728,12 +9728,6 @@ WERROR _spoolss_GetPrinterDataEx(struct pipes_struct *p,
 		goto done;
 	}
 
-	/* check to see if the keyname is valid */
-	if (!strlen(r->in.key_name)) {
-		result = WERR_INVALID_PARAM;
-		goto done;
-	}
-
 	/* Is the handle to a printer or to the server? */
 
 	if (Printer->printer_type == SPLHND_SERVER) {
@@ -9764,6 +9758,12 @@ WERROR _spoolss_GetPrinterDataEx(struct pipes_struct *p,
 		goto done;
 	}
 
+	/* check to see if the keyname is valid */
+	if (!strlen(r->in.key_name)) {
+		result = WERR_INVALID_PARAM;
+		goto done;
+	}
+
 	if (!get_printer_snum(p, r->in.handle, &snum, NULL)) {
 		result = WERR_BADFID;
 		goto done;
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index c506c43..a44b732 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -4119,19 +4119,27 @@ static bool test_GetPrinterData_list(struct torture_context *tctx,
 
 	for (i=0; i < ARRAY_SIZE(list); i++) {
 		enum winreg_Type type = REG_NONE;
-		enum winreg_Type type_ex= REG_NONE;
+		enum winreg_Type type_ex1 = REG_NONE;
+		enum winreg_Type type_ex2 = REG_NONE;
 		uint8_t *data;
-		uint8_t *data_ex = NULL;
+		uint8_t *data_ex1 = NULL;
+		uint8_t *data_ex2 = NULL;
 		uint32_t needed;
-		uint32_t needed_ex = 0;
+		uint32_t needed_ex1 = 0;
+		uint32_t needed_ex2 = 0;
 
 		torture_assert(tctx, test_GetPrinterData(tctx, b, &ctx->server_handle, list[i], &type, &data, &needed),
 			talloc_asprintf(tctx, "GetPrinterData failed on %s\n", list[i]));
-		torture_assert(tctx, test_GetPrinterDataEx(tctx, p, &ctx->server_handle, "random_string", list[i], &type_ex, &data_ex, &needed_ex),
+		torture_assert(tctx, test_GetPrinterDataEx(tctx, p, &ctx->server_handle, "random_string", list[i], &type_ex1, &data_ex1, &needed_ex1),
 			talloc_asprintf(tctx, "GetPrinterDataEx failed on %s\n", list[i]));
-		torture_assert_int_equal(tctx, type, type_ex, "type mismatch");
-		torture_assert_int_equal(tctx, needed, needed_ex, "needed mismatch");
-		torture_assert_mem_equal(tctx, data, data_ex, needed, "data mismatch");
+		torture_assert(tctx, test_GetPrinterDataEx(tctx, p, &ctx->server_handle, "", list[i], &type_ex2, &data_ex2, &needed_ex2),
+			talloc_asprintf(tctx, "GetPrinterDataEx failed on %s\n", list[i]));
+		torture_assert_int_equal(tctx, type, type_ex1, "type mismatch");
+		torture_assert_int_equal(tctx, type, type_ex2, "type mismatch");
+		torture_assert_int_equal(tctx, needed, needed_ex1, "needed mismatch");
+		torture_assert_int_equal(tctx, needed, needed_ex2, "needed mismatch");
+		torture_assert_mem_equal(tctx, data, data_ex1, needed, "data mismatch");
+		torture_assert_mem_equal(tctx, data, data_ex2, needed, "data mismatch");
 	}
 
 	return true;


-- 
Samba Shared Repository



More information about the samba-cvs mailing list