summaryrefslogtreecommitdiff
path: root/source4/build
diff options
context:
space:
mode:
Diffstat (limited to 'source4/build')
-rw-r--r--source4/build/pidl/parser.pm12
-rwxr-xr-xsource4/build/pidl/pidl.pl1
2 files changed, 9 insertions, 4 deletions
diff --git a/source4/build/pidl/parser.pm b/source4/build/pidl/parser.pm
index 82204e28d6..7d98853122 100644
--- a/source4/build/pidl/parser.pm
+++ b/source4/build/pidl/parser.pm
@@ -221,7 +221,7 @@ sub ParseElementPullSwitch($$$$)
$res .= "\t{ uint16 _level;\n";
$res .= "\tNDR_CHECK(ndr_pull_$e->{TYPE}(ndr, $ndr_flags, &_level, $cprefix$var_prefix$e->{NAME}));\n";
- $res .= "\tif (_level != $switch_var) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, \"Bad switch value %u in $e->{NAME}\");\n";
+ $res .= "\tif ((($ndr_flags) & NDR_SCALARS) && (_level != $switch_var)) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, \"Bad switch value %u in $e->{NAME}\");\n";
$res .= "\t}\n";
}
@@ -309,6 +309,8 @@ sub ParseElementPushBuffer($$$)
}
} elsif (util::is_builtin_type($e->{TYPE})) {
$res .= "\t\tNDR_CHECK(ndr_push_$e->{TYPE}(ndr, $cprefix$var_prefix$e->{NAME}));\n";
+ } elsif ($e->{POINTERS}) {
+ $res .= "\t\tNDR_CHECK(ndr_push_$e->{TYPE}(ndr, NDR_SCALARS|NDR_BUFFERS, $cprefix$var_prefix$e->{NAME}));\n";
} else {
$res .= "\t\tNDR_CHECK(ndr_push_$e->{TYPE}(ndr, $ndr_flags, $cprefix$var_prefix$e->{NAME}));\n";
}
@@ -441,7 +443,7 @@ sub ParseStructPush($)
$res .= "buffers:\n";
$res .= "\tif (!(ndr_flags & NDR_BUFFERS)) goto done;\n";
foreach my $e (@{$struct->{ELEMENTS}}) {
- ParseElementPushBuffer($e, "r->", "ndr_flags");
+ ParseElementPushBuffer($e, "r->", "NDR_BUFFERS");
}
if (defined $struct_len) {
@@ -541,7 +543,7 @@ sub ParseStructPull($)
$res .= "buffers:\n";
$res .= "\tif (!(ndr_flags & NDR_BUFFERS)) goto done;\n";
foreach my $e (@{$struct->{ELEMENTS}}) {
- ParseElementPullBuffer($e, "r->", "ndr_flags");
+ ParseElementPullBuffer($e, "r->", "NDR_BUFFERS");
}
if (defined $struct_len) {
@@ -817,7 +819,9 @@ sub ParseFunctionPull($)
$res .= "\t}\n";
} else {
ParseElementPullScalar($e, "r->out.", "NDR_SCALARS|NDR_BUFFERS");
- ParseElementPullBuffer($e, "r->out.", "NDR_SCALARS|NDR_BUFFERS");
+ if ($e->{POINTERS}) {
+ ParseElementPullBuffer($e, "r->out.", "NDR_SCALARS|NDR_BUFFERS");
+ }
}
}
}
diff --git a/source4/build/pidl/pidl.pl b/source4/build/pidl/pidl.pl
index cd2ad9d7fc..2b856b2e47 100755
--- a/source4/build/pidl/pidl.pl
+++ b/source4/build/pidl/pidl.pl
@@ -111,6 +111,7 @@ my($pidl_file) = util::ChangeExtension($opt_output, "pidl");
if ($opt_parse) {
print "Generating $pidl_file from $idl_file\n";
my($idl) = IdlParse($idl_file);
+ defined $idl || die "Failed to parse $idl_file";
util::SaveStructure($pidl_file, $idl) || die "Failed to save $pidl_file";
}