summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-04-25 16:10:54 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:51:37 -0500
commit771b57b3fcd0daeb3731f18e5b4ef95013150b82 (patch)
treeee37a89c81f3a3be4ec12afbd5d0116a44739da9
parent29c2744f9677dfb033578c076791f8a3249f42b3 (diff)
downloadsamba-771b57b3fcd0daeb3731f18e5b4ef95013150b82.tar.gz
samba-771b57b3fcd0daeb3731f18e5b4ef95013150b82.tar.bz2
samba-771b57b3fcd0daeb3731f18e5b4ef95013150b82.zip
r22520: Fix the TYPE command.
(This used to be commit b81b0d3308bf51c2e22d54024b3d6f1a59c6b283)
-rw-r--r--source4/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm6
-rw-r--r--source4/pidl/lib/Parse/Pidl/Wireshark/NDR.pm2
-rwxr-xr-xsource4/pidl/tests/wireshark-conf.pl47
3 files changed, 49 insertions, 6 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm b/source4/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm
index 44eb77f836..b53c56e741 100644
--- a/source4/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm
+++ b/source4/pidl/lib/Parse/Pidl/Wireshark/Conformance.pm
@@ -124,6 +124,12 @@ sub handle_type($$$$$$$$$$)
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,
diff --git a/source4/pidl/lib/Parse/Pidl/Wireshark/NDR.pm b/source4/pidl/lib/Parse/Pidl/Wireshark/NDR.pm
index 523fff9537..ea3f0db961 100644
--- a/source4/pidl/lib/Parse/Pidl/Wireshark/NDR.pm
+++ b/source4/pidl/lib/Parse/Pidl/Wireshark/NDR.pm
@@ -834,6 +834,8 @@ sub register_type($$$$$$$$)
{
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,
diff --git a/source4/pidl/tests/wireshark-conf.pl b/source4/pidl/tests/wireshark-conf.pl
index 617a63029a..d6fe3158aa 100755
--- a/source4/pidl/tests/wireshark-conf.pl
+++ b/source4/pidl/tests/wireshark-conf.pl
@@ -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 @@ is_deeply(parse_conf("CODE START\ndata\nmore data\nCODE END\n"), { override => "
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 @@ test_errors("nofile:1: incomplete TYPE command\n",
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: no dissectorname specified\n",
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
+ }
+ }
+ }
+);