diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-10-16 23:47:09 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:44:50 -0500 |
commit | f598135c6b3dabd1435ea7eed5d8ab69dac97407 (patch) | |
tree | 26fe2a0c291715762b9eb55772866bd57b530c5e /source4/pidl/lib/Parse/Pidl/Samba | |
parent | dc36f294762c0821542ad4b777e4295230ba03b9 (diff) | |
download | samba-f598135c6b3dabd1435ea7eed5d8ab69dac97407.tar.gz samba-f598135c6b3dabd1435ea7eed5d8ab69dac97407.tar.bz2 samba-f598135c6b3dabd1435ea7eed5d8ab69dac97407.zip |
r11105: Warn if conformant arrays are not at the end of a struct
Support conformant [string] arrays
Eliminate utf8string
This breaks xattr binary compatibility with previous versions - is that a
problem?
(This used to be commit 7596c708ba6642473319a1b699a5a910a639e50d)
Diffstat (limited to 'source4/pidl/lib/Parse/Pidl/Samba')
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/Samba/NDR/Parser.pm | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba/NDR/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba/NDR/Parser.pm index 2ccbc057fc..d203c4fa43 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba/NDR/Parser.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba/NDR/Parser.pm @@ -292,7 +292,11 @@ sub ParseArrayPushHeader($$$$$) my $length; if ($l->{IS_ZERO_TERMINATED}) { - $size = $length = "ndr_string_length($var_name, sizeof(*$var_name))"; + if (has_property($e, "charset")) { + $size = $length = "ndr_charset_length($var_name, CH_$e->{PROPERTIES}->{charset})"; + } else { + $size = $length = "ndr_string_length($var_name, sizeof(*$var_name))"; + } } else { $size = ParseExpr($l->{SIZE_IS}, $env); $length = ParseExpr($l->{LENGTH_IS}, $env); @@ -1125,13 +1129,22 @@ sub ParseStructPush($$) # we need to push the conformant length early, as it fits on # the wire before the structure (and even before the structure # alignment) - my $e = $struct->{ELEMENTS}[-1]; if (defined($struct->{SURROUNDING_ELEMENT})) { my $e = $struct->{SURROUNDING_ELEMENT}; if (defined($e->{LEVELS}[0]) and $e->{LEVELS}[0]->{TYPE} eq "ARRAY") { - my $size = ParseExpr($e->{LEVELS}[0]->{SIZE_IS}, $env); + my $size; + + if ($e->{LEVELS}[0]->{IS_ZERO_TERMINATED}) { + if (has_property($e, "charset")) { + $size = "ndr_charset_length(r->$e->{NAME}, CH_$e->{PROPERTIES}->{charset})"; + } else { + $size = "ndr_string_length(r->$e->{NAME}, sizeof(*r->$e->{NAME}))"; + } + } else { + $size = ParseExpr($e->{LEVELS}[0]->{SIZE_IS}, $env); + } pidl "NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, $size));"; } else { |