summaryrefslogtreecommitdiff
path: root/pidl
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2019-12-05 11:37:05 +1300
committerStefan Metzmacher <metze@samba.org>2019-12-10 17:45:46 +0000
commitbc0c876a9ebbec1a31856a9e7147a481c69ba434 (patch)
tree539179b5187cfc8b16890b8f91a4de19257a7c42 /pidl
parent238d08b07d0178940c28839518c9f1afbc605378 (diff)
downloadsamba-bc0c876a9ebbec1a31856a9e7147a481c69ba434.tar.gz
pidl:NDR/Parser: only include structs in ndr_interface_public_struct
We only have ndrdump and the fuzzers set up for structures, not BITMAPS, ENUMS etc. Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Andrew Bartlett <abartlet@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Tue Dec 10 17:45:46 UTC 2019 on sn-devel-184
Diffstat (limited to 'pidl')
-rw-r--r--pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm20
1 files changed, 16 insertions, 4 deletions
diff --git a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index 91b5f942994..c2821874db8 100644
--- a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -88,6 +88,18 @@ sub has_fast_array($$)
return ($t->{NAME} eq "uint8");
}
+sub is_public_struct
+{
+ my ($d) = @_;
+ if (!has_property($d, "public")) {
+ return 0;
+ }
+ my $t = $d;
+ if ($d->{TYPE} eq "TYPEDEF") {
+ $t = $d->{DATA};
+ }
+ return $t->{TYPE} eq "STRUCT";
+}
####################################
# defer() is like pidl(), but adds to
@@ -2794,7 +2806,7 @@ sub FunctionTable($$)
my $uname = uc $interface->{NAME};
foreach my $d (@{$interface->{TYPES}}) {
- next unless (has_property($d, "public"));
+ next unless (is_public_struct($d));
$count_public_structs += 1;
}
return if ($#{$interface->{FUNCTIONS}}+1 == 0 and
@@ -2807,8 +2819,8 @@ sub FunctionTable($$)
$self->pidl("static const struct ndr_interface_public_struct $interface->{NAME}\_public_structs[] = {");
foreach my $d (@{$interface->{TYPES}}) {
- next unless (has_property($d, "public"));
- $self->StructEntry($d)
+ next unless (is_public_struct($d));
+ $self->StructEntry($d);
}
$self->pidl("\t{ .name = NULL }");
$self->pidl("};");
@@ -3034,7 +3046,7 @@ sub ParseTypePrintFunction($$$)
$self->pidl_hdr("void ".TypeFunctionName("ndr_print", $e)."(struct ndr_print *ndr, const char *name, $args);");
- if (has_property($e, "public")) {
+ if (is_public_struct($e)) {
$self->pidl("static void ".TypeFunctionName("ndr_print_flags", $e).
"(struct ndr_print *$ndr, const char *name, int unused, $args)"
);