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/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 +- 5 files changed, 49 insertions(+), 46 deletions(-) (limited to 'source4/librpc') 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) -- cgit