summaryrefslogtreecommitdiff
path: root/source4/build/pidl
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-03-28 18:28:16 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:11:19 -0500
commite760bd37b2f3fd135de429e640942ae7aecc7c91 (patch)
tree8ba23fbaff4cfaa5690953c8745820d9bbcc11c3 /source4/build/pidl
parent4931dfc8c673360c216b0db9c44e45e51bd2a5ca (diff)
downloadsamba-e760bd37b2f3fd135de429e640942ae7aecc7c91.tar.gz
samba-e760bd37b2f3fd135de429e640942ae7aecc7c91.tar.bz2
samba-e760bd37b2f3fd135de429e640942ae7aecc7c91.zip
r6101: only allow properties we know about, that helps to catch typos!
what does length_of() and id() do? metze (This used to be commit 55963934db51fadb1340c7a2ec275aa24151dd14)
Diffstat (limited to 'source4/build/pidl')
-rw-r--r--source4/build/pidl/validator.pm99
1 files changed, 98 insertions, 1 deletions
diff --git a/source4/build/pidl/validator.pm b/source4/build/pidl/validator.pm
index d3f3cbe1e7..7bd82f1506 100644
--- a/source4/build/pidl/validator.pm
+++ b/source4/build/pidl/validator.pm
@@ -35,12 +35,99 @@ sub el_name($)
return $e->{NAME};
}
+my %property_list = (
+ # interface
+ "helpstring" => {},
+ "version" => {},
+ "uuid" => {},
+ "endpoint" => {},
+ "pointer_default" => {},
+ "depends" => {},
+ "authservice" => {},
+
+ # dcom
+ "object" => {},
+ "local" => {},
+ "iid_is" => {},
+ "call_as" => {},
+ "iid_is" => {},
+ "idempotent" => {},
+
+ # function
+ "id" => {},# what is that? --metze
+ "in" => {},
+ "out" => {},
+
+ # pointer
+ "ref" => {},
+ "ptr" => {},
+ "unique" => {},
+ "relative" => {},
+
+ # ndr_size
+ "gensize" => {},
+ "value" => {},
+ "flag" => {},
+
+ # generic
+ "public" => {},
+ "nopush" => {},
+ "nopull" => {},
+ "noprint" => {},
+
+ # union
+ "switch_is" => {},
+ "switch_type" => {},
+ "nodiscriminant" => {},
+ "case" => {},
+ "default" => {},
+
+ # subcontext
+ "subcontext" => {},
+ "subcontext_size" => {},
+ "compression" => {},
+
+ # enum
+ "enum8bit" => {},
+ "enum16bit" => {},
+ "v1_enum" => {},
+
+ # bitmap
+ "bitmap8bit" => {},
+ "bitmap16bit" => {},
+ "bitmap32bit" => {},
+ "bitmap64bit" => {},
+
+ # array
+ "range" => {},
+ "size_is" => {},
+ "length_is" => {},
+ "length_of" => {}, # what is that? --metze
+);
+
+#####################################################################
+# check for unknown properties
+sub ValidProperties($)
+{
+ my $e = shift;
+
+ return unless defined $e->{PROPERTIES};
+
+ foreach my $key (keys %{$e->{PROPERTIES}}) {
+ if (not defined $property_list{$key}) {
+ fatal(el_name($e) . ": unknown property '$key'\n");
+ }
+ }
+}
+
#####################################################################
# parse a struct
sub ValidElement($)
{
my $e = shift;
-
+
+ ValidProperties($e);
+
if (util::has_property($e, "ptr")) {
fatal(el_name($e) . " : pidl does not support full NDR pointers yet\n");
}
@@ -95,6 +182,8 @@ sub ValidStruct($)
{
my($struct) = shift;
+ ValidProperties($struct);
+
foreach my $e (@{$struct->{ELEMENTS}}) {
$e->{PARENT} = $struct;
ValidElement($e);
@@ -107,6 +196,8 @@ sub ValidUnion($)
{
my($union) = shift;
+ ValidProperties($union);
+
if (util::has_property($union->{PARENT}, "nodiscriminant") and util::has_property($union->{PARENT}, "switch_type")) {
fatal($union->{PARENT}->{NAME} . ": switch_type() on union without discriminant");
}
@@ -140,6 +231,8 @@ sub ValidTypedef($)
my($typedef) = shift;
my $data = $typedef->{DATA};
+ ValidProperties($typedef);
+
$data->{PARENT} = $typedef;
if (ref($data) eq "HASH") {
@@ -159,6 +252,8 @@ sub ValidFunction($)
{
my($fn) = shift;
+ ValidProperties($fn);
+
foreach my $e (@{$fn->{ELEMENTS}}) {
$e->{PARENT} = $fn;
if (util::has_property($e, "ref") && !$e->{POINTERS}) {
@@ -175,6 +270,8 @@ sub ValidInterface($)
my($interface) = shift;
my($data) = $interface->{DATA};
+ ValidProperties($interface);
+
if (util::has_property($interface, "pointer_default") &&
$interface->{PROPERTIES}->{pointer_default} eq "ptr") {
fatal "Full pointers are not supported yet\n";