summaryrefslogtreecommitdiff
path: root/source4/pidl/lib/Parse/Pidl/NDR.pm
diff options
context:
space:
mode:
Diffstat (limited to 'source4/pidl/lib/Parse/Pidl/NDR.pm')
-rw-r--r--source4/pidl/lib/Parse/Pidl/NDR.pm26
1 files changed, 24 insertions, 2 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/NDR.pm b/source4/pidl/lib/Parse/Pidl/NDR.pm
index 5839b042d3..21875a1297 100644
--- a/source4/pidl/lib/Parse/Pidl/NDR.pm
+++ b/source4/pidl/lib/Parse/Pidl/NDR.pm
@@ -571,8 +571,7 @@ sub ParseFunction($$$)
sub CheckPointerTypes($$)
{
- my $s = shift;
- my $default = shift;
+ my ($s,$default) = @_;
foreach my $e (@{$s->{ELEMENTS}}) {
if ($e->{POINTERS} and not defined(pointer_type($e))) {
@@ -581,6 +580,23 @@ sub CheckPointerTypes($$)
}
}
+#FIXME: Remove when ref handling in Samba4 is fixed
+sub AddKeepRef($)
+{
+ my $d = shift;
+
+ if ($d->{TYPE} eq "FUNCTION") {
+ foreach (@{$d->{ELEMENTS}}) {
+ $_->{PROPERTIES}->{keepref} = 1;
+ }
+ } elsif ($d->{TYPE} eq "TYPEDEF" and ($d->{DATA}->{TYPE} eq "STRUCT"
+ or $d->{DATA}->{TYPE} eq "UNION")) {
+ foreach (@{$d->{DATA}->{ELEMENTS}}) {
+ $_->{PROPERTIES}->{keepref} = 1;
+ }
+ }
+}
+
sub ParseInterface($)
{
my $idl = shift;
@@ -606,10 +622,12 @@ sub ParseInterface($)
if ($d->{TYPE} eq "DECLARE") {
push (@declares, $d);
} elsif ($d->{TYPE} eq "FUNCTION") {
+ AddKeepRef($d) if (has_property($idl, "keepref"));
push (@functions, ParseFunction($idl, $d, \$opnum));
} elsif ($d->{TYPE} eq "CONST") {
push (@consts, ParseConst($idl, $d));
} else {
+ AddKeepRef($d) if (has_property($idl, "keepref"));
push (@types, ParseType($idl, $d));
}
}
@@ -831,6 +849,10 @@ my %property_list = (
"noheader" => ["ELEMENT"],
"charset" => ["ELEMENT"],
"length_is" => ["ELEMENT"],
+
+ # temporary (should be removed once we've migrated away from
+ # relying on ref pointers being there in Samba4's code)
+ "keepref" => ["ELEMENT","INTERFACE"],
);
#####################################################################