samba3-python: Add methods to get any entry (user/group) and its sid from idmap
[idra/samba.git] / source4 / scripting / python / uuidmodule.c
index 9b952d31b9b1e7fa731dabc413c2a47cdb2bfcfb..3bfe0162cacefd13a00a8a5df28ed09469443e0a 100644 (file)
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include "includes.h"
 #include <Python.h>
+#include "includes.h"
 #include "librpc/ndr/libndr.h"
 
 static PyObject *uuid_random(PyObject *self, PyObject *args)
 {
        struct GUID guid;
+       PyObject *pyobj;
        char *str;
 
-       if (!PyArg_ParseTuple(args, (char *)""))
+       if (!PyArg_ParseTuple(args, ""))
                return NULL;
 
        guid = GUID_random();
@@ -37,19 +38,21 @@ static PyObject *uuid_random(PyObject *self, PyObject *args)
                return NULL;
        }
 
+       pyobj = PyString_FromString(str);
+
        talloc_free(str);
 
-       return PyString_FromString(str);
+       return pyobj;
 }
 
 static PyMethodDef methods[] = {
-       { "random", (PyCFunction)uuid_random, METH_VARARGS, NULL},
+       { "uuid4", (PyCFunction)uuid_random, METH_VARARGS, NULL},
        { NULL, NULL }
 };
 
-PyMODINIT_FUNC inituuid(void)
+void inituuid(void)
 {
-       PyObject *mod = Py_InitModule3((char *)"uuid", methods, "UUID helper routines");
+       PyObject *mod = Py_InitModule3("uuid", methods, "UUID helper routines");
        if (mod == NULL)
                return;
 }