pylibsmb: Add a compatible python-level wrapper
authorVolker Lendecke <vl@samba.org>
Wed, 11 Nov 2020 10:20:29 +0000 (11:20 +0100)
committerJeremy Allison <jra@samba.org>
Mon, 16 Nov 2020 19:53:44 +0000 (19:53 +0000)
Right now this is empty, but it is the basis for moving complexity out
or pylibsmb.c into python code.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
python/samba/samba3/libsmb_samba_internal.py [new file with mode: 0644]
source3/libsmb/pylibsmb.c
source3/wscript_build

diff --git a/python/samba/samba3/libsmb_samba_internal.py b/python/samba/samba3/libsmb_samba_internal.py
new file mode 100644 (file)
index 0000000..d8621a2
--- /dev/null
@@ -0,0 +1,19 @@
+# Copyright (C) Volker Lendecke <vl@samba.org> 2020
+#
+# 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 samba.samba3.libsmb_samba_cwrapper import *
+
+class Conn(LibsmbCConn):
+    pass
index 7985b842a1576fa0a28ee206eae2494fb7fde535..78bc066ba4f76dca5ccb007a1e0fdbce94a677e1 100644 (file)
@@ -1610,10 +1610,10 @@ static PyMethodDef py_cli_state_methods[] = {
 
 static PyTypeObject py_cli_state_type = {
        PyVarObject_HEAD_INIT(NULL, 0)
-       .tp_name = "libsmb_samba_internal.Conn",
+       .tp_name = "libsmb_samba_cwrapper.LibsmbCConn",
        .tp_basicsize = sizeof(struct py_cli_state),
        .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
-       .tp_doc = "libsmb connection",
+       .tp_doc = "libsmb cwrapper connection",
        .tp_new = py_cli_state_new,
        .tp_init = (initproc)py_cli_state_init,
        .tp_dealloc = (destructor)py_cli_state_dealloc,
@@ -1624,17 +1624,17 @@ static PyMethodDef py_libsmb_methods[] = {
        {0},
 };
 
-void initlibsmb_samba_internal(void);
+void initlibsmb_samba_cwrapper(void);
 
 static struct PyModuleDef moduledef = {
     PyModuleDef_HEAD_INIT,
-    .m_name = "libsmb_samba_internal",
+    .m_name = "libsmb_samba_cwrapper",
     .m_doc = "libsmb wrapper",
     .m_size = -1,
     .m_methods = py_libsmb_methods,
 };
 
-MODULE_INIT_FUNC(libsmb_samba_internal)
+MODULE_INIT_FUNC(libsmb_samba_cwrapper)
 {
        PyObject *m = NULL;
 
@@ -1648,7 +1648,7 @@ MODULE_INIT_FUNC(libsmb_samba_internal)
                return NULL;
        }
        Py_INCREF(&py_cli_state_type);
-       PyModule_AddObject(m, "Conn", (PyObject *)&py_cli_state_type);
+       PyModule_AddObject(m, "LibsmbCConn", (PyObject *)&py_cli_state_type);
 
 #define ADD_FLAGS(val) PyModule_AddObject(m, #val, PyLong_FromLong(val))
 
index 62d6820b5d2d9d292ac1e93b5ebe65cddd543bd1..22e2bc7deeaaa746923b43277928dcefc031769b 100644 (file)
@@ -1341,7 +1341,7 @@ pycredentials = 'pycredentials'
 bld.SAMBA3_PYTHON('pylibsmb',
                   source='libsmb/pylibsmb.c',
                   deps='smbclient samba-credentials %s' % pycredentials,
-                  realname='samba/samba3/libsmb_samba_internal.so'
+                  realname='samba/samba3/libsmb_samba_cwrapper.so'
                   )
 
 bld.SAMBA3_PYTHON('pymdscli',