2 Unix SMB/CIFS implementation.
3 Copyright (C) Luke Morrison <luc785@hotmail.com> 2013
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "param/pyparam.h"
26 /* A Python C API module to use LIBGPO */
28 #ifndef Py_RETURN_NONE
29 #define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
32 /* Parameter mapping and functions for the GP_EXT struct */
35 /* Global methods aka do not need a special pyobject type */
36 static PyObject *py_gpo_get_sysvol_gpt_version(PyObject * self, PyObject * args)
38 TALLOC_CTX *tmp_ctx = NULL;
40 char *display_name = NULL;
41 uint32_t sysvol_version = 0;
44 tmp_ctx = talloc_new(NULL);
46 if (!PyArg_ParseTuple(args, "s", &unix_path)) {
49 gpo_get_sysvol_gpt_version(tmp_ctx, unix_path, &sysvol_version, &display_name);
51 result = Py_BuildValue("[s,i]", display_name, sysvol_version);
55 static PyMethodDef py_gpo_methods[] = {
56 {"gpo_get_sysvol_gpt_version", (PyCFunction) py_gpo_get_sysvol_gpt_version, METH_VARARGS, NULL},
60 /* Will be called by python when loading this module */
65 debug_setup_talloc_log();
66 /* Instantiate the types */
67 m = Py_InitModule3("gpo", py_gpo_methods, "libgpo python bindings");
70 PyModule_AddObject(m, "version", PyString_FromString(SAMBA_VERSION_STRING));