[SCM] Samba Shared Repository - branch v4-0-test updated - release-4-0-0alpha3-48-gda8b836

Jelmer Vernooij jelmer at samba.org
Sat Apr 5 22:58:08 GMT 2008


The branch, v4-0-test has been updated
       via  da8b8364b06a79a10d4ebdc0e451463b3105730e (commit)
      from  761536a5e4dd3dbfacf1576d7092827cdeda897b (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v4-0-test


- Log -----------------------------------------------------------------
commit da8b8364b06a79a10d4ebdc0e451463b3105730e
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun Apr 6 00:57:14 2008 +0200

    Add test for authservice struct.

-----------------------------------------------------------------------

Summary of changes:
 source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm |   37 +++++++++++++---------
 source/pidl/tests/samba-ndr.pl                  |   16 +++++++++-
 2 files changed, 37 insertions(+), 16 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index 9fb5a6a..0d1806a 100644
--- a/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -2190,6 +2190,26 @@ sub ParseFunctionPull($$)
 	$self->pidl("");
 }
 
+sub AuthServiceStruct($$$)
+{
+	my ($self, $ifacename, $authservice) = @_;
+	my @a = split /,/, $authservice;
+	my $authservice_count = $#a + 1;
+
+	$self->pidl("static const char * const $ifacename\_authservice_strings[] = {");
+	foreach my $ap (@a) {
+		$self->pidl("\t$ap, ");
+	}
+	$self->pidl("};");
+	$self->pidl("");
+
+	$self->pidl("static const struct ndr_interface_string_array $ifacename\_authservices = {");
+	$self->pidl("\t.count\t= $authservice_count,");
+	$self->pidl("\t.names\t= $ifacename\_authservice_strings");
+	$self->pidl("};");
+	$self->pidl("");
+}
+
 #####################################################################
 # produce a function call table
 sub FunctionTable($$)
@@ -2237,21 +2257,8 @@ sub FunctionTable($$)
 		$interface->{PROPERTIES}->{authservice} = "\"host\"";
 	}
 
-	my @a = split /,/, $interface->{PROPERTIES}->{authservice};
-	my $authservice_count = $#a + 1;
-
-	$self->pidl("static const char * const $interface->{NAME}\_authservice_strings[] = {");
-	foreach my $ap (@a) {
-		$self->pidl("\t$ap, ");
-	}
-	$self->pidl("};");
-	$self->pidl("");
-
-	$self->pidl("static const struct ndr_interface_string_array $interface->{NAME}\_authservices = {");
-	$self->pidl("\t.count\t= $authservice_count,");
-	$self->pidl("\t.names\t= $interface->{NAME}\_authservice_strings");
-	$self->pidl("};");
-	$self->pidl("");
+	$self->AuthServiceStruct($interface->{NAME}, 
+		                     $interface->{PROPERTIES}->{authservice});
 
 	$self->pidl("\nconst struct ndr_interface_table ndr_table_$interface->{NAME} = {");
 	$self->pidl("\t.name\t\t= \"$interface->{NAME}\",");
diff --git a/source/pidl/tests/samba-ndr.pl b/source/pidl/tests/samba-ndr.pl
index a141119..114ca01 100755
--- a/source/pidl/tests/samba-ndr.pl
+++ b/source/pidl/tests/samba-ndr.pl
@@ -4,7 +4,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 30;
+use Test::More tests => 31;
 use FindBin qw($RealBin);
 use lib "$RealBin";
 use Util;
@@ -277,3 +277,17 @@ $generator->ParseElementPrint({ NAME => "x", TYPE => "uint32", REPRESENTATION_TY
 				    PROPERTIES => { value => "23" },
 				    LEVELS => [ { TYPE => "DATA", DATA_TYPE => "uint32"} ]}, "var", { "x" => "r->foobar" } );
 is($generator->{res}, "ndr_print_uint32(ndr, \"x\", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?23:var);\n");
+
+$generator = new Parse::Pidl::Samba4::NDR::Parser();
+$generator->AuthServiceStruct("bridge", "\"rot13\",\"onetimepad\"");
+is($generator->{res}, "static const char * const bridge_authservice_strings[] = {
+	\"rot13\", 
+	\"onetimepad\", 
+};
+
+static const struct ndr_interface_string_array bridge_authservices = {
+	.count	= 2,
+	.names	= bridge_authservice_strings
+};
+
+");


-- 
Samba Shared Repository


More information about the samba-cvs mailing list