summaryrefslogtreecommitdiff
path: root/source4/pidl
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-09-15 17:34:46 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:18:46 -0500
commit291c5ed53c9957d1da981fa39477b046b94fe192 (patch)
treed37aaf68edb34ed6a7e59921341403bab318631e /source4/pidl
parentfa257e78b5e1de1ba12e12968b1b2a6edbead7c6 (diff)
downloadsamba-291c5ed53c9957d1da981fa39477b046b94fe192.tar.gz
samba-291c5ed53c9957d1da981fa39477b046b94fe192.tar.bz2
samba-291c5ed53c9957d1da981fa39477b046b94fe192.zip
r18559: [string] always applies to the last pointer
(This used to be commit 86b4624226d6e72645221cadb8669b0f1aba0903)
Diffstat (limited to 'source4/pidl')
-rw-r--r--source4/pidl/lib/Parse/Pidl/NDR.pm3
-rwxr-xr-xsource4/pidl/tests/ndr_string.pl31
2 files changed, 32 insertions, 2 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/NDR.pm b/source4/pidl/lib/Parse/Pidl/NDR.pm
index 114de797b8..f602bd2d68 100644
--- a/source4/pidl/lib/Parse/Pidl/NDR.pm
+++ b/source4/pidl/lib/Parse/Pidl/NDR.pm
@@ -204,7 +204,8 @@ sub GetElementLevelTable($)
}
}
- if (scalar(@size_is) == 0 and has_property($e, "string")) {
+ if (scalar(@size_is) == 0 and has_property($e, "string") and
+ $i == $e->{POINTERS}) {
$is_string = 1;
$is_varying = $is_conformant = has_property($e, "noheader")?0:1;
delete($e->{PROPERTIES}->{string});
diff --git a/source4/pidl/tests/ndr_string.pl b/source4/pidl/tests/ndr_string.pl
index e8e37be8c1..00ccbb31bb 100755
--- a/source4/pidl/tests/ndr_string.pl
+++ b/source4/pidl/tests/ndr_string.pl
@@ -4,7 +4,7 @@
# Published under the GNU General Public License
use strict;
-use Test::More tests => 2 * 8;
+use Test::More tests => 3 * 8;
use FindBin qw($RealBin);
use lib "$RealBin/../lib";
use lib "$RealBin";
@@ -53,3 +53,32 @@ test_samba4_ndr("string-ascii-pull",
if (r.in.data[4] != 0)
return 4;
');
+
+test_samba4_ndr("string-out",
+'
+ [public] void TestString([out,string] uint8 **data);
+',
+'
+ uint8_t data[] = { 0x03, 0x00, 0x00, 0x00,
+ \'f\', \'o\', \'o\', 0 };
+ DATA_BLOB b = { data, 8 };
+ struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL);
+ struct TestString r;
+ char *str = NULL;
+ r.out.data = &str;
+
+ if (NT_STATUS_IS_ERR(ndr_pull_TestString(ndr, NDR_IN, &r)))
+ return 1;
+
+ if (r.out.data == NULL)
+ return 2;
+
+ if (*r.out.data == NULL)
+ return 3;
+
+ if (strncmp(r.out.data, "foo", 3) != 0)
+ return 3;
+
+ if (r.in.data[4] != 0)
+ return 4;
+');