[PATCHES] pidl backports from wireshark

Günther Deschner gd at samba.org
Wed Aug 17 16:11:39 UTC 2016


Hi,

attached are two patches from wireshark master git tree.

Please review and push.

Thanks,
Guenther
-- 
Günther Deschner                    GPG-ID: 8EE11688
Red Hat                         gdeschner at redhat.com
Samba Team                              gd at samba.org
-------------- next part --------------
From facf671f653e76cee217a5d1386ba22eee1c88b5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Wed, 11 May 2016 15:41:02 +0200
Subject: [PATCH 1/2] pidl: Keep case from fieldnames.

Change-Id: I5626cfa0487cc88eb65cc349c05ae1762bc953f4
Signed-off-by: Guenther Deschner <gd at samba.org>
Reviewed-on: https://code.wireshark.org/review/16720
Petri-Dish: Michael Mann <mmann78 at netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply at wireshark.org>
Reviewed-by: Michael Mann <mmann78 at netscape.net>
---
 pidl/lib/Parse/Pidl/Wireshark/NDR.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pidl/lib/Parse/Pidl/Wireshark/NDR.pm b/pidl/lib/Parse/Pidl/Wireshark/NDR.pm
index 8161646..6583746 100644
--- a/pidl/lib/Parse/Pidl/Wireshark/NDR.pm
+++ b/pidl/lib/Parse/Pidl/Wireshark/NDR.pm
@@ -61,7 +61,7 @@ sub field2name($)
 
 	$field =~ s/^(_)*//g;		# Remove any starting underscores
 	$field =~ s/_/ /g;		# Replace underscores with spaces
-	$field =~ s/(\w+)/\u\L$1/g;	# Capitalise each word
+	$field =~ s/(\w+)/\u$1/g;	# Capitalise each word
 
 	return $field;
 }
-- 
2.7.4


From 6d138278831e7508ed282a68480124308b446140 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Mon, 28 Sep 2015 07:28:28 +0200
Subject: [PATCH 2/2] pidl: support HRESULT as return code in wireshark
 autogenerated dissectors.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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>
---
 pidl/lib/Parse/Pidl/Wireshark/NDR.pm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/pidl/lib/Parse/Pidl/Wireshark/NDR.pm b/pidl/lib/Parse/Pidl/Wireshark/NDR.pm
index 6583746..49b0c2c 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);
 
-- 
2.7.4



More information about the samba-technical mailing list