summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2004-07-27 18:45:18 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:57:43 -0500
commitc5cc59b1b37b105bdf588689e57b1a45e86d69c8 (patch)
tree66cdf944da11f52785b48cda9fe92f9448c81456 /source4
parentccbad228651d9e5e72d23f25e6ada5a9b7c2f2df (diff)
downloadsamba-c5cc59b1b37b105bdf588689e57b1a45e86d69c8.tar.gz
samba-c5cc59b1b37b105bdf588689e57b1a45e86d69c8.tar.bz2
samba-c5cc59b1b37b105bdf588689e57b1a45e86d69c8.zip
r1594: Remove some array checks that we can't do because we don't store state
between scalar and buffer passes. Fix array handling - most of the samr queryuserinfo calls now parse properly! (This used to be commit 10e3ba03df500ecbb24a70fb9a59c80ac64608da)
Diffstat (limited to 'source4')
-rw-r--r--source4/build/pidl/eparser.pm44
1 files changed, 11 insertions, 33 deletions
diff --git a/source4/build/pidl/eparser.pm b/source4/build/pidl/eparser.pm
index d279a7c661..0c216c18b9 100644
--- a/source4/build/pidl/eparser.pm
+++ b/source4/build/pidl/eparser.pm
@@ -247,22 +247,12 @@ sub ParseArrayPull($$)
# }
# non fixed arrays encode the size just before the array
- pidl "\t{\n";
- pidl "\t\tguint32 _array_size;\n\n";
- pidl "\t\tndr_pull_uint32(ndr, tree, hf_array_size, &_array_size);\n";
- if ($size =~ /r->in/) {
- pidl "\t\tif (!(ndr->flags & LIBNDR_FLAG_REF_ALLOC) && _array_size != $size) {\n";
- } else {
- pidl "\t\tif ($size != _array_size) {\n";
- }
- pidl "\t\t\tproto_tree_add_text(tree, ndr->tvb, ndr->offset, 0, \"Bad array size (%u should be %u)\", _array_size, $size);\n";
- pidl "\t\t\tif (check_col(ndr->pinfo->cinfo, COL_INFO))\n";
- pidl "\t\t\t\tcol_append_fstr(ndr->pinfo->cinfo, COL_INFO, \", Bad array size (%u should be %u)\", _array_size, $size);\n";
- pidl "\t\t}\n";
- if ($size =~ /r->in/) {
- pidl "else { $size = _array_size; }\n";
- }
- pidl "\t}\n";
+
+ if (!($size =~ /\d+/)) {
+ pidl "\t\tndr_pull_uint32(ndr, tree, hf_array_size, &$size);\n";
+ } else {
+ pidl "\t\tndr_pull_uint32(ndr, tree, hf_array_size, NULL);\n";
+ }
}
# if ((util::need_alloc($e) && !util::is_fixed_array($e)) ||
@@ -280,33 +270,18 @@ sub ParseArrayPull($$)
# }
# }
- pidl "\t{\n";
-
if (my $length = util::has_property($e, "length_is")) {
$length = find_size_var($e, $length);
- pidl "\t\tguint32 _offset, _length;\n";
pidl "\t\tndr_pull_uint32(ndr, tree, hf_array_offset, &_offset);\n";
pidl "\t\tndr_pull_uint32(ndr, tree, hf_array_length, &_length);\n";
- pidl "\t\tif (_offset != 0) {\n";
- pidl "\t\t\tproto_tree_add_text(tree, ndr->tvb, ndr->offset, 0, \"Bad array offset %d\", _offset);\n";
- pidl "\t\t\tif (check_col(ndr->pinfo->cinfo, COL_INFO))\n";
- pidl "\t\t\t\tcol_append_fstr(ndr->pinfo->cinfo, COL_INFO, \"Bad array offset %d\", _offset);\n";
- pidl "\t\t}\n";
- pidl "\t\tif (_length > $size || _length != $length) {\n";
- pidl "\t\t\tproto_tree_add_text(tree, ndr->tvb, ndr->offset, 0, \"Bad array length %d > size %d\", _offset, $size);\n";
- pidl "\t\t\tif (check_col(ndr->pinfo->cinfo, COL_INFO))\n";
- pidl "\t\t\t\tcol_append_fstr(ndr->pinfo->cinfo, COL_INFO, \", Bad array length %d > size %d\", _offset, $size);\n";
- pidl "\t\t}\n";
$size = "_length";
}
if (util::is_scalar_type($e->{TYPE})) {
- pidl "\t\tndr_pull_array_$e->{TYPE}(ndr, tree, hf_$e->{NAME}_$e->{TYPE}, $ndr_flags, $size);\n";
+ pidl "\tndr_pull_array_$e->{TYPE}(ndr, tree, hf_$e->{NAME}_$e->{TYPE}, $ndr_flags, $size);\n";
} else {
- pidl "\t\tndr_pull_array(ndr, tree, $ndr_flags, $size, ndr_pull_$e->{TYPE});\n";
+ pidl "\tndr_pull_array(ndr, tree, $ndr_flags, $size, ndr_pull_$e->{TYPE});\n";
}
-
- pidl "\t}\n";
}
@@ -446,6 +421,8 @@ sub ParseStructPull($)
my($struct) = shift;
my $conform_e;
+ pidl "\tguint32 _offset, _length;\n";
+
for my $x (@{$struct->{ELEMENTS}}) {
if (util::is_builtin_type($x->{TYPE})) {
pidl "\tg$x->{TYPE} elt_$x->{NAME};\n";
@@ -717,6 +694,7 @@ sub ParseFunctionPull($)
pidl $static . "int $fn->{NAME}_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep)\n";
pidl "{\n";
pidl "\tstruct e_ndr_pull *ndr = ndr_pull_init(tvb, offset, pinfo, drep);\n";
+ pidl "\tguint32 _offset, _length;\n";
# declare any internal pointers we need
foreach my $e (@{$fn->{DATA}}) {