summaryrefslogtreecommitdiff
path: root/source4/pidl/lib/Parse
diff options
context:
space:
mode:
Diffstat (limited to 'source4/pidl/lib/Parse')
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba3/Parser.pm10
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba3/Types.pm9
2 files changed, 12 insertions, 7 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba3/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba3/Parser.pm
index d582305326..9ef8f09dc4 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba3/Parser.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba3/Parser.pm
@@ -27,7 +27,7 @@ sub fatal($$) { my ($e,$s) = @_; die("$e->{FILE}:$e->{LINE}: $s\n"); }
#TODO:
# - Add some security checks (array sizes, memory alloc == NULL, etc)
# - Don't add seperate _p and _d functions if there is no deferred data
-# - [string] with non-varying arrays
+# - [string] with non-varying arrays and "surrounding" strings
# - subcontext()
# - DATA_BLOB
@@ -90,11 +90,13 @@ sub ParseElementLevelArray($$$$$$$)
my ($e,$l,$nl,$env,$varname,$what,$align) = @_;
if ($l->{IS_ZERO_TERMINATED}) {
+ return if ($what == DEFERRED);
+
my ($t,$f) = StringType($e,$l);
- pidl "if (!prs_io_$t(\"$e->{VARNAME}\", ps, depth, $varname))";
+ Align($align, 4);
+ pidl "if (!smb_io_$t(\"$e->{NAME}\", &$varname, 1, ps, depth))";
pidl "\treturn False;";
- pidl "";
$$align = 0;
return;
@@ -246,7 +248,7 @@ sub InitLevel($$$$)
}
} elsif ($l->{TYPE} eq "ARRAY" and $l->{IS_ZERO_TERMINATED}) {
my ($t,$f) = StringType($e,$l);
- pidl "init_$t(" . ParseExpr($e->{NAME}, $env) . ", $varname, $f);";
+ pidl "init_$t(&" . ParseExpr($e->{NAME}, $env) . ", ".substr($varname, 1) . ", $f);";
} elsif ($l->{TYPE} eq "ARRAY") {
pidl ParseExpr($e->{NAME}, $env) . " = $varname;";
} elsif ($l->{TYPE} eq "DATA") {
diff --git a/source4/pidl/lib/Parse/Pidl/Samba3/Types.pm b/source4/pidl/lib/Parse/Pidl/Samba3/Types.pm
index db20372bba..3f7e8ae134 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba3/Types.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba3/Types.pm
@@ -11,7 +11,7 @@ require Exporter;
use strict;
use Parse::Pidl::Util qw(has_property ParseExpr property_matches);
-use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel ContainsDeferred);
+use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel ContainsDeferred ContainsString);
use vars qw($VERSION);
$VERSION = '0.01';
@@ -110,7 +110,7 @@ sub StringType($$)
my $nl = GetNextLevel($e,$l);
if ($l->{IS_VARYING} and $l->{IS_CONFORMANT} and $nl->{DATA_TYPE} eq "uint16") {
- return ("unistr2", 0);
+ return ("unistr2", "UNI_FLAGS_NONE");
} elsif ($l->{IS_CONFORMANT} and $l->{IS_VARYING} and $nl->{DATA_TYPE} eq "uint8") {
return ("string2", 0);
} else {
@@ -282,7 +282,10 @@ sub DeclLong($)
my $suffixes = "";
foreach my $l (@{$e->{LEVELS}}) {
- if ($l->{TYPE} eq "ARRAY" and not $l->{IS_FIXED}) {
+ if ($l->{TYPE} eq "ARRAY" and $l->{IS_ZERO_TERMINATED}) {
+ $p = "const char";
+ last;
+ } elsif ($l->{TYPE} eq "ARRAY" and not $l->{IS_FIXED}) {
$prefixes = "*$prefixes";
} elsif ($l->{TYPE} eq "ARRAY" and $l->{IS_FIXED}) {
$suffixes.="[$l->{SIZE_IS}]";