svn commit: samba r18559 - in branches/SAMBA_4_0/source/pidl: lib/Parse/Pidl tests

jelmer at samba.org jelmer at samba.org
Fri Sep 15 17:34:46 GMT 2006


Author: jelmer
Date: 2006-09-15 17:34:46 +0000 (Fri, 15 Sep 2006)
New Revision: 18559

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=18559

Log:
[string] always applies to the last pointer

Modified:
   branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/NDR.pm
   branches/SAMBA_4_0/source/pidl/tests/ndr_string.pl


Changeset:
Modified: branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/NDR.pm
===================================================================
--- branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/NDR.pm	2006-09-15 16:27:55 UTC (rev 18558)
+++ branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/NDR.pm	2006-09-15 17:34:46 UTC (rev 18559)
@@ -204,7 +204,8 @@
 			}
 		} 
 		
-		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});

Modified: branches/SAMBA_4_0/source/pidl/tests/ndr_string.pl
===================================================================
--- branches/SAMBA_4_0/source/pidl/tests/ndr_string.pl	2006-09-15 16:27:55 UTC (rev 18558)
+++ branches/SAMBA_4_0/source/pidl/tests/ndr_string.pl	2006-09-15 17:34:46 UTC (rev 18559)
@@ -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 @@
 	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;
+');



More information about the samba-cvs mailing list