summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/foo.py27
-rw-r--r--source4/librpc/config.mk4
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/Python.pm11
-rw-r--r--source4/scripting/python/STATUS1
-rw-r--r--source4/scripting/python/samba/tests/dcerpc/registry.py53
-rwxr-xr-xsource4/selftest/samba4_tests.sh1
6 files changed, 64 insertions, 33 deletions
diff --git a/source4/foo.py b/source4/foo.py
deleted file mode 100644
index 21a422ce01..0000000000
--- a/source4/foo.py
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/python
-
-# Unix SMB/CIFS implementation.
-# Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2008
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-
-from echo import rpcecho
-from param import LoadParm
-
-lp = LoadParm()
-lp.load("st/client/client.conf")
-
-x = rpcecho("ncalrpc:", lp)
-print x.AddOne(41)
diff --git a/source4/librpc/config.mk b/source4/librpc/config.mk
index 55991f4953..ab94770d46 100644
--- a/source4/librpc/config.mk
+++ b/source4/librpc/config.mk
@@ -605,3 +605,7 @@ PRIVATE_DEPENDENCIES = RPC_NDR_WINREG python_misc
[PYTHON::python_dcerpc_misc]
OBJ_FILES = gen_ndr/py_misc.o
+
+[PYTHON::python_dcerpc_initshutdown]
+OBJ_FILES = gen_ndr/py_initshutdown.o
+PRIVATE_DEPENDENCIES = RPC_NDR_INITSHUTDOWN
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm
index e538771624..c8505e9904 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm
@@ -665,6 +665,7 @@ sub ConvertObjectFromPythonLevel($$$$$$$$)
$self->pidl("} else {");
$self->indent;
}
+ $self->pidl("$var_name = talloc_ptrtype($mem_ctx, $var_name);");
$self->ConvertObjectFromPythonLevel($env, $mem_ctx, $py_var, $e, GetNextLevel($e, $l), get_value_of($var_name), $fail);
if ($l->{POINTER_TYPE} ne "ref") {
$self->deindent;
@@ -686,7 +687,9 @@ sub ConvertObjectFromPythonLevel($$$$$$$$)
$self->pidl("{");
$self->indent;
$self->pidl("int $counter;");
- $self->pidl("$var_name = talloc_array_ptrtype($mem_ctx, $var_name, PyList_Size($py_var));");
+ if (!$l->{IS_FIXED}) {
+ $self->pidl("$var_name = talloc_array_ptrtype($mem_ctx, $var_name, PyList_Size($py_var));");
+ }
$self->pidl("for ($counter = 0; $counter < PyList_Size($py_var); $counter++) {");
$self->indent;
$self->ConvertObjectFromPythonLevel($env, $var_name, "PyList_GetItem($py_var, $counter)", $e, GetNextLevel($e, $l), $var_name."[$counter]", $fail);
@@ -697,8 +700,7 @@ sub ConvertObjectFromPythonLevel($$$$$$$$)
}
} elsif ($l->{TYPE} eq "DATA") {
- if (not Parse::Pidl::Typelist::is_scalar($l->{DATA_TYPE}) or
- Parse::Pidl::Typelist::scalar_is_reference($l->{DATA_TYPE})) {
+ if (not Parse::Pidl::Typelist::is_scalar($l->{DATA_TYPE})) {
$var_name = get_pointer_to($var_name);
}
$self->ConvertObjectFromPythonData($mem_ctx, $py_var, $l->{DATA_TYPE}, $var_name, $fail);
@@ -841,8 +843,7 @@ sub ConvertObjectToPythonLevel($$$$$)
my $switch = ParseExpr($l->{SWITCH_IS}, $env, $e);
$self->pidl("$py_var = py_import_" . GetNextLevel($e, $l)->{DATA_TYPE} . "($mem_ctx, $switch, $var_name);");
} elsif ($l->{TYPE} eq "DATA") {
- if (not Parse::Pidl::Typelist::is_scalar($l->{DATA_TYPE}) or
- Parse::Pidl::Typelist::scalar_is_reference($l->{DATA_TYPE})) {
+ if (not Parse::Pidl::Typelist::is_scalar($l->{DATA_TYPE})) {
$var_name = get_pointer_to($var_name);
}
my $conv = $self->ConvertObjectToPythonData($mem_ctx, $l->{DATA_TYPE}, $var_name);
diff --git a/source4/scripting/python/STATUS b/source4/scripting/python/STATUS
index 9a1c5b1b64..0e88b4041c 100644
--- a/source4/scripting/python/STATUS
+++ b/source4/scripting/python/STATUS
@@ -10,7 +10,6 @@ DCE/RPC bindings
- wrap struct/bitmap/enum/union types
- __ndr_pack__/__ndr_unpack__ members
- scripting/bin/smbstatus.py
- - scripting/bin/winreg.py
not important before making Python the default:
- scripting/python/samba/upgrade.py
diff --git a/source4/scripting/python/samba/tests/dcerpc/registry.py b/source4/scripting/python/samba/tests/dcerpc/registry.py
new file mode 100644
index 0000000000..7979592a40
--- /dev/null
+++ b/source4/scripting/python/samba/tests/dcerpc/registry.py
@@ -0,0 +1,53 @@
+#!/usr/bin/python
+
+# Unix SMB/CIFS implementation.
+# Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2008
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+
+#!/usr/bin/python
+
+# Unix SMB/CIFS implementation.
+# Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2008
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+import winreg
+from param import LoadParm
+import unittest
+
+class WinregTests(unittest.TestCase):
+ def setUp(self):
+ lp_ctx = LoadParm()
+ lp_ctx.load("st/client/client.conf")
+ self.conn = winreg.winreg("ncalrpc:", lp_ctx)
+
+ def test_hklm(self):
+ (handle, _) = self.conn.OpenHKLM(None,
+ winreg.KEY_QUERY_VALUE | winreg.KEY_ENUMERATE_SUB_KEYS)
+ self.conn.CloseKey(handle)
diff --git a/source4/selftest/samba4_tests.sh b/source4/selftest/samba4_tests.sh
index c1dac21614..fdf535e003 100755
--- a/source4/selftest/samba4_tests.sh
+++ b/source4/selftest/samba4_tests.sh
@@ -323,6 +323,7 @@ then
plantest "events.python" none PYTHONPATH="$PYTHONPATH:lib/events" $SUBUNITRUN tests
plantest "samba3sam.python" none PYTHONPATH="$PYTHONPATH:dsdb/samdb/ldb_modules/tests" $SUBUNITRUN samba3sam
plantest "rpcecho.python" dc $SUBUNITRUN samba.tests.dcerpc.rpcecho
+ plantest "winreg.python" dc $SUBUNITRUN samba.tests.dcerpc.registry
plantest "ldap.python" dc $PYTHON $samba4srcdir/lib/ldb/tests/python/ldap.py $CONFIGURATION \$SERVER -U\$USERNAME%\$PASSWORD -W \$DOMAIN
plantest "blackbox.samba3dump" none $PYTHON scripting/bin/samba3dump $samba4srcdir/../testdata/samba3
rm -rf $PREFIX/upgrade