/*
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
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;
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;
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);
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);
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))
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;
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;
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;
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);
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;
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;
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;
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;
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)
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) {
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;
return NULL;
if (py_sid != Py_None)
- sid = py_talloc_get_ptr(py_sid);
+ sid = pytalloc_get_ptr(py_sid);
else
sid = NULL;
{
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));
}
{
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));
}
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;
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;
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[] = {
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;
}