Rev 12008: Fix the TYPE command. in file:///home/jelmer/bzr.samba/SAMBA_4_0/

Jelmer Vernooij jelmer at samba.org
Wed Apr 25 17:10:39 GMT 2007


At file:///home/jelmer/bzr.samba/SAMBA_4_0/

------------------------------------------------------------
revno: 12008
revision-id: jelmer at samba.org-20070425171016-dzm4koduxz0s2jba
parent: svn-v2:22519 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: SAMBA_4_0
timestamp: Wed 2007-04-25 19:10:16 +0200
message:
  Fix the TYPE command.
modified:
  source/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm svn-v2:16824 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2fpidl%2flib%2fParse%2fPidl%2fWireshark%2fConformance.pm
  source/pidl/lib/Parse/Pidl/Wireshark/NDR.pm svn-v2:16824 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2fpidl%2flib%2fParse%2fPidl%2fWireshark%2fNDR.pm
  source/pidl/tests/wireshark-conf.pl svn-v2:21253 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2fpidl%2ftests%2fwireshark%2dconf.pl
=== modified file 'source/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm'
--- a/source/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm	2007-02-27 12:46:19 +0000
+++ b/source/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm	2007-04-25 17:10:16 +0000
@@ -124,6 +124,12 @@
 		warning($pos, "invalid BASE_TYPE `$base_type'");
 	}
 
+	$dissectorname =~ s/^\"(.*)\"$/$1/g;
+
+	if (not ($dissectorname =~ /;$/)) {
+		warning($pos, "missing semicolon");
+	}
+
 	$data->{types}->{$name} = {
 		NAME => $name,
 		POS => $pos,

=== modified file 'source/pidl/lib/Parse/Pidl/Wireshark/NDR.pm'
--- a/source/pidl/lib/Parse/Pidl/Wireshark/NDR.pm	2007-04-22 13:57:07 +0000
+++ b/source/pidl/lib/Parse/Pidl/Wireshark/NDR.pm	2007-04-25 17:10:16 +0000
@@ -834,6 +834,8 @@
 {
 	my ($self, $type,$call,$ft,$base,$mask,$vals,$length) = @_;
 
+	return if (defined($self->{conformance}->{types}->{$type}));
+
 	$self->{conformance}->{types}->{$type} = {
 		NAME => $type,
 		DISSECTOR_NAME => $call,

=== modified file 'source/pidl/tests/wireshark-conf.pl'
--- a/source/pidl/tests/wireshark-conf.pl	2007-02-27 13:41:56 +0000
+++ b/source/pidl/tests/wireshark-conf.pl	2007-04-25 17:10:16 +0000
@@ -5,7 +5,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 45;
+use Test::More tests => 47;
 use FindBin qw($RealBin);
 use lib "$RealBin";
 use Util;
@@ -61,11 +61,11 @@
 test_warnings("nofile:1: Unknown command `CODE'\n",
 	sub { parse_conf("CODE END\n"); } );
 
-is_deeply(parse_conf("TYPE winreg_String dissect_myminregstring FT_STRING BASE_DEC 0 0 2\n"), { types => { winreg_String => { 
+is_deeply(parse_conf("TYPE winreg_String dissect_myminregstring(); FT_STRING BASE_DEC 0 0 2\n"), { types => { winreg_String => { 
 				NAME => "winreg_String",
 				POS => { FILE => "nofile", LINE => 1 },
 				USED => 0,
-				DISSECTOR_NAME => "dissect_myminregstring",
+				DISSECTOR_NAME => "dissect_myminregstring();",
 				FT_TYPE => "FT_STRING",
 				BASE_TYPE => "BASE_DEC",
 				MASK => 0,
@@ -87,13 +87,13 @@
 	sub { parse_conf("TYPE mytype dissector\n"); });
 
 test_warnings("nofile:1: dissector name does not contain `dissect'\n",
-	sub { parse_conf("TYPE winreg_String myminregstring FT_STRING BASE_DEC 0 0 2\n"); });
+	sub { parse_conf("TYPE winreg_String myminregstring; FT_STRING BASE_DEC 0 0 2\n"); });
 
 test_warnings("nofile:1: invalid FT_TYPE `BLA'\n",
-	sub { parse_conf("TYPE winreg_String dissect_myminregstring BLA BASE_DEC 0 0 2\n"); });
+	sub { parse_conf("TYPE winreg_String dissect_myminregstring; BLA BASE_DEC 0 0 2\n"); });
 
 test_warnings("nofile:1: invalid BASE_TYPE `BLOE'\n",
-	sub { parse_conf("TYPE winreg_String dissect_myminregstring FT_UINT32 BLOE 0 0 2\n"); });
+	sub { parse_conf("TYPE winreg_String dissect_myminregstring; FT_UINT32 BLOE 0 0 2\n"); });
 
 is_deeply(parse_conf("TFS hf_bla \"True string\" \"False String\"\n"),
 		{ tfs => { hf_bla => {
@@ -163,3 +163,38 @@
 
 test_errors("nofile:1: incomplete HF_FIELD command\n",
 	sub { parse_conf("HF_FIELD hf_idx\n"); });
+
+is_deeply(parse_conf("TYPE winreg_String dissect_myminregstring(); FT_STRING BASE_DEC 0 0 0 2\n"), {
+		types => {
+			winreg_String => {
+				NAME => "winreg_String",
+				POS => { FILE => "nofile", LINE => 1 },
+				USED => 0,
+				DISSECTOR_NAME => "dissect_myminregstring();",
+				FT_TYPE => "FT_STRING",
+				BASE_TYPE => "BASE_DEC",
+				MASK => 0,
+				VALSSTRING => 0,
+				ALIGNMENT => 0
+			}
+		}
+	}
+);
+
+
+is_deeply(parse_conf("TYPE winreg_String \"offset = dissect_myminregstring(\@HF\@);\" FT_STRING BASE_DEC 0 0 0 2\n"), {
+		types => {
+			winreg_String => {
+				NAME => "winreg_String",
+				POS => { FILE => "nofile", LINE => 1 },
+				USED => 0,
+				DISSECTOR_NAME => "offset = dissect_myminregstring(\@HF\@);",
+				FT_TYPE => "FT_STRING",
+				BASE_TYPE => "BASE_DEC",
+				MASK => 0,
+				VALSSTRING => 0,
+				ALIGNMENT => 0
+			}
+		}
+	}
+);



More information about the samba-cvs mailing list