summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2002-04-15 07:29:47 +0000
committerTim Potter <tpot@samba.org>2002-04-15 07:29:47 +0000
commitb84cce809baceeb7a24b3a98e9bef47279aad3ca (patch)
treed69e9e52ecfaeeb0c08b29857411b4cb213e0b94 /source3
parent3fca495f8c7a1579beda3305b207af6a988bac4c (diff)
downloadsamba-b84cce809baceeb7a24b3a98e9bef47279aad3ca.tar.gz
samba-b84cce809baceeb7a24b3a98e9bef47279aad3ca.tar.bz2
samba-b84cce809baceeb7a24b3a98e9bef47279aad3ca.zip
Skeleton for SAMR module.
(This used to be commit 70bd1a0f94412236bf6603f16947336cb75c6415)
Diffstat (limited to 'source3')
-rw-r--r--source3/python/py_samr.c206
-rw-r--r--source3/python/py_samr.h83
-rwxr-xr-xsource3/python/setup.py.in9
3 files changed, 298 insertions, 0 deletions
diff --git a/source3/python/py_samr.c b/source3/python/py_samr.c
new file mode 100644
index 0000000000..2271cb4464
--- /dev/null
+++ b/source3/python/py_samr.c
@@ -0,0 +1,206 @@
+/*
+ Python wrappers for DCERPC/SMB client routines.
+
+ Copyright (C) Tim Potter, 2002
+
+ 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 2 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, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "includes.h"
+#include "Python.h"
+
+#include "python/py_samr.h"
+
+PyObject *new_samr_connect_hnd_object(struct cli_state *cli, TALLOC_CTX *mem_ctx,
+ POLICY_HND *pol)
+{
+ samr_connect_hnd_object *o;
+
+ o = PyObject_New(samr_connect_hnd_object, &samr_connect_hnd_type);
+
+ o->cli = cli;
+ o->mem_ctx = mem_ctx;
+ memcpy(&o->pol, pol, sizeof(POLICY_HND));
+
+ return (PyObject*)o;
+}
+
+/*
+ * Exceptions raised by this module
+ */
+
+PyObject *samr_error; /* This indicates a non-RPC related error
+ such as name lookup failure */
+
+PyObject *samr_ntstatus; /* This exception is raised when a RPC call
+ returns a status code other than
+ NT_STATUS_OK */
+
+static void py_samr_connect_hnd_dealloc(PyObject* self)
+{
+ PyObject_Del(self);
+}
+
+#if 0
+
+static PyObject *py_samr_connect_hnd_getattr(PyObject *self, char *attrname)
+{
+ return Py_FindMethod(samr_connect_methods, self, attrname);
+}
+
+#endif
+
+PyTypeObject samr_connect_hnd_type = {
+ PyObject_HEAD_INIT(NULL)
+ 0,
+ "SAMR Connect Handle",
+ sizeof(samr_connect_hnd_object),
+ 0,
+ py_samr_connect_hnd_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+// py_samr_connect_hnd_getattr, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+};
+
+PyTypeObject samr_domain_hnd_type = {
+ PyObject_HEAD_INIT(NULL)
+ 0,
+ "SAMR Domain Handle",
+ sizeof(samr_connect_hnd_object),
+ 0,
+ py_samr_connect_hnd_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+// py_samr_connect_hnd_getattr, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+};
+
+PyTypeObject samr_user_hnd_type = {
+ PyObject_HEAD_INIT(NULL)
+ 0,
+ "SAMR User Handle",
+ sizeof(samr_connect_hnd_object),
+ 0,
+ py_samr_connect_hnd_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+// py_samr_connect_hnd_getattr, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+};
+
+PyTypeObject samr_group_hnd_type = {
+ PyObject_HEAD_INIT(NULL)
+ 0,
+ "SAMR Group Handle",
+ sizeof(samr_connect_hnd_object),
+ 0,
+ py_samr_connect_hnd_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+// py_samr_connect_hnd_getattr, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+};
+
+PyTypeObject samr_alias_hnd_type = {
+ PyObject_HEAD_INIT(NULL)
+ 0,
+ "SAMR Alias Handle",
+ sizeof(samr_connect_hnd_object),
+ 0,
+ py_samr_connect_hnd_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+// py_samr_connect_hnd_getattr, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+};
+
+static PyMethodDef samr_methods[] = {
+
+ /* Open/close samr connect handles */
+
+#if 0
+ { "connect", lsa_open_policy, METH_VARARGS | METH_KEYWORDS,
+ "Open a connect handle" },
+
+ { "close", lsa_close, METH_VARARGS, "Close a policy handle" },
+#endif
+
+ { NULL }
+};
+
+/*
+ * Module initialisation
+*/
+
+void initsamr(void)
+{
+ PyObject *module, *dict;
+
+ /* Initialise module */
+
+ module = Py_InitModule("samr", samr_methods);
+ dict = PyModule_GetDict(module);
+
+ samr_error = PyErr_NewException("samr.error", NULL, NULL);
+ PyDict_SetItemString(dict, "error", samr_error);
+
+ samr_ntstatus = PyErr_NewException("samr.ntstatus", NULL, NULL);
+ PyDict_SetItemString(dict, "ntstatus", samr_ntstatus);
+
+ /* Initialise policy handle object */
+
+ samr_connect_hnd_type.ob_type = &PyType_Type;
+ samr_domain_hnd_type.ob_type = &PyType_Type;
+ samr_user_hnd_type.ob_type = &PyType_Type;
+ samr_group_hnd_type.ob_type = &PyType_Type;
+ samr_alias_hnd_type.ob_type = &PyType_Type;
+
+ /* Initialise constants */
+
+// const_init(dict);
+
+ /* Do samba initialisation */
+
+ py_samba_init();
+
+ setup_logging("samr", True);
+ DEBUGLEVEL = 10;
+}
diff --git a/source3/python/py_samr.h b/source3/python/py_samr.h
new file mode 100644
index 0000000000..52352cc64d
--- /dev/null
+++ b/source3/python/py_samr.h
@@ -0,0 +1,83 @@
+/*
+ Python wrappers for DCERPC/SMB client routines.
+
+ Copyright (C) Tim Potter, 2002
+
+ 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 2 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, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef _PY_SAMR_H
+#define _PY_SAMR_H
+
+#include "includes.h"
+#include "Python.h"
+
+#include "python/py_common.h"
+
+/* SAMR connect policy handle object */
+
+typedef struct {
+ PyObject_HEAD
+ struct cli_state *cli;
+ TALLOC_CTX *mem_ctx;
+ POLICY_HND pol;
+} samr_connect_hnd_object;
+
+/* SAMR domain policy handle object */
+
+typedef struct {
+ PyObject_HEAD
+ struct cli_state *cli;
+ TALLOC_CTX *mem_ctx;
+ POLICY_HND pol;
+} samr_domain_hnd_object;
+
+/* SAMR user policy handle object */
+
+typedef struct {
+ PyObject_HEAD
+ struct cli_state *cli;
+ TALLOC_CTX *mem_ctx;
+ POLICY_HND pol;
+} samr_user_hnd_object;
+
+/* SAMR group policy handle object */
+
+typedef struct {
+ PyObject_HEAD
+ struct cli_state *cli;
+ TALLOC_CTX *mem_ctx;
+ POLICY_HND pol;
+} samr_group_hnd_object;
+
+/* SAMR alias policy handle object */
+
+typedef struct {
+ PyObject_HEAD
+ struct cli_state *cli;
+ TALLOC_CTX *mem_ctx;
+ POLICY_HND pol;
+} samr_alias_hnd_object;
+
+extern PyTypeObject samr_connect_hnd_type, samr_domain_hnd_type,
+ samr_user_hnd_type, samr_group_hnd_type, samr_alias_hnd_type;
+
+/* Exceptions raised by this module */
+
+extern PyObject *samr_error;
+
+// #include "python/py_samr_proto.h"
+
+#endif /* _PY_SAMR_H */
diff --git a/source3/python/setup.py.in b/source3/python/setup.py.in
index 59182f5def..6bc568fa1d 100755
--- a/source3/python/setup.py.in
+++ b/source3/python/setup.py.in
@@ -111,6 +111,15 @@ setup(
library_dirs = ["/usr/kerberos/lib"],
extra_objects = obj_list),
+ # SAMR pipe module
+
+ Extension(name = "samr",
+ sources = [samba_srcdir + "python/py_samr.c",
+ samba_srcdir + "python/py_common.c"],
+ libraries = lib_list,
+ library_dirs = ["/usr/kerberos/lib"],
+ extra_objects = obj_list),
+
# winbind client module
Extension(name = "winbind",