The branch, master has been updated
via eeaa1163b79 wireshark-pidl: Don't warn about unused hfs used in
CODE blocks
via 18ba2316f8e wireshark-pidl: Do not calculate functions replaced by
manual code
via fe67eb0a7fd wireshark-pidl: Fix filter names for subcontext length
fields
via 56e4a4faad7 wireshark-pidl: Check for undefined SwitchType first
via f20f86781e5 wireshark-pidl: Warn appropriately on unsupported
switch_is discriminants
via 1573dd8b51e wireshark-pidl: Reduce Perl strict warnings
via 7011429284d wireshark-pidl: Reduce false positive warnings when
compiling
from d3aa479f962 docs-xml: Document samba-tool subcommand to generate
Certificate Signing Requests
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit eeaa1163b79b5c0b786becf6ddf759011b19ce20
Author: John Thacker <[email protected]>
Date: Sun Oct 12 15:18:11 2025 -0400
wireshark-pidl: Don't warn about unused hfs used in CODE blocks
From the Wireshark development branch:
commit 4f55543f6b6e5c5d15572889a2cac2b0ec28200e
Author: John Thacker <[email protected]>
Date: Fri Oct 10 11:10:13 2025 -0400
pidl: Check if a hf is used in a CODE block
If a field declared in a conformance file appears within a custom
CODE block in the conformance file, don't warn about the hf being
unused. This theoretically could have false negatives if a field
is mentioned only in a comment in the CODE block; we'd have to
remove the comments with something like Regexp::Common before
searching to avoid that.
The current conformance files in the Wireshark distribution don't
have any such false negative cases, but there are dozens of false
positives prevented by this change.
Signed-off-by: John Thacker <[email protected]>
Reviewed-by: Stefan Metzmacher <[email protected]>
Reviewed-by: Andreas Schneider <[email protected]>
Autobuild-User(master): Andreas Schneider <[email protected]>
Autobuild-Date(master): Wed Nov 5 11:12:35 UTC 2025 on atb-devel-224
commit 18ba2316f8e223f50474d8a6e5b6ee1a287a4a9d
Author: John Thacker <[email protected]>
Date: Sun Oct 12 15:14:47 2025 -0400
wireshark-pidl: Do not calculate functions replaced by manual code
From the Wireshark development branch:
commit d2232d7e51640e0e736d7b8df1b21598a21a1c85
Author: John Thacker <[email protected]>
Date: Fri Oct 10 23:02:58 2025 -0400
pidl: Do not produce a function that is replaced by MANUAL code
If a MANUAL directive in a conformance file causes a function not
to be
emitted, do not bother calculating the function that will not be
used.
This is similar to the NOEMIT directive, but has different logic
because
MANUAL only prevents emitting the function for one level of an
element
instead of all the functions and variables. This does not change the
dissectors produced at all, only skips some unnecessary compilation.
In particular, the messages when compiling the pidl-dissectors
target:
dnsserver.idl:159: error: Inline arrays not supported
eventlog.idl:54: error: Inline arrays not supported
are no longer inaccurately produced. The inline arrays in those two
IDL
files have long been supported through the MANUAL code blocks.
Expand on the error message to suggest the use of MANUAL directives
for implementation.
Signed-off-by: John Thacker <[email protected]>
Reviewed-by: Stefan Metzmacher <[email protected]>
Reviewed-by: Andreas Schneider <[email protected]>
commit fe67eb0a7fdb28b92fc17ba20c18ee4dd912cfdd
Author: John Thacker <[email protected]>
Date: Sun Oct 12 15:11:39 2025 -0400
wireshark-pidl: Fix filter names for subcontext length fields
From the Wireshark development branch:
commit e3d8636109182d7e243eea6216af7f14edda3227
Author: John Thacker <[email protected]>
Date: Thu Oct 9 20:06:43 2025 -0400
pidl: Fix filter names for subcontext length fields
The Perl variable $_->{NAME} never exists at the point in the code;
$e->{NAME} is almost surely intended instead, which makes the
subcontext
length field have the same filter name as the parent field with
".subcontext" added.
This changes a few fields, including making some fields in the same
struct or union that incorrectly shared a filter name now have
unique
filter names. Also prevents Perl warnings:
Use of uninitialized value in concatenation (.) or string at
/builds/wireshark/wireshark/tools/pid
l/lib/Parse/Pidl/Wireshark/NDR.pm line 438.
Signed-off-by: John Thacker <[email protected]>
Reviewed-by: Stefan Metzmacher <[email protected]>
Reviewed-by: Andreas Schneider <[email protected]>
commit 56e4a4faad7a6da2fe479b02e7f296f2263733f8
Author: John Thacker <[email protected]>
Date: Sun Oct 12 15:07:00 2025 -0400
wireshark-pidl: Check for undefined SwitchType first
From the Wireshark development branch:
commit edc98c1b537cbd7b8fb35cdb8b61b7dd000a1544
Author: John Thacker <[email protected]>
Date: Thu Oct 9 18:31:35 2025 -0400
pidl: Check for undefined SwitchType first
If the switch type is not defined (e.g. in a union with no
discriminant) check for that first instead of doing a bunch of
comparisons with an uninitialized scalar variable. Doesn't change
the dissector results, but prevents a bunch of Perl warnings:
Use of uninitialized value $t in hash element at
/wireshark/tools/pidl/lib/Parse/Pidl/Typelist.pm
line 194.
Use of uninitialized value in string eq at
/wireshark/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm l
ine 480.
Use of uninitialized value in string eq at
/wireshark/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm l
ine 482.
Use of uninitialized value in string eq at
/wireshark/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm l
ine 484.
Signed-off-by: John Thacker <[email protected]>
Reviewed-by: Stefan Metzmacher <[email protected]>
Reviewed-by: Andreas Schneider <[email protected]>
commit f20f86781e5843b0c02b993da93c7f7736970ccb
Author: John Thacker <[email protected]>
Date: Sun Oct 12 15:00:35 2025 -0400
wireshark-pidl: Warn appropriately on unsupported switch_is discriminants
From the Wireshark development branch:
commit 448a0d6a239f3f274d3a3a3a39ea9c6ce7fd2611
Author: John Thacker <[email protected]>
Date: Thu Oct 9 10:18:07 2025 -0400
pidl: Warn appropriately on unsupported switch_is discriminants
Microsoft's MIDL supports switch_is discriminants which have limited
C-language expressions including conditionals, logical, relational,
and arithmetic expressions. [1] Some of the distributed IDL files
include
such expressions. The current handling in PIDL's Wireshark NDR.pm
only
supports a single identifier (possibly a pointer), which appears to
be
the way it is defined in the original DCE IDL. [2,3]
In addition, the switch_is discriminant may simply be misspelled or
otherwise not found when parsing, leading to an empty array
reference.
Test for the empty array in order to produce a helpful warning
message
with the filename and line number, instead of unhelpful Perl
warnings.
This does not provide support for the construct not affect the
generated
dissectors at all, only reduces 4 unclear warnings into a single
useful
warning.
Before:
Use of uninitialized value $name in string ne at
/home/johnthacker/wireshark/tools/pidl/lib/Parse/
Pidl/Wireshark/NDR.pm line 516.
Use of uninitialized value in string eq at
/home/johnthacker/wireshark/tools/pidl/lib/Parse/Pidl/W
ireshark/NDR.pm line 525.
Use of uninitialized value $name in string ne at
/home/johnthacker/wireshark/tools/pidl/lib/Parse/
Pidl/Wireshark/NDR.pm line 527.
Use of uninitialized value $name in string ne at
/home/johnthacker/wireshark/tools/pidl/lib/Parse/
Pidl/Wireshark/NDR.pm line 531.
After:
drsuapi.idl:828: warning: ctr switch_is discriminant
`level|(type<<16)' not found. (Only single id
entifiers are supported, not expressions as in MIDL.)
[1] - https://learn.microsoft.com/en-us/windows/win32/midl/switch-is
[2] -
https://pubs.opengroup.org/onlinepubs/9629399/chap4.htm#tagcjh_08_02_12
[3] -
https://pubs.opengroup.org/onlinepubs/9629399/chap4.htm#tagcjh_08_04
Signed-off-by: John Thacker <[email protected]>
Reviewed-by: Stefan Metzmacher <[email protected]>
Reviewed-by: Andreas Schneider <[email protected]>
commit 1573dd8b51e1858feaaf5e2479a63bb6f4743855
Author: John Thacker <[email protected]>
Date: Sun Oct 12 14:56:40 2025 -0400
wireshark-pidl: Reduce Perl strict warnings
From the Wireshark git development branch:
commit 8dee8601776175a6132bef7ab19f36ee3d589d06
Author: John Thacker <[email protected]>
Date: Wed Oct 8 17:15:56 2025 -0400
pidl: Use has_property to avoid comparing undef with the empty
string
Prevents a bunch of (harmless) warnings when compiling:
Use of uninitialized value in string eq at
/builds/wireshark/wireshark/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm line 521.
Signed-off-by: John Thacker <[email protected]>
Reviewed-by: Stefan Metzmacher <[email protected]>
Reviewed-by: Andreas Schneider <[email protected]>
commit 7011429284dac61406eaabea90eee4f59a078178
Author: John Thacker <[email protected]>
Date: Sun Oct 12 14:53:49 2025 -0400
wireshark-pidl: Reduce false positive warnings when compiling
From the Wireshark git repository, to reduce false positive warnings when
compiling dissectors with pidl:
commit 919f15ab2ea313d69cc2578426430f22f65a51b5
Author: John Thacker <[email protected]>
Date: Wed Oct 8 16:52:09 2025 -0400
pidl: Don't warn about params that are used
The "USED" indicator is never set for params, which results in many
bogus "warning: dissector param never used" messages when compiling
the pidl dissectors. Set it when used, to reduce the number of
messages.
Signed-off-by: John Thacker <[email protected]>
Reviewed-by: Stefan Metzmacher <[email protected]>
Reviewed-by: Andreas Schneider <[email protected]>
-----------------------------------------------------------------------
Summary of changes:
pidl/lib/Parse/Pidl/Wireshark/NDR.pm | 91 +++++++++++++++++++++++-------------
1 file changed, 58 insertions(+), 33 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 3d8b74bab45..b8833def613 100644
--- a/pidl/lib/Parse/Pidl/Wireshark/NDR.pm
+++ b/pidl/lib/Parse/Pidl/Wireshark/NDR.pm
@@ -322,7 +322,7 @@ sub ElementLevel($$$$$$$$)
$self->pidl_code("offset = dissect_ndr_$type\_pointer(tvb,
offset, pinfo, tree, di, drep, $myname\_,
$ptrtype_mappings{$l->{POINTER_TYPE}}, \"Pointer to
".field2name(StripPrefixes($e->{NAME}, $self->{conformance}->{strip_prefixes}))
. " ($e->{TYPE})\",$hf);");
} elsif ($l->{TYPE} eq "ARRAY") {
if ($l->{IS_INLINE}) {
- error($e->{ORIGINAL}, "Inline arrays not supported");
+ error($e->{ORIGINAL}, "Inline arrays not supported
automatically. Use conformance file MANUAL directives for `$myname' and
`$l->{SIZE_IS}' to implement them.");
} elsif ($l->{IS_FIXED}) {
$self->pidl_code("int i;");
$self->pidl_code("for (i = 0; i < $l->{SIZE_IS}; i++)");
@@ -389,13 +389,19 @@ sub ElementLevel($$$$$$$$)
$t = $l->{DATA_TYPE};
}
+ if ($param ne 0) {
+
$self->{conformance}->{dissectorparams}->{$myname}->{USED} = 1;
+ }
$self->pidl_code("offset =
$ifname\_dissect_struct_" . $t . "(tvb,offset,pinfo,tree,di,drep,$hf,$param);");
return;
}
$call =~ s/\@HF\@/$hf/g;
- $call =~ s/\@PARAM\@/$param/g;
+ my $replacements = ($call =~ s/\@PARAM\@/$param/g);
+ if ($param ne 0 and $replacements ne 0) {
+
$self->{conformance}->{dissectorparams}->{$myname}->{USED} = 1;
+ }
$self->pidl_code($call);
}
} elsif ($_->{TYPE} eq "SUBCONTEXT") {
@@ -404,7 +410,7 @@ sub ElementLevel($$$$$$$$)
$varswitch = $e->{PROPERTIES}->{switch_is};
}
my $num_bits = ($l->{HEADER_SIZE}*8);
- my $hf2 = $self->register_hf_field($hf."_", "Subcontext
length", "$ifname.$pn.$_->{NAME}subcontext", "FT_UINT$num_bits", "BASE_HEX",
"NULL", 0, "");
+ my $hf2 = $self->register_hf_field($hf."_", "Subcontext
length", "$ifname.$pn.$e->{NAME}.subcontext", "FT_UINT$num_bits", "BASE_HEX",
"NULL", 0, "");
$num_bits = 3264 if ($num_bits == 32);
$self->{hf_used}->{$hf2} = 1;
$self->pidl_code("guint$num_bits size;");
@@ -424,6 +430,7 @@ sub ElementLevel($$$$$$$$)
$self->pidl_code("subtvb = tvb_new_subset_length_caplen(tvb,
offset, (const int)size, -1);");
if ($param ne 0) {
+
$self->{conformance}->{dissectorparams}->{$myname}->{USED} = 1;
$self->pidl_code("$myname\_(subtvb, 0, pinfo, tree, di,
drep, $param);");
} else {
$self->pidl_code("$myname\_(subtvb, 0, pinfo, tree, di,
drep);");
@@ -443,21 +450,23 @@ sub SwitchType($$;$)
{
my ($e, $type, $nodiscriminant) = @_;
- my $switch_dt = getType($type);
my $switch_type = undef;
- if ($switch_dt->{DATA}->{TYPE} eq "ENUM") {
- $switch_type =
Parse::Pidl::Typelist::enum_type_fn($switch_dt->{DATA});
- } elsif ($switch_dt->{DATA}->{TYPE} eq "BITMAP") {
- $switch_type =
Parse::Pidl::Typelist::bitmap_type_fn($switch_dt->{DATA});
- } elsif ($switch_dt->{DATA}->{TYPE} eq "SCALAR") {
- if (defined $e->{SWITCH_TYPE}) {
- $switch_type = "$e->{SWITCH_TYPE}";
- } else {
- $switch_type = "$switch_dt->{DATA}->{NAME}";
- }
- } elsif (not defined $e->{SWITCH_TYPE}) {
+ if (not defined($type)) {
$switch_type = $nodiscriminant;
- }
+ } else {
+ my $switch_dt = getType($type);
+ if ($switch_dt->{DATA}->{TYPE} eq "ENUM") {
+ $switch_type =
Parse::Pidl::Typelist::enum_type_fn($switch_dt->{DATA});
+ } elsif ($switch_dt->{DATA}->{TYPE} eq "BITMAP") {
+ $switch_type =
Parse::Pidl::Typelist::bitmap_type_fn($switch_dt->{DATA});
+ } elsif ($switch_dt->{DATA}->{TYPE} eq "SCALAR") {
+ if (defined $e->{SWITCH_TYPE}) {
+ $switch_type = "$e->{SWITCH_TYPE}";
+ } else {
+ $switch_type = "$switch_dt->{DATA}->{NAME}";
+ }
+ }
+ }
return $switch_type
}
@@ -470,7 +479,7 @@ sub Element($$$$$$)
my ($call_code, $moreparam);
my $param = 0;
- if (defined $isoruseswitch) {
+ if (defined $isoruseswitch and @$isoruseswitch) {
my $type = $isoruseswitch->[0];
my $name = $isoruseswitch->[1];
@@ -486,7 +495,7 @@ sub Element($$$$$$)
} else {
$moreparam = "";
}
- if (($e->{PROPERTIES}->{switch_is} eq "") &&
($switchvars{$name}) &&
+ if ((not has_property($e, "switch_is")) && ($switchvars{$name})
&&
#not a "native" type
(!($type =~ /^uint(8|16|1632|32|3264|64)/))) {
$param = $name;
@@ -555,22 +564,24 @@ sub Element($$$$$$)
next if ($_->{TYPE} eq "SWITCH");
next if
(defined($self->{conformance}->{noemit}->{"$dissectorname$add"}));
$self->pidl_def("static int $dissectorname$add(tvbuff_t *tvb
_U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info*
di _U_, uint8_t *drep _U_$moreparam);");
- $self->pidl_fn_start("$dissectorname$add");
- $self->pidl_code("static int");
- $self->pidl_code("$dissectorname$add(tvbuff_t *tvb _U_, int
offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_,
uint8_t *drep _U_$moreparam)");
- $self->pidl_code("{");
- $self->indent;
+ if (not
defined($self->{conformance}->{manual}->{"$dissectorname$add"})) {
+ $self->pidl_fn_start("$dissectorname$add");
+ $self->pidl_code("static int");
+ $self->pidl_code("$dissectorname$add(tvbuff_t *tvb _U_,
int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di
_U_, uint8_t *drep _U_$moreparam)");
+ $self->pidl_code("{");
+ $self->indent;
+
+
$self->ElementLevel($e,$_,$hf,$dissectorname.$add,$pn,$ifname,$param);
+ if (defined $oldparam) {
+ $param = $oldparam;
+ }
-
$self->ElementLevel($e,$_,$hf,$dissectorname.$add,$pn,$ifname,$param);
- if (defined $oldparam) {
- $param = $oldparam;
+ $self->pidl_code("");
+ $self->pidl_code("return offset;");
+ $self->deindent;
+ $self->pidl_code("}\n");
+ $self->pidl_fn_end("$dissectorname$add");
}
-
- $self->pidl_code("");
- $self->pidl_code("return offset;");
- $self->deindent;
- $self->pidl_code("}\n");
- $self->pidl_fn_end("$dissectorname$add");
$add.="_";
last if ($_->{TYPE} eq "ARRAY" and $_->{IS_ZERO_TERMINATED});
}
@@ -723,6 +734,9 @@ sub Struct($$$$)
if (has_property($_, "switch_is")) {
my $varswitch = $_->{PROPERTIES}->{switch_is};
$switch_info = $varswitchs->{$varswitch};
+ if (not @$switch_info) {
+ warning($_->{ORIGINAL}, "`$v' switch_is
discriminant `$varswitch' not found. (Only single identifiers are supported,
not expressions as in MIDL.)");
+ }
}
$res.="\t".$self->Element($_, $name, $ifname, $switch_info,
%switch_hash)."\n\n";
@@ -1357,9 +1371,20 @@ sub DumpFunctionTable($)
sub CheckUsed($$)
{
my ($self, $conformance) = @_;
+
+ # Check if some word appears inside a CODE block
+ # This has false positives if a word appears within a comment.
+ # We could use Regexp::Common to remove comments before searching.
+ local *CheckCode = sub {
+ my $name = shift;
+ return (exists ($conformance->{override}) and
($conformance->{override} =~ /\b$name\b/));
+ };
+
foreach (values %{$conformance->{header_fields}}) {
if (not defined($self->{hf_used}->{$_->{INDEX}})) {
- warning($_->{POS}, "hf field `$_->{INDEX}' not used");
+ if (not CheckCode($_->{INDEX})) {
+ warning($_->{POS}, "hf field `$_->{INDEX}' not
used");
+ }
}
}
--
Samba Shared Repository