From 8dd6f735bc6ff65a364ac65572529e8abf6f130a Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 8 Apr 2008 13:31:07 +0200 Subject: Set VENDORPREFIX rather than PREFIX to try to fix installation on some buildfarm hosts. (This used to be commit 2d9bb0db6c9e1e9b68844f2eede00fd249466cbb) --- source4/pidl/config.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/pidl') diff --git a/source4/pidl/config.mk b/source4/pidl/config.mk index 0d36473ade..cdc3843d28 100644 --- a/source4/pidl/config.mk +++ b/source4/pidl/config.mk @@ -5,7 +5,7 @@ pidl-testcov: pidl/Makefile cd pidl && cover -test installpidl:: pidl/Makefile - $(MAKE) -C pidl install_vendor PREFIX=$(prefix) + $(MAKE) -C pidl install_vendor VENDORPREFIX=$(prefix) ifeq ($(HAVE_PERL_EXTUTILS_MAKEMAKER),1) install:: installpidl -- cgit From 5db62a16ff9b784c11c704b8083da9bf6e736f08 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 8 Apr 2008 14:19:26 +0200 Subject: Array lengths can be obtained from Python objects so remove them from the Python API. (This used to be commit 652810ff46c6db9034e930d0fb018a02ee385f15) --- source4/pidl/lib/Parse/Pidl/Samba4/Python.pm | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'source4/pidl') diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm index c04324e992..5d514c5f09 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm @@ -272,7 +272,21 @@ sub PythonFunctionBody($$$) my $signature = "S.$prettyname("; + my %metadata_args = (); + + sub get_var($) { my $x = shift; $x =~ s/\*//g; return $x; } + + # Determine arguments that are metadata for other arguments (size_is/length_is) + foreach my $e (@{$fn->{ELEMENTS}}) { + if (has_property($e, "length_is")) { + $metadata_args{get_var($e->{PROPERTIES}->{length_is})} = $e->{NAME}; + } elsif (has_property($e, "size_is")) { + $metadata_args{get_var($e->{PROPERTIES}->{size_is})} = $e->{NAME}; + } + } + foreach my $e (@{$fn->{ELEMENTS}}) { + next if ($metadata_args{$e->{NAME}}); $self->pidl("PyObject *py_$e->{NAME};"); if (grep(/out/,@{$e->{DIRECTION}})) { $result_size++; @@ -307,7 +321,16 @@ sub PythonFunctionBody($$$) } foreach my $e (@{$fn->{ELEMENTS}}) { - if (grep(/in/,@{$e->{DIRECTION}})) { + next unless (grep(/in/,@{$e->{DIRECTION}})); + if ($metadata_args{$e->{NAME}}) { + my $val = "PyList_Size(py_".$metadata_args{$e->{NAME}}.")"; + if ($e->{LEVELS}[0]->{TYPE} eq "POINTER") { + $self->pidl("r->in.$e->{NAME} = talloc_ptrtype(mem_ctx, r->in.$e->{NAME});"); + $self->pidl("*r->in.$e->{NAME} = $val;"); + } else { + $self->pidl("r->in.$e->{NAME} = PyList_Size(py_".$metadata_args{$e->{NAME}}.");"); + } + } else { $self->ConvertObjectFromPython($env, "mem_ctx", $e, "py_$e->{NAME}", "r->in.$e->{NAME}", "talloc_free(mem_ctx); return NULL;"); } } @@ -325,6 +348,7 @@ sub PythonFunctionBody($$$) } foreach my $e (@{$fn->{ELEMENTS}}) { + next if ($metadata_args{$e->{NAME}}); my $py_name = "py_$e->{NAME}"; if (grep(/out/,@{$e->{DIRECTION}})) { $self->ConvertObjectToPython("r", $env, $e, "r->out.$e->{NAME}", $py_name); -- cgit From 90c8841beff1fe8c492670811aacd3b92e296912 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 8 Apr 2008 14:56:09 +0200 Subject: Fix bug handling size arguments in a direction without actual data. (This used to be commit 169d505e9e2285aedc21547e44986b8b841b8e37) --- source4/pidl/lib/Parse/Pidl/Samba4/Python.pm | 33 ++++++++++++++++++---------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'source4/pidl') diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm index 5d514c5f09..2ab61e3246 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm @@ -272,21 +272,28 @@ sub PythonFunctionBody($$$) my $signature = "S.$prettyname("; - my %metadata_args = (); + my $metadata_args = { in => {}, out => {} }; sub get_var($) { my $x = shift; $x =~ s/\*//g; return $x; } # Determine arguments that are metadata for other arguments (size_is/length_is) foreach my $e (@{$fn->{ELEMENTS}}) { - if (has_property($e, "length_is")) { - $metadata_args{get_var($e->{PROPERTIES}->{length_is})} = $e->{NAME}; - } elsif (has_property($e, "size_is")) { - $metadata_args{get_var($e->{PROPERTIES}->{size_is})} = $e->{NAME}; + foreach my $dir (@{$e->{DIRECTION}}) { + my $main = undef; + if (has_property($e, "length_is")) { + $main = get_var($e->{PROPERTIES}->{length_is}); + } elsif (has_property($e, "size_is")) { + $main = get_var($e->{PROPERTIES}->{size_is}); + } + if ($main) { + $metadata_args->{$dir}->{$main} = $e->{NAME}; + } } } foreach my $e (@{$fn->{ELEMENTS}}) { - next if ($metadata_args{$e->{NAME}}); + next if (($metadata_args->{in}->{$e->{NAME}} and grep(/in/, @{$e->{DIRECTION}})) or + ($metadata_args->{out}->{$e->{NAME}}) and grep(/out/, @{$e->{DIRECTION}})); $self->pidl("PyObject *py_$e->{NAME};"); if (grep(/out/,@{$e->{DIRECTION}})) { $result_size++; @@ -315,23 +322,27 @@ sub PythonFunctionBody($$$) $self->pidl("return NULL;"); $self->deindent; $self->pidl("}"); + $self->pidl(""); if ($fn->{RETURN_TYPE}) { $result_size++ unless ($fn->{RETURN_TYPE} eq "WERROR" or $fn->{RETURN_TYPE} eq "NTSTATUS"); } + my $fail = "talloc_free(mem_ctx); return NULL;"; foreach my $e (@{$fn->{ELEMENTS}}) { next unless (grep(/in/,@{$e->{DIRECTION}})); - if ($metadata_args{$e->{NAME}}) { - my $val = "PyList_Size(py_".$metadata_args{$e->{NAME}}.")"; + if ($metadata_args->{in}->{$e->{NAME}}) { + my $py_var = "py_".$metadata_args->{in}->{$e->{NAME}}; + $self->pidl("PY_CHECK_TYPE(PyList, $py_var, $fail);"); + my $val = "PyList_Size($py_var)"; if ($e->{LEVELS}[0]->{TYPE} eq "POINTER") { $self->pidl("r->in.$e->{NAME} = talloc_ptrtype(mem_ctx, r->in.$e->{NAME});"); $self->pidl("*r->in.$e->{NAME} = $val;"); } else { - $self->pidl("r->in.$e->{NAME} = PyList_Size(py_".$metadata_args{$e->{NAME}}.");"); + $self->pidl("r->in.$e->{NAME} = $val;"); } } else { - $self->ConvertObjectFromPython($env, "mem_ctx", $e, "py_$e->{NAME}", "r->in.$e->{NAME}", "talloc_free(mem_ctx); return NULL;"); + $self->ConvertObjectFromPython($env, "mem_ctx", $e, "py_$e->{NAME}", "r->in.$e->{NAME}", $fail); } } $self->pidl("status = dcerpc_$fn->{NAME}(iface->pipe, mem_ctx, r);"); @@ -348,7 +359,7 @@ sub PythonFunctionBody($$$) } foreach my $e (@{$fn->{ELEMENTS}}) { - next if ($metadata_args{$e->{NAME}}); + next if ($metadata_args->{out}->{$e->{NAME}}); my $py_name = "py_$e->{NAME}"; if (grep(/out/,@{$e->{DIRECTION}})) { $self->ConvertObjectToPython("r", $env, $e, "r->out.$e->{NAME}", $py_name); -- cgit From 66b529029a6d15d9d2f8cac8f863de618509a95e Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 8 Apr 2008 15:18:24 +0200 Subject: Clearer names for singleton return types. (This used to be commit 19d0560464304f79224a946278105edafb285453) --- source4/pidl/lib/Parse/Pidl/Samba4/Python.pm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source4/pidl') diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm index 2ab61e3246..acaea99f6d 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm @@ -369,7 +369,7 @@ sub PythonFunctionBody($$$) $signature .= "$e->{NAME}, "; } else { $self->pidl("result = $py_name;"); - $signature .= "result"; + $signature .= $e->{NAME}; } } } @@ -382,11 +382,10 @@ sub PythonFunctionBody($$$) my $conv = $self->ConvertObjectToPythonData("r", $fn->{RETURN_TYPE}, "r->out.result"); if ($result_size > 1) { $self->pidl("PyTuple_SetItem(result, $i, $conv);"); - $signature .= "result"; } else { $self->pidl("result = $conv;"); - $signature .= "result"; } + $signature .= "result"; } if (substr($signature, -2) eq ", ") { -- cgit From 43896320dd0a1fed1b1bedb46c99a7eb6498e816 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 14 Apr 2008 19:41:13 +0200 Subject: Explicitly specify the paths when installing pidl. (This used to be commit 1695e0e1ab3f2151490232462b0e3650eba96237) --- source4/pidl/config.mk | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'source4/pidl') diff --git a/source4/pidl/config.mk b/source4/pidl/config.mk index cdc3843d28..38542f5b7f 100644 --- a/source4/pidl/config.mk +++ b/source4/pidl/config.mk @@ -5,7 +5,12 @@ pidl-testcov: pidl/Makefile cd pidl && cover -test installpidl:: pidl/Makefile - $(MAKE) -C pidl install_vendor VENDORPREFIX=$(prefix) + $(MAKE) -C pidl install_vendor VENDORPREFIX=$(prefix) \ + INSTALLVENDORLIB=$(libdir) \ + INSTALLVENDORBIN=$(bindir) \ + INSTALLVENDORSCRIPT=$(bindir) \ + INSTALLVENDORMAN1DIR=$(mandir)/man1 \ + INSTALLVENDORMAN3DIR=$(mandir)/man3 ifeq ($(HAVE_PERL_EXTUTILS_MAKEMAKER),1) install:: installpidl -- cgit From c937efc1a6f7c117119bc43b91c8554825b5a9f9 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 15 Apr 2008 10:55:32 +0200 Subject: Attempt to fix the pidl installation on fedora. (This used to be commit 4dd29284bdffc96df1d6eb71b25e305f107d1e12) --- source4/pidl/config.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/pidl') diff --git a/source4/pidl/config.mk b/source4/pidl/config.mk index 38542f5b7f..25cea495a7 100644 --- a/source4/pidl/config.mk +++ b/source4/pidl/config.mk @@ -1,5 +1,5 @@ pidl/Makefile: pidl/Makefile.PL - cd pidl && $(PERL) Makefile.PL + cd pidl && $(PERL) Makefile.PL PREFIX=$(prefix) pidl-testcov: pidl/Makefile cd pidl && cover -test -- cgit From fd52fe86169ddc0adda2d1cd97215c58d06f93c4 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 15 Apr 2008 14:32:13 +0200 Subject: Fix pointers when pushing strings to python during pidl generation. (This used to be commit ca72187b3e71a037780d42a57e46b60e75f724f6) --- source4/pidl/lib/Parse/Pidl/Samba4/Python.pm | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'source4/pidl') diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm index acaea99f6d..2d12da358c 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm @@ -952,16 +952,15 @@ sub ConvertObjectToPythonLevel($$$$$) $self->pidl("}"); } } elsif ($l->{TYPE} eq "ARRAY") { - if (is_charset_array($e, $l)) { + my $pl = GetPrevLevel($e, $l); + if ($pl && $pl->{TYPE} eq "POINTER") { $var_name = get_pointer_to($var_name); + } + + if (is_charset_array($e, $l)) { # FIXME: Use Unix charset setting rather than utf-8 $self->pidl("$py_var = PyUnicode_Decode($var_name, strlen($var_name), \"utf-8\", \"ignore\");"); } else { - my $pl = GetPrevLevel($e, $l); - if ($pl && $pl->{TYPE} eq "POINTER") { - $var_name = get_pointer_to($var_name); - } - die("No SIZE_IS for array $var_name") unless (defined($l->{SIZE_IS})); my $length = $l->{SIZE_IS}; if (defined($l->{LENGTH_IS})) { -- cgit From 7bb2ebb884c35676a6cf03efe6ecc15b3e232a43 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 15 Apr 2008 16:00:07 +0200 Subject: Fix size to memcpy call in generated Samba 3 client code. Reported-By: vl (This used to be commit a28807569d0cf32968bacdc0bd88197b19fbae49) --- source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm | 65 ++++++++++++++----------- source4/pidl/tests/samba3-cli.pl | 13 ++++- 2 files changed, 47 insertions(+), 31 deletions(-) (limited to 'source4/pidl') diff --git a/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm b/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm index 7a2575b897..87ed29b54e 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm @@ -9,7 +9,7 @@ package Parse::Pidl::Samba3::ClientNDR; use Exporter; @ISA = qw(Exporter); -@EXPORT_OK = qw(ParseFunction $res $res_hdr); +@EXPORT_OK = qw(ParseFunction $res $res_hdr ParseOutputArgument); use strict; use Parse::Pidl qw(fatal warning); @@ -73,6 +73,40 @@ sub HeaderProperties($$) } } +sub ParseOutputArgument($$$) +{ + my ($self, $fn, $e) = @_; + my $level = 0; + + fatal($e->{ORIGINAL}, "[out] argument is not a pointer or array") if ($e->{LEVELS}[0]->{TYPE} ne "POINTER" and $e->{LEVELS}[0]->{TYPE} ne "ARRAY"); + + if ($e->{LEVELS}[0]->{TYPE} eq "POINTER") { + $level = 1; + if ($e->{LEVELS}[0]->{POINTER_TYPE} ne "ref") { + $self->pidl("if ($e->{NAME} && r.out.$e->{NAME}) {"); + $self->indent; + } + } + + if ($e->{LEVELS}[$level]->{TYPE} eq "ARRAY") { + # This is a call to GenerateFunctionInEnv intentionally. + # Since the data is being copied into a user-provided data + # structure, the user should be able to know the size beforehand + # to allocate a structure of the right size. + my $env = GenerateFunctionInEnv($fn, "r."); + my $size_is = ParseExpr($e->{LEVELS}[$level]->{SIZE_IS}, $env, $e->{ORIGINAL}); + $self->pidl("memcpy($e->{NAME}, r.out.$e->{NAME}, $size_is * sizeof(*$e->{NAME}));"); + } else { + $self->pidl("*$e->{NAME} = *r.out.$e->{NAME};"); + } + + if ($e->{LEVELS}[0]->{TYPE} eq "POINTER") { + if ($e->{LEVELS}[0]->{POINTER_TYPE} ne "ref") { + $self->deindent; + $self->pidl("}"); + } + } +} sub ParseFunction($$$) { @@ -147,36 +181,9 @@ sub ParseFunction($$$) $self->pidl("/* Return variables */"); foreach my $e (@{$fn->{ELEMENTS}}) { next unless (grep(/out/, @{$e->{DIRECTION}})); - my $level = 0; - fatal($e->{ORIGINAL}, "[out] argument is not a pointer or array") if ($e->{LEVELS}[0]->{TYPE} ne "POINTER" and $e->{LEVELS}[0]->{TYPE} ne "ARRAY"); - - if ($e->{LEVELS}[0]->{TYPE} eq "POINTER") { - $level = 1; - if ($e->{LEVELS}[0]->{POINTER_TYPE} ne "ref") { - $self->pidl("if ($e->{NAME} && r.out.$e->{NAME}) {"); - $self->indent; - } - } + $self->ParseOutputArgument($fn, $e); - if ($e->{LEVELS}[$level]->{TYPE} eq "ARRAY") { - # This is a call to GenerateFunctionInEnv intentionally. - # Since the data is being copied into a user-provided data - # structure, the user should be able to know the size beforehand - # to allocate a structure of the right size. - my $env = GenerateFunctionInEnv($fn, "r."); - my $size_is = ParseExpr($e->{LEVELS}[$level]->{SIZE_IS}, $env, $e->{ORIGINAL}); - $self->pidl("memcpy($e->{NAME}, r.out.$e->{NAME}, $size_is);"); - } else { - $self->pidl("*$e->{NAME} = *r.out.$e->{NAME};"); - } - - if ($e->{LEVELS}[0]->{TYPE} eq "POINTER") { - if ($e->{LEVELS}[0]->{POINTER_TYPE} ne "ref") { - $self->deindent; - $self->pidl("}"); - } - } } $self->pidl(""); diff --git a/source4/pidl/tests/samba3-cli.pl b/source4/pidl/tests/samba3-cli.pl index f5b51b7d34..80725d28cf 100755 --- a/source4/pidl/tests/samba3-cli.pl +++ b/source4/pidl/tests/samba3-cli.pl @@ -4,12 +4,12 @@ use strict; use warnings; -use Test::More tests => 8; +use Test::More tests => 9; use FindBin qw($RealBin); use lib "$RealBin"; use Util; use Parse::Pidl::Util qw(MyDumper); -use Parse::Pidl::Samba3::ClientNDR qw(ParseFunction); +use Parse::Pidl::Samba3::ClientNDR qw(ParseFunction ParseOutputArgument); use Parse::Pidl::Samba4::Header qw(GenerateFunctionInEnv GenerateFunctionOutEnv); # Make sure GenerateFunctionInEnv and GenerateFunctionOutEnv work @@ -117,3 +117,12 @@ is($x->{res}, } "); + +$x = new Parse::Pidl::Samba3::ClientNDR(); + +$fn = { NAME => "bar", ELEMENTS => [ ], RETURN_TYPE => "WERROR" }; +my $e = { NAME => "foo", ORIGINAL => { FILE => "f", LINE => -1 }, + LEVELS => [ { TYPE => "ARRAY", SIZE_IS => "mysize" }, { TYPE => "DATA", DATA_TYPE => "int" } ]}; + +$x->ParseOutputArgument($fn, $e); +is($x->{res}, "memcpy(foo, r.out.foo, mysize * sizeof(*foo));\n"); -- cgit From d49f94621bd1d18437d5846d61b84054f35d39e4 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 16 Apr 2008 17:21:48 +0200 Subject: Provide stubs when the [todo] attribute is set. (This used to be commit 356a5d24747bb5e1ef9774c690a5ec386a4a165e) --- source4/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm | 54 ++++++++++++++++++------ 1 file changed, 41 insertions(+), 13 deletions(-) (limited to 'source4/pidl') diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm index e9c158e933..f8209be654 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm @@ -7,6 +7,7 @@ package Parse::Pidl::Samba4::NDR::Client; use Parse::Pidl::Samba4 qw(choose_header is_intree); +use Parse::Pidl::Util qw(has_property); use vars qw($VERSION); $VERSION = '0.01'; @@ -15,30 +16,45 @@ use strict; my($res,$res_hdr); -##################################################################### -# parse a function -sub ParseFunction($$) +sub ParseFunctionSend($$$) { - my ($interface, $fn) = @_; - my $name = $fn->{NAME}; + my ($interface, $fn, $name) = @_; my $uname = uc $name; - $res_hdr .= "\nstruct rpc_request *dcerpc_$name\_send(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name *r); -NTSTATUS dcerpc_$name(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name *r); -"; + my $proto = "struct rpc_request *dcerpc_$name\_send(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name *r)"; - $res .= " -struct rpc_request *dcerpc_$name\_send(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name *r) -{ + $res_hdr .= "\n$proto;\n"; + + $res .= "$proto\n{\n"; + + if (has_property($fn, "todo")) { + $res .= "\treturn NULL;\n"; + } else { + $res .= " if (p->conn->flags & DCERPC_DEBUG_PRINT_IN) { NDR_PRINT_IN_DEBUG($name, r); } return dcerpc_ndr_request_send(p, NULL, &ndr_table_$interface->{NAME}, NDR_$uname, mem_ctx, r); +"; + } + + $res .= "}\n\n"; } -NTSTATUS dcerpc_$name(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name *r) +sub ParseFunctionSync($$$) { + my ($interface, $fn, $name) = @_; + + my $proto = "NTSTATUS dcerpc_$name(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name *r)"; + + $res_hdr .= "\n$proto;\n"; + $res .= "$proto\n{\n"; + + if (has_property($fn, "todo")) { + $res .= "\treturn NT_STATUS_NOT_IMPLEMENTED;\n"; + } else { + $res .= " struct rpc_request *req; NTSTATUS status; @@ -58,8 +74,20 @@ NTSTATUS dcerpc_$name(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name * $res .= " return status; -} "; + } + + $res .= "}\n\n"; +} + +##################################################################### +# parse a function +sub ParseFunction($$) +{ + my ($interface, $fn) = @_; + + ParseFunctionSend($interface, $fn, $fn->{NAME}); + ParseFunctionSync($interface, $fn, $fn->{NAME}); } my %done; -- cgit From db30ff4bea11f6612bd68c934ba31387ad99cefc Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 21 Apr 2008 17:59:08 +0200 Subject: Load default smb.conf file if none was specified explicitly. (This used to be commit 8fa23fac516dbf4c8245c1d009e81f02a6341775) --- source4/pidl/lib/Parse/Pidl/Samba4/Python.pm | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'source4/pidl') diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm index 2d12da358c..e344589f8e 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm @@ -597,7 +597,7 @@ sub Interface($$$) $self->pidl("const char *binding_string;"); $self->pidl("struct cli_credentials *credentials;"); $self->pidl("struct loadparm_context *lp_ctx = NULL;"); - $self->pidl("PyObject *py_lp_ctx = NULL, *py_credentials = Py_None;"); + $self->pidl("PyObject *py_lp_ctx = Py_None, *py_credentials = Py_None;"); $self->pidl("TALLOC_CTX *mem_ctx = NULL;"); $self->pidl("NTSTATUS status;"); $self->pidl(""); @@ -609,14 +609,12 @@ sub Interface($$$) $self->pidl("extern struct loadparm_context *lp_from_py_object(PyObject *py_obj);"); $self->pidl("extern struct cli_credentials *cli_credentials_from_py_object(PyObject *py_obj);"); $self->pidl(""); - $self->pidl("if (!PyArg_ParseTupleAndKeywords(args, kwargs, \"sO|O:$interface->{NAME}\", discard_const_p(char *, kwnames), &binding_string, &py_lp_ctx, &py_credentials)) {"); + $self->pidl("if (!PyArg_ParseTupleAndKeywords(args, kwargs, \"s|OO:$interface->{NAME}\", discard_const_p(char *, kwnames), &binding_string, &py_lp_ctx, &py_credentials)) {"); $self->indent; $self->pidl("return NULL;"); $self->deindent; $self->pidl("}"); $self->pidl(""); - $self->pidl("if (py_lp_ctx != NULL) {"); - $self->indent; $self->pidl("lp_ctx = lp_from_py_object(py_lp_ctx);"); $self->pidl("if (lp_ctx == NULL) {"); $self->indent; @@ -624,8 +622,6 @@ sub Interface($$$) $self->pidl("return NULL;"); $self->deindent; $self->pidl("}"); - $self->deindent; - $self->pidl("}"); $self->pidl(""); $self->pidl("credentials = cli_credentials_from_py_object(py_credentials);"); -- cgit From f1b76952c035ca6341e67d0ef1a14b655c4652a2 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 22 Apr 2008 22:33:34 +0200 Subject: Fix event context initialization for Python bindings. (This used to be commit 132efc779ede27898765320a13bdde0b5256102b) --- source4/pidl/lib/Parse/Pidl/Samba4/Python.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source4/pidl') diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm index e344589f8e..884ee1d822 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm @@ -599,6 +599,7 @@ sub Interface($$$) $self->pidl("struct loadparm_context *lp_ctx = NULL;"); $self->pidl("PyObject *py_lp_ctx = Py_None, *py_credentials = Py_None;"); $self->pidl("TALLOC_CTX *mem_ctx = NULL;"); + $self->pidl("struct event_context *event_ctx;"); $self->pidl("NTSTATUS status;"); $self->pidl(""); $self->pidl("const char *kwnames[] = {"); @@ -634,9 +635,11 @@ sub Interface($$$) $self->pidl("ret = PyObject_New($interface->{NAME}_InterfaceObject, &$interface->{NAME}_InterfaceType);"); $self->pidl(""); + $self->pidl("event_ctx = event_context_init(mem_ctx);"); + $self->pidl(""); $self->pidl("status = dcerpc_pipe_connect(NULL, &ret->pipe, binding_string, "); - $self->pidl(" &ndr_table_$interface->{NAME}, credentials, NULL, lp_ctx);"); + $self->pidl(" &ndr_table_$interface->{NAME}, credentials, event_ctx, lp_ctx);"); $self->handle_ntstatus("status", "NULL", "mem_ctx"); $self->pidl("ret->pipe->conn->flags |= DCERPC_NDR_REF_ALLOC;"); @@ -1020,6 +1023,7 @@ sub Parse($$$$$) #include \"librpc/rpc/dcerpc.h\" #include \"scripting/python/pytalloc.h\" #include \"scripting/python/pyrpc.h\" +#include \"lib/events/events.h\" #include \"$hdr\" #include \"$ndr_hdr\" #include \"$py_hdr\" -- cgit