From f8ec7f6cb19c4cc27398bdc0482b531e601d4291 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 10 Aug 2011 15:15:18 +0200 Subject: pytalloc: Use consistent prefix for functions, add ABI file. --- 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 +- 16 files changed, 160 insertions(+), 156 deletions(-) (limited to 'source4') diff --git a/source4/auth/credentials/pycredentials.c b/source4/auth/credentials/pycredentials.c index b77d476bb8..5d21721490 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 451ade6ee9..3a110fb09a 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 6a69fd3f9d..a088f9c4db 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 2f83be95c7..08ce9d3f7f 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 60fd2e5d14..c01144d87c 100644 --- a/source4/auth/pyauth.h +++ b/source4/auth/pyauth.h @@ -23,7 +23,7 @@ #include #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 a3317c73ba..162c5ea0fc 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 afa85ab5da..31d163cd3a 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 b43f69bf0f..0fae791d69 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 2008-2010 Copyright (C) Kamen Mazdrashki 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 40164e0981..8c9c16fa21 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 2007-2008 + + Copyright (C) Jelmer Vernooij 2007-2011 Copyright (C) Andrew Bartlett 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 184029b59b..4e6d62ef48 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 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 d04e2579f5..2d038cfcca 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 2008 + + Copyright (C) Jelmer Vernooij 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 19c5f26672..5a61c734a5 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 385acc87e5..fa6bdab2a2 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 54b60730dd..6663f269a8 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 b4901ca02e..f46926105a 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 cbf2095e85..969226f4f7 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) { -- cgit