[SCM] Samba Shared Repository - branch v4-0-test updated -
release-4-0-0alpha3-76-gcae61e3
Jelmer Vernooij
jelmer at samba.org
Tue Apr 8 12:59:40 GMT 2008
The branch, v4-0-test has been updated
via cae61e32e5b61a02c2986b74bd1d7e58460b1e80 (commit)
via 169d505e9e2285aedc21547e44986b8b841b8e37 (commit)
via 652810ff46c6db9034e930d0fb018a02ee385f15 (commit)
from c8dbf00b4490d804e1aac96a3fb66ff726bf9ef6 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v4-0-test
- Log -----------------------------------------------------------------
commit cae61e32e5b61a02c2986b74bd1d7e58460b1e80
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Tue Apr 8 14:58:38 2008 +0200
Remove length arguments, add tests for unixinfo.GidToSid and unixinfo.UidToSid.
commit 169d505e9e2285aedc21547e44986b8b841b8e37
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Tue Apr 8 14:56:09 2008 +0200
Fix bug handling size arguments in a direction without actual data.
commit 652810ff46c6db9034e930d0fb018a02ee385f15
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Tue Apr 8 14:19:26 2008 +0200
Array lengths can be obtained from Python objects so remove them from the Python API.
-----------------------------------------------------------------------
Summary of changes:
source/pidl/lib/Parse/Pidl/Samba4/Python.pm | 39 +++++++++++++++++++-
.../scripting/python/samba/tests/dcerpc/rpcecho.py | 2 +-
source/scripting/python/samba/tests/dcerpc/unix.py | 10 ++++-
3 files changed, 46 insertions(+), 5 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source/pidl/lib/Parse/Pidl/Samba4/Python.pm b/source/pidl/lib/Parse/Pidl/Samba4/Python.pm
index c04324e..2ab61e3 100644
--- a/source/pidl/lib/Parse/Pidl/Samba4/Python.pm
+++ b/source/pidl/lib/Parse/Pidl/Samba4/Python.pm
@@ -272,7 +272,28 @@ sub PythonFunctionBody($$$)
my $signature = "S.$prettyname(";
+ 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}}) {
+ 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->{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++;
@@ -301,14 +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}}) {
- if (grep(/in/,@{$e->{DIRECTION}})) {
- $self->ConvertObjectFromPython($env, "mem_ctx", $e, "py_$e->{NAME}", "r->in.$e->{NAME}", "talloc_free(mem_ctx); return NULL;");
+ next unless (grep(/in/,@{$e->{DIRECTION}}));
+ 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} = $val;");
+ }
+ } else {
+ $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);");
@@ -325,6 +359,7 @@ sub PythonFunctionBody($$$)
}
foreach my $e (@{$fn->{ELEMENTS}}) {
+ 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);
diff --git a/source/scripting/python/samba/tests/dcerpc/rpcecho.py b/source/scripting/python/samba/tests/dcerpc/rpcecho.py
index 8c1a8be..484af94 100644
--- a/source/scripting/python/samba/tests/dcerpc/rpcecho.py
+++ b/source/scripting/python/samba/tests/dcerpc/rpcecho.py
@@ -30,7 +30,7 @@ class RpcEchoTests(unittest.TestCase):
self.assertEquals(2, self.conn.AddOne(1))
def test_echodata(self):
- self.assertEquals([1,2,3], self.conn.EchoData(3, [1, 2, 3]))
+ self.assertEquals([1,2,3], self.conn.EchoData([1, 2, 3]))
def test_call(self):
self.assertEquals(u"foobar", self.conn.TestCall(u"foobar"))
diff --git a/source/scripting/python/samba/tests/dcerpc/unix.py b/source/scripting/python/samba/tests/dcerpc/unix.py
index 99c84c0..b2577ec 100644
--- a/source/scripting/python/samba/tests/dcerpc/unix.py
+++ b/source/scripting/python/samba/tests/dcerpc/unix.py
@@ -26,5 +26,11 @@ class UnixinfoTests(unittest.TestCase):
self.conn = unixinfo.unixinfo("ncalrpc:", get_loadparm())
def test_getpwuid(self):
- (count, infos) = self.conn.GetPWUid(1, [0])
- self.assertEquals(1, len(infos))
+ infos = self.conn.GetPWUid(range(512))
+ self.assertEquals(512, len(infos))
+
+ def test_gidtosid(self):
+ self.conn.GidToSid(1000)
+
+ def test_uidtosid(self):
+ self.conn.UidToSid(1000)
--
Samba Shared Repository
More information about the samba-cvs
mailing list