From 64e08fef16001d62b43f6925a26ad739391cface Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 29 Sep 2009 17:47:54 +1000 Subject: pidl: added union padding for NDR64 This fixes the problem with samr UserInfo16 when NDR64 is enabled --- pidl/lib/Parse/Pidl/NDR.pm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'pidl/lib/Parse/Pidl/NDR.pm') diff --git a/pidl/lib/Parse/Pidl/NDR.pm b/pidl/lib/Parse/Pidl/NDR.pm index 7aebed0fe2..4f2578e72e 100644 --- a/pidl/lib/Parse/Pidl/NDR.pm +++ b/pidl/lib/Parse/Pidl/NDR.pm @@ -509,7 +509,8 @@ sub ParseUnion($$) ELEMENTS => undef, PROPERTIES => $e->{PROPERTIES}, HAS_DEFAULT => $hasdefault, - ORIGINAL => $e + ORIGINAL => $e, + ALIGN => undef } unless defined($e->{ELEMENTS}); CheckPointerTypes($e, $pointer_default); @@ -533,6 +534,11 @@ sub ParseUnion($$) push @elements, $t; } + my $align = undef; + if ($e->{NAME}) { + $align = align_type($e->{NAME}); + } + return { TYPE => "UNION", NAME => $e->{NAME}, @@ -540,7 +546,8 @@ sub ParseUnion($$) ELEMENTS => \@elements, PROPERTIES => $e->{PROPERTIES}, HAS_DEFAULT => $hasdefault, - ORIGINAL => $e + ORIGINAL => $e, + ALIGN => $align }; } -- cgit From f21fb4b3958fe630400b145b729c966fa9c053a9 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 3 Oct 2009 18:13:25 +1000 Subject: pidl: added int3264 as a base type This is the type used for a variable that is 32 bits for NDR32 and 64 bits for NDR64 --- pidl/lib/Parse/Pidl/NDR.pm | 2 ++ 1 file changed, 2 insertions(+) (limited to 'pidl/lib/Parse/Pidl/NDR.pm') diff --git a/pidl/lib/Parse/Pidl/NDR.pm b/pidl/lib/Parse/Pidl/NDR.pm index 4f2578e72e..7c0f7bb7b4 100644 --- a/pidl/lib/Parse/Pidl/NDR.pm +++ b/pidl/lib/Parse/Pidl/NDR.pm @@ -52,6 +52,8 @@ my $scalar_alignment = { 'uint16' => 2, 'int32' => 4, 'uint32' => 4, + 'int3264' => 5, + 'uint3264' => 5, 'hyper' => 8, 'double' => 8, 'pointer' => 8, -- cgit From d26016c19854142c1e5fbb5a3bfc40e7e4b1c616 Mon Sep 17 00:00:00 2001 From: ronnie sahlberg Date: Tue, 6 Oct 2009 17:49:59 +1100 Subject: PIDL fix for using external types with wireshark backend List, Please review this patch to pidl. Basically, we need to process the wireshark conformance file BEFORE we process the idl file since this file may define external types and set the alignment for them (using the TYPE directive). Otherwise pidl will default all external types to use 4byte alignment which breaks (much more often) on NDR64 regards ronnie sahlberg From 8f86903fc353d0906bd82e72ce19c5af09beb001 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Mon, 5 Oct 2009 15:22:43 +1100 Subject: [PATCH] In the PIDL wireshark backend, we define external types in the conformance file using the TYPE directive. If we declare external types here, we must parse this file before we process the IDL file, or else these external types will all default to 4byte padding (pidl assumes all unknown types are 4byte aligned). Make sure we read the conformance file and create these new types before we parse the idl file. Signed-off-by: Ronnie Sahlberg --- pidl/lib/Parse/Pidl/NDR.pm | 2 ++ 1 file changed, 2 insertions(+) (limited to 'pidl/lib/Parse/Pidl/NDR.pm') diff --git a/pidl/lib/Parse/Pidl/NDR.pm b/pidl/lib/Parse/Pidl/NDR.pm index 7c0f7bb7b4..48a4ccbc95 100644 --- a/pidl/lib/Parse/Pidl/NDR.pm +++ b/pidl/lib/Parse/Pidl/NDR.pm @@ -406,6 +406,8 @@ sub align_type($) if ($dt->{TYPE} eq "TYPEDEF") { return align_type($dt->{DATA}); + } elsif ($dt->{TYPE} eq "CONFORMANCE") { + return $dt->{DATA}->{ALIGN}; } elsif ($dt->{TYPE} eq "ENUM") { return align_type(Parse::Pidl::Typelist::enum_type_fn($dt)); } elsif ($dt->{TYPE} eq "BITMAP") { -- cgit From 2bf8a7485cf0733c808bc97a399a1c73bb988414 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 6 Oct 2009 20:47:09 +1100 Subject: pidl: get the alignment right for uint1632 enums (NDR64) The default enum in NDR63 is 32 bits, not 16 bits. We need a uint1632 type to get the alignment right. --- pidl/lib/Parse/Pidl/NDR.pm | 2 ++ 1 file changed, 2 insertions(+) (limited to 'pidl/lib/Parse/Pidl/NDR.pm') diff --git a/pidl/lib/Parse/Pidl/NDR.pm b/pidl/lib/Parse/Pidl/NDR.pm index 48a4ccbc95..249b778389 100644 --- a/pidl/lib/Parse/Pidl/NDR.pm +++ b/pidl/lib/Parse/Pidl/NDR.pm @@ -50,6 +50,8 @@ my $scalar_alignment = { 'uint8' => 1, 'int16' => 2, 'uint16' => 2, + 'int1632' => 3, + 'uint1632' => 3, 'int32' => 4, 'uint32' => 4, 'int3264' => 5, -- cgit From dfbaf79a1b7455a0eef61813e07cb661cf17e995 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 13 Oct 2009 10:03:27 +1100 Subject: pidl: don't warn for compatible scalar types in unions When we have an enum that is used as a union discriminator, what matters is that the scalar mappings are the same, not if the types are the same (otherwise we get warnings about uint1632). Thanks to gd for noticing this. --- pidl/lib/Parse/Pidl/NDR.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'pidl/lib/Parse/Pidl/NDR.pm') diff --git a/pidl/lib/Parse/Pidl/NDR.pm b/pidl/lib/Parse/Pidl/NDR.pm index 249b778389..4e680b336f 100644 --- a/pidl/lib/Parse/Pidl/NDR.pm +++ b/pidl/lib/Parse/Pidl/NDR.pm @@ -39,7 +39,7 @@ $VERSION = '0.01'; use strict; use Parse::Pidl qw(warning fatal); -use Parse::Pidl::Typelist qw(hasType getType expandAlias); +use Parse::Pidl::Typelist qw(hasType getType expandAlias mapScalarType); use Parse::Pidl::Util qw(has_property property_matches); # Alignment of the built-in scalar types @@ -1010,13 +1010,13 @@ sub ValidElement($) my $discriminator_type = has_property($type->{DATA}, "switch_type"); $discriminator_type = "uint32" unless defined ($discriminator_type); - my $t1 = mapToScalar($discriminator_type); + my $t1 = mapScalarType(mapToScalar($discriminator_type)); if (not defined($t1)) { fatal($e, el_name($e) . ": unable to map discriminator type '$discriminator_type' to scalar"); } - my $t2 = mapToScalar($e2->{TYPE}); + my $t2 = mapScalarType(mapToScalar($e2->{TYPE})); if (not defined($t2)) { fatal($e, el_name($e) . ": unable to map variable used for switch_is() to scalar"); } -- cgit