diff options
-rw-r--r-- | lib/talloc/ABI/pytalloc-util-2.0.6.sigs | 5 | ||||
-rw-r--r-- | lib/talloc/pytalloc.c | 42 | ||||
-rw-r--r-- | lib/talloc/pytalloc.h | 36 | ||||
-rw-r--r-- | lib/talloc/pytalloc_util.c | 22 | ||||
-rw-r--r-- | lib/talloc/wscript | 3 | ||||
-rw-r--r-- | libcli/security/pysecurity.c | 8 | ||||
-rw-r--r-- | pidl/lib/Parse/Pidl/Samba4/Python.pm | 36 | ||||
-rw-r--r-- | source4/auth/credentials/pycredentials.c | 60 | ||||
-rw-r--r-- | source4/auth/credentials/pycredentials.h | 2 | ||||
-rw-r--r-- | source4/auth/gensec/pygensec.c | 40 | ||||
-rw-r--r-- | source4/auth/pyauth.c | 8 | ||||
-rw-r--r-- | source4/auth/pyauth.h | 2 | ||||
-rw-r--r-- | source4/lib/registry/pyregistry.c | 30 | ||||
-rw-r--r-- | source4/libcli/pysmb.c | 28 | ||||
-rw-r--r-- | source4/libnet/py_net.c | 9 | ||||
-rw-r--r-- | source4/librpc/ndr/py_auth.c | 7 | ||||
-rw-r--r-- | source4/librpc/ndr/py_misc.c | 17 | ||||
-rw-r--r-- | source4/librpc/ndr/py_security.c | 67 | ||||
-rw-r--r-- | source4/librpc/ndr/py_xattr.c | 2 | ||||
-rw-r--r-- | source4/librpc/rpc/pyrpc_util.c | 2 | ||||
-rw-r--r-- | source4/param/provision.c | 2 | ||||
-rw-r--r-- | source4/param/pyparam.c | 38 | ||||
-rw-r--r-- | source4/param/pyparam_util.c | 2 |
23 files changed, 239 insertions, 229 deletions
diff --git a/lib/talloc/ABI/pytalloc-util-2.0.6.sigs b/lib/talloc/ABI/pytalloc-util-2.0.6.sigs new file mode 100644 index 00000000000..5f446ce7acb --- /dev/null +++ b/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 *) diff --git a/lib/talloc/pytalloc.c b/lib/talloc/pytalloc.c index 614b81f0571..62c68088256 100644 --- a/lib/talloc/pytalloc.c +++ b/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(PyObject *self, PyObject *args) 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(PyObject *self, PyObject *args) 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(PyObject *obj) /** * 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* self) /** * 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) diff --git a/lib/talloc/pytalloc.h b/lib/talloc/pytalloc.h index bfd9c2e0175..2d2c57b7898 100644 --- a/lib/talloc/pytalloc.h +++ b/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_ */ diff --git a/lib/talloc/pytalloc_util.c b/lib/talloc/pytalloc_util.c index c8a7e6ac587..89a093b1cef 100644 --- a/lib/talloc/pytalloc_util.c +++ b/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_GetObjectType(void) /** * 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(PyTypeObject *py_type, TALLOC_CTX *mem_ctx /** * 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(PyTypeObject *py_type, void *ptr) * 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 *ptr) 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_FromTallocPtr(void *ptr) 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); } diff --git a/lib/talloc/wscript b/lib/talloc/wscript index 6c0019fd7e5..c43c6618238 100644 --- a/lib/talloc/wscript +++ b/lib/talloc/wscript @@ -110,6 +110,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' ) diff --git a/libcli/security/pysecurity.c b/libcli/security/pysecurity.c index 87134bf1044..5dbf95cfac2 100644 --- a/libcli/security/pysecurity.c +++ b/libcli/security/pysecurity.c @@ -44,19 +44,19 @@ static PyObject *py_se_access_check(PyObject *module, PyObject *args, PyObject * 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; } diff --git a/pidl/lib/Parse/Pidl/Samba4/Python.pm b/pidl/lib/Parse/Pidl/Samba4/Python.pm index 1622e71efbc..63f4b2baefd 100644 --- a/pidl/lib/Parse/Pidl/Samba4/Python.pm +++ b/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,7 +274,7 @@ 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("int blob_length = 0;"); $self->pidl("enum ndr_err_code err;"); @@ -285,7 +285,7 @@ sub PythonStruct($$$$$$) $self->pidl("}"); $self->pidl("blob.length = blob_length;"); $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);"); @@ -301,11 +301,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(""); @@ -340,7 +340,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("};"); @@ -924,13 +924,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; } @@ -1142,13 +1142,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"); @@ -1181,7 +1181,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"); diff --git a/source4/auth/credentials/pycredentials.c b/source4/auth/credentials/pycredentials.c index b77d476bb80..5d21721490d 100644 --- a/source4/auth/credentials/pycredentials.c +++ b/source4/auth/credentials/pycredentials.c @@ -37,7 +37,7 @@ static PyObject *PyString_FromStringOrNULL(const char *str) 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(PyTypeObject *type, PyObject *args, PyObject *kwar 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; @@ -70,13 +70,13 @@ static PyObject *py_creds_set_username(py_talloc_Object *self, PyObject *args) 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; @@ -90,12 +90,12 @@ static PyObject *py_creds_set_password(py_talloc_Object *self, PyObject *args) 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; @@ -109,12 +109,12 @@ static PyObject *py_creds_set_domain(py_talloc_Object *self, PyObject *args) 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; @@ -128,12 +128,12 @@ static PyObject *py_creds_set_realm(py_talloc_Object *self, PyObject *args) 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)) @@ -142,12 +142,12 @@ static PyObject *py_creds_set_bind_dn(py_talloc_Object *self, PyObject *args) 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; @@ -161,33 +161,33 @@ static PyObject *py_creds_set_workstation(py_talloc_Object *self, PyObject *args 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; @@ -202,14 +202,14 @@ static PyObject *py_creds_parse_string(py_talloc_Object *self, PyObject *args) 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)) @@ -219,7 +219,7 @@ static PyObject *py_creds_set_kerberos_state(py_talloc_Object *self, PyObject *a 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)) @@ -229,7 +229,7 @@ static PyObject *py_creds_set_krb_forwardable(py_talloc_Object *self, PyObject * 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; @@ -260,7 +260,7 @@ static PyObject *py_creds_guess(py_talloc_Object *self, PyObject *args) 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; @@ -312,7 +312,7 @@ static PyObject *PyCredentialCacheContainer_from_ccache_container(struct ccache_ } -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; @@ -358,7 +358,7 @@ static PyObject *py_creds_get_named_ccache(py_talloc_Object *self, PyObject *arg 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; @@ -370,7 +370,7 @@ static PyObject *py_creds_set_gensec_features(py_talloc_Object *self, PyObject * 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; @@ -445,7 +445,7 @@ static PyMethodDef py_creds_methods[] = { PyTypeObject PyCredentials = { .tp_name = "credentials.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, @@ -454,14 +454,14 @@ PyTypeObject PyCredentials = { PyTypeObject PyCredentialCacheContainer = { .tp_name = "credentials.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; diff --git a/source4/auth/credentials/pycredentials.h b/source4/auth/credentials/pycredentials.h index 451ade6ee96..3a110fb09a5 100644 --- a/source4/auth/credentials/pycredentials.h +++ b/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_ */ diff --git a/source4/auth/gensec/pygensec.c b/source4/auth/gensec/pygensec.c index 6a69fd3f9de..a088f9c4db6 100644 --- a/source4/auth/gensec/pygensec.c +++ b/source4/auth/gensec/pygensec.c @@ -36,7 +36,7 @@ static PyObject *py_get_name_by_authtype(PyObject *self, PyObject *args) 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_from_object(TALLOC_CTX *mem_ctx, PyObjec 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(PyTypeObject *type, PyObject *args, PyOb 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(PyTypeObject *type, PyObject *args, PyOb 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(PyTypeObject *type, PyObject *args, PyOb 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(PyTypeObject *type, PyObject *args, PyOb } 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_credentials(PyObject *self, PyObject *args) { 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_credentials(PyObject *self, PyObject *args) 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); @@ -260,7 +260,7 @@ static PyObject *py_gensec_session_info(PyObject *self) TALLOC_CTX *mem_ctx; 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"); @@ -283,7 +283,7 @@ static PyObject *py_gensec_session_info(PyObject *self) 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)) @@ -301,7 +301,7 @@ static PyObject *py_gensec_start_mech_by_name(PyObject *self, PyObject *args) 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)) @@ -319,7 +319,7 @@ static PyObject *py_gensec_start_mech_by_sasl_name(PyObject *self, PyObject *arg 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; @@ -336,7 +336,7 @@ static PyObject *py_gensec_start_mech_by_authtype(PyObject *self, PyObject *args 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; @@ -349,7 +349,7 @@ static PyObject *py_gensec_want_feature(PyObject *self, PyObject *args) 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; @@ -366,7 +366,7 @@ static PyObject *py_gensec_update(PyObject *self, PyObject *args) 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)) @@ -409,7 +409,7 @@ static PyObject *py_gensec_wrap(PyObject *self, PyObject *args) 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; @@ -443,7 +443,7 @@ static PyObject *py_gensec_unwrap(PyObject *self, PyObject *args) 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; @@ -505,7 +505,7 @@ static PyTypeObject Py_Security = { .tp_name = "gensec.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); @@ -513,7 +513,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; diff --git a/source4/auth/pyauth.c b/source4/auth/pyauth.c index 2f83be95c75..08ce9d3f7fd 100644 --- a/source4/auth/pyauth.c +++ b/source4/auth/pyauth.c @@ -207,7 +207,7 @@ static const char **PyList_AsStringList(TALLOC_CTX *mem_ctx, PyObject *list, 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(PyTypeObject *type, PyObject *args, PyObjec } 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,7 +298,7 @@ static PyObject *py_auth_context_new(PyTypeObject *type, PyObject *args, PyObjec 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, }; @@ -314,7 +314,7 @@ void initauth(void) { PyObject *m; - PyAuthContext.tp_base = PyTalloc_GetObjectType(); + PyAuthContext.tp_base = pytalloc_GetObjectType(); if (PyAuthContext.tp_base == NULL) return; diff --git a/source4/auth/pyauth.h b/source4/auth/pyauth.h index 60fd2e5d140..c01144d87c8 100644 --- a/source4/auth/pyauth.h +++ b/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 */ diff --git a/source4/lib/registry/pyregistry.c b/source4/lib/registry/pyregistry.c index a3317c73bad..162c5ea0fc2 100644 --- a/source4/lib/registry/pyregistry.c +++ b/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_by_name(PyObject *self, PyObject *args) 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(PyObject *self, PyObject *args) 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(PyTypeObject *type, PyObject *args, PyObject *kwar 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, }; @@ -293,20 +293,20 @@ static PyObject *py_open_hive(PyTypeObject *type, PyObject *args, PyObject *kwar 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, }; @@ -357,7 +357,7 @@ static PyObject *py_open_samba(PyObject *self, PyObject *args, PyObject *kwargs) return NULL; } - return py_talloc_steal(&PyRegistry, reg_ctx); + return pytalloc_steal(&PyRegistry, reg_ctx); } static PyObject *py_open_directory(PyObject *self, PyObject *args) @@ -372,7 +372,7 @@ static PyObject *py_open_directory(PyObject *self, PyObject *args) 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) @@ -387,7 +387,7 @@ static PyObject *py_create_directory(PyObject *self, PyObject *args) 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) @@ -435,7 +435,7 @@ static PyObject *py_open_ldb_file(PyObject *self, PyObject *args, PyObject *kwar 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) @@ -476,7 +476,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; diff --git a/source4/libcli/pysmb.c b/source4/libcli/pysmb.c index afa85ab5dad..31d163cd3a9 100644 --- a/source4/libcli/pysmb.c +++ b/source4/libcli/pysmb.c @@ -103,7 +103,7 @@ static NTSTATUS do_smb_connect(TALLOC_CTX *mem_ctx, struct smb_private_data *spd /* * Read SMB file and return the contents of the file as python string */ -static PyObject * py_smb_loadfile(py_talloc_Object *self, PyObject *args) +static PyObject * py_smb_loadfile(pytalloc_Object *self, PyObject *args) { struct smb_composite_loadfile io; const char *filename; @@ -128,7 +128,7 @@ static PyObject * py_smb_loadfile(py_talloc_Object *self, PyObject *args) /* * Create a SMB file with given string as the contents */ -static PyObject * py_smb_savefile(py_talloc_Object *self, PyObject *args) +static PyObject * py_smb_savefile(pytalloc_Object *self, PyObject *args) { struct smb_composite_savefile io; const char *filename; @@ -187,7 +187,7 @@ static void py_smb_list_callback(struct clilist_file_info *f, const char *mask, /* * List the directory contents for specified directory (Ignore '.' and '..' dirs) */ -static PyObject *py_smb_list(py_talloc_Object *self, PyObject *args, PyObject *kwargs) +static PyObject *py_smb_list(pytalloc_Object *self, PyObject *args, PyObject *kwargs) { struct smb_private_data *spdata; PyObject *py_dirlist; @@ -229,7 +229,7 @@ static PyObject *py_smb_list(py_talloc_Object *self, PyObject *args, PyObject *k /* * Create a directory */ -static PyObject *py_smb_mkdir(py_talloc_Object *self, PyObject *args) +static PyObject *py_smb_mkdir(pytalloc_Object *self, PyObject *args) { NTSTATUS status; const char *dirname; @@ -250,7 +250,7 @@ static PyObject *py_smb_mkdir(py_talloc_Object *self, PyObject *args) /* * Remove a directory */ -static PyObject *py_smb_rmdir(py_talloc_Object *self, PyObject *args) +static PyObject *py_smb_rmdir(pytalloc_Object *self, PyObject *args) { NTSTATUS status; const char *dirname; @@ -271,7 +271,7 @@ static PyObject *py_smb_rmdir(py_talloc_Object *self, PyObject *args) /* * Check existence of a path */ -static PyObject *py_smb_chkpath(py_talloc_Object *self, PyObject *args) +static PyObject *py_smb_chkpath(pytalloc_Object *self, PyObject *args) { NTSTATUS status; const char *path; @@ -295,7 +295,7 @@ static PyObject *py_smb_chkpath(py_talloc_Object *self, PyObject *args) /* * Read ACL on a given file/directory as a security descriptor object */ -static PyObject *py_smb_getacl(py_talloc_Object *self, PyObject *args, PyObject *kwargs) +static PyObject *py_smb_getacl(pytalloc_Object *self, PyObject *args, PyObject *kwargs) { NTSTATUS status; union smb_open io; @@ -358,7 +358,7 @@ static PyObject *py_smb_getacl(py_talloc_Object *self, PyObject *args, PyObject /* * Set ACL on file/directory using given security descriptor object */ -static PyObject *py_smb_setacl(py_talloc_Object *self, PyObject *args, PyObject *kwargs) +static PyObject *py_smb_setacl(pytalloc_Object *self, PyObject *args, PyObject *kwargs) { NTSTATUS status; union smb_open io; @@ -375,11 +375,11 @@ static PyObject *py_smb_setacl(py_talloc_Object *self, PyObject *args, PyObject spdata = self->ptr; - sd = py_talloc_get_type(py_sd, struct security_descriptor); + sd = pytalloc_get_type(py_sd, struct security_descriptor); if (!sd) { PyErr_Format(PyExc_TypeError, "Expected dcerpc.security.descriptor as argument, got %s", - talloc_get_name(py_talloc_get_ptr(py_sd))); + talloc_get_name(pytalloc_get_ptr(py_sd))); return NULL; } @@ -463,7 +463,7 @@ static PyObject *py_smb_new(PyTypeObject *type, PyObject *args, PyObject *kwargs const char *kwnames[] = { "hostname", "service", "creds", "lp", NULL }; const char *hostname = NULL; const char *service = NULL; - py_talloc_Object *smb; + pytalloc_Object *smb; struct smb_private_data *spdata; NTSTATUS status; @@ -473,7 +473,7 @@ static PyObject *py_smb_new(PyTypeObject *type, PyObject *args, PyObject *kwargs return NULL; } - smb = (py_talloc_Object *)type->tp_alloc(type, 0); + smb = (pytalloc_Object *)type->tp_alloc(type, 0); if (smb == NULL) { PyErr_NoMemory(); return NULL; @@ -518,7 +518,7 @@ static PyObject *py_smb_new(PyTypeObject *type, PyObject *args, PyObject *kwargs static PyTypeObject PySMB = { .tp_name = "smb.SMB", - .tp_basicsize = sizeof(py_talloc_Object), + .tp_basicsize = sizeof(pytalloc_Object), .tp_new = py_smb_new, .tp_flags = Py_TPFLAGS_DEFAULT, .tp_methods = py_smb_methods, @@ -529,7 +529,7 @@ static PyTypeObject PySMB = { void initsmb(void) { PyObject *m; - PyTypeObject *talloc_type = PyTalloc_GetObjectType(); + PyTypeObject *talloc_type = pytalloc_GetObjectType(); if (talloc_type == NULL) { return; } diff --git a/source4/libnet/py_net.c b/source4/libnet/py_net.c index b43f69bf0f9..0fae791d69e 100644 --- a/source4/libnet/py_net.c +++ b/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 @@ -341,7 +342,7 @@ static PyObject *py_dom_sid_FromSid(struct dom_sid *sid) 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) @@ -453,7 +454,7 @@ static PyObject *py_net_replicate_init(py_net_Object *self, PyObject *args, PyOb s->chunk.forest = &s->forest; s->chunk.dest_dsa = &s->dest_dsa; - return PyCObject_FromTallocPtr(s); + return pytalloc_CObject_FromTallocPtr(s); } @@ -486,7 +487,7 @@ static PyObject *py_net_replicate_chunk(py_net_Object *self, PyObject *args, PyO 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; @@ -497,7 +498,7 @@ static PyObject *py_net_replicate_chunk(py_net_Object *self, PyObject *args, PyO 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; diff --git a/source4/librpc/ndr/py_auth.c b/source4/librpc/ndr/py_auth.c index 40164e09816..8c9c16fa212 100644 --- a/source4/librpc/ndr/py_auth.c +++ b/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(PyTypeObject *type, PyGetSetDef *getset) 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_credentials(PyObject *self, void *closure) 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; } diff --git a/source4/librpc/ndr/py_misc.c b/source4/librpc/ndr/py_misc.c index 184029b59bf..4e6d62ef482 100644 --- a/source4/librpc/ndr/py_misc.c +++ b/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, PyObject *py_other) 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 *py_self) 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 *args, PyObject *kwargs) { 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(PyObject *self, PyObject *args, PyObject *kwarg { 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(PyObject *self, PyObject *args, PyObject *kwarg 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(PyObject *py_self) 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); diff --git a/source4/librpc/ndr/py_security.c b/source4/librpc/ndr/py_security.c index d04e2579f50..2d038cfcca8 100644 --- a/source4/librpc/ndr/py_security.c +++ b/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(PyTypeObject *type, PyMethodDef *methods) 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(PyObject *py_self, PyObject *args) 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_self, PyObject *py_other) 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 *py_self) 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(PyObject *py_self) 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(PyTypeObject *type) 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(PyObject *self, PyObject *args) 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(PyObject *self, PyObject *args) 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(PyObject *self, PyObject *args) 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(PyObject *self, PyObject *args) 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(PyObject *self, PyObject *args) 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(PyObject *self, PyObject *args) 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(PyObject *self, PyObject *args) 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(PyObject *self, PyObject *args) 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(PyObject *self, PyObject *args) 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(PyObject *self, PyObject *args) 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(PyObject *self, PyObject *args) 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(PyObject *self, PyObject *args) { 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(PyObject *self, PyObject *args) { 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_authenticated_users(PyObject *self) 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(PyObject *self, PyObject *args) 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(PyObject *self, PyObject *args) 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 *self) 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; } diff --git a/source4/librpc/ndr/py_xattr.c b/source4/librpc/ndr/py_xattr.c index 19c5f266728..5a61c734a52 100644 --- a/source4/librpc/ndr/py_xattr.c +++ b/source4/librpc/ndr/py_xattr.c @@ -63,7 +63,7 @@ static void ntacl_print_debug_helper(struct ndr_print *ndr, const char *format, 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; diff --git a/source4/librpc/rpc/pyrpc_util.c b/source4/librpc/rpc/pyrpc_util.c index 385acc87e59..fa6bdab2a28 100644 --- a/source4/librpc/rpc/pyrpc_util.c +++ b/source4/librpc/rpc/pyrpc_util.c @@ -298,7 +298,7 @@ PyObject *py_return_ndr_struct(const char *module_name, const char *type_name, 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) diff --git a/source4/param/provision.c b/source4/param/provision.c index 54b60730dd3..6663f269a8e 100644 --- a/source4/param/provision.c +++ b/source4/param/provision.c @@ -203,7 +203,7 @@ static PyObject *py_dom_sid_FromSid(struct dom_sid *sid) 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, diff --git a/source4/param/pyparam.c b/source4/param/pyparam.c index b4901ca02ee..f46926105a1 100644 --- a/source4/param/pyparam.c +++ b/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) @@ -150,7 +150,7 @@ static PyObject *py_lp_ctx_get_helper(struct loadparm_context *lp_ctx, const cha } -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; @@ -166,7 +166,7 @@ static PyObject *py_lp_ctx_load(py_talloc_Object *self, PyObject *args) 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)); @@ -178,7 +178,7 @@ static PyObject *py_lp_ctx_load_default(py_talloc_Object *self) 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; @@ -192,7 +192,7 @@ static PyObject *py_lp_ctx_get(py_talloc_Object *self, PyObject *args) 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)) @@ -201,7 +201,7 @@ static PyObject *py_lp_ctx_is_myname(py_talloc_Object *self, PyObject *args) 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)) @@ -210,7 +210,7 @@ static PyObject *py_lp_ctx_is_mydomain(py_talloc_Object *self, PyObject *args) 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; @@ -226,7 +226,7 @@ static PyObject *py_lp_ctx_set(py_talloc_Object *self, PyObject *args) 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; @@ -240,7 +240,7 @@ static PyObject *py_lp_ctx_private_path(py_talloc_Object *self, PyObject *args) 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; @@ -314,12 +314,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) @@ -337,7 +337,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; @@ -355,12 +355,12 @@ static PyObject *py_lp_ctx_new(PyTypeObject *type, PyObject *args, PyObject *kwa 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)) { @@ -382,7 +382,7 @@ static PyMappingMethods py_lp_ctx_mapping = { PyTypeObject PyLoadparmContext = { .tp_name = "param.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, @@ -429,7 +429,7 @@ static PyMethodDef py_lp_service_methods[] = { PyTypeObject PyLoadparmService = { .tp_name = "param.LoadparmService", - .tp_basicsize = sizeof(py_talloc_Object), + .tp_basicsize = sizeof(pytalloc_Object), .tp_methods = py_lp_service_methods, .tp_flags = Py_TPFLAGS_DEFAULT, }; @@ -462,7 +462,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; diff --git a/source4/param/pyparam_util.c b/source4/param/pyparam_util.c index cbf2095e855..969226f4f7b 100644 --- a/source4/param/pyparam_util.c +++ b/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) { |