commit f8ec7f6cb19c4cc27398bdc0482b531e601d4291 Author: Jelmer Vernooij <jelmer@samba.org> AuthorDate: Wed Aug 10 15:15:18 2011 +0200 Commit: Jelmer Vernooij <jelmer@samba.org> CommitDate: Wed Aug 10 15:36:21 2011 +0200 pytalloc: Use consistent prefix for functions, add ABI file. --- lib/talloc/ABI/pytalloc-util-2.0.6.sigs | 5 ++ lib/talloc/pytalloc.c | 42 +++++++++--------- lib/talloc/pytalloc.h | 36 ++++++++-------- lib/talloc/pytalloc_util.c | 22 +++++----- lib/talloc/wscript | 3 + libcli/security/pysecurity.c | 8 ++-- pidl/lib/Parse/Pidl/Samba4/Python.pm | 36 ++++++++-------- source4/auth/credentials/pycredentials.c | 60 +++++++++++++------------- source4/auth/credentials/pycredentials.h | 2 +- source4/auth/gensec/pygensec.c | 40 +++++++++--------- source4/auth/pyauth.c | 8 ++-- source4/auth/pyauth.h | 2 +- source4/lib/registry/pyregistry.c | 30 +++++++------- source4/libcli/pysmb.c | 28 ++++++------ source4/libnet/py_net.c | 9 ++-- source4/librpc/ndr/py_auth.c | 7 ++- source4/librpc/ndr/py_misc.c | 17 ++++---- source4/librpc/ndr/py_security.c | 67 +++++++++++++++--------------- source4/librpc/ndr/py_xattr.c | 2 +- source4/librpc/rpc/pyrpc_util.c | 2 +- source4/param/provision.c | 2 +- source4/param/pyparam.c | 38 ++++++++-------- source4/param/pyparam_util.c | 2 +- 23 files changed, 239 insertions(+), 229 deletions(-) Index: samba-4.0.0alpha16/lib/talloc/ABI/pytalloc-util-2.0.6.sigs =================================================================== --- /dev/null +++ samba-4.0.0alpha16/lib/talloc/ABI/pytalloc-util-2.0.6.sigs @@ -0,0 +1,5 @@ +pytalloc_CObject_FromTallocPtr: PyObject *(void *) +pytalloc_GetObjectType: PyTypeObject *(void) +pytalloc_reference_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *) +pytalloc_steal: PyObject *(PyTypeObject *, void *) +pytalloc_steal_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *) Index: samba-4.0.0alpha16/lib/talloc/pytalloc.c =================================================================== --- samba-4.0.0alpha16.orig/lib/talloc/pytalloc.c +++ samba-4.0.0alpha16/lib/talloc/pytalloc.c @@ -1,7 +1,7 @@ /* Unix SMB/CIFS implementation. Python Talloc Module - Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2010 + Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2010-2011 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 @@ -24,7 +24,7 @@ void inittalloc(void); /* print a talloc tree report for a talloc python object */ -static PyObject *py_talloc_report_full(PyObject *self, PyObject *args) +static PyObject *pytalloc_report_full(PyObject *self, PyObject *args) { PyObject *py_obj = Py_None; PyTypeObject *type; @@ -36,20 +36,20 @@ static PyObject *py_talloc_report_full(P talloc_report_full(NULL, stdout); } else { type = (PyTypeObject*)PyObject_Type(py_obj); - talloc_report_full(py_talloc_get_mem_ctx(py_obj), stdout); + talloc_report_full(pytalloc_get_mem_ctx(py_obj), stdout); } return Py_None; } /* enable null tracking */ -static PyObject *py_talloc_enable_null_tracking(PyObject *self) +static PyObject *pytalloc_enable_null_tracking(PyObject *self) { talloc_enable_null_tracking(); return Py_None; } /* return the number of talloc blocks */ -static PyObject *py_talloc_total_blocks(PyObject *self, PyObject *args) +static PyObject *pytalloc_total_blocks(PyObject *self, PyObject *args) { PyObject *py_obj = Py_None; PyTypeObject *type; @@ -63,15 +63,15 @@ static PyObject *py_talloc_total_blocks( type = (PyTypeObject*)PyObject_Type(py_obj); - return PyLong_FromLong(talloc_total_blocks(py_talloc_get_mem_ctx(py_obj))); + return PyLong_FromLong(talloc_total_blocks(pytalloc_get_mem_ctx(py_obj))); } static PyMethodDef talloc_methods[] = { - { "report_full", (PyCFunction)py_talloc_report_full, METH_VARARGS, + { "report_full", (PyCFunction)pytalloc_report_full, METH_VARARGS, "show a talloc tree for an object"}, - { "enable_null_tracking", (PyCFunction)py_talloc_enable_null_tracking, METH_NOARGS, + { "enable_null_tracking", (PyCFunction)pytalloc_enable_null_tracking, METH_NOARGS, "enable tracking of the NULL object"}, - { "total_blocks", (PyCFunction)py_talloc_total_blocks, METH_VARARGS, + { "total_blocks", (PyCFunction)pytalloc_total_blocks, METH_VARARGS, "return talloc block count"}, { NULL } }; @@ -79,9 +79,9 @@ static PyMethodDef talloc_methods[] = { /** * Default (but only slightly more useful than the default) implementation of Repr(). */ -static PyObject *py_talloc_default_repr(PyObject *obj) +static PyObject *pytalloc_default_repr(PyObject *obj) { - py_talloc_Object *talloc_obj = (py_talloc_Object *)obj; + pytalloc_Object *talloc_obj = (pytalloc_Object *)obj; PyTypeObject *type = (PyTypeObject*)PyObject_Type(obj); return PyString_FromFormat("<%s talloc object at 0x%p>", @@ -91,9 +91,9 @@ static PyObject *py_talloc_default_repr( /** * Simple dealloc for talloc-wrapping PyObjects */ -static void py_talloc_dealloc(PyObject* self) +static void pytalloc_dealloc(PyObject* self) { - py_talloc_Object *obj = (py_talloc_Object *)self; + pytalloc_Object *obj = (pytalloc_Object *)self; assert(talloc_unlink(NULL, obj->talloc_ctx) != -1); obj->talloc_ctx = NULL; self->ob_type->tp_free(self); @@ -102,24 +102,24 @@ static void py_talloc_dealloc(PyObject* /** * Default (but only slightly more useful than the default) implementation of cmp. */ -static int py_talloc_default_cmp(PyObject *_obj1, PyObject *_obj2) +static int pytalloc_default_cmp(PyObject *_obj1, PyObject *_obj2) { - py_talloc_Object *obj1 = (py_talloc_Object *)_obj1, - *obj2 = (py_talloc_Object *)_obj2; + pytalloc_Object *obj1 = (pytalloc_Object *)_obj1, + *obj2 = (pytalloc_Object *)_obj2; if (obj1->ob_type != obj2->ob_type) return (obj1->ob_type - obj2->ob_type); - return ((char *)py_talloc_get_ptr(obj1) - (char *)py_talloc_get_ptr(obj2)); + return ((char *)pytalloc_get_ptr(obj1) - (char *)pytalloc_get_ptr(obj2)); } static PyTypeObject TallocObject_Type = { .tp_name = "talloc.Object", .tp_doc = "Python wrapper for a talloc-maintained object.", - .tp_basicsize = sizeof(py_talloc_Object), - .tp_dealloc = (destructor)py_talloc_dealloc, + .tp_basicsize = sizeof(pytalloc_Object), + .tp_dealloc = (destructor)pytalloc_dealloc, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - .tp_repr = py_talloc_default_repr, - .tp_compare = py_talloc_default_cmp, + .tp_repr = pytalloc_default_repr, + .tp_compare = pytalloc_default_cmp, }; void inittalloc(void) Index: samba-4.0.0alpha16/lib/talloc/pytalloc.h =================================================================== --- samba-4.0.0alpha16.orig/lib/talloc/pytalloc.h +++ samba-4.0.0alpha16/lib/talloc/pytalloc.h @@ -17,8 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef _PY_TALLOC_H_ -#define _PY_TALLOC_H_ +#ifndef _PYTALLOC_H_ +#define _PYTALLOC_H_ #include <Python.h> #include <talloc.h> @@ -27,30 +27,28 @@ typedef struct { PyObject_HEAD TALLOC_CTX *talloc_ctx; void *ptr; -} py_talloc_Object; +} pytalloc_Object; -PyTypeObject *PyTalloc_GetObjectType(void); -int PyTalloc_Check(PyObject *); +PyTypeObject *pytalloc_GetObjectType(void); +int pytalloc_Check(PyObject *); -/* Retrieve the pointer for a py_talloc_object. Like talloc_get_type() - * but for py_talloc_Objects. */ +/* Retrieve the pointer for a pytalloc_object. Like talloc_get_type() + * but for pytalloc_Objects. */ /* FIXME: Call PyErr_SetString(PyExc_TypeError, "expected " __STR(type) ") * when talloc_get_type() returns NULL. */ -#define py_talloc_get_type(py_obj, type) (talloc_get_type(py_talloc_get_ptr(py_obj), type)) +#define pytalloc_get_type(py_obj, type) (talloc_get_type(pytalloc_get_ptr(py_obj), type)) -#define py_talloc_get_ptr(py_obj) (((py_talloc_Object *)py_obj)->ptr) -#define py_talloc_get_mem_ctx(py_obj) ((py_talloc_Object *)py_obj)->talloc_ctx +#define pytalloc_get_ptr(py_obj) (((pytalloc_Object *)py_obj)->ptr) +#define pytalloc_get_mem_ctx(py_obj) ((pytalloc_Object *)py_obj)->talloc_ctx -PyObject *py_talloc_steal_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx, void *ptr); -PyObject *py_talloc_steal(PyTypeObject *py_type, void *ptr); -PyObject *py_talloc_reference_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx, void *ptr); -#define py_talloc_reference(py_type, talloc_ptr) py_talloc_reference_ex(py_type, talloc_ptr, talloc_ptr) +PyObject *pytalloc_steal_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx, void *ptr); +PyObject *pytalloc_steal(PyTypeObject *py_type, void *ptr); +PyObject *pytalloc_reference_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx, void *ptr); +#define pytalloc_reference(py_type, talloc_ptr) pytalloc_reference_ex(py_type, talloc_ptr, talloc_ptr) -#define py_talloc_new(type, typeobj) py_talloc_steal(typeobj, talloc_zero(NULL, type)) +#define pytalloc_new(type, typeobj) pytalloc_steal(typeobj, talloc_zero(NULL, type)) -PyObject *PyCObject_FromTallocPtr(void *); +PyObject *pytalloc_CObject_FromTallocPtr(void *); -PyObject *PyString_FromString_check_null(const char *ptr); - -#endif /* _PY_TALLOC_H_ */ +#endif /* _PYTALLOC_H_ */ Index: samba-4.0.0alpha16/lib/talloc/pytalloc_util.c =================================================================== --- samba-4.0.0alpha16.orig/lib/talloc/pytalloc_util.c +++ samba-4.0.0alpha16/lib/talloc/pytalloc_util.c @@ -23,7 +23,7 @@ #include "pytalloc.h" #include <assert.h> -_PUBLIC_ PyTypeObject *PyTalloc_GetObjectType(void) +_PUBLIC_ PyTypeObject *pytalloc_GetObjectType(void) { static PyTypeObject *type = NULL; PyObject *mod; @@ -46,10 +46,10 @@ _PUBLIC_ PyTypeObject *PyTalloc_GetObjec /** * Import an existing talloc pointer into a Python object. */ -_PUBLIC_ PyObject *py_talloc_steal_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx, +_PUBLIC_ PyObject *pytalloc_steal_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx, void *ptr) { - py_talloc_Object *ret = (py_talloc_Object *)py_type->tp_alloc(py_type, 0); + pytalloc_Object *ret = (pytalloc_Object *)py_type->tp_alloc(py_type, 0); ret->talloc_ctx = talloc_new(NULL); if (ret->talloc_ctx == NULL) { return NULL; @@ -65,9 +65,9 @@ _PUBLIC_ PyObject *py_talloc_steal_ex(Py /** * Import an existing talloc pointer into a Python object. */ -_PUBLIC_ PyObject *py_talloc_steal(PyTypeObject *py_type, void *ptr) +_PUBLIC_ PyObject *pytalloc_steal(PyTypeObject *py_type, void *ptr) { - return py_talloc_steal_ex(py_type, ptr, ptr); + return pytalloc_steal_ex(py_type, ptr, ptr); } @@ -76,15 +76,15 @@ _PUBLIC_ PyObject *py_talloc_steal(PyTyp * original parent, and creating a reference to the object in the python * object */ -_PUBLIC_ PyObject *py_talloc_reference_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx, void *ptr) +_PUBLIC_ PyObject *pytalloc_reference_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx, void *ptr) { - py_talloc_Object *ret; + pytalloc_Object *ret; if (ptr == NULL) { Py_RETURN_NONE; } - ret = (py_talloc_Object *)py_type->tp_alloc(py_type, 0); + ret = (pytalloc_Object *)py_type->tp_alloc(py_type, 0); ret->talloc_ctx = talloc_new(NULL); if (ret->talloc_ctx == NULL) { return NULL; @@ -102,7 +102,7 @@ static void py_cobject_talloc_free(void talloc_free(ptr); } -_PUBLIC_ PyObject *PyCObject_FromTallocPtr(void *ptr) +_PUBLIC_ PyObject *pytalloc_CObject_FromTallocPtr(void *ptr) { if (ptr == NULL) { Py_RETURN_NONE; @@ -110,9 +110,9 @@ _PUBLIC_ PyObject *PyCObject_FromTallocP return PyCObject_FromVoidPtr(ptr, py_cobject_talloc_free); } -_PUBLIC_ int PyTalloc_Check(PyObject *obj) +_PUBLIC_ int pytalloc_Check(PyObject *obj) { - PyTypeObject *tp = PyTalloc_GetObjectType(); + PyTypeObject *tp = pytalloc_GetObjectType(); return PyObject_TypeCheck(obj, tp); } Index: samba-4.0.0alpha16/lib/talloc/wscript =================================================================== --- samba-4.0.0alpha16.orig/lib/talloc/wscript +++ samba-4.0.0alpha16/lib/talloc/wscript @@ -109,6 +109,9 @@ def build(bld): public_deps='talloc', pyext=True, vnum=VERSION, + hide_symbols=True, + abi_directory='ABI', + abi_match='pytalloc_*', private_library=private_library, public_headers='pytalloc.h' ) Index: samba-4.0.0alpha16/libcli/security/pysecurity.c =================================================================== --- samba-4.0.0alpha16.orig/libcli/security/pysecurity.c +++ samba-4.0.0alpha16/libcli/security/pysecurity.c @@ -44,19 +44,19 @@ static PyObject *py_se_access_check(PyOb return NULL; } - security_descriptor = py_talloc_get_type(py_sec_desc, struct security_descriptor); + security_descriptor = pytalloc_get_type(py_sec_desc, struct security_descriptor); if (!security_descriptor) { PyErr_Format(PyExc_TypeError, "Expected dcerpc.security.descriptor for security_descriptor argument got %s", - talloc_get_name(py_talloc_get_ptr(py_sec_desc))); + talloc_get_name(pytalloc_get_ptr(py_sec_desc))); return NULL; } - security_token = py_talloc_get_type(py_security_token, struct security_token); + security_token = pytalloc_get_type(py_security_token, struct security_token); if (!security_token) { PyErr_Format(PyExc_TypeError, "Expected dcerpc.security.token for token argument, got %s", - talloc_get_name(py_talloc_get_ptr(py_security_token))); + talloc_get_name(pytalloc_get_ptr(py_security_token))); return NULL; } Index: samba-4.0.0alpha16/pidl/lib/Parse/Pidl/Samba4/Python.pm =================================================================== --- samba-4.0.0alpha16.orig/pidl/lib/Parse/Pidl/Samba4/Python.pm +++ samba-4.0.0alpha16/pidl/lib/Parse/Pidl/Samba4/Python.pm @@ -200,9 +200,9 @@ sub PythonStruct($$$$$$) $self->pidl("static PyObject *py_$name\_get_$e->{NAME}(PyObject *obj, void *closure)"); $self->pidl("{"); $self->indent; - $self->pidl("$cname *object = ($cname *)py_talloc_get_ptr(obj);"); + $self->pidl("$cname *object = ($cname *)pytalloc_get_ptr(obj);"); $self->pidl("PyObject *py_$e->{NAME};"); - $self->ConvertObjectToPython("py_talloc_get_mem_ctx(obj)", $env, $e, $varname, "py_$e->{NAME}", "return NULL;"); + $self->ConvertObjectToPython("pytalloc_get_mem_ctx(obj)", $env, $e, $varname, "py_$e->{NAME}", "return NULL;"); $self->pidl("return py_$e->{NAME};"); $self->deindent; $self->pidl("}"); @@ -211,14 +211,14 @@ sub PythonStruct($$$$$$) $self->pidl("static int py_$name\_set_$e->{NAME}(PyObject *py_obj, PyObject *value, void *closure)"); $self->pidl("{"); $self->indent; - $self->pidl("$cname *object = ($cname *)py_talloc_get_ptr(py_obj);"); - my $mem_ctx = "py_talloc_get_mem_ctx(py_obj)"; + $self->pidl("$cname *object = ($cname *)pytalloc_get_ptr(py_obj);"); + my $mem_ctx = "pytalloc_get_mem_ctx(py_obj)"; my $l = $e->{LEVELS}[0]; my $nl = GetNextLevel($e, $l); if ($l->{TYPE} eq "POINTER" and not ($nl->{TYPE} eq "ARRAY" and ($nl->{IS_FIXED} or is_charset_array($e, $nl))) and not ($nl->{TYPE} eq "DATA" and Parse::Pidl::Typelist::scalar_is_reference($nl->{DATA_TYPE}))) { - $self->pidl("talloc_unlink(py_talloc_get_mem_ctx(py_obj), $varname);"); + $self->pidl("talloc_unlink(pytalloc_get_mem_ctx(py_obj), $varname);"); } $self->ConvertObjectFromPython($env, $mem_ctx, $e, "value", $varname, "return -1;"); $self->pidl("return 0;"); @@ -242,7 +242,7 @@ sub PythonStruct($$$$$$) $self->pidl("static PyObject *py_$name\_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)"); $self->pidl("{"); $self->indent; - $self->pidl("return py_talloc_new($cname, type);"); + $self->pidl("return pytalloc_new($cname, type);"); $self->deindent; $self->pidl("}"); $self->pidl(""); @@ -255,10 +255,10 @@ sub PythonStruct($$$$$$) $self->pidl("static PyObject *py_$name\_ndr_pack(PyObject *py_obj)"); $self->pidl("{"); $self->indent; - $self->pidl("$cname *object = ($cname *)py_talloc_get_ptr(py_obj);"); + $self->pidl("$cname *object = ($cname *)pytalloc_get_ptr(py_obj);"); $self->pidl("DATA_BLOB blob;"); $self->pidl("enum ndr_err_code err;"); - $self->pidl("err = ndr_push_struct_blob(&blob, py_talloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_$name);"); + $self->pidl("err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_$name);"); $self->pidl("if (err != NDR_ERR_SUCCESS) {"); $self->indent; $self->pidl("PyErr_SetNdrError(err);"); @@ -274,13 +274,13 @@ sub PythonStruct($$$$$$) $self->pidl("static PyObject *py_$name\_ndr_unpack(PyObject *py_obj, PyObject *args)"); $self->pidl("{"); $self->indent; - $self->pidl("$cname *object = ($cname *)py_talloc_get_ptr(py_obj);"); + $self->pidl("$cname *object = ($cname *)pytalloc_get_ptr(py_obj);"); $self->pidl("DATA_BLOB blob;"); $self->pidl("enum ndr_err_code err;"); $self->pidl("if (!PyArg_ParseTuple(args, \"s#:__ndr_unpack__\", &blob.data, &blob.length))"); $self->pidl("\treturn NULL;"); $self->pidl(""); - $self->pidl("err = ndr_pull_struct_blob_all(&blob, py_talloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_$name);"); + $self->pidl("err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_$name);"); $self->pidl("if (err != NDR_ERR_SUCCESS) {"); $self->indent; $self->pidl("PyErr_SetNdrError(err);"); @@ -296,11 +296,11 @@ sub PythonStruct($$$$$$) $self->pidl("static PyObject *py_$name\_ndr_print(PyObject *py_obj)"); $self->pidl("{"); $self->indent; - $self->pidl("$cname *object = ($cname *)py_talloc_get_ptr(py_obj);"); + $self->pidl("$cname *object = ($cname *)pytalloc_get_ptr(py_obj);"); $self->pidl("PyObject *ret;"); $self->pidl("char *retstr;"); $self->pidl(""); - $self->pidl("retstr = ndr_print_struct_string(py_talloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_$name, \"$name\", object);"); + $self->pidl("retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_$name, \"$name\", object);"); $self->pidl("ret = PyString_FromString(retstr);"); $self->pidl("talloc_free(retstr);"); $self->pidl(""); @@ -335,7 +335,7 @@ sub PythonStruct($$$$$$) } $self->pidl(".tp_methods = $py_methods,"); $self->pidl(".tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,"); - $self->pidl(".tp_basicsize = sizeof(py_talloc_Object),"); + $self->pidl(".tp_basicsize = sizeof(pytalloc_Object),"); $self->pidl(".tp_new = py_$name\_new,"); $self->deindent; $self->pidl("};"); @@ -919,13 +919,13 @@ sub ConvertObjectFromPythonData($$$$$$;$ return; } $self->pidl("PY_CHECK_TYPE($ctype_name, $cvar, $fail);"); - $self->pidl("if (talloc_reference($mem_ctx, py_talloc_get_mem_ctx($cvar)) == NULL) {"); + $self->pidl("if (talloc_reference($mem_ctx, pytalloc_get_mem_ctx($cvar)) == NULL) {"); $self->indent; $self->pidl("PyErr_NoMemory();"); $self->pidl("$fail"); $self->deindent; $self->pidl("}"); - $self->assign($target, "(".mapTypeName($ctype)." *)py_talloc_get_ptr($cvar)"); + $self->assign($target, "(".mapTypeName($ctype)." *)pytalloc_get_ptr($cvar)"); return; } @@ -1137,13 +1137,13 @@ sub ConvertScalarToPython($$$) } # Not yet supported - if ($ctypename eq "string_array") { return "PyCObject_FromTallocPtr($cvar)"; } + if ($ctypename eq "string_array") { return "pytalloc_CObject_FromTallocPtr($cvar)"; } if ($ctypename eq "ipv4address") { return "PyString_FromStringOrNULL($cvar)"; } if ($ctypename eq "ipv6address") { return "PyString_FromStringOrNULL($cvar)"; } if ($ctypename eq "dnsp_name") { return "PyString_FromStringOrNULL($cvar)"; } if ($ctypename eq "dnsp_string") { return "PyString_FromStringOrNULL($cvar)"; } if ($ctypename eq "pointer") { - return "PyCObject_FromTallocPtr($cvar)"; + return "pytalloc_CObject_FromTallocPtr($cvar)"; } die("Unknown scalar type $ctypename"); @@ -1176,7 +1176,7 @@ sub ConvertObjectToPythonData($$$$$;$) error($location, "Unable to determine origin of type `" . mapTypeName($ctype) . "'"); return "NULL"; # FIXME! } - return "py_talloc_reference_ex($ctype_name, $mem_ctx, $cvar)"; + return "pytalloc_reference_ex($ctype_name, $mem_ctx, $cvar)"; } fatal($location, "unknown type $actual_ctype->{TYPE} for ".mapTypeName($ctype) . ": $cvar"); Index: samba-4.0.0alpha16/source4/auth/credentials/pycredentials.c =================================================================== --- samba-4.0.0alpha16.orig/source4/auth/credentials/pycredentials.c +++ samba-4.0.0alpha16/source4/auth/credentials/pycredentials.c @@ -37,7 +37,7 @@ static PyObject *PyString_FromStringOrNU static PyObject *py_creds_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { - py_talloc_Object *ret = (py_talloc_Object *)type->tp_alloc(type, 0); + pytalloc_Object *ret = (pytalloc_Object *)type->tp_alloc(type, 0); if (ret == NULL) { PyErr_NoMemory(); return NULL; @@ -51,12 +51,12 @@ static PyObject *py_creds_new(PyTypeObje return (PyObject *)ret; } -static PyObject *py_creds_get_username(py_talloc_Object *self) +static PyObject *py_creds_get_username(pytalloc_Object *self) { return PyString_FromStringOrNULL(cli_credentials_get_username(PyCredentials_AsCliCredentials(self))); } -static PyObject *py_creds_set_username(py_talloc_Object *self, PyObject *args) +static PyObject *py_creds_set_username(pytalloc_Object *self, PyObject *args) { char *newval; enum credentials_obtained obt = CRED_SPECIFIED; @@ -66,13 +66,13 @@ static PyObject *py_creds_set_username(p return PyBool_FromLong(cli_credentials_set_username(PyCredentials_AsCliCredentials(self), newval, obt)); } -static PyObject *py_creds_get_password(py_talloc_Object *self) +static PyObject *py_creds_get_password(pytalloc_Object *self) { return PyString_FromStringOrNULL(cli_credentials_get_password(PyCredentials_AsCliCredentials(self))); } -static PyObject *py_creds_set_password(py_talloc_Object *self, PyObject *args) +static PyObject *py_creds_set_password(pytalloc_Object *self, PyObject *args) { char *newval; enum credentials_obtained obt = CRED_SPECIFIED; @@ -82,12 +82,12 @@ static PyObject *py_creds_set_password(p return PyBool_FromLong(cli_credentials_set_password(PyCredentials_AsCliCredentials(self), newval, obt)); } -static PyObject *py_creds_get_domain(py_talloc_Object *self) +static PyObject *py_creds_get_domain(pytalloc_Object *self) { return PyString_FromStringOrNULL(cli_credentials_get_domain(PyCredentials_AsCliCredentials(self))); } -static PyObject *py_creds_set_domain(py_talloc_Object *self, PyObject *args) +static PyObject *py_creds_set_domain(pytalloc_Object *self, PyObject *args) { char *newval; enum credentials_obtained obt = CRED_SPECIFIED; @@ -97,12 +97,12 @@ static PyObject *py_creds_set_domain(py_ return PyBool_FromLong(cli_credentials_set_domain(PyCredentials_AsCliCredentials(self), newval, obt)); } -static PyObject *py_creds_get_realm(py_talloc_Object *self) +static PyObject *py_creds_get_realm(pytalloc_Object *self) { return PyString_FromStringOrNULL(cli_credentials_get_realm(PyCredentials_AsCliCredentials(self))); } -static PyObject *py_creds_set_realm(py_talloc_Object *self, PyObject *args) +static PyObject *py_creds_set_realm(pytalloc_Object *self, PyObject *args) { char *newval; enum credentials_obtained obt = CRED_SPECIFIED; @@ -112,12 +112,12 @@ static PyObject *py_creds_set_realm(py_t return PyBool_FromLong(cli_credentials_set_realm(PyCredentials_AsCliCredentials(self), newval, obt)); } -static PyObject *py_creds_get_bind_dn(py_talloc_Object *self) +static PyObject *py_creds_get_bind_dn(pytalloc_Object *self) { return PyString_FromStringOrNULL(cli_credentials_get_bind_dn(PyCredentials_AsCliCredentials(self))); } -static PyObject *py_creds_set_bind_dn(py_talloc_Object *self, PyObject *args) +static PyObject *py_creds_set_bind_dn(pytalloc_Object *self, PyObject *args) { char *newval; if (!PyArg_ParseTuple(args, "s", &newval)) @@ -126,12 +126,12 @@ static PyObject *py_creds_set_bind_dn(py return PyBool_FromLong(cli_credentials_set_bind_dn(PyCredentials_AsCliCredentials(self), newval)); } -static PyObject *py_creds_get_workstation(py_talloc_Object *self) +static PyObject *py_creds_get_workstation(pytalloc_Object *self) { return PyString_FromStringOrNULL(cli_credentials_get_workstation(PyCredentials_AsCliCredentials(self))); } -static PyObject *py_creds_set_workstation(py_talloc_Object *self, PyObject *args) +static PyObject *py_creds_set_workstation(pytalloc_Object *self, PyObject *args) { char *newval; enum credentials_obtained obt = CRED_SPECIFIED; @@ -141,33 +141,33 @@ static PyObject *py_creds_set_workstatio return PyBool_FromLong(cli_credentials_set_workstation(PyCredentials_AsCliCredentials(self), newval, obt)); } -static PyObject *py_creds_is_anonymous(py_talloc_Object *self) +static PyObject *py_creds_is_anonymous(pytalloc_Object *self) { return PyBool_FromLong(cli_credentials_is_anonymous(PyCredentials_AsCliCredentials(self))); } -static PyObject *py_creds_set_anonymous(py_talloc_Object *self) +static PyObject *py_creds_set_anonymous(pytalloc_Object *self) { cli_credentials_set_anonymous(PyCredentials_AsCliCredentials(self)); Py_RETURN_NONE; } -static PyObject *py_creds_authentication_requested(py_talloc_Object *self) +static PyObject *py_creds_authentication_requested(pytalloc_Object *self) { return PyBool_FromLong(cli_credentials_authentication_requested(PyCredentials_AsCliCredentials(self))); } -static PyObject *py_creds_wrong_password(py_talloc_Object *self) +static PyObject *py_creds_wrong_password(pytalloc_Object *self) { return PyBool_FromLong(cli_credentials_wrong_password(PyCredentials_AsCliCredentials(self))); } -static PyObject *py_creds_set_cmdline_callbacks(py_talloc_Object *self) +static PyObject *py_creds_set_cmdline_callbacks(pytalloc_Object *self) { return PyBool_FromLong(cli_credentials_set_cmdline_callbacks(PyCredentials_AsCliCredentials(self))); } -static PyObject *py_creds_parse_string(py_talloc_Object *self, PyObject *args) +static PyObject *py_creds_parse_string(pytalloc_Object *self, PyObject *args) { char *newval; enum credentials_obtained obt = CRED_SPECIFIED; @@ -178,14 +178,14 @@ static PyObject *py_creds_parse_string(p Py_RETURN_NONE; } -static PyObject *py_creds_get_nt_hash(py_talloc_Object *self) +static PyObject *py_creds_get_nt_hash(pytalloc_Object *self) { const struct samr_Password *ntpw = cli_credentials_get_nt_hash(PyCredentials_AsCliCredentials(self), self->ptr); return PyString_FromStringAndSize(discard_const_p(char, ntpw->hash), 16); } -static PyObject *py_creds_set_kerberos_state(py_talloc_Object *self, PyObject *args) +static PyObject *py_creds_set_kerberos_state(pytalloc_Object *self, PyObject *args) { int state; if (!PyArg_ParseTuple(args, "i", &state)) @@ -195,7 +195,7 @@ static PyObject *py_creds_set_kerberos_s Py_RETURN_NONE; } -static PyObject *py_creds_set_krb_forwardable(py_talloc_Object *self, PyObject *args) +static PyObject *py_creds_set_krb_forwardable(pytalloc_Object *self, PyObject *args) { int state; if (!PyArg_ParseTuple(args, "i", &state)) @@ -205,7 +205,7 @@ static PyObject *py_creds_set_krb_forwar Py_RETURN_NONE; } -static PyObject *py_creds_guess(py_talloc_Object *self, PyObject *args) +static PyObject *py_creds_guess(pytalloc_Object *self, PyObject *args) { PyObject *py_lp_ctx = Py_None; struct loadparm_context *lp_ctx; @@ -236,7 +236,7 @@ static PyObject *py_creds_guess(py_tallo Py_RETURN_NONE; } -static PyObject *py_creds_set_machine_account(py_talloc_Object *self, PyObject *args) +static PyObject *py_creds_set_machine_account(pytalloc_Object *self, PyObject *args) { PyObject *py_lp_ctx = Py_None; struct loadparm_context *lp_ctx; @@ -288,7 +288,7 @@ static PyObject *PyCredentialCacheContai } -static PyObject *py_creds_get_named_ccache(py_talloc_Object *self, PyObject *args) +static PyObject *py_creds_get_named_ccache(pytalloc_Object *self, PyObject *args) { PyObject *py_lp_ctx = Py_None; char *ccache_name; @@ -334,7 +334,7 @@ static PyObject *py_creds_get_named_ccac return NULL; } -static PyObject *py_creds_set_gensec_features(py_talloc_Object *self, PyObject *args) +static PyObject *py_creds_set_gensec_features(pytalloc_Object *self, PyObject *args) { unsigned int gensec_features; @@ -346,7 +346,7 @@ static PyObject *py_creds_set_gensec_fea Py_RETURN_NONE; } -static PyObject *py_creds_get_gensec_features(py_talloc_Object *self, PyObject *args) +static PyObject *py_creds_get_gensec_features(pytalloc_Object *self, PyObject *args) { unsigned int gensec_features; @@ -421,7 +421,7 @@ static PyMethodDef py_creds_methods[] = PyTypeObject PyCredentials = { .tp_name = "Credentials", - .tp_basicsize = sizeof(py_talloc_Object), + .tp_basicsize = sizeof(pytalloc_Object), .tp_new = py_creds_new, .tp_flags = Py_TPFLAGS_DEFAULT, .tp_methods = py_creds_methods, @@ -430,14 +430,14 @@ PyTypeObject PyCredentials = { PyTypeObject PyCredentialCacheContainer = { .tp_name = "CredentialCacheContainer", - .tp_basicsize = sizeof(py_talloc_Object), + .tp_basicsize = sizeof(pytalloc_Object), .tp_flags = Py_TPFLAGS_DEFAULT, }; void initcredentials(void) { PyObject *m; - PyTypeObject *talloc_type = PyTalloc_GetObjectType(); + PyTypeObject *talloc_type = pytalloc_GetObjectType(); if (talloc_type == NULL) return; Index: samba-4.0.0alpha16/source4/auth/credentials/pycredentials.h =================================================================== --- samba-4.0.0alpha16.orig/source4/auth/credentials/pycredentials.h +++ samba-4.0.0alpha16/source4/auth/credentials/pycredentials.h @@ -30,7 +30,7 @@ typedef struct { struct ccache_container *ccc; } PyCredentialCacheContainerObject; #define PyCredentials_Check(py_obj) PyObject_TypeCheck(py_obj, &PyCredentials) -#define PyCredentials_AsCliCredentials(py_obj) py_talloc_get_type(py_obj, struct cli_credentials) +#define PyCredentials_AsCliCredentials(py_obj) pytalloc_get_type(py_obj, struct cli_credentials) #define cli_credentials_from_py_object(py_obj) (py_obj == Py_None)?cli_credentials_init_anon(NULL):PyCredentials_AsCliCredentials(py_obj) #endif /* _PYCREDENTIALS_H_ */ Index: samba-4.0.0alpha16/source4/auth/gensec/pygensec.c =================================================================== --- samba-4.0.0alpha16.orig/source4/auth/gensec/pygensec.c +++ samba-4.0.0alpha16/source4/auth/gensec/pygensec.c @@ -36,7 +36,7 @@ static PyObject *py_get_name_by_authtype if (!PyArg_ParseTuple(args, "i", &type)) return NULL; - security = py_talloc_get_type(self, struct gensec_security); + security = pytalloc_get_type(self, struct gensec_security); name = gensec_get_name_by_authtype(security, type); if (name == NULL) @@ -78,7 +78,7 @@ static struct gensec_settings *settings_ static PyObject *py_gensec_start_client(PyTypeObject *type, PyObject *args, PyObject *kwargs) { NTSTATUS status; - py_talloc_Object *self; + pytalloc_Object *self; struct gensec_settings *settings; const char *kwnames[] = { "settings", NULL }; PyObject *py_settings; @@ -88,7 +88,7 @@ static PyObject *py_gensec_start_client( if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O", discard_const_p(char *, kwnames), &py_settings)) return NULL; - self = (py_talloc_Object*)type->tp_alloc(type, 0); + self = (pytalloc_Object*)type->tp_alloc(type, 0); if (self == NULL) { PyErr_NoMemory(); return NULL; @@ -149,7 +149,7 @@ static PyObject *py_gensec_start_client( static PyObject *py_gensec_start_server(PyTypeObject *type, PyObject *args, PyObject *kwargs) { NTSTATUS status; - py_talloc_Object *self; + pytalloc_Object *self; struct gensec_settings *settings = NULL; const char *kwnames[] = { "settings", "auth_context", NULL }; PyObject *py_settings = Py_None; @@ -161,7 +161,7 @@ static PyObject *py_gensec_start_server( if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO", discard_const_p(char *, kwnames), &py_settings, &py_auth_context)) return NULL; - self = (py_talloc_Object*)type->tp_alloc(type, 0); + self = (pytalloc_Object*)type->tp_alloc(type, 0); if (self == NULL) { PyErr_NoMemory(); return NULL; @@ -201,11 +201,11 @@ static PyObject *py_gensec_start_server( } if (py_auth_context != Py_None) { - auth_context = py_talloc_get_type(py_auth_context, struct auth4_context); + auth_context = pytalloc_get_type(py_auth_context, struct auth4_context); if (!auth_context) { PyErr_Format(PyExc_TypeError, "Expected auth.AuthContext for auth_context argument, got %s", - talloc_get_name(py_talloc_get_ptr(py_auth_context))); + talloc_get_name(pytalloc_get_ptr(py_auth_context))); return NULL; } } @@ -233,7 +233,7 @@ static PyObject *py_gensec_set_credentia { PyObject *py_creds = Py_None; struct cli_credentials *creds; - struct gensec_security *security = py_talloc_get_type(self, struct gensec_security); + struct gensec_security *security = pytalloc_get_type(self, struct gensec_security); NTSTATUS status; if (!PyArg_ParseTuple(args, "O", &py_creds)) @@ -243,7 +243,7 @@ static PyObject *py_gensec_set_credentia if (!creds) { PyErr_Format(PyExc_TypeError, "Expected samba.credentaials for credentials argument got %s", - talloc_get_name(py_talloc_get_ptr(py_creds))); + talloc_get_name(pytalloc_get_ptr(py_creds))); } status = gensec_set_credentials(security, creds); @@ -259,7 +259,7 @@ static PyObject *py_gensec_session_info( { NTSTATUS status; PyObject *py_session_info; - struct gensec_security *security = py_talloc_get_type(self, struct gensec_security); + struct gensec_security *security = pytalloc_get_type(self, struct gensec_security); struct auth_session_info *info; if (security->ops == NULL) { PyErr_SetString(PyExc_RuntimeError, "no mechanism selected"); @@ -279,7 +279,7 @@ static PyObject *py_gensec_session_info( static PyObject *py_gensec_start_mech_by_name(PyObject *self, PyObject *args) { char *name; - struct gensec_security *security = py_talloc_get_type(self, struct gensec_security); + struct gensec_security *security = pytalloc_get_type(self, struct gensec_security); NTSTATUS status; if (!PyArg_ParseTuple(args, "s", &name)) @@ -297,7 +297,7 @@ static PyObject *py_gensec_start_mech_by static PyObject *py_gensec_start_mech_by_sasl_name(PyObject *self, PyObject *args) { char *sasl_name; - struct gensec_security *security = py_talloc_get_type(self, struct gensec_security); + struct gensec_security *security = pytalloc_get_type(self, struct gensec_security); NTSTATUS status; if (!PyArg_ParseTuple(args, "s", &sasl_name)) @@ -315,7 +315,7 @@ static PyObject *py_gensec_start_mech_by static PyObject *py_gensec_start_mech_by_authtype(PyObject *self, PyObject *args) { int authtype, level; - struct gensec_security *security = py_talloc_get_type(self, struct gensec_security); + struct gensec_security *security = pytalloc_get_type(self, struct gensec_security); NTSTATUS status; if (!PyArg_ParseTuple(args, "ii", &authtype, &level)) return NULL; @@ -332,7 +332,7 @@ static PyObject *py_gensec_start_mech_by static PyObject *py_gensec_want_feature(PyObject *self, PyObject *args) { int feature; - struct gensec_security *security = py_talloc_get_type(self, struct gensec_security); + struct gensec_security *security = pytalloc_get_type(self, struct gensec_security); /* This is i (and declared as an int above) by design, as they are handled as an integer in python */ if (!PyArg_ParseTuple(args, "i", &feature)) return NULL; @@ -345,7 +345,7 @@ static PyObject *py_gensec_want_feature( static PyObject *py_gensec_have_feature(PyObject *self, PyObject *args) { int feature; - struct gensec_security *security = py_talloc_get_type(self, struct gensec_security); + struct gensec_security *security = pytalloc_get_type(self, struct gensec_security); /* This is i (and declared as an int above) by design, as they are handled as an integer in python */ if (!PyArg_ParseTuple(args, "i", &feature)) return NULL; @@ -362,7 +362,7 @@ static PyObject *py_gensec_update(PyObje TALLOC_CTX *mem_ctx; DATA_BLOB in, out; PyObject *ret, *py_in; - struct gensec_security *security = py_talloc_get_type(self, struct gensec_security); + struct gensec_security *security = pytalloc_get_type(self, struct gensec_security); PyObject *finished_processing; if (!PyArg_ParseTuple(args, "O", &py_in)) @@ -405,7 +405,7 @@ static PyObject *py_gensec_wrap(PyObject TALLOC_CTX *mem_ctx; DATA_BLOB in, out; PyObject *ret, *py_in; - struct gensec_security *security = py_talloc_get_type(self, struct gensec_security); + struct gensec_security *security = pytalloc_get_type(self, struct gensec_security); if (!PyArg_ParseTuple(args, "O", &py_in)) return NULL; @@ -439,7 +439,7 @@ static PyObject *py_gensec_unwrap(PyObje TALLOC_CTX *mem_ctx; DATA_BLOB in, out; PyObject *ret, *py_in; - struct gensec_security *security = py_talloc_get_type(self, struct gensec_security); + struct gensec_security *security = pytalloc_get_type(self, struct gensec_security); if (!PyArg_ParseTuple(args, "O", &py_in)) return NULL; @@ -501,7 +501,7 @@ static PyTypeObject Py_Security = { .tp_name = "Security", .tp_flags = Py_TPFLAGS_DEFAULT, .tp_methods = py_gensec_security_methods, - .tp_basicsize = sizeof(py_talloc_Object), + .tp_basicsize = sizeof(pytalloc_Object), }; void initgensec(void); @@ -509,7 +509,7 @@ void initgensec(void) { PyObject *m; - Py_Security.tp_base = PyTalloc_GetObjectType(); + Py_Security.tp_base = pytalloc_GetObjectType(); if (Py_Security.tp_base == NULL) return; Index: samba-4.0.0alpha16/source4/auth/pyauth.c =================================================================== --- samba-4.0.0alpha16.orig/source4/auth/pyauth.c +++ samba-4.0.0alpha16/source4/auth/pyauth.c @@ -207,7 +207,7 @@ static const char **PyList_AsStringList( static PyObject *PyAuthContext_FromContext(struct auth4_context *auth_context) { - return py_talloc_reference(&PyAuthContext, auth_context); + return pytalloc_reference(&PyAuthContext, auth_context); } static PyObject *py_auth_context_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) @@ -252,7 +252,7 @@ static PyObject *py_auth_context_new(PyT } if (py_imessaging_ctx != Py_None) { - imessaging_context = py_talloc_get_type(py_imessaging_ctx, struct imessaging_context); + imessaging_context = pytalloc_get_type(py_imessaging_ctx, struct imessaging_context); } if (py_methods == Py_None && py_ldb == Py_None) { @@ -298,10 +298,10 @@ static PyObject *py_auth_context_new(PyT static PyTypeObject PyAuthContext = { .tp_name = "AuthContext", - .tp_basicsize = sizeof(py_talloc_Object), + .tp_basicsize = sizeof(pytalloc_Object), .tp_flags = Py_TPFLAGS_DEFAULT, .tp_new = py_auth_context_new, - .tp_basicsize = sizeof(py_talloc_Object), + .tp_basicsize = sizeof(pytalloc_Object), }; static PyMethodDef py_auth_methods[] = { @@ -315,7 +315,7 @@ void initauth(void) { PyObject *m; - PyAuthContext.tp_base = PyTalloc_GetObjectType(); + PyAuthContext.tp_base = pytalloc_GetObjectType(); if (PyAuthContext.tp_base == NULL) return; Index: samba-4.0.0alpha16/source4/auth/pyauth.h =================================================================== --- samba-4.0.0alpha16.orig/source4/auth/pyauth.h +++ samba-4.0.0alpha16/source4/auth/pyauth.h @@ -23,7 +23,7 @@ #include <pytalloc.h> #include "auth/session.h" -#define PyAuthSession_AsSession(obj) py_talloc_get_type(obj, struct auth_session_info) +#define PyAuthSession_AsSession(obj) pytalloc_get_type(obj, struct auth_session_info) struct auth_session_info *PyObject_AsSession(PyObject *obj); #endif /* _PYAUTH_H */ Index: samba-4.0.0alpha16/source4/lib/registry/pyregistry.c =================================================================== --- samba-4.0.0alpha16.orig/source4/lib/registry/pyregistry.c +++ samba-4.0.0alpha16/source4/lib/registry/pyregistry.c @@ -33,9 +33,9 @@ extern PyTypeObject PyHiveKey; void initregistry(void); -/*#define PyRegistryKey_AsRegistryKey(obj) py_talloc_get_type(obj, struct registry_key)*/ -#define PyRegistry_AsRegistryContext(obj) ((struct registry_context *)py_talloc_get_ptr(obj)) -#define PyHiveKey_AsHiveKey(obj) ((struct hive_key*)py_talloc_get_ptr(obj)) +/*#define PyRegistryKey_AsRegistryKey(obj) pytalloc_get_type(obj, struct registry_key)*/ +#define PyRegistry_AsRegistryContext(obj) ((struct registry_context *)pytalloc_get_ptr(obj)) +#define PyHiveKey_AsHiveKey(obj) ((struct hive_key*)pytalloc_get_ptr(obj)) static PyObject *py_get_predefined_key_by_name(PyObject *self, PyObject *args) @@ -51,7 +51,7 @@ static PyObject *py_get_predefined_key_b result = reg_get_predefined_key_by_name(ctx, name, &key); PyErr_WERROR_IS_ERR_RAISE(result); - return py_talloc_steal(&PyRegistryKey, key); + return pytalloc_steal(&PyRegistryKey, key); } static PyObject *py_key_del_abs(PyObject *self, PyObject *args) @@ -82,7 +82,7 @@ static PyObject *py_get_predefined_key(P result = reg_get_predefined_key(ctx, hkey, &key); PyErr_WERROR_IS_ERR_RAISE(result); - return py_talloc_steal(&PyRegistryKey, key); + return pytalloc_steal(&PyRegistryKey, key); } static PyObject *py_diff_apply(PyObject *self, PyObject *args) @@ -138,7 +138,7 @@ static PyObject *registry_new(PyTypeObje struct registry_context *ctx; result = reg_open_local(NULL, &ctx); PyErr_WERROR_IS_ERR_RAISE(result); - return py_talloc_steal(&PyRegistry, ctx); + return pytalloc_steal(&PyRegistry, ctx); } static PyMethodDef registry_methods[] = { @@ -160,7 +160,7 @@ PyTypeObject PyRegistry = { .tp_name = "Registry", .tp_methods = registry_methods, .tp_new = registry_new, - .tp_basicsize = sizeof(py_talloc_Object), + .tp_basicsize = sizeof(pytalloc_Object), .tp_flags = Py_TPFLAGS_DEFAULT, }; @@ -290,20 +290,20 @@ static PyObject *py_open_hive(PyTypeObje talloc_free(mem_ctx); PyErr_WERROR_IS_ERR_RAISE(result); - return py_talloc_steal(&PyHiveKey, hive_key); + return pytalloc_steal(&PyHiveKey, hive_key); } PyTypeObject PyHiveKey = { .tp_name = "HiveKey", .tp_methods = hive_key_methods, .tp_new = hive_new, - .tp_basicsize = sizeof(py_talloc_Object), + .tp_basicsize = sizeof(pytalloc_Object), .tp_flags = Py_TPFLAGS_DEFAULT, }; PyTypeObject PyRegistryKey = { .tp_name = "RegistryKey", - .tp_basicsize = sizeof(py_talloc_Object), + .tp_basicsize = sizeof(pytalloc_Object), .tp_flags = Py_TPFLAGS_DEFAULT, }; @@ -354,7 +354,7 @@ static PyObject *py_open_samba(PyObject return NULL; } - return py_talloc_steal(&PyRegistry, reg_ctx); + return pytalloc_steal(&PyRegistry, reg_ctx); } static PyObject *py_open_directory(PyObject *self, PyObject *args) @@ -369,7 +369,7 @@ static PyObject *py_open_directory(PyObj result = reg_open_directory(NULL, location, &key); PyErr_WERROR_IS_ERR_RAISE(result); - return py_talloc_steal(&PyHiveKey, key); + return pytalloc_steal(&PyHiveKey, key); } static PyObject *py_create_directory(PyObject *self, PyObject *args) @@ -384,7 +384,7 @@ static PyObject *py_create_directory(PyO result = reg_create_directory(NULL, location, &key); PyErr_WERROR_IS_ERR_RAISE(result); - return py_talloc_steal(&PyHiveKey, key); + return pytalloc_steal(&PyHiveKey, key); } static PyObject *py_open_ldb_file(PyObject *self, PyObject *args, PyObject *kwargs) @@ -432,7 +432,7 @@ static PyObject *py_open_ldb_file(PyObje talloc_free(mem_ctx); PyErr_WERROR_IS_ERR_RAISE(result); - return py_talloc_steal(&PyHiveKey, key); + return pytalloc_steal(&PyHiveKey, key); } static PyObject *py_str_regtype(PyObject *self, PyObject *args) @@ -473,7 +473,7 @@ static PyMethodDef py_registry_methods[] void initregistry(void) { PyObject *m; - PyTypeObject *talloc_type = PyTalloc_GetObjectType(); + PyTypeObject *talloc_type = pytalloc_GetObjectType(); if (talloc_type == NULL) return; Index: samba-4.0.0alpha16/source4/libnet/py_net.c =================================================================== --- samba-4.0.0alpha16.orig/source4/libnet/py_net.c +++ samba-4.0.0alpha16/source4/libnet/py_net.c @@ -1,6 +1,7 @@ /* Unix SMB/CIFS implementation. Samba utility functions + Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2008-2010 Copyright (C) Kamen Mazdrashki <kamen.mazdrashki@postpath.com> 2009 @@ -285,7 +286,7 @@ static PyObject *py_dom_sid_FromSid(stru if (dom_sid_Type == NULL) return NULL; - return py_talloc_reference((PyTypeObject *)dom_sid_Type, sid); + return pytalloc_reference((PyTypeObject *)dom_sid_Type, sid); } static PyObject *py_net_vampire(py_net_Object *self, PyObject *args, PyObject *kwargs) @@ -396,7 +397,7 @@ static PyObject *py_net_replicate_init(p s->chunk.forest = &s->forest; s->chunk.dest_dsa = &s->dest_dsa; - return PyCObject_FromTallocPtr(s); + return pytalloc_CObject_FromTallocPtr(s); } @@ -429,7 +430,7 @@ static PyObject *py_net_replicate_chunk( if (!py_check_dcerpc_type(py_ctr, "samba.dcerpc.drsuapi", "DsGetNCChangesCtr1")) { return NULL; } - s->chunk.ctr1 = py_talloc_get_ptr(py_ctr); + s->chunk.ctr1 = pytalloc_get_ptr(py_ctr); s->partition.nc = *s->chunk.ctr1->naming_context; s->partition.more_data = s->chunk.ctr1->more_data; s->partition.source_dsa_guid = s->chunk.ctr1->source_dsa_guid; @@ -440,7 +441,7 @@ static PyObject *py_net_replicate_chunk( if (!py_check_dcerpc_type(py_ctr, "samba.dcerpc.drsuapi", "DsGetNCChangesCtr6")) { return NULL; } - s->chunk.ctr6 = py_talloc_get_ptr(py_ctr); + s->chunk.ctr6 = pytalloc_get_ptr(py_ctr); s->partition.nc = *s->chunk.ctr6->naming_context; s->partition.more_data = s->chunk.ctr6->more_data; s->partition.source_dsa_guid = s->chunk.ctr6->source_dsa_guid; Index: samba-4.0.0alpha16/source4/librpc/ndr/py_auth.c =================================================================== --- samba-4.0.0alpha16.orig/source4/librpc/ndr/py_auth.c +++ samba-4.0.0alpha16/source4/librpc/ndr/py_auth.c @@ -1,6 +1,7 @@ /* Unix SMB/CIFS implementation. - Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007-2008 + + Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007-2011 Copyright (C) Andrew Bartlett <abartlet@samba.org> 2011 This program is free software; you can redistribute it and/or modify @@ -46,7 +47,7 @@ static void PyType_AddGetSet(PyTypeObjec static PyObject *py_auth_session_get_credentials(PyObject *self, void *closure) { - struct auth_session_info *session = py_talloc_get_type(self, struct auth_session_info); + struct auth_session_info *session = pytalloc_get_type(self, struct auth_session_info); PyObject *py_credentials; /* This is evil, as the credentials are not IDL structures */ py_credentials = py_return_ndr_struct("samba.credentials", "Credentials", session->credentials, session->credentials); @@ -55,7 +56,7 @@ static PyObject *py_auth_session_get_cre static int py_auth_session_set_credentials(PyObject *self, PyObject *value, void *closure) { - struct auth_session_info *session = py_talloc_get_type(self, struct auth_session_info); + struct auth_session_info *session = pytalloc_get_type(self, struct auth_session_info); session->credentials = talloc_reference(session, PyCredentials_AsCliCredentials(value)); return 0; } Index: samba-4.0.0alpha16/source4/librpc/ndr/py_misc.c =================================================================== --- samba-4.0.0alpha16.orig/source4/librpc/ndr/py_misc.c +++ samba-4.0.0alpha16/source4/librpc/ndr/py_misc.c @@ -1,6 +1,7 @@ /* Unix SMB/CIFS implementation. Samba utility functions + Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2008 This program is free software; you can redistribute it and/or modify @@ -26,8 +27,8 @@ static int py_GUID_cmp(PyObject *py_self, PyObject *py_other) { int ret; - struct GUID *self = py_talloc_get_ptr(py_self), *other; - other = py_talloc_get_ptr(py_other); + struct GUID *self = pytalloc_get_ptr(py_self), *other; + other = pytalloc_get_ptr(py_other); if (other == NULL) return -1; @@ -43,7 +44,7 @@ static int py_GUID_cmp(PyObject *py_self static PyObject *py_GUID_str(PyObject *py_self) { - struct GUID *self = py_talloc_get_ptr(py_self); + struct GUID *self = pytalloc_get_ptr(py_self); char *str = GUID_string(NULL, self); PyObject *ret = PyString_FromString(str); talloc_free(str); @@ -52,7 +53,7 @@ static PyObject *py_GUID_str(PyObject *p static PyObject *py_GUID_repr(PyObject *py_self) { - struct GUID *self = py_talloc_get_ptr(py_self); + struct GUID *self = pytalloc_get_ptr(py_self); char *str = GUID_string(NULL, self); PyObject *ret = PyString_FromFormat("GUID('%s')", str); talloc_free(str); @@ -63,7 +64,7 @@ static int py_GUID_init(PyObject *self, { PyObject *str = NULL; NTSTATUS status; - struct GUID *guid = py_talloc_get_ptr(self); + struct GUID *guid = pytalloc_get_ptr(self); const char *kwnames[] = { "str", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O", discard_const_p(char *, kwnames), &str)) @@ -102,7 +103,7 @@ static int py_policy_handle_init(PyObjec { char *str = NULL; NTSTATUS status; - struct policy_handle *handle = py_talloc_get_ptr(self); + struct policy_handle *handle = pytalloc_get_ptr(self); const char *kwnames[] = { "uuid", "type", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|si", discard_const_p(char *, kwnames), &str, &handle->handle_type)) @@ -121,7 +122,7 @@ static int py_policy_handle_init(PyObjec static PyObject *py_policy_handle_repr(PyObject *py_self) { - struct policy_handle *self = py_talloc_get_ptr(py_self); + struct policy_handle *self = pytalloc_get_ptr(py_self); char *uuid_str = GUID_string(NULL, &self->uuid); PyObject *ret = PyString_FromFormat("policy_handle(%d, '%s')", self->handle_type, uuid_str); talloc_free(uuid_str); @@ -130,7 +131,7 @@ static PyObject *py_policy_handle_repr(P static PyObject *py_policy_handle_str(PyObject *py_self) { - struct policy_handle *self = py_talloc_get_ptr(py_self); + struct policy_handle *self = pytalloc_get_ptr(py_self); char *uuid_str = GUID_string(NULL, &self->uuid); PyObject *ret = PyString_FromFormat("%d, %s", self->handle_type, uuid_str); talloc_free(uuid_str); Index: samba-4.0.0alpha16/source4/librpc/ndr/py_security.c =================================================================== --- samba-4.0.0alpha16.orig/source4/librpc/ndr/py_security.c +++ samba-4.0.0alpha16/source4/librpc/ndr/py_security.c @@ -1,7 +1,8 @@ /* Unix SMB/CIFS implementation. Samba utility functions - Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2008 + + Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2008-2010 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 @@ -43,7 +44,7 @@ static void PyType_AddMethods(PyTypeObje static PyObject *py_dom_sid_split(PyObject *py_self, PyObject *args) { - struct dom_sid *self = py_talloc_get_ptr(py_self); + struct dom_sid *self = pytalloc_get_ptr(py_self); struct dom_sid *domain_sid; TALLOC_CTX *mem_ctx; uint32_t rid; @@ -63,15 +64,15 @@ static PyObject *py_dom_sid_split(PyObje return NULL; } - py_domain_sid = py_talloc_steal(&dom_sid_Type, domain_sid); + py_domain_sid = pytalloc_steal(&dom_sid_Type, domain_sid); talloc_free(mem_ctx); return Py_BuildValue("(OI)", py_domain_sid, rid); } static int py_dom_sid_cmp(PyObject *py_self, PyObject *py_other) { - struct dom_sid *self = py_talloc_get_ptr(py_self), *other; - other = py_talloc_get_ptr(py_other); + struct dom_sid *self = pytalloc_get_ptr(py_self), *other; + other = pytalloc_get_ptr(py_other); if (other == NULL) return -1; @@ -80,7 +81,7 @@ static int py_dom_sid_cmp(PyObject *py_s static PyObject *py_dom_sid_str(PyObject *py_self) { - struct dom_sid *self = py_talloc_get_ptr(py_self); + struct dom_sid *self = pytalloc_get_ptr(py_self); char *str = dom_sid_string(NULL, self); PyObject *ret = PyString_FromString(str); talloc_free(str); @@ -89,7 +90,7 @@ static PyObject *py_dom_sid_str(PyObject static PyObject *py_dom_sid_repr(PyObject *py_self) { - struct dom_sid *self = py_talloc_get_ptr(py_self); + struct dom_sid *self = pytalloc_get_ptr(py_self); char *str = dom_sid_string(NULL, self); PyObject *ret = PyString_FromFormat("dom_sid('%s')", str); talloc_free(str); @@ -99,7 +100,7 @@ static PyObject *py_dom_sid_repr(PyObjec static int py_dom_sid_init(PyObject *self, PyObject *args, PyObject *kwargs) { char *str = NULL; - struct dom_sid *sid = py_talloc_get_ptr(self); + struct dom_sid *sid = pytalloc_get_ptr(self); const char *kwnames[] = { "str", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|s", discard_const_p(char *, kwnames), &str)) @@ -134,7 +135,7 @@ static void py_dom_sid_patch(PyTypeObjec static PyObject *py_descriptor_sacl_add(PyObject *self, PyObject *args) { - struct security_descriptor *desc = py_talloc_get_ptr(self); + struct security_descriptor *desc = pytalloc_get_ptr(self); NTSTATUS status; struct security_ace *ace; PyObject *py_ace; @@ -142,7 +143,7 @@ static PyObject *py_descriptor_sacl_add( if (!PyArg_ParseTuple(args, "O", &py_ace)) return NULL; - ace = py_talloc_get_ptr(py_ace); + ace = pytalloc_get_ptr(py_ace); status = security_descriptor_sacl_add(desc, ace); PyErr_NTSTATUS_IS_ERR_RAISE(status); Py_RETURN_NONE; @@ -150,7 +151,7 @@ static PyObject *py_descriptor_sacl_add( static PyObject *py_descriptor_dacl_add(PyObject *self, PyObject *args) { - struct security_descriptor *desc = py_talloc_get_ptr(self); + struct security_descriptor *desc = pytalloc_get_ptr(self); NTSTATUS status; struct security_ace *ace; PyObject *py_ace; @@ -158,7 +159,7 @@ static PyObject *py_descriptor_dacl_add( if (!PyArg_ParseTuple(args, "O", &py_ace)) return NULL; - ace = py_talloc_get_ptr(py_ace); + ace = pytalloc_get_ptr(py_ace); status = security_descriptor_dacl_add(desc, ace); PyErr_NTSTATUS_IS_ERR_RAISE(status); @@ -167,7 +168,7 @@ static PyObject *py_descriptor_dacl_add( static PyObject *py_descriptor_dacl_del(PyObject *self, PyObject *args) { - struct security_descriptor *desc = py_talloc_get_ptr(self); + struct security_descriptor *desc = pytalloc_get_ptr(self); NTSTATUS status; struct dom_sid *sid; PyObject *py_sid; @@ -175,7 +176,7 @@ static PyObject *py_descriptor_dacl_del( if (!PyArg_ParseTuple(args, "O", &py_sid)) return NULL; - sid = py_talloc_get_ptr(py_sid); + sid = pytalloc_get_ptr(py_sid); status = security_descriptor_dacl_del(desc, sid); PyErr_NTSTATUS_IS_ERR_RAISE(status); Py_RETURN_NONE; @@ -183,7 +184,7 @@ static PyObject *py_descriptor_dacl_del( static PyObject *py_descriptor_sacl_del(PyObject *self, PyObject *args) { - struct security_descriptor *desc = py_talloc_get_ptr(self); + struct security_descriptor *desc = pytalloc_get_ptr(self); NTSTATUS status; struct dom_sid *sid; PyObject *py_sid; @@ -191,7 +192,7 @@ static PyObject *py_descriptor_sacl_del( if (!PyArg_ParseTuple(args, "O", &py_sid)) return NULL; - sid = py_talloc_get_ptr(py_sid); + sid = pytalloc_get_ptr(py_sid); status = security_descriptor_sacl_del(desc, sid); PyErr_NTSTATUS_IS_ERR_RAISE(status); Py_RETURN_NONE; @@ -199,7 +200,7 @@ static PyObject *py_descriptor_sacl_del( static PyObject *py_descriptor_new(PyTypeObject *self, PyObject *args, PyObject *kwargs) { - return py_talloc_steal(self, security_descriptor_initialise(NULL)); + return pytalloc_steal(self, security_descriptor_initialise(NULL)); } static PyObject *py_descriptor_from_sddl(PyObject *self, PyObject *args) @@ -212,7 +213,7 @@ static PyObject *py_descriptor_from_sddl if (!PyArg_ParseTuple(args, "sO!", &sddl, &dom_sid_Type, &py_sid)) return NULL; - sid = py_talloc_get_ptr(py_sid); + sid = pytalloc_get_ptr(py_sid); secdesc = sddl_decode(NULL, sddl, sid); if (secdesc == NULL) { @@ -220,14 +221,14 @@ static PyObject *py_descriptor_from_sddl return NULL; } - return py_talloc_steal((PyTypeObject *)self, secdesc); + return pytalloc_steal((PyTypeObject *)self, secdesc); } static PyObject *py_descriptor_as_sddl(PyObject *self, PyObject *args) { struct dom_sid *sid; PyObject *py_sid = Py_None; - struct security_descriptor *desc = py_talloc_get_ptr(self); + struct security_descriptor *desc = pytalloc_get_ptr(self); char *text; PyObject *ret; @@ -235,7 +236,7 @@ static PyObject *py_descriptor_as_sddl(P return NULL; if (py_sid != Py_None) - sid = py_talloc_get_ptr(py_sid); + sid = pytalloc_get_ptr(py_sid); else sid = NULL; @@ -277,11 +278,11 @@ static PyObject *py_token_is_sid(PyObjec { PyObject *py_sid; struct dom_sid *sid; - struct security_token *token = py_talloc_get_ptr(self); + struct security_token *token = pytalloc_get_ptr(self); if (!PyArg_ParseTuple(args, "O", &py_sid)) return NULL; - sid = py_talloc_get_ptr(py_sid); + sid = pytalloc_get_ptr(py_sid); return PyBool_FromLong(security_token_is_sid(token, sid)); } @@ -290,39 +291,39 @@ static PyObject *py_token_has_sid(PyObje { PyObject *py_sid; struct dom_sid *sid; - struct security_token *token = py_talloc_get_ptr(self); + struct security_token *token = pytalloc_get_ptr(self); if (!PyArg_ParseTuple(args, "O", &py_sid)) return NULL; - sid = py_talloc_get_ptr(py_sid); + sid = pytalloc_get_ptr(py_sid); return PyBool_FromLong(security_token_has_sid(token, sid)); } static PyObject *py_token_is_anonymous(PyObject *self) { - struct security_token *token = py_talloc_get_ptr(self); + struct security_token *token = pytalloc_get_ptr(self); return PyBool_FromLong(security_token_is_anonymous(token)); } static PyObject *py_token_is_system(PyObject *self) { - struct security_token *token = py_talloc_get_ptr(self); + struct security_token *token = pytalloc_get_ptr(self); return PyBool_FromLong(security_token_is_system(token)); } static PyObject *py_token_has_builtin_administrators(PyObject *self) { - struct security_token *token = py_talloc_get_ptr(self); + struct security_token *token = pytalloc_get_ptr(self); return PyBool_FromLong(security_token_has_builtin_administrators(token)); } static PyObject *py_token_has_nt_authenticated_users(PyObject *self) { - struct security_token *token = py_talloc_get_ptr(self); + struct security_token *token = pytalloc_get_ptr(self); return PyBool_FromLong(security_token_has_nt_authenticated_users(token)); } @@ -330,7 +331,7 @@ static PyObject *py_token_has_nt_authent static PyObject *py_token_has_privilege(PyObject *self, PyObject *args) { int priv; - struct security_token *token = py_talloc_get_ptr(self); + struct security_token *token = pytalloc_get_ptr(self); if (!PyArg_ParseTuple(args, "i", &priv)) return NULL; @@ -341,7 +342,7 @@ static PyObject *py_token_has_privilege( static PyObject *py_token_set_privilege(PyObject *self, PyObject *args) { int priv; - struct security_token *token = py_talloc_get_ptr(self); + struct security_token *token = pytalloc_get_ptr(self); if (!PyArg_ParseTuple(args, "i", &priv)) return NULL; @@ -352,7 +353,7 @@ static PyObject *py_token_set_privilege( static PyObject *py_token_new(PyTypeObject *self, PyObject *args, PyObject *kwargs) { - return py_talloc_steal(self, security_token_initialise(NULL)); + return pytalloc_steal(self, security_token_initialise(NULL)); } static PyMethodDef py_token_extra_methods[] = { @@ -414,7 +415,7 @@ static PyObject *py_random_sid(PyObject sid = dom_sid_parse_talloc(NULL, str); talloc_free(str); - ret = py_talloc_steal(&dom_sid_Type, sid); + ret = pytalloc_steal(&dom_sid_Type, sid); return ret; } Index: samba-4.0.0alpha16/source4/librpc/ndr/py_xattr.c =================================================================== --- samba-4.0.0alpha16.orig/source4/librpc/ndr/py_xattr.c +++ samba-4.0.0alpha16/source4/librpc/ndr/py_xattr.c @@ -63,7 +63,7 @@ static void ntacl_print_debug_helper(str static PyObject *py_ntacl_print(PyObject *self, PyObject *args) { - struct xattr_NTACL *ntacl = py_talloc_get_ptr(self); + struct xattr_NTACL *ntacl = pytalloc_get_ptr(self); struct ndr_print *pr; TALLOC_CTX *mem_ctx; Index: samba-4.0.0alpha16/source4/librpc/rpc/pyrpc_util.c =================================================================== --- samba-4.0.0alpha16.orig/source4/librpc/rpc/pyrpc_util.c +++ samba-4.0.0alpha16/source4/librpc/rpc/pyrpc_util.c @@ -298,7 +298,7 @@ PyObject *py_return_ndr_struct(const cha return NULL; } - return py_talloc_reference_ex(py_type, r_ctx, r); + return pytalloc_reference_ex(py_type, r_ctx, r); } PyObject *PyString_FromStringOrNULL(const char *str) Index: samba-4.0.0alpha16/source4/param/provision.c =================================================================== --- samba-4.0.0alpha16.orig/source4/param/provision.c +++ samba-4.0.0alpha16/source4/param/provision.c @@ -203,7 +203,7 @@ static PyObject *py_dom_sid_FromSid(stru if (dom_sid_Type == NULL) return NULL; - return py_talloc_reference((PyTypeObject *)dom_sid_Type, sid); + return pytalloc_reference((PyTypeObject *)dom_sid_Type, sid); } NTSTATUS provision_store_self_join(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, Index: samba-4.0.0alpha16/source4/param/pyparam.c =================================================================== --- samba-4.0.0alpha16.orig/source4/param/pyparam.c +++ samba-4.0.0alpha16/source4/param/pyparam.c @@ -32,15 +32,15 @@ typedef int Py_ssize_t; typedef inquiry lenfunc; #endif -#define PyLoadparmContext_AsLoadparmContext(obj) py_talloc_get_type(obj, struct loadparm_context) -#define PyLoadparmService_AsLoadparmService(obj) py_talloc_get_type(obj, struct loadparm_service) +#define PyLoadparmContext_AsLoadparmContext(obj) pytalloc_get_type(obj, struct loadparm_context) +#define PyLoadparmService_AsLoadparmService(obj) pytalloc_get_type(obj, struct loadparm_service) extern PyTypeObject PyLoadparmContext; extern PyTypeObject PyLoadparmService; static PyObject *PyLoadparmService_FromService(struct loadparm_service *service) { - return py_talloc_reference(&PyLoadparmService, service); + return pytalloc_reference(&PyLoadparmService, service); } static PyObject *py_lp_ctx_get_helper(struct loadparm_context *lp_ctx, const char *service_name, const char *param_name) @@ -146,7 +146,7 @@ static PyObject *py_lp_ctx_get_helper(st } -static PyObject *py_lp_ctx_load(py_talloc_Object *self, PyObject *args) +static PyObject *py_lp_ctx_load(pytalloc_Object *self, PyObject *args) { char *filename; bool ret; @@ -162,7 +162,7 @@ static PyObject *py_lp_ctx_load(py_tallo Py_RETURN_NONE; } -static PyObject *py_lp_ctx_load_default(py_talloc_Object *self) +static PyObject *py_lp_ctx_load_default(pytalloc_Object *self) { bool ret; ret = lpcfg_load_default(PyLoadparmContext_AsLoadparmContext(self)); @@ -174,7 +174,7 @@ static PyObject *py_lp_ctx_load_default( Py_RETURN_NONE; } -static PyObject *py_lp_ctx_get(py_talloc_Object *self, PyObject *args) +static PyObject *py_lp_ctx_get(pytalloc_Object *self, PyObject *args) { char *param_name; char *section_name = NULL; @@ -188,7 +188,7 @@ static PyObject *py_lp_ctx_get(py_talloc return ret; } -static PyObject *py_lp_ctx_is_myname(py_talloc_Object *self, PyObject *args) +static PyObject *py_lp_ctx_is_myname(pytalloc_Object *self, PyObject *args) { char *name; if (!PyArg_ParseTuple(args, "s", &name)) @@ -197,7 +197,7 @@ static PyObject *py_lp_ctx_is_myname(py_ return PyBool_FromLong(lpcfg_is_myname(PyLoadparmContext_AsLoadparmContext(self), name)); } -static PyObject *py_lp_ctx_is_mydomain(py_talloc_Object *self, PyObject *args) +static PyObject *py_lp_ctx_is_mydomain(pytalloc_Object *self, PyObject *args) { char *name; if (!PyArg_ParseTuple(args, "s", &name)) @@ -206,7 +206,7 @@ static PyObject *py_lp_ctx_is_mydomain(p return PyBool_FromLong(lpcfg_is_mydomain(PyLoadparmContext_AsLoadparmContext(self), name)); } -static PyObject *py_lp_ctx_set(py_talloc_Object *self, PyObject *args) +static PyObject *py_lp_ctx_set(pytalloc_Object *self, PyObject *args) { char *name, *value; bool ret; @@ -222,7 +222,7 @@ static PyObject *py_lp_ctx_set(py_talloc Py_RETURN_NONE; } -static PyObject *py_lp_ctx_private_path(py_talloc_Object *self, PyObject *args) +static PyObject *py_lp_ctx_private_path(pytalloc_Object *self, PyObject *args) { char *name, *path; PyObject *ret; @@ -236,7 +236,7 @@ static PyObject *py_lp_ctx_private_path( return ret; } -static PyObject *py_lp_ctx_services(py_talloc_Object *self) +static PyObject *py_lp_ctx_services(pytalloc_Object *self) { struct loadparm_context *lp_ctx = PyLoadparmContext_AsLoadparmContext(self); PyObject *ret; @@ -310,12 +310,12 @@ static PyMethodDef py_lp_ctx_methods[] = { NULL } }; -static PyObject *py_lp_ctx_default_service(py_talloc_Object *self, void *closure) +static PyObject *py_lp_ctx_default_service(pytalloc_Object *self, void *closure) { return PyLoadparmService_FromService(lpcfg_default_service(PyLoadparmContext_AsLoadparmContext(self))); } -static PyObject *py_lp_ctx_config_file(py_talloc_Object *self, void *closure) +static PyObject *py_lp_ctx_config_file(pytalloc_Object *self, void *closure) { const char *configfile = lpcfg_configfile(PyLoadparmContext_AsLoadparmContext(self)); if (configfile == NULL) @@ -333,7 +333,7 @@ static PyGetSetDef py_lp_ctx_getset[] = static PyObject *py_lp_ctx_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { - py_talloc_Object *ret = (py_talloc_Object *)type->tp_alloc(type, 0); + pytalloc_Object *ret = (pytalloc_Object *)type->tp_alloc(type, 0); if (ret == NULL) { PyErr_NoMemory(); return NULL; @@ -351,12 +351,12 @@ static PyObject *py_lp_ctx_new(PyTypeObj return (PyObject *)ret; } -static Py_ssize_t py_lp_ctx_len(py_talloc_Object *self) +static Py_ssize_t py_lp_ctx_len(pytalloc_Object *self) { return lpcfg_numservices(PyLoadparmContext_AsLoadparmContext(self)); } -static PyObject *py_lp_ctx_getitem(py_talloc_Object *self, PyObject *name) +static PyObject *py_lp_ctx_getitem(pytalloc_Object *self, PyObject *name) { struct loadparm_service *service; if (!PyString_Check(name)) { @@ -378,7 +378,7 @@ static PyMappingMethods py_lp_ctx_mappin PyTypeObject PyLoadparmContext = { .tp_name = "LoadParm", - .tp_basicsize = sizeof(py_talloc_Object), + .tp_basicsize = sizeof(pytalloc_Object), .tp_getset = py_lp_ctx_getset, .tp_methods = py_lp_ctx_methods, .tp_new = py_lp_ctx_new, @@ -425,7 +425,7 @@ static PyMethodDef py_lp_service_methods PyTypeObject PyLoadparmService = { .tp_name = "LoadparmService", - .tp_basicsize = sizeof(py_talloc_Object), + .tp_basicsize = sizeof(pytalloc_Object), .tp_methods = py_lp_service_methods, .tp_flags = Py_TPFLAGS_DEFAULT, }; @@ -458,7 +458,7 @@ static PyMethodDef pyparam_methods[] = { void initparam(void) { PyObject *m; - PyTypeObject *talloc_type = PyTalloc_GetObjectType(); + PyTypeObject *talloc_type = pytalloc_GetObjectType(); if (talloc_type == NULL) return; Index: samba-4.0.0alpha16/source4/param/pyparam_util.c =================================================================== --- samba-4.0.0alpha16.orig/source4/param/pyparam_util.c +++ samba-4.0.0alpha16/source4/param/pyparam_util.c @@ -24,7 +24,7 @@ #include "param/loadparm.h" #include "lib/talloc/pytalloc.h" -#define PyLoadparmContext_AsLoadparmContext(obj) py_talloc_get_type(obj, struct loadparm_context) +#define PyLoadparmContext_AsLoadparmContext(obj) pytalloc_get_type(obj, struct loadparm_context) _PUBLIC_ struct loadparm_context *lpcfg_from_py_object(TALLOC_CTX *mem_ctx, PyObject *py_obj) {