diff options
author | Andrew Tridgell <tridge@samba.org> | 2003-11-14 13:15:20 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2003-11-14 13:15:20 +0000 |
commit | 492282316795af676b249fcdee51759866cc8129 (patch) | |
tree | f3b94d900da200a90d2536621a3ea4dce34c1429 /source4/build/pidl | |
parent | 15b258051cf3bbf8592eac0fd5e3d747d7172101 (diff) | |
download | samba-492282316795af676b249fcdee51759866cc8129.tar.gz samba-492282316795af676b249fcdee51759866cc8129.tar.bz2 samba-492282316795af676b249fcdee51759866cc8129.zip |
* make pidl.pl exit with an error on a parse error
* fixed a buffers/scalars bug in structures
(This used to be commit e66daf527357c65228db55a3d3319a0c20d8f51c)
Diffstat (limited to 'source4/build/pidl')
-rw-r--r-- | source4/build/pidl/parser.pm | 12 | ||||
-rwxr-xr-x | source4/build/pidl/pidl.pl | 1 |
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"; } |