
/* Python wrapper functions auto-generated by pidl */
#include <Python.h>
#include "includes.h"
#include <pytalloc.h>
#include "librpc/rpc/pyrpc.h"
#include "librpc/rpc/pyrpc_util.h"
#include "autoconf/librpc/gen_ndr/ndr_security.h"
#include "autoconf/librpc/gen_ndr/ndr_security_c.h"

#include "librpc/gen_ndr/misc.h"
staticforward PyTypeObject dom_sid_Type;
staticforward PyTypeObject security_ace_object_Type;
staticforward PyTypeObject security_ace_Type;
staticforward PyTypeObject security_acl_Type;
staticforward PyTypeObject security_descriptor_Type;
staticforward PyTypeObject sec_desc_buf_Type;
staticforward PyTypeObject security_token_Type;
staticforward PyTypeObject security_unix_token_Type;
staticforward PyTypeObject generic_mapping_Type;
staticforward PyTypeObject standard_mapping_Type;

void initsecurity(void);static PyTypeObject *Object_Type;
static PyTypeObject *GUID_Type;
#include "librpc/ndr/py_security.c"


static PyObject *py_dom_sid_get_sid_rev_num(PyObject *obj, void *closure)
{
	struct dom_sid *object = (struct dom_sid *)pytalloc_get_ptr(obj);
	PyObject *py_sid_rev_num;
	py_sid_rev_num = PyInt_FromLong(object->sid_rev_num);
	return py_sid_rev_num;
}

static int py_dom_sid_set_sid_rev_num(PyObject *py_obj, PyObject *value, void *closure)
{
	struct dom_sid *object = (struct dom_sid *)pytalloc_get_ptr(py_obj);
	PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
	object->sid_rev_num = PyInt_AsLong(value);
	return 0;
}

static PyObject *py_dom_sid_get_num_auths(PyObject *obj, void *closure)
{
	struct dom_sid *object = (struct dom_sid *)pytalloc_get_ptr(obj);
	PyObject *py_num_auths;
	py_num_auths = PyInt_FromLong(object->num_auths);
	return py_num_auths;
}

static int py_dom_sid_set_num_auths(PyObject *py_obj, PyObject *value, void *closure)
{
	struct dom_sid *object = (struct dom_sid *)pytalloc_get_ptr(py_obj);
	PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
	object->num_auths = PyInt_AsLong(value);
	return 0;
}

static PyObject *py_dom_sid_get_id_auth(PyObject *obj, void *closure)
{
	struct dom_sid *object = (struct dom_sid *)pytalloc_get_ptr(obj);
	PyObject *py_id_auth;
	py_id_auth = PyList_New(6);
	if (py_id_auth == NULL) {
		return NULL;
	}
	{
		int id_auth_cntr_0;
		for (id_auth_cntr_0 = 0; id_auth_cntr_0 < 6; id_auth_cntr_0++) {
			PyObject *py_id_auth_0;
			py_id_auth_0 = PyInt_FromLong(object->id_auth[id_auth_cntr_0]);
			PyList_SetItem(py_id_auth, id_auth_cntr_0, py_id_auth_0);
		}
	}
	return py_id_auth;
}

static int py_dom_sid_set_id_auth(PyObject *py_obj, PyObject *value, void *closure)
{
	struct dom_sid *object = (struct dom_sid *)pytalloc_get_ptr(py_obj);
	PY_CHECK_TYPE(&PyList_Type, value, return -1;);
	{
		int id_auth_cntr_0;
		for (id_auth_cntr_0 = 0; id_auth_cntr_0 < PyList_GET_SIZE(value); id_auth_cntr_0++) {
			PY_CHECK_TYPE(&PyInt_Type, PyList_GET_ITEM(value, id_auth_cntr_0), return -1;);
			object->id_auth[id_auth_cntr_0] = PyInt_AsLong(PyList_GET_ITEM(value, id_auth_cntr_0));
		}
	}
	return 0;
}

static PyObject *py_dom_sid_get_sub_auths(PyObject *obj, void *closure)
{
	struct dom_sid *object = (struct dom_sid *)pytalloc_get_ptr(obj);
	PyObject *py_sub_auths;
	py_sub_auths = PyList_New(15);
	if (py_sub_auths == NULL) {
		return NULL;
	}
	{
		int sub_auths_cntr_0;
		for (sub_auths_cntr_0 = 0; sub_auths_cntr_0 < 15; sub_auths_cntr_0++) {
			PyObject *py_sub_auths_0;
			py_sub_auths_0 = PyInt_FromLong(object->sub_auths[sub_auths_cntr_0]);
			PyList_SetItem(py_sub_auths, sub_auths_cntr_0, py_sub_auths_0);
		}
	}
	return py_sub_auths;
}

static int py_dom_sid_set_sub_auths(PyObject *py_obj, PyObject *value, void *closure)
{
	struct dom_sid *object = (struct dom_sid *)pytalloc_get_ptr(py_obj);
	PY_CHECK_TYPE(&PyList_Type, value, return -1;);
	{
		int sub_auths_cntr_0;
		for (sub_auths_cntr_0 = 0; sub_auths_cntr_0 < PyList_GET_SIZE(value); sub_auths_cntr_0++) {
			PY_CHECK_TYPE(&PyInt_Type, PyList_GET_ITEM(value, sub_auths_cntr_0), return -1;);
			object->sub_auths[sub_auths_cntr_0] = PyInt_AsLong(PyList_GET_ITEM(value, sub_auths_cntr_0));
		}
	}
	return 0;
}

static PyGetSetDef py_dom_sid_getsetters[] = {
	{ discard_const_p(char, "sid_rev_num"), py_dom_sid_get_sid_rev_num, py_dom_sid_set_sid_rev_num },
	{ discard_const_p(char, "num_auths"), py_dom_sid_get_num_auths, py_dom_sid_set_num_auths },
	{ discard_const_p(char, "id_auth"), py_dom_sid_get_id_auth, py_dom_sid_set_id_auth },
	{ discard_const_p(char, "sub_auths"), py_dom_sid_get_sub_auths, py_dom_sid_set_sub_auths },
	{ NULL }
};

static PyObject *py_dom_sid_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
	return pytalloc_new(struct dom_sid, type);
}

static PyObject *py_dom_sid_ndr_pack(PyObject *py_obj)
{
	struct dom_sid *object = (struct dom_sid *)pytalloc_get_ptr(py_obj);
	DATA_BLOB blob;
	enum ndr_err_code err;
	err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_dom_sid);
	if (err != NDR_ERR_SUCCESS) {
		PyErr_SetNdrError(err);
		return NULL;
	}

	return PyString_FromStringAndSize((char *)blob.data, blob.length);
}

static PyObject *py_dom_sid_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
{
	struct dom_sid *object = (struct dom_sid *)pytalloc_get_ptr(py_obj);
	DATA_BLOB blob;
	int blob_length = 0;
	enum ndr_err_code err;
	const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
	PyObject *allow_remaining_obj = NULL;
	bool allow_remaining = false;

	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|O:__ndr_unpack__",
		discard_const_p(char *, kwnames),
		&blob.data, &blob_length,
		&allow_remaining_obj)) {
		return NULL;
	}
	blob.length = blob_length;

	if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
		allow_remaining = true;
	}

	if (allow_remaining) {
		err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_dom_sid);
	} else {
		err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_dom_sid);
	}
	if (err != NDR_ERR_SUCCESS) {
		PyErr_SetNdrError(err);
		return NULL;
	}

	Py_RETURN_NONE;
}

static PyObject *py_dom_sid_ndr_print(PyObject *py_obj)
{
	struct dom_sid *object = (struct dom_sid *)pytalloc_get_ptr(py_obj);
	PyObject *ret;
	char *retstr;

	retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_dom_sid, "dom_sid", object);
	ret = PyString_FromString(retstr);
	talloc_free(retstr);

	return ret;
}

static PyMethodDef py_dom_sid_methods[] = {
	{ "__ndr_pack__", (PyCFunction)py_dom_sid_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
	{ "__ndr_unpack__", (PyCFunction)py_dom_sid_ndr_unpack, METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
	{ "__ndr_print__", (PyCFunction)py_dom_sid_ndr_print, METH_VARARGS, "S.ndr_print(object) -> None\nNDR print" },
	{ NULL, NULL, 0, NULL }
};


static PyTypeObject dom_sid_Type = {
	PyObject_HEAD_INIT(NULL) 0,
	.tp_name = "security.dom_sid",
	.tp_getset = py_dom_sid_getsetters,
	.tp_methods = py_dom_sid_methods,
	.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
	.tp_basicsize = sizeof(pytalloc_Object),
	.tp_new = py_dom_sid_new,
};

PyObject *py_import_security_ace_object_type(TALLOC_CTX *mem_ctx, int level, union security_ace_object_type *in)
{
	PyObject *ret;

	switch (level) {
		case SEC_ACE_OBJECT_TYPE_PRESENT:
			ret = pytalloc_reference_ex(GUID_Type, mem_ctx, &in->type);
			return ret;

		default:
			ret = Py_None;
			Py_INCREF(ret);
			return ret;

	}
	PyErr_SetString(PyExc_TypeError, "unknown union level");
	return NULL;
}

union security_ace_object_type *py_export_security_ace_object_type(TALLOC_CTX *mem_ctx, int level, PyObject *in)
{
	union security_ace_object_type *ret = talloc_zero(mem_ctx, union security_ace_object_type);
	switch (level) {
		case SEC_ACE_OBJECT_TYPE_PRESENT:
			PY_CHECK_TYPE(GUID_Type, in, talloc_free(ret); return NULL;);
			if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
				PyErr_NoMemory();
				talloc_free(ret); return NULL;
			}
			ret->type = *(struct GUID *)pytalloc_get_ptr(in);
			break;

		default:
			break;

	}

	return ret;
}

PyObject *py_import_security_ace_object_inherited_type(TALLOC_CTX *mem_ctx, int level, union security_ace_object_inherited_type *in)
{
	PyObject *ret;

	switch (level) {
		case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT:
			ret = pytalloc_reference_ex(GUID_Type, mem_ctx, &in->inherited_type);
			return ret;

		default:
			ret = Py_None;
			Py_INCREF(ret);
			return ret;

	}
	PyErr_SetString(PyExc_TypeError, "unknown union level");
	return NULL;
}

union security_ace_object_inherited_type *py_export_security_ace_object_inherited_type(TALLOC_CTX *mem_ctx, int level, PyObject *in)
{
	union security_ace_object_inherited_type *ret = talloc_zero(mem_ctx, union security_ace_object_inherited_type);
	switch (level) {
		case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT:
			PY_CHECK_TYPE(GUID_Type, in, talloc_free(ret); return NULL;);
			if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
				PyErr_NoMemory();
				talloc_free(ret); return NULL;
			}
			ret->inherited_type = *(struct GUID *)pytalloc_get_ptr(in);
			break;

		default:
			break;

	}

	return ret;
}


static PyObject *py_security_ace_object_get_flags(PyObject *obj, void *closure)
{
	struct security_ace_object *object = (struct security_ace_object *)pytalloc_get_ptr(obj);
	PyObject *py_flags;
	py_flags = PyInt_FromLong(object->flags);
	return py_flags;
}

static int py_security_ace_object_set_flags(PyObject *py_obj, PyObject *value, void *closure)
{
	struct security_ace_object *object = (struct security_ace_object *)pytalloc_get_ptr(py_obj);
	if (PyLong_Check(value)) {
		object->flags = PyLong_AsLongLong(value);
	} else if (PyInt_Check(value)) {
		object->flags = PyInt_AsLong(value);
	} else {
		PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
		  PyInt_Type.tp_name, PyLong_Type.tp_name);
		return -1;
	}
	return 0;
}

static PyObject *py_security_ace_object_get_type(PyObject *obj, void *closure)
{
	struct security_ace_object *object = (struct security_ace_object *)pytalloc_get_ptr(obj);
	PyObject *py_type;
	py_type = py_import_security_ace_object_type(pytalloc_get_mem_ctx(obj), object->flags & SEC_ACE_OBJECT_TYPE_PRESENT, &object->type);
	if (py_type == NULL) {
		return NULL;
	}
	return py_type;
}

static int py_security_ace_object_set_type(PyObject *py_obj, PyObject *value, void *closure)
{
	struct security_ace_object *object = (struct security_ace_object *)pytalloc_get_ptr(py_obj);
	{
		union security_ace_object_type *type_switch_0;
		type_switch_0 = py_export_security_ace_object_type(pytalloc_get_mem_ctx(py_obj), object->flags & SEC_ACE_OBJECT_TYPE_PRESENT, value);
		if (type_switch_0 == NULL) {
			return -1;
		}
		object->type = *type_switch_0;
	}
	return 0;
}

static PyObject *py_security_ace_object_get_inherited_type(PyObject *obj, void *closure)
{
	struct security_ace_object *object = (struct security_ace_object *)pytalloc_get_ptr(obj);
	PyObject *py_inherited_type;
	py_inherited_type = py_import_security_ace_object_inherited_type(pytalloc_get_mem_ctx(obj), object->flags & SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT, &object->inherited_type);
	if (py_inherited_type == NULL) {
		return NULL;
	}
	return py_inherited_type;
}

static int py_security_ace_object_set_inherited_type(PyObject *py_obj, PyObject *value, void *closure)
{
	struct security_ace_object *object = (struct security_ace_object *)pytalloc_get_ptr(py_obj);
	{
		union security_ace_object_inherited_type *inherited_type_switch_0;
		inherited_type_switch_0 = py_export_security_ace_object_inherited_type(pytalloc_get_mem_ctx(py_obj), object->flags & SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT, value);
		if (inherited_type_switch_0 == NULL) {
			return -1;
		}
		object->inherited_type = *inherited_type_switch_0;
	}
	return 0;
}

static PyGetSetDef py_security_ace_object_getsetters[] = {
	{ discard_const_p(char, "flags"), py_security_ace_object_get_flags, py_security_ace_object_set_flags },
	{ discard_const_p(char, "type"), py_security_ace_object_get_type, py_security_ace_object_set_type },
	{ discard_const_p(char, "inherited_type"), py_security_ace_object_get_inherited_type, py_security_ace_object_set_inherited_type },
	{ NULL }
};

static PyObject *py_security_ace_object_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
	return pytalloc_new(struct security_ace_object, type);
}


static PyTypeObject security_ace_object_Type = {
	PyObject_HEAD_INIT(NULL) 0,
	.tp_name = "security.ace_object",
	.tp_getset = py_security_ace_object_getsetters,
	.tp_methods = NULL,
	.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
	.tp_basicsize = sizeof(pytalloc_Object),
	.tp_new = py_security_ace_object_new,
};

PyObject *py_import_security_ace_object_ctr(TALLOC_CTX *mem_ctx, int level, union security_ace_object_ctr *in)
{
	PyObject *ret;

	switch (level) {
		case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT:
			ret = pytalloc_reference_ex(&security_ace_object_Type, mem_ctx, &in->object);
			return ret;

		case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT:
			ret = pytalloc_reference_ex(&security_ace_object_Type, mem_ctx, &in->object);
			return ret;

		case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT:
			ret = pytalloc_reference_ex(&security_ace_object_Type, mem_ctx, &in->object);
			return ret;

		case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT:
			ret = pytalloc_reference_ex(&security_ace_object_Type, mem_ctx, &in->object);
			return ret;

		default:
			ret = Py_None;
			Py_INCREF(ret);
			return ret;

	}
	PyErr_SetString(PyExc_TypeError, "unknown union level");
	return NULL;
}

union security_ace_object_ctr *py_export_security_ace_object_ctr(TALLOC_CTX *mem_ctx, int level, PyObject *in)
{
	union security_ace_object_ctr *ret = talloc_zero(mem_ctx, union security_ace_object_ctr);
	switch (level) {
		case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT:
			PY_CHECK_TYPE(&security_ace_object_Type, in, talloc_free(ret); return NULL;);
			if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
				PyErr_NoMemory();
				talloc_free(ret); return NULL;
			}
			ret->object = *(struct security_ace_object *)pytalloc_get_ptr(in);
			break;

		case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT:
			PY_CHECK_TYPE(&security_ace_object_Type, in, talloc_free(ret); return NULL;);
			if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
				PyErr_NoMemory();
				talloc_free(ret); return NULL;
			}
			ret->object = *(struct security_ace_object *)pytalloc_get_ptr(in);
			break;

		case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT:
			PY_CHECK_TYPE(&security_ace_object_Type, in, talloc_free(ret); return NULL;);
			if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
				PyErr_NoMemory();
				talloc_free(ret); return NULL;
			}
			ret->object = *(struct security_ace_object *)pytalloc_get_ptr(in);
			break;

		case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT:
			PY_CHECK_TYPE(&security_ace_object_Type, in, talloc_free(ret); return NULL;);
			if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
				PyErr_NoMemory();
				talloc_free(ret); return NULL;
			}
			ret->object = *(struct security_ace_object *)pytalloc_get_ptr(in);
			break;

		default:
			break;

	}

	return ret;
}


static PyObject *py_security_ace_get_type(PyObject *obj, void *closure)
{
	struct security_ace *object = (struct security_ace *)pytalloc_get_ptr(obj);
	PyObject *py_type;
	py_type = PyInt_FromLong(object->type);
	return py_type;
}

static int py_security_ace_set_type(PyObject *py_obj, PyObject *value, void *closure)
{
	struct security_ace *object = (struct security_ace *)pytalloc_get_ptr(py_obj);
	if (PyLong_Check(value)) {
		object->type = PyLong_AsLongLong(value);
	} else if (PyInt_Check(value)) {
		object->type = PyInt_AsLong(value);
	} else {
		PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
		  PyInt_Type.tp_name, PyLong_Type.tp_name);
		return -1;
	}
	return 0;
}

static PyObject *py_security_ace_get_flags(PyObject *obj, void *closure)
{
	struct security_ace *object = (struct security_ace *)pytalloc_get_ptr(obj);
	PyObject *py_flags;
	py_flags = PyInt_FromLong(object->flags);
	return py_flags;
}

static int py_security_ace_set_flags(PyObject *py_obj, PyObject *value, void *closure)
{
	struct security_ace *object = (struct security_ace *)pytalloc_get_ptr(py_obj);
	if (PyLong_Check(value)) {
		object->flags = PyLong_AsLongLong(value);
	} else if (PyInt_Check(value)) {
		object->flags = PyInt_AsLong(value);
	} else {
		PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
		  PyInt_Type.tp_name, PyLong_Type.tp_name);
		return -1;
	}
	return 0;
}

static PyObject *py_security_ace_get_size(PyObject *obj, void *closure)
{
	struct security_ace *object = (struct security_ace *)pytalloc_get_ptr(obj);
	PyObject *py_size;
	py_size = PyInt_FromLong(object->size);
	return py_size;
}

static int py_security_ace_set_size(PyObject *py_obj, PyObject *value, void *closure)
{
	struct security_ace *object = (struct security_ace *)pytalloc_get_ptr(py_obj);
	PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
	object->size = PyInt_AsLong(value);
	return 0;
}

static PyObject *py_security_ace_get_access_mask(PyObject *obj, void *closure)
{
	struct security_ace *object = (struct security_ace *)pytalloc_get_ptr(obj);
	PyObject *py_access_mask;
	py_access_mask = PyInt_FromLong(object->access_mask);
	return py_access_mask;
}

static int py_security_ace_set_access_mask(PyObject *py_obj, PyObject *value, void *closure)
{
	struct security_ace *object = (struct security_ace *)pytalloc_get_ptr(py_obj);
	PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
	object->access_mask = PyInt_AsLong(value);
	return 0;
}

static PyObject *py_security_ace_get_object(PyObject *obj, void *closure)
{
	struct security_ace *object = (struct security_ace *)pytalloc_get_ptr(obj);
	PyObject *py_object;
	py_object = py_import_security_ace_object_ctr(pytalloc_get_mem_ctx(obj), object->type, &object->object);
	if (py_object == NULL) {
		return NULL;
	}
	return py_object;
}

static int py_security_ace_set_object(PyObject *py_obj, PyObject *value, void *closure)
{
	struct security_ace *object = (struct security_ace *)pytalloc_get_ptr(py_obj);
	{
		union security_ace_object_ctr *object_switch_0;
		object_switch_0 = py_export_security_ace_object_ctr(pytalloc_get_mem_ctx(py_obj), object->type, value);
		if (object_switch_0 == NULL) {
			return -1;
		}
		object->object = *object_switch_0;
	}
	return 0;
}

static PyObject *py_security_ace_get_trustee(PyObject *obj, void *closure)
{
	struct security_ace *object = (struct security_ace *)pytalloc_get_ptr(obj);
	PyObject *py_trustee;
	py_trustee = pytalloc_reference_ex(&dom_sid_Type, pytalloc_get_mem_ctx(obj), &object->trustee);
	return py_trustee;
}

static int py_security_ace_set_trustee(PyObject *py_obj, PyObject *value, void *closure)
{
	struct security_ace *object = (struct security_ace *)pytalloc_get_ptr(py_obj);
	PY_CHECK_TYPE(&dom_sid_Type, value, return -1;);
	if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
		PyErr_NoMemory();
		return -1;
	}
	object->trustee = *(struct dom_sid *)pytalloc_get_ptr(value);
	return 0;
}

static PyGetSetDef py_security_ace_getsetters[] = {
	{ discard_const_p(char, "type"), py_security_ace_get_type, py_security_ace_set_type },
	{ discard_const_p(char, "flags"), py_security_ace_get_flags, py_security_ace_set_flags },
	{ discard_const_p(char, "size"), py_security_ace_get_size, py_security_ace_set_size },
	{ discard_const_p(char, "access_mask"), py_security_ace_get_access_mask, py_security_ace_set_access_mask },
	{ discard_const_p(char, "object"), py_security_ace_get_object, py_security_ace_set_object },
	{ discard_const_p(char, "trustee"), py_security_ace_get_trustee, py_security_ace_set_trustee },
	{ NULL }
};

static PyObject *py_security_ace_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
	return pytalloc_new(struct security_ace, type);
}

static PyObject *py_security_ace_ndr_pack(PyObject *py_obj)
{
	struct security_ace *object = (struct security_ace *)pytalloc_get_ptr(py_obj);
	DATA_BLOB blob;
	enum ndr_err_code err;
	err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_security_ace);
	if (err != NDR_ERR_SUCCESS) {
		PyErr_SetNdrError(err);
		return NULL;
	}

	return PyString_FromStringAndSize((char *)blob.data, blob.length);
}

static PyObject *py_security_ace_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
{
	struct security_ace *object = (struct security_ace *)pytalloc_get_ptr(py_obj);
	DATA_BLOB blob;
	int blob_length = 0;
	enum ndr_err_code err;
	const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
	PyObject *allow_remaining_obj = NULL;
	bool allow_remaining = false;

	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|O:__ndr_unpack__",
		discard_const_p(char *, kwnames),
		&blob.data, &blob_length,
		&allow_remaining_obj)) {
		return NULL;
	}
	blob.length = blob_length;

	if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
		allow_remaining = true;
	}

	if (allow_remaining) {
		err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_security_ace);
	} else {
		err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_security_ace);
	}
	if (err != NDR_ERR_SUCCESS) {
		PyErr_SetNdrError(err);
		return NULL;
	}

	Py_RETURN_NONE;
}

static PyObject *py_security_ace_ndr_print(PyObject *py_obj)
{
	struct security_ace *object = (struct security_ace *)pytalloc_get_ptr(py_obj);
	PyObject *ret;
	char *retstr;

	retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_security_ace, "security_ace", object);
	ret = PyString_FromString(retstr);
	talloc_free(retstr);

	return ret;
}

static PyMethodDef py_security_ace_methods[] = {
	{ "__ndr_pack__", (PyCFunction)py_security_ace_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
	{ "__ndr_unpack__", (PyCFunction)py_security_ace_ndr_unpack, METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
	{ "__ndr_print__", (PyCFunction)py_security_ace_ndr_print, METH_VARARGS, "S.ndr_print(object) -> None\nNDR print" },
	{ NULL, NULL, 0, NULL }
};


static PyTypeObject security_ace_Type = {
	PyObject_HEAD_INIT(NULL) 0,
	.tp_name = "security.ace",
	.tp_getset = py_security_ace_getsetters,
	.tp_methods = py_security_ace_methods,
	.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
	.tp_basicsize = sizeof(pytalloc_Object),
	.tp_new = py_security_ace_new,
};


static PyObject *py_security_acl_get_revision(PyObject *obj, void *closure)
{
	struct security_acl *object = (struct security_acl *)pytalloc_get_ptr(obj);
	PyObject *py_revision;
	py_revision = PyInt_FromLong(object->revision);
	return py_revision;
}

static int py_security_acl_set_revision(PyObject *py_obj, PyObject *value, void *closure)
{
	struct security_acl *object = (struct security_acl *)pytalloc_get_ptr(py_obj);
	if (PyLong_Check(value)) {
		object->revision = PyLong_AsLongLong(value);
	} else if (PyInt_Check(value)) {
		object->revision = PyInt_AsLong(value);
	} else {
		PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
		  PyInt_Type.tp_name, PyLong_Type.tp_name);
		return -1;
	}
	return 0;
}

static PyObject *py_security_acl_get_size(PyObject *obj, void *closure)
{
	struct security_acl *object = (struct security_acl *)pytalloc_get_ptr(obj);
	PyObject *py_size;
	py_size = PyInt_FromLong(object->size);
	return py_size;
}

static int py_security_acl_set_size(PyObject *py_obj, PyObject *value, void *closure)
{
	struct security_acl *object = (struct security_acl *)pytalloc_get_ptr(py_obj);
	PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
	object->size = PyInt_AsLong(value);
	return 0;
}

static PyObject *py_security_acl_get_num_aces(PyObject *obj, void *closure)
{
	struct security_acl *object = (struct security_acl *)pytalloc_get_ptr(obj);
	PyObject *py_num_aces;
	py_num_aces = PyInt_FromLong(object->num_aces);
	return py_num_aces;
}

static int py_security_acl_set_num_aces(PyObject *py_obj, PyObject *value, void *closure)
{
	struct security_acl *object = (struct security_acl *)pytalloc_get_ptr(py_obj);
	PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
	object->num_aces = PyInt_AsLong(value);
	return 0;
}

static PyObject *py_security_acl_get_aces(PyObject *obj, void *closure)
{
	struct security_acl *object = (struct security_acl *)pytalloc_get_ptr(obj);
	PyObject *py_aces;
	py_aces = PyList_New(object->num_aces);
	if (py_aces == NULL) {
		return NULL;
	}
	{
		int aces_cntr_0;
		for (aces_cntr_0 = 0; aces_cntr_0 < object->num_aces; aces_cntr_0++) {
			PyObject *py_aces_0;
			py_aces_0 = pytalloc_reference_ex(&security_ace_Type, object->aces, &object->aces[aces_cntr_0]);
			PyList_SetItem(py_aces, aces_cntr_0, py_aces_0);
		}
	}
	return py_aces;
}

static int py_security_acl_set_aces(PyObject *py_obj, PyObject *value, void *closure)
{
	struct security_acl *object = (struct security_acl *)pytalloc_get_ptr(py_obj);
	PY_CHECK_TYPE(&PyList_Type, value, return -1;);
	{
		int aces_cntr_0;
		object->aces = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->aces, PyList_GET_SIZE(value));
		if (!object->aces) { return -1;; }
		talloc_set_name_const(object->aces, "ARRAY: object->aces");
		for (aces_cntr_0 = 0; aces_cntr_0 < PyList_GET_SIZE(value); aces_cntr_0++) {
			PY_CHECK_TYPE(&security_ace_Type, PyList_GET_ITEM(value, aces_cntr_0), return -1;);
			if (talloc_reference(object->aces, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, aces_cntr_0))) == NULL) {
				PyErr_NoMemory();
				return -1;
			}
			object->aces[aces_cntr_0] = *(struct security_ace *)pytalloc_get_ptr(PyList_GET_ITEM(value, aces_cntr_0));
		}
	}
	return 0;
}

static PyGetSetDef py_security_acl_getsetters[] = {
	{ discard_const_p(char, "revision"), py_security_acl_get_revision, py_security_acl_set_revision },
	{ discard_const_p(char, "size"), py_security_acl_get_size, py_security_acl_set_size },
	{ discard_const_p(char, "num_aces"), py_security_acl_get_num_aces, py_security_acl_set_num_aces },
	{ discard_const_p(char, "aces"), py_security_acl_get_aces, py_security_acl_set_aces },
	{ NULL }
};

static PyObject *py_security_acl_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
	return pytalloc_new(struct security_acl, type);
}

static PyObject *py_security_acl_ndr_pack(PyObject *py_obj)
{
	struct security_acl *object = (struct security_acl *)pytalloc_get_ptr(py_obj);
	DATA_BLOB blob;
	enum ndr_err_code err;
	err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_security_acl);
	if (err != NDR_ERR_SUCCESS) {
		PyErr_SetNdrError(err);
		return NULL;
	}

	return PyString_FromStringAndSize((char *)blob.data, blob.length);
}

static PyObject *py_security_acl_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
{
	struct security_acl *object = (struct security_acl *)pytalloc_get_ptr(py_obj);
	DATA_BLOB blob;
	int blob_length = 0;
	enum ndr_err_code err;
	const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
	PyObject *allow_remaining_obj = NULL;
	bool allow_remaining = false;

	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|O:__ndr_unpack__",
		discard_const_p(char *, kwnames),
		&blob.data, &blob_length,
		&allow_remaining_obj)) {
		return NULL;
	}
	blob.length = blob_length;

	if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
		allow_remaining = true;
	}

	if (allow_remaining) {
		err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_security_acl);
	} else {
		err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_security_acl);
	}
	if (err != NDR_ERR_SUCCESS) {
		PyErr_SetNdrError(err);
		return NULL;
	}

	Py_RETURN_NONE;
}

static PyObject *py_security_acl_ndr_print(PyObject *py_obj)
{
	struct security_acl *object = (struct security_acl *)pytalloc_get_ptr(py_obj);
	PyObject *ret;
	char *retstr;

	retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_security_acl, "security_acl", object);
	ret = PyString_FromString(retstr);
	talloc_free(retstr);

	return ret;
}

static PyMethodDef py_security_acl_methods[] = {
	{ "__ndr_pack__", (PyCFunction)py_security_acl_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
	{ "__ndr_unpack__", (PyCFunction)py_security_acl_ndr_unpack, METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
	{ "__ndr_print__", (PyCFunction)py_security_acl_ndr_print, METH_VARARGS, "S.ndr_print(object) -> None\nNDR print" },
	{ NULL, NULL, 0, NULL }
};


static PyTypeObject security_acl_Type = {
	PyObject_HEAD_INIT(NULL) 0,
	.tp_name = "security.acl",
	.tp_getset = py_security_acl_getsetters,
	.tp_methods = py_security_acl_methods,
	.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
	.tp_basicsize = sizeof(pytalloc_Object),
	.tp_new = py_security_acl_new,
};


static PyObject *py_security_descriptor_get_revision(PyObject *obj, void *closure)
{
	struct security_descriptor *object = (struct security_descriptor *)pytalloc_get_ptr(obj);
	PyObject *py_revision;
	py_revision = PyInt_FromLong(object->revision);
	return py_revision;
}

static int py_security_descriptor_set_revision(PyObject *py_obj, PyObject *value, void *closure)
{
	struct security_descriptor *object = (struct security_descriptor *)pytalloc_get_ptr(py_obj);
	if (PyLong_Check(value)) {
		object->revision = PyLong_AsLongLong(value);
	} else if (PyInt_Check(value)) {
		object->revision = PyInt_AsLong(value);
	} else {
		PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
		  PyInt_Type.tp_name, PyLong_Type.tp_name);
		return -1;
	}
	return 0;
}

static PyObject *py_security_descriptor_get_type(PyObject *obj, void *closure)
{
	struct security_descriptor *object = (struct security_descriptor *)pytalloc_get_ptr(obj);
	PyObject *py_type;
	py_type = PyInt_FromLong(object->type);
	return py_type;
}

static int py_security_descriptor_set_type(PyObject *py_obj, PyObject *value, void *closure)
{
	struct security_descriptor *object = (struct security_descriptor *)pytalloc_get_ptr(py_obj);
	if (PyLong_Check(value)) {
		object->type = PyLong_AsLongLong(value);
	} else if (PyInt_Check(value)) {
		object->type = PyInt_AsLong(value);
	} else {
		PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
		  PyInt_Type.tp_name, PyLong_Type.tp_name);
		return -1;
	}
	return 0;
}

static PyObject *py_security_descriptor_get_owner_sid(PyObject *obj, void *closure)
{
	struct security_descriptor *object = (struct security_descriptor *)pytalloc_get_ptr(obj);
	PyObject *py_owner_sid;
	if (object->owner_sid == NULL) {
		py_owner_sid = Py_None;
		Py_INCREF(py_owner_sid);
	} else {
		py_owner_sid = pytalloc_reference_ex(&dom_sid_Type, object->owner_sid, object->owner_sid);
	}
	return py_owner_sid;
}

static int py_security_descriptor_set_owner_sid(PyObject *py_obj, PyObject *value, void *closure)
{
	struct security_descriptor *object = (struct security_descriptor *)pytalloc_get_ptr(py_obj);
	talloc_unlink(pytalloc_get_mem_ctx(py_obj), object->owner_sid);
	if (value == Py_None) {
		object->owner_sid = NULL;
	} else {
		object->owner_sid = NULL;
		PY_CHECK_TYPE(&dom_sid_Type, value, return -1;);
		if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
			PyErr_NoMemory();
			return -1;
		}
		object->owner_sid = (struct dom_sid *)pytalloc_get_ptr(value);
	}
	return 0;
}

static PyObject *py_security_descriptor_get_group_sid(PyObject *obj, void *closure)
{
	struct security_descriptor *object = (struct security_descriptor *)pytalloc_get_ptr(obj);
	PyObject *py_group_sid;
	if (object->group_sid == NULL) {
		py_group_sid = Py_None;
		Py_INCREF(py_group_sid);
	} else {
		py_group_sid = pytalloc_reference_ex(&dom_sid_Type, object->group_sid, object->group_sid);
	}
	return py_group_sid;
}

static int py_security_descriptor_set_group_sid(PyObject *py_obj, PyObject *value, void *closure)
{
	struct security_descriptor *object = (struct security_descriptor *)pytalloc_get_ptr(py_obj);
	talloc_unlink(pytalloc_get_mem_ctx(py_obj), object->group_sid);
	if (value == Py_None) {
		object->group_sid = NULL;
	} else {
		object->group_sid = NULL;
		PY_CHECK_TYPE(&dom_sid_Type, value, return -1;);
		if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
			PyErr_NoMemory();
			return -1;
		}
		object->group_sid = (struct dom_sid *)pytalloc_get_ptr(value);
	}
	return 0;
}

static PyObject *py_security_descriptor_get_sacl(PyObject *obj, void *closure)
{
	struct security_descriptor *object = (struct security_descriptor *)pytalloc_get_ptr(obj);
	PyObject *py_sacl;
	if (object->sacl == NULL) {
		py_sacl = Py_None;
		Py_INCREF(py_sacl);
	} else {
		py_sacl = pytalloc_reference_ex(&security_acl_Type, object->sacl, object->sacl);
	}
	return py_sacl;
}

static int py_security_descriptor_set_sacl(PyObject *py_obj, PyObject *value, void *closure)
{
	struct security_descriptor *object = (struct security_descriptor *)pytalloc_get_ptr(py_obj);
	talloc_unlink(pytalloc_get_mem_ctx(py_obj), object->sacl);
	if (value == Py_None) {
		object->sacl = NULL;
	} else {
		object->sacl = NULL;
		PY_CHECK_TYPE(&security_acl_Type, value, return -1;);
		if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
			PyErr_NoMemory();
			return -1;
		}
		object->sacl = (struct security_acl *)pytalloc_get_ptr(value);
	}
	return 0;
}

static PyObject *py_security_descriptor_get_dacl(PyObject *obj, void *closure)
{
	struct security_descriptor *object = (struct security_descriptor *)pytalloc_get_ptr(obj);
	PyObject *py_dacl;
	if (object->dacl == NULL) {
		py_dacl = Py_None;
		Py_INCREF(py_dacl);
	} else {
		py_dacl = pytalloc_reference_ex(&security_acl_Type, object->dacl, object->dacl);
	}
	return py_dacl;
}

static int py_security_descriptor_set_dacl(PyObject *py_obj, PyObject *value, void *closure)
{
	struct security_descriptor *object = (struct security_descriptor *)pytalloc_get_ptr(py_obj);
	talloc_unlink(pytalloc_get_mem_ctx(py_obj), object->dacl);
	if (value == Py_None) {
		object->dacl = NULL;
	} else {
		object->dacl = NULL;
		PY_CHECK_TYPE(&security_acl_Type, value, return -1;);
		if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
			PyErr_NoMemory();
			return -1;
		}
		object->dacl = (struct security_acl *)pytalloc_get_ptr(value);
	}
	return 0;
}

static PyGetSetDef py_security_descriptor_getsetters[] = {
	{ discard_const_p(char, "revision"), py_security_descriptor_get_revision, py_security_descriptor_set_revision },
	{ discard_const_p(char, "type"), py_security_descriptor_get_type, py_security_descriptor_set_type },
	{ discard_const_p(char, "owner_sid"), py_security_descriptor_get_owner_sid, py_security_descriptor_set_owner_sid },
	{ discard_const_p(char, "group_sid"), py_security_descriptor_get_group_sid, py_security_descriptor_set_group_sid },
	{ discard_const_p(char, "sacl"), py_security_descriptor_get_sacl, py_security_descriptor_set_sacl },
	{ discard_const_p(char, "dacl"), py_security_descriptor_get_dacl, py_security_descriptor_set_dacl },
	{ NULL }
};

static PyObject *py_security_descriptor_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
	return pytalloc_new(struct security_descriptor, type);
}

static PyObject *py_security_descriptor_ndr_pack(PyObject *py_obj)
{
	struct security_descriptor *object = (struct security_descriptor *)pytalloc_get_ptr(py_obj);
	DATA_BLOB blob;
	enum ndr_err_code err;
	err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_security_descriptor);
	if (err != NDR_ERR_SUCCESS) {
		PyErr_SetNdrError(err);
		return NULL;
	}

	return PyString_FromStringAndSize((char *)blob.data, blob.length);
}

static PyObject *py_security_descriptor_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
{
	struct security_descriptor *object = (struct security_descriptor *)pytalloc_get_ptr(py_obj);
	DATA_BLOB blob;
	int blob_length = 0;
	enum ndr_err_code err;
	const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
	PyObject *allow_remaining_obj = NULL;
	bool allow_remaining = false;

	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|O:__ndr_unpack__",
		discard_const_p(char *, kwnames),
		&blob.data, &blob_length,
		&allow_remaining_obj)) {
		return NULL;
	}
	blob.length = blob_length;

	if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
		allow_remaining = true;
	}

	if (allow_remaining) {
		err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_security_descriptor);
	} else {
		err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_security_descriptor);
	}
	if (err != NDR_ERR_SUCCESS) {
		PyErr_SetNdrError(err);
		return NULL;
	}

	Py_RETURN_NONE;
}

static PyObject *py_security_descriptor_ndr_print(PyObject *py_obj)
{
	struct security_descriptor *object = (struct security_descriptor *)pytalloc_get_ptr(py_obj);
	PyObject *ret;
	char *retstr;

	retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_security_descriptor, "security_descriptor", object);
	ret = PyString_FromString(retstr);
	talloc_free(retstr);

	return ret;
}

static PyMethodDef py_security_descriptor_methods[] = {
	{ "__ndr_pack__", (PyCFunction)py_security_descriptor_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
	{ "__ndr_unpack__", (PyCFunction)py_security_descriptor_ndr_unpack, METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
	{ "__ndr_print__", (PyCFunction)py_security_descriptor_ndr_print, METH_VARARGS, "S.ndr_print(object) -> None\nNDR print" },
	{ NULL, NULL, 0, NULL }
};


static PyTypeObject security_descriptor_Type = {
	PyObject_HEAD_INIT(NULL) 0,
	.tp_name = "security.descriptor",
	.tp_getset = py_security_descriptor_getsetters,
	.tp_methods = py_security_descriptor_methods,
	.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
	.tp_basicsize = sizeof(pytalloc_Object),
	.tp_new = py_security_descriptor_new,
};


static PyObject *py_sec_desc_buf_get_sd_size(PyObject *obj, void *closure)
{
	struct sec_desc_buf *object = (struct sec_desc_buf *)pytalloc_get_ptr(obj);
	PyObject *py_sd_size;
	py_sd_size = PyInt_FromLong(object->sd_size);
	return py_sd_size;
}

static int py_sec_desc_buf_set_sd_size(PyObject *py_obj, PyObject *value, void *closure)
{
	struct sec_desc_buf *object = (struct sec_desc_buf *)pytalloc_get_ptr(py_obj);
	PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
	object->sd_size = PyInt_AsLong(value);
	return 0;
}

static PyObject *py_sec_desc_buf_get_sd(PyObject *obj, void *closure)
{
	struct sec_desc_buf *object = (struct sec_desc_buf *)pytalloc_get_ptr(obj);
	PyObject *py_sd;
	if (object->sd == NULL) {
		py_sd = Py_None;
		Py_INCREF(py_sd);
	} else {
		py_sd = pytalloc_reference_ex(&security_descriptor_Type, object->sd, object->sd);
	}
	return py_sd;
}

static int py_sec_desc_buf_set_sd(PyObject *py_obj, PyObject *value, void *closure)
{
	struct sec_desc_buf *object = (struct sec_desc_buf *)pytalloc_get_ptr(py_obj);
	talloc_unlink(pytalloc_get_mem_ctx(py_obj), object->sd);
	if (value == Py_None) {
		object->sd = NULL;
	} else {
		object->sd = NULL;
		PY_CHECK_TYPE(&security_descriptor_Type, value, return -1;);
		if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
			PyErr_NoMemory();
			return -1;
		}
		object->sd = (struct security_descriptor *)pytalloc_get_ptr(value);
	}
	return 0;
}

static PyGetSetDef py_sec_desc_buf_getsetters[] = {
	{ discard_const_p(char, "sd_size"), py_sec_desc_buf_get_sd_size, py_sec_desc_buf_set_sd_size },
	{ discard_const_p(char, "sd"), py_sec_desc_buf_get_sd, py_sec_desc_buf_set_sd },
	{ NULL }
};

static PyObject *py_sec_desc_buf_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
	return pytalloc_new(struct sec_desc_buf, type);
}

static PyObject *py_sec_desc_buf_ndr_pack(PyObject *py_obj)
{
	struct sec_desc_buf *object = (struct sec_desc_buf *)pytalloc_get_ptr(py_obj);
	DATA_BLOB blob;
	enum ndr_err_code err;
	err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_sec_desc_buf);
	if (err != NDR_ERR_SUCCESS) {
		PyErr_SetNdrError(err);
		return NULL;
	}

	return PyString_FromStringAndSize((char *)blob.data, blob.length);
}

static PyObject *py_sec_desc_buf_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
{
	struct sec_desc_buf *object = (struct sec_desc_buf *)pytalloc_get_ptr(py_obj);
	DATA_BLOB blob;
	int blob_length = 0;
	enum ndr_err_code err;
	const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
	PyObject *allow_remaining_obj = NULL;
	bool allow_remaining = false;

	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|O:__ndr_unpack__",
		discard_const_p(char *, kwnames),
		&blob.data, &blob_length,
		&allow_remaining_obj)) {
		return NULL;
	}
	blob.length = blob_length;

	if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
		allow_remaining = true;
	}

	if (allow_remaining) {
		err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_sec_desc_buf);
	} else {
		err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_sec_desc_buf);
	}
	if (err != NDR_ERR_SUCCESS) {
		PyErr_SetNdrError(err);
		return NULL;
	}

	Py_RETURN_NONE;
}

static PyObject *py_sec_desc_buf_ndr_print(PyObject *py_obj)
{
	struct sec_desc_buf *object = (struct sec_desc_buf *)pytalloc_get_ptr(py_obj);
	PyObject *ret;
	char *retstr;

	retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_sec_desc_buf, "sec_desc_buf", object);
	ret = PyString_FromString(retstr);
	talloc_free(retstr);

	return ret;
}

static PyMethodDef py_sec_desc_buf_methods[] = {
	{ "__ndr_pack__", (PyCFunction)py_sec_desc_buf_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
	{ "__ndr_unpack__", (PyCFunction)py_sec_desc_buf_ndr_unpack, METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
	{ "__ndr_print__", (PyCFunction)py_sec_desc_buf_ndr_print, METH_VARARGS, "S.ndr_print(object) -> None\nNDR print" },
	{ NULL, NULL, 0, NULL }
};


static PyTypeObject sec_desc_buf_Type = {
	PyObject_HEAD_INIT(NULL) 0,
	.tp_name = "security.sec_desc_buf",
	.tp_getset = py_sec_desc_buf_getsetters,
	.tp_methods = py_sec_desc_buf_methods,
	.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
	.tp_basicsize = sizeof(pytalloc_Object),
	.tp_new = py_sec_desc_buf_new,
};


static PyObject *py_security_token_get_num_sids(PyObject *obj, void *closure)
{
	struct security_token *object = (struct security_token *)pytalloc_get_ptr(obj);
	PyObject *py_num_sids;
	py_num_sids = PyInt_FromLong(object->num_sids);
	return py_num_sids;
}

static int py_security_token_set_num_sids(PyObject *py_obj, PyObject *value, void *closure)
{
	struct security_token *object = (struct security_token *)pytalloc_get_ptr(py_obj);
	PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
	object->num_sids = PyInt_AsLong(value);
	return 0;
}

static PyObject *py_security_token_get_sids(PyObject *obj, void *closure)
{
	struct security_token *object = (struct security_token *)pytalloc_get_ptr(obj);
	PyObject *py_sids;
	py_sids = PyList_New(object->num_sids);
	if (py_sids == NULL) {
		return NULL;
	}
	{
		int sids_cntr_0;
		for (sids_cntr_0 = 0; sids_cntr_0 < object->num_sids; sids_cntr_0++) {
			PyObject *py_sids_0;
			py_sids_0 = pytalloc_reference_ex(&dom_sid_Type, object->sids, &object->sids[sids_cntr_0]);
			PyList_SetItem(py_sids, sids_cntr_0, py_sids_0);
		}
	}
	return py_sids;
}

static int py_security_token_set_sids(PyObject *py_obj, PyObject *value, void *closure)
{
	struct security_token *object = (struct security_token *)pytalloc_get_ptr(py_obj);
	PY_CHECK_TYPE(&PyList_Type, value, return -1;);
	{
		int sids_cntr_0;
		object->sids = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->sids, PyList_GET_SIZE(value));
		if (!object->sids) { return -1;; }
		talloc_set_name_const(object->sids, "ARRAY: object->sids");
		for (sids_cntr_0 = 0; sids_cntr_0 < PyList_GET_SIZE(value); sids_cntr_0++) {
			PY_CHECK_TYPE(&dom_sid_Type, PyList_GET_ITEM(value, sids_cntr_0), return -1;);
			if (talloc_reference(object->sids, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, sids_cntr_0))) == NULL) {
				PyErr_NoMemory();
				return -1;
			}
			object->sids[sids_cntr_0] = *(struct dom_sid *)pytalloc_get_ptr(PyList_GET_ITEM(value, sids_cntr_0));
		}
	}
	return 0;
}

static PyObject *py_security_token_get_privilege_mask(PyObject *obj, void *closure)
{
	struct security_token *object = (struct security_token *)pytalloc_get_ptr(obj);
	PyObject *py_privilege_mask;
	py_privilege_mask = PyLong_FromLongLong(object->privilege_mask);
	return py_privilege_mask;
}

static int py_security_token_set_privilege_mask(PyObject *py_obj, PyObject *value, void *closure)
{
	struct security_token *object = (struct security_token *)pytalloc_get_ptr(py_obj);
	if (PyLong_Check(value)) {
		object->privilege_mask = PyLong_AsLongLong(value);
	} else if (PyInt_Check(value)) {
		object->privilege_mask = PyInt_AsLong(value);
	} else {
		PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
		  PyInt_Type.tp_name, PyLong_Type.tp_name);
		return -1;
	}
	return 0;
}

static PyObject *py_security_token_get_rights_mask(PyObject *obj, void *closure)
{
	struct security_token *object = (struct security_token *)pytalloc_get_ptr(obj);
	PyObject *py_rights_mask;
	py_rights_mask = PyInt_FromLong(object->rights_mask);
	return py_rights_mask;
}

static int py_security_token_set_rights_mask(PyObject *py_obj, PyObject *value, void *closure)
{
	struct security_token *object = (struct security_token *)pytalloc_get_ptr(py_obj);
	if (PyLong_Check(value)) {
		object->rights_mask = PyLong_AsLongLong(value);
	} else if (PyInt_Check(value)) {
		object->rights_mask = PyInt_AsLong(value);
	} else {
		PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
		  PyInt_Type.tp_name, PyLong_Type.tp_name);
		return -1;
	}
	return 0;
}

static PyGetSetDef py_security_token_getsetters[] = {
	{ discard_const_p(char, "num_sids"), py_security_token_get_num_sids, py_security_token_set_num_sids },
	{ discard_const_p(char, "sids"), py_security_token_get_sids, py_security_token_set_sids },
	{ discard_const_p(char, "privilege_mask"), py_security_token_get_privilege_mask, py_security_token_set_privilege_mask },
	{ discard_const_p(char, "rights_mask"), py_security_token_get_rights_mask, py_security_token_set_rights_mask },
	{ NULL }
};

static PyObject *py_security_token_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
	return pytalloc_new(struct security_token, type);
}

static PyObject *py_security_token_ndr_pack(PyObject *py_obj)
{
	struct security_token *object = (struct security_token *)pytalloc_get_ptr(py_obj);
	DATA_BLOB blob;
	enum ndr_err_code err;
	err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_security_token);
	if (err != NDR_ERR_SUCCESS) {
		PyErr_SetNdrError(err);
		return NULL;
	}

	return PyString_FromStringAndSize((char *)blob.data, blob.length);
}

static PyObject *py_security_token_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
{
	struct security_token *object = (struct security_token *)pytalloc_get_ptr(py_obj);
	DATA_BLOB blob;
	int blob_length = 0;
	enum ndr_err_code err;
	const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
	PyObject *allow_remaining_obj = NULL;
	bool allow_remaining = false;

	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|O:__ndr_unpack__",
		discard_const_p(char *, kwnames),
		&blob.data, &blob_length,
		&allow_remaining_obj)) {
		return NULL;
	}
	blob.length = blob_length;

	if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
		allow_remaining = true;
	}

	if (allow_remaining) {
		err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_security_token);
	} else {
		err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_security_token);
	}
	if (err != NDR_ERR_SUCCESS) {
		PyErr_SetNdrError(err);
		return NULL;
	}

	Py_RETURN_NONE;
}

static PyObject *py_security_token_ndr_print(PyObject *py_obj)
{
	struct security_token *object = (struct security_token *)pytalloc_get_ptr(py_obj);
	PyObject *ret;
	char *retstr;

	retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_security_token, "security_token", object);
	ret = PyString_FromString(retstr);
	talloc_free(retstr);

	return ret;
}

static PyMethodDef py_security_token_methods[] = {
	{ "__ndr_pack__", (PyCFunction)py_security_token_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
	{ "__ndr_unpack__", (PyCFunction)py_security_token_ndr_unpack, METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
	{ "__ndr_print__", (PyCFunction)py_security_token_ndr_print, METH_VARARGS, "S.ndr_print(object) -> None\nNDR print" },
	{ NULL, NULL, 0, NULL }
};


static PyTypeObject security_token_Type = {
	PyObject_HEAD_INIT(NULL) 0,
	.tp_name = "security.token",
	.tp_getset = py_security_token_getsetters,
	.tp_methods = py_security_token_methods,
	.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
	.tp_basicsize = sizeof(pytalloc_Object),
	.tp_new = py_security_token_new,
};


static PyObject *py_security_unix_token_get_uid(PyObject *obj, void *closure)
{
	struct security_unix_token *object = (struct security_unix_token *)pytalloc_get_ptr(obj);
	PyObject *py_uid;
	py_uid = PyInt_FromLong(object->uid);
	return py_uid;
}

static int py_security_unix_token_set_uid(PyObject *py_obj, PyObject *value, void *closure)
{
	struct security_unix_token *object = (struct security_unix_token *)pytalloc_get_ptr(py_obj);
	PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
	object->uid = PyInt_AsLong(value);
	return 0;
}

static PyObject *py_security_unix_token_get_gid(PyObject *obj, void *closure)
{
	struct security_unix_token *object = (struct security_unix_token *)pytalloc_get_ptr(obj);
	PyObject *py_gid;
	py_gid = PyInt_FromLong(object->gid);
	return py_gid;
}

static int py_security_unix_token_set_gid(PyObject *py_obj, PyObject *value, void *closure)
{
	struct security_unix_token *object = (struct security_unix_token *)pytalloc_get_ptr(py_obj);
	PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
	object->gid = PyInt_AsLong(value);
	return 0;
}

static PyObject *py_security_unix_token_get_ngroups(PyObject *obj, void *closure)
{
	struct security_unix_token *object = (struct security_unix_token *)pytalloc_get_ptr(obj);
	PyObject *py_ngroups;
	py_ngroups = PyInt_FromLong(object->ngroups);
	return py_ngroups;
}

static int py_security_unix_token_set_ngroups(PyObject *py_obj, PyObject *value, void *closure)
{
	struct security_unix_token *object = (struct security_unix_token *)pytalloc_get_ptr(py_obj);
	PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
	object->ngroups = PyInt_AsLong(value);
	return 0;
}

static PyObject *py_security_unix_token_get_groups(PyObject *obj, void *closure)
{
	struct security_unix_token *object = (struct security_unix_token *)pytalloc_get_ptr(obj);
	PyObject *py_groups;
	py_groups = PyList_New(object->ngroups);
	if (py_groups == NULL) {
		return NULL;
	}
	{
		int groups_cntr_0;
		for (groups_cntr_0 = 0; groups_cntr_0 < object->ngroups; groups_cntr_0++) {
			PyObject *py_groups_0;
			py_groups_0 = PyInt_FromLong(object->groups[groups_cntr_0]);
			PyList_SetItem(py_groups, groups_cntr_0, py_groups_0);
		}
	}
	return py_groups;
}

static int py_security_unix_token_set_groups(PyObject *py_obj, PyObject *value, void *closure)
{
	struct security_unix_token *object = (struct security_unix_token *)pytalloc_get_ptr(py_obj);
	PY_CHECK_TYPE(&PyList_Type, value, return -1;);
	{
		int groups_cntr_0;
		object->groups = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->groups, PyList_GET_SIZE(value));
		if (!object->groups) { return -1;; }
		talloc_set_name_const(object->groups, "ARRAY: object->groups");
		for (groups_cntr_0 = 0; groups_cntr_0 < PyList_GET_SIZE(value); groups_cntr_0++) {
			PY_CHECK_TYPE(&PyInt_Type, PyList_GET_ITEM(value, groups_cntr_0), return -1;);
			object->groups[groups_cntr_0] = PyInt_AsLong(PyList_GET_ITEM(value, groups_cntr_0));
		}
	}
	return 0;
}

static PyGetSetDef py_security_unix_token_getsetters[] = {
	{ discard_const_p(char, "uid"), py_security_unix_token_get_uid, py_security_unix_token_set_uid },
	{ discard_const_p(char, "gid"), py_security_unix_token_get_gid, py_security_unix_token_set_gid },
	{ discard_const_p(char, "ngroups"), py_security_unix_token_get_ngroups, py_security_unix_token_set_ngroups },
	{ discard_const_p(char, "groups"), py_security_unix_token_get_groups, py_security_unix_token_set_groups },
	{ NULL }
};

static PyObject *py_security_unix_token_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
	return pytalloc_new(struct security_unix_token, type);
}

static PyObject *py_security_unix_token_ndr_pack(PyObject *py_obj)
{
	struct security_unix_token *object = (struct security_unix_token *)pytalloc_get_ptr(py_obj);
	DATA_BLOB blob;
	enum ndr_err_code err;
	err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_security_unix_token);
	if (err != NDR_ERR_SUCCESS) {
		PyErr_SetNdrError(err);
		return NULL;
	}

	return PyString_FromStringAndSize((char *)blob.data, blob.length);
}

static PyObject *py_security_unix_token_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
{
	struct security_unix_token *object = (struct security_unix_token *)pytalloc_get_ptr(py_obj);
	DATA_BLOB blob;
	int blob_length = 0;
	enum ndr_err_code err;
	const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
	PyObject *allow_remaining_obj = NULL;
	bool allow_remaining = false;

	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|O:__ndr_unpack__",
		discard_const_p(char *, kwnames),
		&blob.data, &blob_length,
		&allow_remaining_obj)) {
		return NULL;
	}
	blob.length = blob_length;

	if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
		allow_remaining = true;
	}

	if (allow_remaining) {
		err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_security_unix_token);
	} else {
		err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_security_unix_token);
	}
	if (err != NDR_ERR_SUCCESS) {
		PyErr_SetNdrError(err);
		return NULL;
	}

	Py_RETURN_NONE;
}

static PyObject *py_security_unix_token_ndr_print(PyObject *py_obj)
{
	struct security_unix_token *object = (struct security_unix_token *)pytalloc_get_ptr(py_obj);
	PyObject *ret;
	char *retstr;

	retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_security_unix_token, "security_unix_token", object);
	ret = PyString_FromString(retstr);
	talloc_free(retstr);

	return ret;
}

static PyMethodDef py_security_unix_token_methods[] = {
	{ "__ndr_pack__", (PyCFunction)py_security_unix_token_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
	{ "__ndr_unpack__", (PyCFunction)py_security_unix_token_ndr_unpack, METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
	{ "__ndr_print__", (PyCFunction)py_security_unix_token_ndr_print, METH_VARARGS, "S.ndr_print(object) -> None\nNDR print" },
	{ NULL, NULL, 0, NULL }
};


static PyTypeObject security_unix_token_Type = {
	PyObject_HEAD_INIT(NULL) 0,
	.tp_name = "security.unix_token",
	.tp_getset = py_security_unix_token_getsetters,
	.tp_methods = py_security_unix_token_methods,
	.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
	.tp_basicsize = sizeof(pytalloc_Object),
	.tp_new = py_security_unix_token_new,
};


static PyObject *py_generic_mapping_get_generic_read(PyObject *obj, void *closure)
{
	struct generic_mapping *object = (struct generic_mapping *)pytalloc_get_ptr(obj);
	PyObject *py_generic_read;
	py_generic_read = PyInt_FromLong(object->generic_read);
	return py_generic_read;
}

static int py_generic_mapping_set_generic_read(PyObject *py_obj, PyObject *value, void *closure)
{
	struct generic_mapping *object = (struct generic_mapping *)pytalloc_get_ptr(py_obj);
	PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
	object->generic_read = PyInt_AsLong(value);
	return 0;
}

static PyObject *py_generic_mapping_get_generic_write(PyObject *obj, void *closure)
{
	struct generic_mapping *object = (struct generic_mapping *)pytalloc_get_ptr(obj);
	PyObject *py_generic_write;
	py_generic_write = PyInt_FromLong(object->generic_write);
	return py_generic_write;
}

static int py_generic_mapping_set_generic_write(PyObject *py_obj, PyObject *value, void *closure)
{
	struct generic_mapping *object = (struct generic_mapping *)pytalloc_get_ptr(py_obj);
	PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
	object->generic_write = PyInt_AsLong(value);
	return 0;
}

static PyObject *py_generic_mapping_get_generic_execute(PyObject *obj, void *closure)
{
	struct generic_mapping *object = (struct generic_mapping *)pytalloc_get_ptr(obj);
	PyObject *py_generic_execute;
	py_generic_execute = PyInt_FromLong(object->generic_execute);
	return py_generic_execute;
}

static int py_generic_mapping_set_generic_execute(PyObject *py_obj, PyObject *value, void *closure)
{
	struct generic_mapping *object = (struct generic_mapping *)pytalloc_get_ptr(py_obj);
	PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
	object->generic_execute = PyInt_AsLong(value);
	return 0;
}

static PyObject *py_generic_mapping_get_generic_all(PyObject *obj, void *closure)
{
	struct generic_mapping *object = (struct generic_mapping *)pytalloc_get_ptr(obj);
	PyObject *py_generic_all;
	py_generic_all = PyInt_FromLong(object->generic_all);
	return py_generic_all;
}

static int py_generic_mapping_set_generic_all(PyObject *py_obj, PyObject *value, void *closure)
{
	struct generic_mapping *object = (struct generic_mapping *)pytalloc_get_ptr(py_obj);
	PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
	object->generic_all = PyInt_AsLong(value);
	return 0;
}

static PyGetSetDef py_generic_mapping_getsetters[] = {
	{ discard_const_p(char, "generic_read"), py_generic_mapping_get_generic_read, py_generic_mapping_set_generic_read },
	{ discard_const_p(char, "generic_write"), py_generic_mapping_get_generic_write, py_generic_mapping_set_generic_write },
	{ discard_const_p(char, "generic_execute"), py_generic_mapping_get_generic_execute, py_generic_mapping_set_generic_execute },
	{ discard_const_p(char, "generic_all"), py_generic_mapping_get_generic_all, py_generic_mapping_set_generic_all },
	{ NULL }
};

static PyObject *py_generic_mapping_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
	return pytalloc_new(struct generic_mapping, type);
}


static PyTypeObject generic_mapping_Type = {
	PyObject_HEAD_INIT(NULL) 0,
	.tp_name = "security.generic_mapping",
	.tp_getset = py_generic_mapping_getsetters,
	.tp_methods = NULL,
	.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
	.tp_basicsize = sizeof(pytalloc_Object),
	.tp_new = py_generic_mapping_new,
};


static PyObject *py_standard_mapping_get_std_read(PyObject *obj, void *closure)
{
	struct standard_mapping *object = (struct standard_mapping *)pytalloc_get_ptr(obj);
	PyObject *py_std_read;
	py_std_read = PyInt_FromLong(object->std_read);
	return py_std_read;
}

static int py_standard_mapping_set_std_read(PyObject *py_obj, PyObject *value, void *closure)
{
	struct standard_mapping *object = (struct standard_mapping *)pytalloc_get_ptr(py_obj);
	PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
	object->std_read = PyInt_AsLong(value);
	return 0;
}

static PyObject *py_standard_mapping_get_std_write(PyObject *obj, void *closure)
{
	struct standard_mapping *object = (struct standard_mapping *)pytalloc_get_ptr(obj);
	PyObject *py_std_write;
	py_std_write = PyInt_FromLong(object->std_write);
	return py_std_write;
}

static int py_standard_mapping_set_std_write(PyObject *py_obj, PyObject *value, void *closure)
{
	struct standard_mapping *object = (struct standard_mapping *)pytalloc_get_ptr(py_obj);
	PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
	object->std_write = PyInt_AsLong(value);
	return 0;
}

static PyObject *py_standard_mapping_get_std_execute(PyObject *obj, void *closure)
{
	struct standard_mapping *object = (struct standard_mapping *)pytalloc_get_ptr(obj);
	PyObject *py_std_execute;
	py_std_execute = PyInt_FromLong(object->std_execute);
	return py_std_execute;
}

static int py_standard_mapping_set_std_execute(PyObject *py_obj, PyObject *value, void *closure)
{
	struct standard_mapping *object = (struct standard_mapping *)pytalloc_get_ptr(py_obj);
	PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
	object->std_execute = PyInt_AsLong(value);
	return 0;
}

static PyObject *py_standard_mapping_get_std_all(PyObject *obj, void *closure)
{
	struct standard_mapping *object = (struct standard_mapping *)pytalloc_get_ptr(obj);
	PyObject *py_std_all;
	py_std_all = PyInt_FromLong(object->std_all);
	return py_std_all;
}

static int py_standard_mapping_set_std_all(PyObject *py_obj, PyObject *value, void *closure)
{
	struct standard_mapping *object = (struct standard_mapping *)pytalloc_get_ptr(py_obj);
	PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
	object->std_all = PyInt_AsLong(value);
	return 0;
}

static PyGetSetDef py_standard_mapping_getsetters[] = {
	{ discard_const_p(char, "std_read"), py_standard_mapping_get_std_read, py_standard_mapping_set_std_read },
	{ discard_const_p(char, "std_write"), py_standard_mapping_get_std_write, py_standard_mapping_set_std_write },
	{ discard_const_p(char, "std_execute"), py_standard_mapping_get_std_execute, py_standard_mapping_set_std_execute },
	{ discard_const_p(char, "std_all"), py_standard_mapping_get_std_all, py_standard_mapping_set_std_all },
	{ NULL }
};

static PyObject *py_standard_mapping_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
	return pytalloc_new(struct standard_mapping, type);
}


static PyTypeObject standard_mapping_Type = {
	PyObject_HEAD_INIT(NULL) 0,
	.tp_name = "security.standard_mapping",
	.tp_getset = py_standard_mapping_getsetters,
	.tp_methods = NULL,
	.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
	.tp_basicsize = sizeof(pytalloc_Object),
	.tp_new = py_standard_mapping_new,
};

static PyMethodDef security_methods[] = {
	{ NULL, NULL, 0, NULL }
};

void initsecurity(void)
{
	PyObject *m;
	PyObject *dep_talloc;
	PyObject *dep_samba_dcerpc_misc;

	dep_talloc = PyImport_ImportModule("talloc");
	if (dep_talloc == NULL)
		return;

	dep_samba_dcerpc_misc = PyImport_ImportModule("samba.dcerpc.misc");
	if (dep_samba_dcerpc_misc == NULL)
		return;

	Object_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "Object");
	if (Object_Type == NULL)
		return;

	GUID_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_misc, "GUID");
	if (GUID_Type == NULL)
		return;

	dom_sid_Type.tp_base = Object_Type;

	security_ace_object_Type.tp_base = Object_Type;

	security_ace_Type.tp_base = Object_Type;

	security_acl_Type.tp_base = Object_Type;

	security_descriptor_Type.tp_base = Object_Type;

	sec_desc_buf_Type.tp_base = Object_Type;

	security_token_Type.tp_base = Object_Type;

	security_unix_token_Type.tp_base = Object_Type;

	generic_mapping_Type.tp_base = Object_Type;

	standard_mapping_Type.tp_base = Object_Type;

	if (PyType_Ready(&dom_sid_Type) < 0)
		return;
	if (PyType_Ready(&security_ace_object_Type) < 0)
		return;
	if (PyType_Ready(&security_ace_Type) < 0)
		return;
	if (PyType_Ready(&security_acl_Type) < 0)
		return;
	if (PyType_Ready(&security_descriptor_Type) < 0)
		return;
	if (PyType_Ready(&sec_desc_buf_Type) < 0)
		return;
	if (PyType_Ready(&security_token_Type) < 0)
		return;
	if (PyType_Ready(&security_unix_token_Type) < 0)
		return;
	if (PyType_Ready(&generic_mapping_Type) < 0)
		return;
	if (PyType_Ready(&standard_mapping_Type) < 0)
		return;
#ifdef PY_DOM_SID_PATCH
	PY_DOM_SID_PATCH(&dom_sid_Type);
#endif
#ifdef PY_ACE_OBJECT_PATCH
	PY_ACE_OBJECT_PATCH(&security_ace_object_Type);
#endif
#ifdef PY_ACE_PATCH
	PY_ACE_PATCH(&security_ace_Type);
#endif
#ifdef PY_ACL_PATCH
	PY_ACL_PATCH(&security_acl_Type);
#endif
#ifdef PY_DESCRIPTOR_PATCH
	PY_DESCRIPTOR_PATCH(&security_descriptor_Type);
#endif
#ifdef PY_SEC_DESC_BUF_PATCH
	PY_SEC_DESC_BUF_PATCH(&sec_desc_buf_Type);
#endif
#ifdef PY_TOKEN_PATCH
	PY_TOKEN_PATCH(&security_token_Type);
#endif
#ifdef PY_UNIX_TOKEN_PATCH
	PY_UNIX_TOKEN_PATCH(&security_unix_token_Type);
#endif
#ifdef PY_GENERIC_MAPPING_PATCH
	PY_GENERIC_MAPPING_PATCH(&generic_mapping_Type);
#endif
#ifdef PY_STANDARD_MAPPING_PATCH
	PY_STANDARD_MAPPING_PATCH(&standard_mapping_Type);
#endif

	m = Py_InitModule3("security", security_methods, "security DCE/RPC");
	if (m == NULL)
		return;

	PyModule_AddObject(m, "NAME_NT_AUTHORITY", PyString_FromString("NT AUTHORITY"));
	PyModule_AddObject(m, "SID_BUILTIN_NETWORK_CONF_OPERATORS", PyString_FromString("S-1-5-32-556"));
	PyModule_AddObject(m, "SEC_FLAG_MAXIMUM_ALLOWED", PyInt_FromLong(0x02000000));
	PyModule_AddObject(m, "DOMAIN_RID_USERS", PyInt_FromLong(513));
	PyModule_AddObject(m, "SID_BUILTIN_PREW2K", PyString_FromString("S-1-5-32-554"));
	PyModule_AddObject(m, "SEC_ACE_FLAG_INHERIT_ONLY", PyInt_FromLong(SEC_ACE_FLAG_INHERIT_ONLY));
	PyModule_AddObject(m, "SID_OWNER_RIGHTS", PyString_FromString("S-1-3-4"));
	PyModule_AddObject(m, "BUILTIN_RID_INCOMING_FOREST_TRUST", PyInt_FromLong(557));
	PyModule_AddObject(m, "DOMAIN_RID_RODC_DENY", PyInt_FromLong(572));
	PyModule_AddObject(m, "SEC_FILE_APPEND_DATA", PyInt_FromLong(0x00000004));
	PyModule_AddObject(m, "SID_BUILTIN_EVENT_LOG_READERS", PyString_FromString("S-1-5-32-573"));
	PyModule_AddObject(m, "SEC_RIGHTS_FILE_ALL", PyInt_FromLong(SEC_STD_ALL|SEC_FILE_ALL));
	PyModule_AddObject(m, "SID_NT_LOCAL_SERVICE", PyString_FromString("S-1-5-19"));
	PyModule_AddObject(m, "SID_NT_ANONYMOUS", PyString_FromString("S-1-5-7"));
	PyModule_AddObject(m, "SEC_PRIV_RESTORE", PyInt_FromLong(SEC_PRIV_RESTORE));
	PyModule_AddObject(m, "DOMAIN_RID_KRBTGT", PyInt_FromLong(502));
	PyModule_AddObject(m, "SID_NT_REMOTE_INTERACTIVE", PyString_FromString("S-1-5-14"));
	PyModule_AddObject(m, "SEC_PRIV_DEBUG", PyInt_FromLong(SEC_PRIV_DEBUG));
	PyModule_AddObject(m, "SEC_RIGHTS_FILE_WRITE", PyInt_FromLong(SEC_STD_READ_CONTROL|SEC_STD_SYNCHRONIZE|SEC_FILE_WRITE_DATA|SEC_FILE_WRITE_ATTRIBUTE|SEC_FILE_WRITE_EA|SEC_FILE_APPEND_DATA));
	PyModule_AddObject(m, "SEC_PRIV_ENABLE_DELEGATION_BIT", PyLong_FromLongLong(SEC_PRIV_ENABLE_DELEGATION_BIT));
	PyModule_AddObject(m, "SID_BUILTIN_ADMINISTRATORS", PyString_FromString("S-1-5-32-544"));
	PyModule_AddObject(m, "BUILTIN_RID_GUESTS", PyInt_FromLong(546));
	PyModule_AddObject(m, "GUID_DRS_CHANGE_INFR_MASTER", PyString_FromString("cc17b1fb-33d9-11d2-97d4-00c04fd8d5cd"));
	PyModule_AddObject(m, "SEC_FLAG_SYSTEM_SECURITY", PyInt_FromLong(0x01000000));
	PyModule_AddObject(m, "SEC_STD_WRITE_DAC", PyInt_FromLong(0x00040000));
	PyModule_AddObject(m, "SID_NT_OTHER_ORGANISATION", PyString_FromString("S-1-5-1000"));
	PyModule_AddObject(m, "GUID_DRS_CHANGE_RID_MASTER", PyString_FromString("d58d5f36-0a98-11d1-adbb-00c04fd8d5cd"));
	PyModule_AddObject(m, "SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT", PyInt_FromLong(SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT));
	PyModule_AddObject(m, "SEC_STD_REQUIRED", PyInt_FromLong(0x000F0000));
	PyModule_AddObject(m, "SEC_ADS_CREATE_CHILD", PyInt_FromLong(0x00000001));
	PyModule_AddObject(m, "SEC_RIGHTS_DIR_EXECUTE", PyInt_FromLong(SEC_RIGHTS_FILE_EXECUTE));
	PyModule_AddObject(m, "BUILTIN_RID_REPLICATOR", PyInt_FromLong(552));
	PyModule_AddObject(m, "SEC_ADS_WRITE_PROP", PyInt_FromLong(0x00000020));
	PyModule_AddObject(m, "SID_NT_DIGEST_AUTHENTICATION", PyString_FromString("S-1-5-64-21"));
	PyModule_AddObject(m, "SEC_DIR_READ_ATTRIBUTE", PyInt_FromLong(0x00000080));
	PyModule_AddObject(m, "SEC_DESC_SACL_PRESENT", PyInt_FromLong(SEC_DESC_SACL_PRESENT));
	PyModule_AddObject(m, "SECURITY_ACL_REVISION_ADS", PyInt_FromLong(SECURITY_ACL_REVISION_ADS));
	PyModule_AddObject(m, "SEC_PRIV_IMPERSONATE_BIT", PyLong_FromLongLong(SEC_PRIV_IMPERSONATE_BIT));
	PyModule_AddObject(m, "SEC_RIGHTS_PRIV_BACKUP", PyInt_FromLong(SEC_STD_READ_CONTROL|SEC_FLAG_SYSTEM_SECURITY|SEC_RIGHTS_FILE_READ|SEC_DIR_TRAVERSE));
	PyModule_AddObject(m, "SEC_DESC_SACL_AUTO_INHERIT_REQ", PyInt_FromLong(SEC_DESC_SACL_AUTO_INHERIT_REQ));
	PyModule_AddObject(m, "SEC_MASK_INVALID", PyInt_FromLong(0x0ce0fe00));
	PyModule_AddObject(m, "SEC_PRIV_TAKE_OWNERSHIP_BIT", PyLong_FromLongLong(SEC_PRIV_TAKE_OWNERSHIP_BIT));
	PyModule_AddObject(m, "SEC_PRIV_SYSTEM_ENVIRONMENT_BIT", PyLong_FromLongLong(SEC_PRIV_SYSTEM_ENVIRONMENT_BIT));
	PyModule_AddObject(m, "BUILTIN_RID_PERFLOG_USERS", PyInt_FromLong(559));
	PyModule_AddObject(m, "SID_BUILTIN_SERVER_OPERATORS", PyString_FromString("S-1-5-32-549"));
	PyModule_AddObject(m, "SEC_PRIV_SYSTEMTIME", PyInt_FromLong(SEC_PRIV_SYSTEMTIME));
	PyModule_AddObject(m, "SID_NT_NTLM_AUTHENTICATION", PyString_FromString("S-1-5-64-10"));
	PyModule_AddObject(m, "BUILTIN_RID_REMOTE_DESKTOP_USERS", PyInt_FromLong(555));
	PyModule_AddObject(m, "SID_CREATOR_OWNER_DOMAIN", PyString_FromString("S-1-3"));
	PyModule_AddObject(m, "SECURITY_DESCRIPTOR_REVISION_1", PyInt_FromLong(SECURITY_DESCRIPTOR_REVISION_1));
	PyModule_AddObject(m, "DOMAIN_RID_READONLY_DCS", PyInt_FromLong(521));
	PyModule_AddObject(m, "BUILTIN_RID_ADMINISTRATORS", PyInt_FromLong(544));
	PyModule_AddObject(m, "SEC_REG_NOTIFY", PyInt_FromLong(0x00000010));
	PyModule_AddObject(m, "SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT", PyInt_FromLong(SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT));
	PyModule_AddObject(m, "SEC_ACE_TYPE_ACCESS_ALLOWED", PyInt_FromLong(SEC_ACE_TYPE_ACCESS_ALLOWED));
	PyModule_AddObject(m, "SEC_DIR_TRAVERSE", PyInt_FromLong(0x00000020));
	PyModule_AddObject(m, "SEC_DESC_DACL_AUTO_INHERIT_REQ", PyInt_FromLong(SEC_DESC_DACL_AUTO_INHERIT_REQ));
	PyModule_AddObject(m, "SEC_PRIV_BACKUP", PyInt_FromLong(SEC_PRIV_BACKUP));
	PyModule_AddObject(m, "SID_NT_TERMINAL_SERVER_USERS", PyString_FromString("S-1-5-13"));
	PyModule_AddObject(m, "SID_NT_ENTERPRISE_DCS", PyString_FromString("S-1-5-9"));
	PyModule_AddObject(m, "SEC_PRIV_SYSTEM_PROFILE_BIT", PyLong_FromLongLong(SEC_PRIV_SYSTEM_PROFILE_BIT));
	PyModule_AddObject(m, "SECINFO_PROTECTED_DACL", PyInt_FromLong(SECINFO_PROTECTED_DACL));
	PyModule_AddObject(m, "GUID_DRS_GET_ALL_CHANGES", PyString_FromString("1131f6ad-9c07-11d1-f79f-00c04fc2dcd2"));
	PyModule_AddObject(m, "SID_BUILTIN_REMOTE_DESKTOP_USERS", PyString_FromString("S-1-5-32-555"));
	PyModule_AddObject(m, "KERB_ENCTYPE_RC4_HMAC_MD5", PyInt_FromLong(KERB_ENCTYPE_RC4_HMAC_MD5));
	PyModule_AddObject(m, "KERB_ENCTYPE_AES256_CTS_HMAC_SHA1_96", PyInt_FromLong(KERB_ENCTYPE_AES256_CTS_HMAC_SHA1_96));
	PyModule_AddObject(m, "GUID_DRS_RO_REPL_SECRET_SYNC", PyString_FromString("1131f6ae-9c07-11d1-f79f-00c04fc2dcd2"));
	PyModule_AddObject(m, "SEC_ADS_LIST_OBJECT", PyInt_FromLong(0x00000080));
	PyModule_AddObject(m, "SEC_PRIV_DEBUG_BIT", PyLong_FromLongLong(SEC_PRIV_DEBUG_BIT));
	PyModule_AddObject(m, "SEC_PRIV_PROFILE_SINGLE_PROCESS", PyInt_FromLong(SEC_PRIV_PROFILE_SINGLE_PROCESS));
	PyModule_AddObject(m, "SEC_DIR_DELETE_CHILD", PyInt_FromLong(0x00000040));
	PyModule_AddObject(m, "GUID_DRS_FORCE_CHANGE_PASSWORD", PyString_FromString("00299570-246d-11d0-a768-00aa006e0529"));
	PyModule_AddObject(m, "SEC_ACE_TYPE_SYSTEM_AUDIT", PyInt_FromLong(SEC_ACE_TYPE_SYSTEM_AUDIT));
	PyModule_AddObject(m, "SEC_FILE_READ_ATTRIBUTE", PyInt_FromLong(0x00000080));
	PyModule_AddObject(m, "SEC_ACE_FLAG_NO_PROPAGATE_INHERIT", PyInt_FromLong(SEC_ACE_FLAG_NO_PROPAGATE_INHERIT));
	PyModule_AddObject(m, "BUILTIN_RID_ACCOUNT_OPERATORS", PyInt_FromLong(548));
	PyModule_AddObject(m, "SEC_RIGHTS_FILE_EXECUTE", PyInt_FromLong(SEC_STD_SYNCHRONIZE|SEC_STD_READ_CONTROL|SEC_FILE_READ_ATTRIBUTE|SEC_FILE_EXECUTE));
	PyModule_AddObject(m, "SECURITY_ACL_REVISION_NT4", PyInt_FromLong(SECURITY_ACL_REVISION_NT4));
	PyModule_AddObject(m, "SEC_MASK_STANDARD", PyInt_FromLong(0x00FF0000));
	PyModule_AddObject(m, "SEC_ACE_FLAG_SUCCESSFUL_ACCESS", PyInt_FromLong(SEC_ACE_FLAG_SUCCESSFUL_ACCESS));
	PyModule_AddObject(m, "SEC_PRIV_INCREASE_BASE_PRIORITY_BIT", PyLong_FromLongLong(SEC_PRIV_INCREASE_BASE_PRIORITY_BIT));
	PyModule_AddObject(m, "SID_NT_TRUSTED_INSTALLER", PyString_FromString("S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464"));
	PyModule_AddObject(m, "DOMAIN_RID_ADMINS", PyInt_FromLong(512));
	PyModule_AddObject(m, "SEC_ACE_FLAG_FAILED_ACCESS", PyInt_FromLong(SEC_ACE_FLAG_FAILED_ACCESS));
	PyModule_AddObject(m, "SEC_DACL_AUTO_INHERIT", PyInt_FromLong(SEC_DACL_AUTO_INHERIT));
	PyModule_AddObject(m, "SEC_ADS_LIST", PyInt_FromLong(0x00000004));
	PyModule_AddObject(m, "DOMAIN_RID_GUESTS", PyInt_FromLong(514));
	PyModule_AddObject(m, "KERB_ENCTYPE_DES_CBC_CRC", PyInt_FromLong(KERB_ENCTYPE_DES_CBC_CRC));
	PyModule_AddObject(m, "BUILTIN_RID_DISTRIBUTED_COM_USERS", PyInt_FromLong(562));
	PyModule_AddObject(m, "SEC_PRIV_INVALID", PyInt_FromLong(SEC_PRIV_INVALID));
	PyModule_AddObject(m, "STANDARD_RIGHTS_REQUIRED_ACCESS", PyInt_FromLong((SEC_STD_DELETE|SEC_STD_READ_CONTROL|SEC_STD_WRITE_DAC|SEC_STD_WRITE_OWNER)));
	PyModule_AddObject(m, "LSA_POLICY_MODE_DENY_NETWORK", PyInt_FromLong(LSA_POLICY_MODE_DENY_NETWORK));
	PyModule_AddObject(m, "SEC_FILE_WRITE_ATTRIBUTE", PyInt_FromLong(0x00000100));
	PyModule_AddObject(m, "SEC_PRIV_ADD_USERS", PyInt_FromLong(SEC_PRIV_ADD_USERS));
	PyModule_AddObject(m, "DOMAIN_RID_GUEST", PyInt_FromLong(501));
	PyModule_AddObject(m, "BUILTIN_RID_AUTH_ACCESS", PyInt_FromLong(560));
	PyModule_AddObject(m, "SEC_PRIV_REMOTE_SHUTDOWN_BIT", PyLong_FromLongLong(SEC_PRIV_REMOTE_SHUTDOWN_BIT));
	PyModule_AddObject(m, "SEC_PRIV_MANAGE_VOLUME", PyInt_FromLong(SEC_PRIV_MANAGE_VOLUME));
	PyModule_AddObject(m, "SECINFO_UNPROTECTED_DACL", PyInt_FromLong(SECINFO_UNPROTECTED_DACL));
	PyModule_AddObject(m, "SEC_REG_QUERY_VALUE", PyInt_FromLong(0x00000001));
	PyModule_AddObject(m, "SID_NT_PROXY", PyString_FromString("S-1-5-8"));
	PyModule_AddObject(m, "SEC_PRIV_TAKE_OWNERSHIP", PyInt_FromLong(SEC_PRIV_TAKE_OWNERSHIP));
	PyModule_AddObject(m, "BUILTIN_RID_TS_LICENSE_SERVERS", PyInt_FromLong(561));
	PyModule_AddObject(m, "SECINFO_OWNER", PyInt_FromLong(SECINFO_OWNER));
	PyModule_AddObject(m, "SEC_PRIV_CREATE_GLOBAL_BIT", PyLong_FromLongLong(SEC_PRIV_CREATE_GLOBAL_BIT));
	PyModule_AddObject(m, "SEC_PRIV_SHUTDOWN_BIT", PyLong_FromLongLong(SEC_PRIV_SHUTDOWN_BIT));
	PyModule_AddObject(m, "SEC_ADS_GENERIC_ALL", PyInt_FromLong((SEC_ADS_GENERIC_EXECUTE|SEC_ADS_GENERIC_WRITE|SEC_ADS_GENERIC_READ|SEC_ADS_GENERIC_ALL_DS)));
	PyModule_AddObject(m, "NAME_WORLD", PyString_FromString("WORLD"));
	PyModule_AddObject(m, "SEC_DEFAULT_DESCRIPTOR", PyInt_FromLong(SEC_DEFAULT_DESCRIPTOR));
	PyModule_AddObject(m, "SEC_ACE_FLAG_INHERITED_ACE", PyInt_FromLong(SEC_ACE_FLAG_INHERITED_ACE));
	PyModule_AddObject(m, "SEC_PRIV_DISK_OPERATOR", PyInt_FromLong(SEC_PRIV_DISK_OPERATOR));
	PyModule_AddObject(m, "SEC_PRIV_SYSTEM_PROFILE", PyInt_FromLong(SEC_PRIV_SYSTEM_PROFILE));
	PyModule_AddObject(m, "SEC_FILE_EXECUTE", PyInt_FromLong(0x00000020));
	PyModule_AddObject(m, "SID_NT_AUTHORITY", PyString_FromString("S-1-5"));
	PyModule_AddObject(m, "SEC_DIR_ADD_SUBDIR", PyInt_FromLong(0x00000004));
	PyModule_AddObject(m, "SID_BUILTIN_PERFMON_USERS", PyString_FromString("S-1-5-32-558"));
	PyModule_AddObject(m, "DOMAIN_RID_POLICY_ADMINS", PyInt_FromLong(520));
	PyModule_AddObject(m, "BUILTIN_RID_PRINT_OPERATORS", PyInt_FromLong(550));
	PyModule_AddObject(m, "SID_NULL", PyString_FromString("S-1-0-0"));
	PyModule_AddObject(m, "SID_NT_SCHANNEL_AUTHENTICATION", PyString_FromString("S-1-5-64-14"));
	PyModule_AddObject(m, "SEC_PRIV_LOAD_DRIVER_BIT", PyLong_FromLongLong(SEC_PRIV_LOAD_DRIVER_BIT));
	PyModule_AddObject(m, "SID_BUILTIN_AUTH_ACCESS", PyString_FromString("S-1-5-32-560"));
	PyModule_AddObject(m, "SEC_FILE_WRITE_EA", PyInt_FromLong(0x00000010));
	PyModule_AddObject(m, "SEC_DIR_LIST", PyInt_FromLong(0x00000001));
	PyModule_AddObject(m, "SD_REVISION", PyInt_FromLong(SECURITY_DESCRIPTOR_REVISION_1));
	PyModule_AddObject(m, "GUID_DRS_CHANGE_SCHEMA_MASTER", PyString_FromString("e12b56b6-0a95-11d1-adbb-00c04fd8d5cd"));
	PyModule_AddObject(m, "SEC_FILE_ALL", PyInt_FromLong(0x000001ff));
	PyModule_AddObject(m, "SEC_ADS_GENERIC_EXECUTE", PyInt_FromLong(SEC_STD_READ_CONTROL|SEC_ADS_LIST));
	PyModule_AddObject(m, "DOMAIN_RID_ENTERPRISE_ADMINS", PyInt_FromLong(519));
	PyModule_AddObject(m, "SEC_MASK_SPECIFIC", PyInt_FromLong(0x0000FFFF));
	PyModule_AddObject(m, "DOMAIN_RID_CERT_ADMINS", PyInt_FromLong(517));
	PyModule_AddObject(m, "SEC_PRIV_CREATE_PAGEFILE", PyInt_FromLong(SEC_PRIV_CREATE_PAGEFILE));
	PyModule_AddObject(m, "SEC_RIGHTS_DIR_READ", PyInt_FromLong(SEC_RIGHTS_FILE_READ));
	PyModule_AddObject(m, "SEC_DESC_DACL_PROTECTED", PyInt_FromLong(SEC_DESC_DACL_PROTECTED));
	PyModule_AddObject(m, "SEC_DESC_SACL_AUTO_INHERITED", PyInt_FromLong(SEC_DESC_SACL_AUTO_INHERITED));
	PyModule_AddObject(m, "SEC_ADS_GENERIC_READ", PyInt_FromLong((SEC_STD_READ_CONTROL|SEC_ADS_LIST|SEC_ADS_READ_PROP|SEC_ADS_LIST_OBJECT)));
	PyModule_AddObject(m, "SID_NT_IUSR", PyString_FromString("S-1-5-17"));
	PyModule_AddObject(m, "SID_NT_BATCH", PyString_FromString("S-1-5-3"));
	PyModule_AddObject(m, "SID_BUILTIN_PRINT_OPERATORS", PyString_FromString("S-1-5-32-550"));
	PyModule_AddObject(m, "SEC_OWNER_FROM_PARENT", PyInt_FromLong(SEC_OWNER_FROM_PARENT));
	PyModule_AddObject(m, "DOMAIN_RID_RAS_SERVERS", PyInt_FromLong(553));
	PyModule_AddObject(m, "SEC_DESC_OWNER_DEFAULTED", PyInt_FromLong(SEC_DESC_OWNER_DEFAULTED));
	PyModule_AddObject(m, "SEC_ACE_TYPE_ALLOWED_COMPOUND", PyInt_FromLong(SEC_ACE_TYPE_ALLOWED_COMPOUND));
	PyModule_AddObject(m, "SEC_STD_WRITE_OWNER", PyInt_FromLong(0x00080000));
	PyModule_AddObject(m, "SECINFO_SACL", PyInt_FromLong(SECINFO_SACL));
	PyModule_AddObject(m, "SEC_STD_DELETE", PyInt_FromLong(0x00010000));
	PyModule_AddObject(m, "SEC_DESC_SACL_PROTECTED", PyInt_FromLong(SEC_DESC_SACL_PROTECTED));
	PyModule_AddObject(m, "SEC_DIR_WRITE_ATTRIBUTE", PyInt_FromLong(0x00000100));
	PyModule_AddObject(m, "SID_NT_NETWORK_SERVICE", PyString_FromString("S-1-5-20"));
	PyModule_AddObject(m, "SEC_ACE_OBJECT_TYPE_PRESENT", PyInt_FromLong(SEC_ACE_OBJECT_TYPE_PRESENT));
	PyModule_AddObject(m, "LSA_POLICY_MODE_INTERACTIVE", PyInt_FromLong(LSA_POLICY_MODE_INTERACTIVE));
	PyModule_AddObject(m, "GUID_DRS_DNS_HOST_NAME", PyString_FromString("72e39547-7b18-11d1-adef-00c04fd8d5cd"));
	PyModule_AddObject(m, "SEC_PRIV_MANAGE_VOLUME_BIT", PyLong_FromLongLong(SEC_PRIV_MANAGE_VOLUME_BIT));
	PyModule_AddObject(m, "KERB_ENCTYPE_AES128_CTS_HMAC_SHA1_96", PyInt_FromLong(KERB_ENCTYPE_AES128_CTS_HMAC_SHA1_96));
	PyModule_AddObject(m, "BUILTIN_RID_PERFMON_USERS", PyInt_FromLong(558));
	PyModule_AddObject(m, "SEC_PRIV_CHANGE_NOTIFY_BIT", PyLong_FromLongLong(SEC_PRIV_CHANGE_NOTIFY_BIT));
	PyModule_AddObject(m, "BUILTIN_RID_NETWORK_CONF_OPERATORS", PyInt_FromLong(556));
	PyModule_AddObject(m, "SID_BUILTIN_GUESTS", PyString_FromString("S-1-5-32-546"));
	PyModule_AddObject(m, "SEC_ADS_READ_PROP", PyInt_FromLong(0x00000010));
	PyModule_AddObject(m, "SEC_STD_SYNCHRONIZE", PyInt_FromLong(0x00100000));
	PyModule_AddObject(m, "SEC_FILE_WRITE_DATA", PyInt_FromLong(0x00000002));
	PyModule_AddObject(m, "STANDARD_RIGHTS_ALL_ACCESS", PyInt_FromLong(SEC_STD_ALL));
	PyModule_AddObject(m, "SEC_STD_ALL", PyInt_FromLong(0x001F0000));
	PyModule_AddObject(m, "SEC_ADS_GENERIC_ALL_DS", PyInt_FromLong((SEC_STD_DELETE|SEC_STD_WRITE_DAC|SEC_STD_WRITE_OWNER|SEC_ADS_CREATE_CHILD|SEC_ADS_DELETE_CHILD|SEC_ADS_DELETE_TREE|SEC_ADS_CONTROL_ACCESS)));
	PyModule_AddObject(m, "DOMAIN_RID_ADMINISTRATOR", PyInt_FromLong(500));
	PyModule_AddObject(m, "GUID_DRS_SELF_MEMBERSHIP", PyString_FromString("bf9679c0-0de6-11d0-a285-00aa003049e2"));
	PyModule_AddObject(m, "SEC_ADS_GENERIC_WRITE", PyInt_FromLong((SEC_STD_READ_CONTROL|SEC_ADS_SELF_WRITE|SEC_ADS_WRITE_PROP)));
	PyModule_AddObject(m, "SEC_PRIV_RESTORE_BIT", PyLong_FromLongLong(SEC_PRIV_RESTORE_BIT));
	PyModule_AddObject(m, "SEC_RIGHTS_PRIV_RESTORE", PyInt_FromLong(SEC_STD_WRITE_DAC|SEC_STD_WRITE_OWNER|SEC_FLAG_SYSTEM_SECURITY|SEC_RIGHTS_FILE_WRITE|SEC_DIR_ADD_FILE|SEC_DIR_ADD_SUBDIR|SEC_STD_DELETE));
	PyModule_AddObject(m, "SEC_DESC_DACL_DEFAULTED", PyInt_FromLong(SEC_DESC_DACL_DEFAULTED));
	PyModule_AddObject(m, "LSA_POLICY_MODE_DENY_BATCH", PyInt_FromLong(LSA_POLICY_MODE_DENY_BATCH));
	PyModule_AddObject(m, "SEC_ACE_FLAG_OBJECT_INHERIT", PyInt_FromLong(SEC_ACE_FLAG_OBJECT_INHERIT));
	PyModule_AddObject(m, "SEC_PRIV_SYSTEM_ENVIRONMENT", PyInt_FromLong(SEC_PRIV_SYSTEM_ENVIRONMENT));
	PyModule_AddObject(m, "SEC_PRIV_PRINT_OPERATOR_BIT", PyLong_FromLongLong(SEC_PRIV_PRINT_OPERATOR_BIT));
	PyModule_AddObject(m, "SID_BUILTIN_REPLICATOR", PyString_FromString("S-1-5-32-552"));
	PyModule_AddObject(m, "SID_BUILTIN_TS_LICENSE_SERVERS", PyString_FromString("S-1-5-32-561"));
	PyModule_AddObject(m, "SID_BUILTIN_CRYPTO_OPERATORS", PyString_FromString("S-1-5-32-569"));
	PyModule_AddObject(m, "SEC_PRIV_UNDOCK_BIT", PyLong_FromLongLong(SEC_PRIV_UNDOCK_BIT));
	PyModule_AddObject(m, "SID_NT_SERVICE", PyString_FromString("S-1-5-6"));
	PyModule_AddObject(m, "SID_BUILTIN_RAS_SERVERS", PyString_FromString("S-1-5-32-553"));
	PyModule_AddObject(m, "GUID_DRS_VALIDATE_SPN", PyString_FromString("f3a64788-5306-11d1-a9c5-0000f80367c1"));
	PyModule_AddObject(m, "SID_NT_DIALUP", PyString_FromString("S-1-5-1"));
	PyModule_AddObject(m, "SECINFO_BACKUP", PyInt_FromLong(SECINFO_BACKUP));
	PyModule_AddObject(m, "SID_BUILTIN_DISTRIBUTED_COM_USERS", PyString_FromString("S-1-5-32-562"));
	PyModule_AddObject(m, "BUILTIN_RID_BACKUP_OPERATORS", PyInt_FromLong(551));
	PyModule_AddObject(m, "SEC_RIGHTS_FILE_READ", PyInt_FromLong(SEC_STD_READ_CONTROL|SEC_STD_SYNCHRONIZE|SEC_FILE_READ_DATA|SEC_FILE_READ_ATTRIBUTE|SEC_FILE_READ_EA));
	PyModule_AddObject(m, "SEC_PRIV_BACKUP_BIT", PyLong_FromLongLong(SEC_PRIV_BACKUP_BIT));
	PyModule_AddObject(m, "SEC_PRIV_CREATE_PAGEFILE_BIT", PyLong_FromLongLong(SEC_PRIV_CREATE_PAGEFILE_BIT));
	PyModule_AddObject(m, "SEC_PRIV_REMOTE_SHUTDOWN", PyInt_FromLong(SEC_PRIV_REMOTE_SHUTDOWN));
	PyModule_AddObject(m, "STANDARD_RIGHTS_EXECUTE_ACCESS", PyInt_FromLong(SEC_STD_READ_CONTROL));
	PyModule_AddObject(m, "BUILTIN_RID_PRE_2K_ACCESS", PyInt_FromLong(554));
	PyModule_AddObject(m, "SEC_PRIV_CREATE_GLOBAL", PyInt_FromLong(SEC_PRIV_CREATE_GLOBAL));
	PyModule_AddObject(m, "KERB_ENCTYPE_DES_CBC_MD5", PyInt_FromLong(KERB_ENCTYPE_DES_CBC_MD5));
	PyModule_AddObject(m, "GUID_DRS_GET_FILTERED_ATTRIBUTES", PyString_FromString("89e95b76-444d-4c62-991a-0facbeda640c"));
	PyModule_AddObject(m, "BUILTIN_RID_RAS_SERVERS", PyInt_FromLong(553));
	PyModule_AddObject(m, "DOMAIN_RID_RODC_ALLOW", PyInt_FromLong(571));
	PyModule_AddObject(m, "SEC_ADS_DELETE_CHILD", PyInt_FromLong(0x00000002));
	PyModule_AddObject(m, "BUILTIN_RID_EVENT_LOG_READERS", PyInt_FromLong(573));
	PyModule_AddObject(m, "LSA_POLICY_MODE_DENY_REMOTE_INTERACTIVE", PyInt_FromLong(LSA_POLICY_MODE_DENY_REMOTE_INTERACTIVE));
	PyModule_AddObject(m, "SEC_DIR_ADD_FILE", PyInt_FromLong(0x00000002));
	PyModule_AddObject(m, "SEC_RIGHTS_DIR_WRITE", PyInt_FromLong(SEC_RIGHTS_FILE_WRITE));
	PyModule_AddObject(m, "LSA_POLICY_MODE_DENY_INTERACTIVE", PyInt_FromLong(LSA_POLICY_MODE_DENY_INTERACTIVE));
	PyModule_AddObject(m, "SEC_GENERIC_WRITE", PyInt_FromLong(0x40000000));
	PyModule_AddObject(m, "SEC_GENERIC_ALL", PyInt_FromLong(0x10000000));
	PyModule_AddObject(m, "SID_NT_SELF", PyString_FromString("S-1-5-10"));
	PyModule_AddObject(m, "DOMAIN_RID_DOMAIN_MEMBERS", PyInt_FromLong(515));
	PyModule_AddObject(m, "LSA_POLICY_MODE_SERVICE", PyInt_FromLong(LSA_POLICY_MODE_SERVICE));
	PyModule_AddObject(m, "SEC_ACE_FLAG_CONTAINER_INHERIT", PyInt_FromLong(SEC_ACE_FLAG_CONTAINER_INHERIT));
	PyModule_AddObject(m, "SEC_PRIV_DISK_OPERATOR_BIT", PyLong_FromLongLong(SEC_PRIV_DISK_OPERATOR_BIT));
	PyModule_AddObject(m, "GUID_DRS_MANAGE_TOPOLOGY", PyString_FromString("1131f6ac-9c07-11d1-f79f-00c04fc2dcd2"));
	PyModule_AddObject(m, "NAME_NT_SERVICE", PyString_FromString("NT SERVICE"));
	PyModule_AddObject(m, "SEC_DIR_READ_EA", PyInt_FromLong(0x00000008));
	PyModule_AddObject(m, "SID_CREATOR_OWNER", PyString_FromString("S-1-3-0"));
	PyModule_AddObject(m, "SEC_PRIV_ADD_USERS_BIT", PyLong_FromLongLong(SEC_PRIV_ADD_USERS_BIT));
	PyModule_AddObject(m, "SID_NT_SYSTEM", PyString_FromString("S-1-5-18"));
	PyModule_AddObject(m, "SEC_PRIV_SECURITY_BIT", PyLong_FromLongLong(SEC_PRIV_SECURITY_BIT));
	PyModule_AddObject(m, "NAME_BUILTIN", PyString_FromString("BUILTIN"));
	PyModule_AddObject(m, "SECINFO_UNPROTECTED_SACL", PyInt_FromLong(SECINFO_UNPROTECTED_SACL));
	PyModule_AddObject(m, "SECINFO_DACL", PyInt_FromLong(SECINFO_DACL));
	PyModule_AddObject(m, "SECINFO_GROUP", PyInt_FromLong(SECINFO_GROUP));
	PyModule_AddObject(m, "SID_BUILTIN_CERT_SERV_DCOM_ACCESS", PyString_FromString("S-1-5-32-574"));
	PyModule_AddObject(m, "NT4_ACL_REVISION", PyInt_FromLong(SECURITY_ACL_REVISION_NT4));
	PyModule_AddObject(m, "LSA_POLICY_MODE_DENY_SERVICE", PyInt_FromLong(LSA_POLICY_MODE_DENY_SERVICE));
	PyModule_AddObject(m, "SEC_REG_CREATE_LINK", PyInt_FromLong(0x00000020));
	PyModule_AddObject(m, "LSA_POLICY_MODE_REMOTE_INTERACTIVE", PyInt_FromLong(LSA_POLICY_MODE_REMOTE_INTERACTIVE));
	PyModule_AddObject(m, "SEC_PRIV_INCREASE_QUOTA_BIT", PyLong_FromLongLong(SEC_PRIV_INCREASE_QUOTA_BIT));
	PyModule_AddObject(m, "SEC_REG_CREATE_SUBKEY", PyInt_FromLong(0x00000004));
	PyModule_AddObject(m, "SEC_DESC_RM_CONTROL_VALID", PyInt_FromLong(SEC_DESC_RM_CONTROL_VALID));
	PyModule_AddObject(m, "SEC_FILE_READ_DATA", PyInt_FromLong(0x00000001));
	PyModule_AddObject(m, "LSA_POLICY_MODE_ALL_NT4", PyInt_FromLong(LSA_POLICY_MODE_ALL_NT4));
	PyModule_AddObject(m, "GUID_DRS_ALLOCATE_RIDS", PyString_FromString("1abd7cf8-0a99-11d1-adbb-00c04fd8d5cd"));
	PyModule_AddObject(m, "SECINFO_PROTECTED_SACL", PyInt_FromLong(SECINFO_PROTECTED_SACL));
	PyModule_AddObject(m, "SEC_DESC_SACL_DEFAULTED", PyInt_FromLong(SEC_DESC_SACL_DEFAULTED));
	PyModule_AddObject(m, "SEC_PRIV_PRINT_OPERATOR", PyInt_FromLong(SEC_PRIV_PRINT_OPERATOR));
	PyModule_AddObject(m, "SEC_DESC_DACL_TRUSTED", PyInt_FromLong(SEC_DESC_DACL_TRUSTED));
	PyModule_AddObject(m, "GUID_DRS_GET_CHANGES", PyString_FromString("1131f6aa-9c07-11d1-f79f-00c04fc2dcd2"));
	PyModule_AddObject(m, "SEC_DESC_SELF_RELATIVE", PyInt_FromLong(SEC_DESC_SELF_RELATIVE));
	PyModule_AddObject(m, "SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT", PyInt_FromLong(SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT));
	PyModule_AddObject(m, "SEC_ACE_FLAG_VALID_INHERIT", PyInt_FromLong(SEC_ACE_FLAG_VALID_INHERIT));
	PyModule_AddObject(m, "SEC_RIGHTS_DIR_ALL", PyInt_FromLong(SEC_RIGHTS_FILE_ALL));
	PyModule_AddObject(m, "GUID_DRS_CHANGE_PDC", PyString_FromString("bae50096-4752-11d1-9052-00c04fc2d4cf"));
	PyModule_AddObject(m, "SEC_PRIV_MACHINE_ACCOUNT", PyInt_FromLong(SEC_PRIV_MACHINE_ACCOUNT));
	PyModule_AddObject(m, "SID_NT_RESTRICTED", PyString_FromString("S-1-5-12"));
	PyModule_AddObject(m, "SEC_DESC_GROUP_DEFAULTED", PyInt_FromLong(SEC_DESC_GROUP_DEFAULTED));
	PyModule_AddObject(m, "SEC_PRIV_CHANGE_NOTIFY", PyInt_FromLong(SEC_PRIV_CHANGE_NOTIFY));
	PyModule_AddObject(m, "GUID_DRS_ADD_DNS_HOST_NAME", PyString_FromString("80863791-dbe9-4eb8-837e-7f0ab55d9ac7"));
	PyModule_AddObject(m, "SEC_PRIV_SYSTEMTIME_BIT", PyLong_FromLongLong(SEC_PRIV_SYSTEMTIME_BIT));
	PyModule_AddObject(m, "BUILTIN_RID_CRYPTO_OPERATORS", PyInt_FromLong(569));
	PyModule_AddObject(m, "SEC_DESC_DACL_PRESENT", PyInt_FromLong(SEC_DESC_DACL_PRESENT));
	PyModule_AddObject(m, "SID_NT_NT_SERVICE", PyString_FromString("S-1-5-80"));
	PyModule_AddObject(m, "SID_BUILTIN_PERFLOG_USERS", PyString_FromString("S-1-5-32-559"));
	PyModule_AddObject(m, "GUID_DRS_BEHAVIOR_VERSION", PyString_FromString("d31a8757-2447-4545-8081-3bb610cacbf2"));
	PyModule_AddObject(m, "SID_NT_INTERACTIVE", PyString_FromString("S-1-5-4"));
	PyModule_AddObject(m, "SID_BUILTIN_POWER_USERS", PyString_FromString("S-1-5-32-547"));
	PyModule_AddObject(m, "BUILTIN_RID_CERT_SERV_DCOM_ACCESS", PyInt_FromLong(574));
	PyModule_AddObject(m, "SECINFO_ATTRIBUTE", PyInt_FromLong(SECINFO_ATTRIBUTE));
	PyModule_AddObject(m, "SEC_PRIV_INCREASE_BASE_PRIORITY", PyInt_FromLong(SEC_PRIV_INCREASE_BASE_PRIORITY));
	PyModule_AddObject(m, "SEC_FILE_READ_EA", PyInt_FromLong(0x00000008));
	PyModule_AddObject(m, "SID_WORLD_DOMAIN", PyString_FromString("S-1-1"));
	PyModule_AddObject(m, "SEC_ADS_SELF_WRITE", PyInt_FromLong(0x00000008));
	PyModule_AddObject(m, "SEC_PRIV_LOAD_DRIVER", PyInt_FromLong(SEC_PRIV_LOAD_DRIVER));
	PyModule_AddObject(m, "SEC_SACL_AUTO_INHERIT", PyInt_FromLong(SEC_SACL_AUTO_INHERIT));
	PyModule_AddObject(m, "SID_BUILTIN_INCOMING_FOREST_TRUST", PyString_FromString("S-1-5-32-557"));
	PyModule_AddObject(m, "SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT", PyInt_FromLong(SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT));
	PyModule_AddObject(m, "SEC_PRIV_ENABLE_DELEGATION", PyInt_FromLong(SEC_PRIV_ENABLE_DELEGATION));
	PyModule_AddObject(m, "SID_CREATOR_GROUP", PyString_FromString("S-1-3-1"));
	PyModule_AddObject(m, "DOMAIN_RID_DCS", PyInt_FromLong(516));
	PyModule_AddObject(m, "SEC_PRIV_MACHINE_ACCOUNT_BIT", PyLong_FromLongLong(SEC_PRIV_MACHINE_ACCOUNT_BIT));
	PyModule_AddObject(m, "SEC_PRIV_PROFILE_SINGLE_PROCESS_BIT", PyLong_FromLongLong(SEC_PRIV_PROFILE_SINGLE_PROCESS_BIT));
	PyModule_AddObject(m, "LSA_POLICY_MODE_BATCH", PyInt_FromLong(LSA_POLICY_MODE_BATCH));
	PyModule_AddObject(m, "SID_NT_AUTHENTICATED_USERS", PyString_FromString("S-1-5-11"));
	PyModule_AddObject(m, "SEC_PRIV_UNDOCK", PyInt_FromLong(SEC_PRIV_UNDOCK));
	PyModule_AddObject(m, "BUILTIN_RID_SERVER_OPERATORS", PyInt_FromLong(549));
	PyModule_AddObject(m, "SEC_REG_SET_VALUE", PyInt_FromLong(0x00000002));
	PyModule_AddObject(m, "SID_BUILTIN_ACCOUNT_OPERATORS", PyString_FromString("S-1-5-32-548"));
	PyModule_AddObject(m, "GUID_DRS_CHANGE_DOMAIN_MASTER", PyString_FromString("014bf69c-7b3b-11d1-85f6-08002be74fab"));
	PyModule_AddObject(m, "SEC_GENERIC_EXECUTE", PyInt_FromLong(0x20000000));
	PyModule_AddObject(m, "SEC_ADS_CONTROL_ACCESS", PyInt_FromLong(0x00000100));
	PyModule_AddObject(m, "BUILTIN_RID_POWER_USERS", PyInt_FromLong(547));
	PyModule_AddObject(m, "STANDARD_RIGHTS_WRITE_ACCESS", PyInt_FromLong((SEC_STD_WRITE_OWNER|SEC_STD_WRITE_DAC|SEC_STD_DELETE)));
	PyModule_AddObject(m, "STANDARD_RIGHTS_READ_ACCESS", PyInt_FromLong(SEC_STD_READ_CONTROL));
	PyModule_AddObject(m, "SEC_PRIV_INCREASE_QUOTA", PyInt_FromLong(SEC_PRIV_INCREASE_QUOTA));
	PyModule_AddObject(m, "LSA_POLICY_MODE_NETWORK", PyInt_FromLong(LSA_POLICY_MODE_NETWORK));
	PyModule_AddObject(m, "SEC_ACE_TYPE_SYSTEM_ALARM", PyInt_FromLong(SEC_ACE_TYPE_SYSTEM_ALARM));
	PyModule_AddObject(m, "SEC_GROUP_FROM_PARENT", PyInt_FromLong(SEC_GROUP_FROM_PARENT));
	PyModule_AddObject(m, "SID_WORLD", PyString_FromString("S-1-1-0"));
	PyModule_AddObject(m, "DOMAIN_RID_LOGON", PyInt_FromLong(9));
	PyModule_AddObject(m, "SEC_STD_READ_CONTROL", PyInt_FromLong(0x00020000));
	PyModule_AddObject(m, "SEC_MASK_GENERIC", PyInt_FromLong(0xF0000000));
	PyModule_AddObject(m, "SEC_GENERIC_READ", PyInt_FromLong(0x80000000));
	PyModule_AddObject(m, "SEC_DIR_WRITE_EA", PyInt_FromLong(0x00000010));
	PyModule_AddObject(m, "DOMAIN_RID_SCHEMA_ADMINS", PyInt_FromLong(518));
	PyModule_AddObject(m, "SID_BUILTIN_USERS", PyString_FromString("S-1-5-32-545"));
	PyModule_AddObject(m, "LSA_POLICY_MODE_ALL", PyInt_FromLong(LSA_POLICY_MODE_ALL));
	PyModule_AddObject(m, "SEC_REG_ENUM_SUBKEYS", PyInt_FromLong(0x00000008));
	PyModule_AddObject(m, "SECINFO_LABEL", PyInt_FromLong(SECINFO_LABEL));
	PyModule_AddObject(m, "SEC_ACE_TYPE_ACCESS_DENIED_OBJECT", PyInt_FromLong(SEC_ACE_TYPE_ACCESS_DENIED_OBJECT));
	PyModule_AddObject(m, "GUID_DRS_MONITOR_TOPOLOGY", PyString_FromString("f98340fb-7c5b-4cdb-a00b-2ebdfa115a96"));
	PyModule_AddObject(m, "SEC_PRIV_IMPERSONATE", PyInt_FromLong(SEC_PRIV_IMPERSONATE));
	PyModule_AddObject(m, "SID_BUILTIN", PyString_FromString("S-1-5-32"));
	PyModule_AddObject(m, "SEC_PRIV_SECURITY", PyInt_FromLong(SEC_PRIV_SECURITY));
	PyModule_AddObject(m, "SEC_DESC_DACL_AUTO_INHERITED", PyInt_FromLong(SEC_DESC_DACL_AUTO_INHERITED));
	PyModule_AddObject(m, "SID_BUILTIN_BACKUP_OPERATORS", PyString_FromString("S-1-5-32-551"));
	PyModule_AddObject(m, "DOMAIN_RID_ENTERPRISE_READONLY_DCS", PyInt_FromLong(498));
	PyModule_AddObject(m, "STANDARD_RIGHTS_MODIFY_ACCESS", PyInt_FromLong(SEC_STD_READ_CONTROL));
	PyModule_AddObject(m, "SEC_MASK_FLAGS", PyInt_FromLong(0x0F000000));
	PyModule_AddObject(m, "SEC_ACE_TYPE_ACCESS_DENIED", PyInt_FromLong(SEC_ACE_TYPE_ACCESS_DENIED));
	PyModule_AddObject(m, "GUID_DRS_USER_CHANGE_PASSWORD", PyString_FromString("ab721a53-1e2f-11d0-9819-00aa0040529b"));
	PyModule_AddObject(m, "LSA_POLICY_MODE_PROXY", PyInt_FromLong(LSA_POLICY_MODE_PROXY));
	PyModule_AddObject(m, "SEC_PRIV_SHUTDOWN", PyInt_FromLong(SEC_PRIV_SHUTDOWN));
	PyModule_AddObject(m, "SID_NT_NETWORK", PyString_FromString("S-1-5-2"));
	PyModule_AddObject(m, "SEC_DESC_SERVER_SECURITY", PyInt_FromLong(SEC_DESC_SERVER_SECURITY));
	PyModule_AddObject(m, "BUILTIN_RID_USERS", PyInt_FromLong(545));
	PyModule_AddObject(m, "SECINFO_SCOPE", PyInt_FromLong(SECINFO_SCOPE));
	PyModule_AddObject(m, "SID_NT_THIS_ORGANISATION", PyString_FromString("S-1-5-15"));
	PyModule_AddObject(m, "SEC_ADS_DELETE_TREE", PyInt_FromLong(0x00000040));
	PyModule_AddObject(m, "GUID_DRS_REPL_SYNCRONIZE", PyString_FromString("1131f6ab-9c07-11d1-f79f-00c04fc2dcd2"));
	Py_INCREF((PyObject *)(void *)&dom_sid_Type);
	PyModule_AddObject(m, "dom_sid", (PyObject *)(void *)&dom_sid_Type);
	Py_INCREF((PyObject *)(void *)&security_ace_object_Type);
	PyModule_AddObject(m, "ace_object", (PyObject *)(void *)&security_ace_object_Type);
	Py_INCREF((PyObject *)(void *)&security_ace_Type);
	PyModule_AddObject(m, "ace", (PyObject *)(void *)&security_ace_Type);
	Py_INCREF((PyObject *)(void *)&security_acl_Type);
	PyModule_AddObject(m, "acl", (PyObject *)(void *)&security_acl_Type);
	Py_INCREF((PyObject *)(void *)&security_descriptor_Type);
	PyModule_AddObject(m, "descriptor", (PyObject *)(void *)&security_descriptor_Type);
	Py_INCREF((PyObject *)(void *)&sec_desc_buf_Type);
	PyModule_AddObject(m, "sec_desc_buf", (PyObject *)(void *)&sec_desc_buf_Type);
	Py_INCREF((PyObject *)(void *)&security_token_Type);
	PyModule_AddObject(m, "token", (PyObject *)(void *)&security_token_Type);
	Py_INCREF((PyObject *)(void *)&security_unix_token_Type);
	PyModule_AddObject(m, "unix_token", (PyObject *)(void *)&security_unix_token_Type);
	Py_INCREF((PyObject *)(void *)&generic_mapping_Type);
	PyModule_AddObject(m, "generic_mapping", (PyObject *)(void *)&generic_mapping_Type);
	Py_INCREF((PyObject *)(void *)&standard_mapping_Type);
	PyModule_AddObject(m, "standard_mapping", (PyObject *)(void *)&standard_mapping_Type);
#ifdef PY_MOD_SECURITY_PATCH
	PY_MOD_SECURITY_PATCH(m);
#endif

}
