aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJörg Mayer <jmayer@loplof.de>2006-04-25 13:40:04 +0000
committerJörg Mayer <jmayer@loplof.de>2006-04-25 13:40:04 +0000
commit6b70d6d9f8872f9ba3ac0faeef89c177580ee96b (patch)
tree3b1477b29c05953e9a9e19116bb4745e2e5ea5ee /tools
parente198ded29798600fd8f1a2a4c38e3449b2ee67e2 (diff)
Update from samba tree revision 14805 to 15243
============================ Samba log start ============ svn: When specifying working copy paths, only one target may be given ============================ Samba log end ============== svn path=/trunk/; revision=17994
Diffstat (limited to 'tools')
-rw-r--r--tools/pidl/lib/Parse/Pidl/Samba4.pm32
-rw-r--r--tools/pidl/lib/Parse/Pidl/Samba4/EJS.pm12
-rw-r--r--tools/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm1
-rw-r--r--tools/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm1
-rw-r--r--tools/pidl/lib/Parse/Pidl/Samba4/TDR.pm1
-rw-r--r--tools/pidl/tests/Util.pm1
-rw-r--r--tools/pidl/tests/ndr_represent.pl43
-rwxr-xr-xtools/pidl/tests/ndr_tagtype.pl38
8 files changed, 127 insertions, 2 deletions
diff --git a/tools/pidl/lib/Parse/Pidl/Samba4.pm b/tools/pidl/lib/Parse/Pidl/Samba4.pm
new file mode 100644
index 0000000000..0a284aa85b
--- /dev/null
+++ b/tools/pidl/lib/Parse/Pidl/Samba4.pm
@@ -0,0 +1,32 @@
+###################################################
+# Common Samba4 functions
+# Copyright jelmer@samba.org 2006
+# released under the GNU GPL
+
+package Parse::Pidl::Samba4;
+
+require Exporter;
+@ISA = qw(Exporter);
+@EXPORT = qw(is_intree choose_header);
+
+use Parse::Pidl::Util qw(has_property);
+use strict;
+
+use vars qw($VERSION);
+$VERSION = '0.01';
+
+sub is_intree()
+{
+ return -f "include/smb.h";
+}
+
+# Return an #include line depending on whether this build is an in-tree
+# build or not.
+sub choose_header($$)
+{
+ my ($in,$out) = @_;
+ return "#include \"$in\"" if (is_intree());
+ return "#include <$out>";
+}
+
+1;
diff --git a/tools/pidl/lib/Parse/Pidl/Samba4/EJS.pm b/tools/pidl/lib/Parse/Pidl/Samba4/EJS.pm
index 41ea1e8eaa..550499a5f3 100644
--- a/tools/pidl/lib/Parse/Pidl/Samba4/EJS.pm
+++ b/tools/pidl/lib/Parse/Pidl/Samba4/EJS.pm
@@ -154,7 +154,11 @@ sub EjsPullPointer($$$$$)
my ($e, $l, $var, $name, $env) = @_;
pidl "if (ejs_pull_null(ejs, v, $name)) {";
indent;
- pidl "$var = NULL;";
+ if ($l->{POINTER_TYPE} eq "ref") {
+ pidl "return NT_STATUS_INVALID_PARAMETER_MIX;";
+ } else {
+ pidl "$var = NULL;";
+ }
deindent;
pidl "} else {";
indent;
@@ -450,7 +454,11 @@ sub EjsPushPointer($$$$$)
my ($e, $l, $var, $name, $env) = @_;
pidl "if (NULL == $var) {";
indent;
- pidl "NDR_CHECK(ejs_push_null(ejs, v, $name));";
+ if ($l->{POINTER_TYPE} eq "ref") {
+ pidl "return NT_STATUS_INVALID_PARAMETER_MIX;";
+ } else {
+ pidl "NDR_CHECK(ejs_push_null(ejs, v, $name));";
+ }
deindent;
pidl "} else {";
indent;
diff --git a/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm b/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm
index ace1e79672..3b12c8f173 100644
--- a/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm
+++ b/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm
@@ -105,6 +105,7 @@ sub Parse($$$$)
} else {
$res .= "#define _GNU_SOURCE\n";
$res .= "#include <stdio.h>\n";
+ $res .= "#include <stdbool.h>\n";
$res .= "#include <stdlib.h>\n";
$res .= "#include <stdint.h>\n";
$res .= "#include <stdarg.h>\n";
diff --git a/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index 07128568bd..38e3268356 100644
--- a/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -2356,6 +2356,7 @@ sub Parse($$$)
pidl "#include <stdint.h>";
pidl "#include <stdlib.h>";
pidl "#include <stdio.h>";
+ pidl "#include <stdbool.h>";
pidl "#include <stdarg.h>";
pidl "#include <string.h>";
}
diff --git a/tools/pidl/lib/Parse/Pidl/Samba4/TDR.pm b/tools/pidl/lib/Parse/Pidl/Samba4/TDR.pm
index 7e597dfb34..592961dee2 100644
--- a/tools/pidl/lib/Parse/Pidl/Samba4/TDR.pm
+++ b/tools/pidl/lib/Parse/Pidl/Samba4/TDR.pm
@@ -242,6 +242,7 @@ sub Parser($$$)
pidl "#include \"includes.h\"";
} else {
pidl "#include <stdio.h>";
+ pidl "#include <stdbool.h>";
pidl "#include <stdlib.h>";
pidl "#include <stdint.h>";
pidl "#include <stdarg.h>";
diff --git a/tools/pidl/tests/Util.pm b/tools/pidl/tests/Util.pm
index fde92c2a77..ccac1a6d7e 100644
--- a/tools/pidl/tests/Util.pm
+++ b/tools/pidl/tests/Util.pm
@@ -54,6 +54,7 @@ SKIP: {
print CC "#include <stdint.h>\n";
print CC "#include <stdlib.h>\n";
print CC "#include <stdio.h>\n";
+ print CC "#include <stdbool.h>\n";
print CC "#include <stdarg.h>\n";
print CC $header;
print CC $ndrheader;
diff --git a/tools/pidl/tests/ndr_represent.pl b/tools/pidl/tests/ndr_represent.pl
new file mode 100644
index 0000000000..3c6b8cf6ab
--- /dev/null
+++ b/tools/pidl/tests/ndr_represent.pl
@@ -0,0 +1,43 @@
+#!/usr/bin/perl
+# NDR represent_as() / transmit_as() tests
+# (C) 2006 Jelmer Vernooij. Published under the GNU GPL
+use strict;
+
+use Test::More tests => 1 * 8;
+use FindBin qw($RealBin);
+use lib "$RealBin/../lib";
+use lib "$RealBin";
+use Util qw(test_samba4_ndr);
+
+test_samba4_ndr('represent_as-simple',
+'
+ void bla([in,represent_as(uint32)] uint8 x);
+',
+'
+ uint8_t expected[] = { 0x0D };
+ DATA_BLOB in_blob = { expected, 1 };
+ struct ndr_pull *ndr = ndr_pull_init_blob(&in_blob, NULL);
+ struct bla r;
+
+ if (NT_STATUS_IS_ERR(ndr_pull_bla(ndr, NDR_SCALARS|NDR_BUFFERS, &r)))
+ return 1;
+
+ if (r.in.x != 13)
+ return 2;
+',
+'
+#include <core/nterr.h>
+
+NTSTATUS ndr_uint8_to_uint32(uint8_t from, uint32_t *to)
+{
+ *to = from;
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_uint32_to_uint8(uint32_t from, uint8_t *to)
+{
+ *to = from;
+ return NT_STATUS_OK;
+}
+'
+);
diff --git a/tools/pidl/tests/ndr_tagtype.pl b/tools/pidl/tests/ndr_tagtype.pl
new file mode 100755
index 0000000000..dcdbc22494
--- /dev/null
+++ b/tools/pidl/tests/ndr_tagtype.pl
@@ -0,0 +1,38 @@
+#!/usr/bin/perl
+# Support for tagged types
+# (C) 2005 Jelmer Vernooij. Published under the GNU GPL
+use strict;
+
+use Test::More tests => 1 * 8;
+use FindBin qw($RealBin);
+use lib "$RealBin/../lib";
+use lib "$RealBin";
+use Util qw(test_samba4_ndr);
+
+SKIP: {
+ skip "Tagged types without typedef are not supported yet", 8;
+
+test_samba4_ndr('struct-notypedef',
+'
+ struct bla {
+ uint8 x;
+ };
+',
+'
+ struct ndr_push *ndr = ndr_push_init();
+ struct bla r;
+ uint8_t expected[] = { 0x0D };
+ DATA_BLOB expected_blob = { expected, 1 };
+ DATA_BLOB result_blob;
+ r.x = 13;
+
+ if (NT_STATUS_IS_ERR(ndr_push_bla(ndr, NDR_SCALARS|NDR_BUFFERS, &r)))
+ return 1;
+
+ result_blob = ndr_push_blob(ndr);
+
+ if (!data_blob_equal(&result_blob, &expected_blob))
+ return 2;
+');
+
+}