git add -f bin/default/librpc/gen_ndr/*.{c,h,ndr,pidl} bin/default/source*/librpc...
[metze/samba/wip.git] / bin / default / librpc / gen_ndr / py_security.c
index ef181c5aedf07b31086d5064a9b5e1ef204ab8bd..64e0fb7115c23df11cd3216bc37e00c23563df24 100644 (file)
@@ -1,5 +1,6 @@
 
 /* Python wrapper functions auto-generated by pidl */
+#define PY_SSIZE_T_CLEAN 1 /* We use Py_ssize_t for PyArg_ParseTupleAndKeywords */
 #include <Python.h>
 #include "includes.h"
 #include <pytalloc.h>
@@ -9,7 +10,7 @@
 #include "bin/default/librpc/gen_ndr/ndr_security_c.h"
 
 /*
- * These functions are here to ensure they can be optomised out by
+ * These functions are here to ensure they can be optimized out by
  * the compiler based on the constant input values
  */
 
@@ -78,11 +79,12 @@ static PyTypeObject security_descriptor_Type;
 static PyTypeObject sec_desc_buf_Type;
 static PyTypeObject security_token_Type;
 static PyTypeObject security_unix_token_Type;
+static PyTypeObject LSAP_TOKEN_INFO_INTEGRITY_Type;
 static PyTypeObject generic_mapping_Type;
 static PyTypeObject standard_mapping_Type;
 static PyTypeObject security_InterfaceType;
 
-void initsecurity(void);static PyTypeObject *Object_Type;
+void initsecurity(void);static PyTypeObject *BaseObject_Type;
 static PyTypeObject *GUID_Type;
 static PyTypeObject *ClientConnection_Type;
 static PyTypeObject *ndr_syntax_id_Type;
@@ -100,6 +102,10 @@ static PyObject *py_dom_sid_get_sid_rev_num(PyObject *obj, void *closure)
 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);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->sid_rev_num");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->sid_rev_num));
                if (PyLong_Check(value)) {
@@ -143,6 +149,10 @@ static PyObject *py_dom_sid_get_num_auths(PyObject *obj, void *closure)
 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);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->num_auths");
+               return -1;
+       }
        {
                const long long int_max = ndr_sizeof2intmax(sizeof(object->num_auths));
                const long long int_min = -int_max - 1;
@@ -198,6 +208,10 @@ static PyObject *py_dom_sid_get_id_auth(PyObject *obj, void *closure)
 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);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->id_auth");
+               return -1;
+       }
        PY_CHECK_TYPE(&PyList_Type, value, return -1;);
        {
                int id_auth_cntr_0;
@@ -206,6 +220,10 @@ static int py_dom_sid_set_id_auth(PyObject *py_obj, PyObject *value, void *closu
                        return -1;
                }
                for (id_auth_cntr_0 = 0; id_auth_cntr_0 < PyList_GET_SIZE(value); id_auth_cntr_0++) {
+                       if (PyList_GET_ITEM(value, id_auth_cntr_0) == NULL) {
+                               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->id_auth[id_auth_cntr_0]");
+                               return -1;
+                       }
                        {
                                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->id_auth[id_auth_cntr_0]));
                                if (PyLong_Check(PyList_GET_ITEM(value, id_auth_cntr_0))) {
@@ -262,6 +280,10 @@ static PyObject *py_dom_sid_get_sub_auths(PyObject *obj, void *closure)
 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);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->sub_auths");
+               return -1;
+       }
        PY_CHECK_TYPE(&PyList_Type, value, return -1;);
        {
                int sub_auths_cntr_0;
@@ -270,6 +292,10 @@ static int py_dom_sid_set_sub_auths(PyObject *py_obj, PyObject *value, void *clo
                        return -1;
                }
                for (sub_auths_cntr_0 = 0; sub_auths_cntr_0 < PyList_GET_SIZE(value); sub_auths_cntr_0++) {
+                       if (PyList_GET_ITEM(value, sub_auths_cntr_0) == NULL) {
+                               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->sub_auths[sub_auths_cntr_0]");
+                               return -1;
+                       }
                        {
                                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->sub_auths[sub_auths_cntr_0]));
                                if (PyLong_Check(PyList_GET_ITEM(value, sub_auths_cntr_0))) {
@@ -305,11 +331,31 @@ static int py_dom_sid_set_sub_auths(PyObject *py_obj, PyObject *value, void *clo
 }
 
 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 }
+       {
+               .name = discard_const_p(char, "sid_rev_num"),
+               .get = py_dom_sid_get_sid_rev_num,
+               .set = py_dom_sid_set_sid_rev_num,
+               .doc = discard_const_p(char, "PIDL-generated element sid_rev_num")
+       },
+       {
+               .name = discard_const_p(char, "num_auths"),
+               .get = py_dom_sid_get_num_auths,
+               .set = py_dom_sid_set_num_auths,
+               .doc = discard_const_p(char, "PIDL-generated element num_auths")
+       },
+       {
+               .name = discard_const_p(char, "id_auth"),
+               .get = py_dom_sid_get_id_auth,
+               .set = py_dom_sid_set_id_auth,
+               .doc = discard_const_p(char, "PIDL-generated element id_auth")
+       },
+       {
+               .name = discard_const_p(char, "sub_auths"),
+               .get = py_dom_sid_get_sub_auths,
+               .set = py_dom_sid_set_sub_auths,
+               .doc = discard_const_p(char, "PIDL-generated element sub_auths")
+       },
+       { .name = NULL }
 };
 
 static PyObject *py_dom_sid_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
@@ -320,22 +366,31 @@ static PyObject *py_dom_sid_new(PyTypeObject *type, PyObject *args, PyObject *kw
 static PyObject *py_dom_sid_ndr_pack(PyObject *py_obj)
 {
        struct dom_sid *object = (struct dom_sid *)pytalloc_get_ptr(py_obj);
+       PyObject *ret = NULL;
        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);
+       TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
+       if (tmp_ctx == NULL) {
+               PyErr_SetNdrError(NDR_ERR_ALLOC);
+               return NULL;
+       }
+       err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_dom_sid);
        if (err != NDR_ERR_SUCCESS) {
+               TALLOC_FREE(tmp_ctx);
                PyErr_SetNdrError(err);
                return NULL;
        }
 
-       return PyString_FromStringAndSize((char *)blob.data, blob.length);
+       ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
+       TALLOC_FREE(tmp_ctx);
+       return ret;
 }
 
 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;
+       Py_ssize_t blob_length = 0;
        enum ndr_err_code err;
        const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
        PyObject *allow_remaining_obj = NULL;
@@ -393,7 +448,6 @@ static PyTypeObject dom_sid_Type = {
        .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,
 };
 
@@ -421,6 +475,10 @@ union security_ace_object_type *py_export_security_ace_object_type(TALLOC_CTX *m
        union security_ace_object_type *ret = talloc_zero(mem_ctx, union security_ace_object_type);
        switch (level) {
                case SEC_ACE_OBJECT_TYPE_PRESENT:
+                       if (in == NULL) {
+                               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->type");
+                               talloc_free(ret); return NULL;
+                       }
                        PY_CHECK_TYPE(GUID_Type, in, talloc_free(ret); return NULL;);
                        if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
                                PyErr_NoMemory();
@@ -461,6 +519,10 @@ union security_ace_object_inherited_type *py_export_security_ace_object_inherite
        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:
+                       if (in == NULL) {
+                               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->inherited_type");
+                               talloc_free(ret); return NULL;
+                       }
                        PY_CHECK_TYPE(GUID_Type, in, talloc_free(ret); return NULL;);
                        if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
                                PyErr_NoMemory();
@@ -489,6 +551,10 @@ static PyObject *py_security_ace_object_get_flags(PyObject *obj, void *closure)
 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 (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->flags");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->flags));
                if (PyLong_Check(value)) {
@@ -535,6 +601,10 @@ static PyObject *py_security_ace_object_get_type(PyObject *obj, void *closure)
 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);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->type");
+               return -1;
+       }
        {
                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);
@@ -560,6 +630,10 @@ static PyObject *py_security_ace_object_get_inherited_type(PyObject *obj, void *
 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);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->inherited_type");
+               return -1;
+       }
        {
                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);
@@ -572,10 +646,25 @@ static int py_security_ace_object_set_inherited_type(PyObject *py_obj, PyObject
 }
 
 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 }
+       {
+               .name = discard_const_p(char, "flags"),
+               .get = py_security_ace_object_get_flags,
+               .set = py_security_ace_object_set_flags,
+               .doc = discard_const_p(char, "PIDL-generated element flags")
+       },
+       {
+               .name = discard_const_p(char, "type"),
+               .get = py_security_ace_object_get_type,
+               .set = py_security_ace_object_set_type,
+               .doc = discard_const_p(char, "PIDL-generated element type")
+       },
+       {
+               .name = discard_const_p(char, "inherited_type"),
+               .get = py_security_ace_object_get_inherited_type,
+               .set = py_security_ace_object_set_inherited_type,
+               .doc = discard_const_p(char, "PIDL-generated element inherited_type")
+       },
+       { .name = NULL }
 };
 
 static PyObject *py_security_ace_object_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
@@ -590,7 +679,6 @@ static PyTypeObject security_ace_object_Type = {
        .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,
 };
 
@@ -630,6 +718,10 @@ union security_ace_object_ctr *py_export_security_ace_object_ctr(TALLOC_CTX *mem
        union security_ace_object_ctr *ret = talloc_zero(mem_ctx, union security_ace_object_ctr);
        switch (level) {
                case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT:
+                       if (in == NULL) {
+                               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->object");
+                               talloc_free(ret); return NULL;
+                       }
                        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();
@@ -639,6 +731,10 @@ union security_ace_object_ctr *py_export_security_ace_object_ctr(TALLOC_CTX *mem
                        break;
 
                case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT:
+                       if (in == NULL) {
+                               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->object");
+                               talloc_free(ret); return NULL;
+                       }
                        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();
@@ -648,6 +744,10 @@ union security_ace_object_ctr *py_export_security_ace_object_ctr(TALLOC_CTX *mem
                        break;
 
                case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT:
+                       if (in == NULL) {
+                               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->object");
+                               talloc_free(ret); return NULL;
+                       }
                        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();
@@ -657,6 +757,10 @@ union security_ace_object_ctr *py_export_security_ace_object_ctr(TALLOC_CTX *mem
                        break;
 
                case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT:
+                       if (in == NULL) {
+                               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->object");
+                               talloc_free(ret); return NULL;
+                       }
                        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();
@@ -685,6 +789,10 @@ static PyObject *py_security_ace_get_type(PyObject *obj, void *closure)
 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 (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->type");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->type));
                if (PyLong_Check(value)) {
@@ -728,6 +836,10 @@ static PyObject *py_security_ace_get_flags(PyObject *obj, void *closure)
 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 (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->flags");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->flags));
                if (PyLong_Check(value)) {
@@ -771,6 +883,10 @@ static PyObject *py_security_ace_get_size(PyObject *obj, void *closure)
 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);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->size");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->size));
                if (PyLong_Check(value)) {
@@ -814,6 +930,10 @@ static PyObject *py_security_ace_get_access_mask(PyObject *obj, void *closure)
 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);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->access_mask");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->access_mask));
                if (PyLong_Check(value)) {
@@ -860,6 +980,10 @@ static PyObject *py_security_ace_get_object(PyObject *obj, void *closure)
 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);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->object");
+               return -1;
+       }
        {
                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);
@@ -882,6 +1006,10 @@ static PyObject *py_security_ace_get_trustee(PyObject *obj, void *closure)
 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);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->trustee");
+               return -1;
+       }
        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();
@@ -892,13 +1020,43 @@ static int py_security_ace_set_trustee(PyObject *py_obj, PyObject *value, void *
 }
 
 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 }
+       {
+               .name = discard_const_p(char, "type"),
+               .get = py_security_ace_get_type,
+               .set = py_security_ace_set_type,
+               .doc = discard_const_p(char, "PIDL-generated element type")
+       },
+       {
+               .name = discard_const_p(char, "flags"),
+               .get = py_security_ace_get_flags,
+               .set = py_security_ace_set_flags,
+               .doc = discard_const_p(char, "PIDL-generated element flags")
+       },
+       {
+               .name = discard_const_p(char, "size"),
+               .get = py_security_ace_get_size,
+               .set = py_security_ace_set_size,
+               .doc = discard_const_p(char, "PIDL-generated element size")
+       },
+       {
+               .name = discard_const_p(char, "access_mask"),
+               .get = py_security_ace_get_access_mask,
+               .set = py_security_ace_set_access_mask,
+               .doc = discard_const_p(char, "PIDL-generated element access_mask")
+       },
+       {
+               .name = discard_const_p(char, "object"),
+               .get = py_security_ace_get_object,
+               .set = py_security_ace_set_object,
+               .doc = discard_const_p(char, "PIDL-generated element object")
+       },
+       {
+               .name = discard_const_p(char, "trustee"),
+               .get = py_security_ace_get_trustee,
+               .set = py_security_ace_set_trustee,
+               .doc = discard_const_p(char, "PIDL-generated element trustee")
+       },
+       { .name = NULL }
 };
 
 static PyObject *py_security_ace_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
@@ -909,22 +1067,31 @@ static PyObject *py_security_ace_new(PyTypeObject *type, PyObject *args, PyObjec
 static PyObject *py_security_ace_ndr_pack(PyObject *py_obj)
 {
        struct security_ace *object = (struct security_ace *)pytalloc_get_ptr(py_obj);
+       PyObject *ret = NULL;
        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);
+       TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
+       if (tmp_ctx == NULL) {
+               PyErr_SetNdrError(NDR_ERR_ALLOC);
+               return NULL;
+       }
+       err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_security_ace);
        if (err != NDR_ERR_SUCCESS) {
+               TALLOC_FREE(tmp_ctx);
                PyErr_SetNdrError(err);
                return NULL;
        }
 
-       return PyString_FromStringAndSize((char *)blob.data, blob.length);
+       ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
+       TALLOC_FREE(tmp_ctx);
+       return ret;
 }
 
 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;
+       Py_ssize_t blob_length = 0;
        enum ndr_err_code err;
        const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
        PyObject *allow_remaining_obj = NULL;
@@ -982,7 +1149,6 @@ static PyTypeObject security_ace_Type = {
        .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,
 };
 
@@ -998,6 +1164,10 @@ static PyObject *py_security_acl_get_revision(PyObject *obj, void *closure)
 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 (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->revision");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->revision));
                if (PyLong_Check(value)) {
@@ -1041,6 +1211,10 @@ static PyObject *py_security_acl_get_size(PyObject *obj, void *closure)
 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);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->size");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->size));
                if (PyLong_Check(value)) {
@@ -1084,6 +1258,10 @@ static PyObject *py_security_acl_get_num_aces(PyObject *obj, void *closure)
 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);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->num_aces");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->num_aces));
                if (PyLong_Check(value)) {
@@ -1138,6 +1316,10 @@ static PyObject *py_security_acl_get_aces(PyObject *obj, void *closure)
 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);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->aces");
+               return -1;
+       }
        PY_CHECK_TYPE(&PyList_Type, value, return -1;);
        {
                int aces_cntr_0;
@@ -1145,6 +1327,10 @@ static int py_security_acl_set_aces(PyObject *py_obj, PyObject *value, void *clo
                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++) {
+                       if (PyList_GET_ITEM(value, aces_cntr_0) == NULL) {
+                               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->aces[aces_cntr_0]");
+                               return -1;
+                       }
                        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();
@@ -1157,11 +1343,31 @@ static int py_security_acl_set_aces(PyObject *py_obj, PyObject *value, void *clo
 }
 
 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 }
+       {
+               .name = discard_const_p(char, "revision"),
+               .get = py_security_acl_get_revision,
+               .set = py_security_acl_set_revision,
+               .doc = discard_const_p(char, "PIDL-generated element revision")
+       },
+       {
+               .name = discard_const_p(char, "size"),
+               .get = py_security_acl_get_size,
+               .set = py_security_acl_set_size,
+               .doc = discard_const_p(char, "PIDL-generated element size")
+       },
+       {
+               .name = discard_const_p(char, "num_aces"),
+               .get = py_security_acl_get_num_aces,
+               .set = py_security_acl_set_num_aces,
+               .doc = discard_const_p(char, "PIDL-generated element num_aces")
+       },
+       {
+               .name = discard_const_p(char, "aces"),
+               .get = py_security_acl_get_aces,
+               .set = py_security_acl_set_aces,
+               .doc = discard_const_p(char, "PIDL-generated element aces")
+       },
+       { .name = NULL }
 };
 
 static PyObject *py_security_acl_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
@@ -1172,22 +1378,31 @@ static PyObject *py_security_acl_new(PyTypeObject *type, PyObject *args, PyObjec
 static PyObject *py_security_acl_ndr_pack(PyObject *py_obj)
 {
        struct security_acl *object = (struct security_acl *)pytalloc_get_ptr(py_obj);
+       PyObject *ret = NULL;
        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);
+       TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
+       if (tmp_ctx == NULL) {
+               PyErr_SetNdrError(NDR_ERR_ALLOC);
+               return NULL;
+       }
+       err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_security_acl);
        if (err != NDR_ERR_SUCCESS) {
+               TALLOC_FREE(tmp_ctx);
                PyErr_SetNdrError(err);
                return NULL;
        }
 
-       return PyString_FromStringAndSize((char *)blob.data, blob.length);
+       ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
+       TALLOC_FREE(tmp_ctx);
+       return ret;
 }
 
 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;
+       Py_ssize_t blob_length = 0;
        enum ndr_err_code err;
        const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
        PyObject *allow_remaining_obj = NULL;
@@ -1245,7 +1460,6 @@ static PyTypeObject security_acl_Type = {
        .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,
 };
 
@@ -1261,6 +1475,10 @@ static PyObject *py_security_descriptor_get_revision(PyObject *obj, void *closur
 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 (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->revision");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->revision));
                if (PyLong_Check(value)) {
@@ -1304,6 +1522,10 @@ static PyObject *py_security_descriptor_get_type(PyObject *obj, void *closure)
 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 (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->type");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->type));
                if (PyLong_Check(value)) {
@@ -1353,10 +1575,18 @@ static int py_security_descriptor_set_owner_sid(PyObject *py_obj, PyObject *valu
 {
        struct security_descriptor *object = (struct security_descriptor *)pytalloc_get_ptr(py_obj);
        talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->owner_sid));
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->owner_sid");
+               return -1;
+       }
        if (value == Py_None) {
                object->owner_sid = NULL;
        } else {
                object->owner_sid = NULL;
+               if (value == NULL) {
+                       PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct *object->owner_sid");
+                       return -1;
+               }
                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();
@@ -1384,10 +1614,18 @@ static int py_security_descriptor_set_group_sid(PyObject *py_obj, PyObject *valu
 {
        struct security_descriptor *object = (struct security_descriptor *)pytalloc_get_ptr(py_obj);
        talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->group_sid));
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->group_sid");
+               return -1;
+       }
        if (value == Py_None) {
                object->group_sid = NULL;
        } else {
                object->group_sid = NULL;
+               if (value == NULL) {
+                       PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct *object->group_sid");
+                       return -1;
+               }
                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();
@@ -1415,10 +1653,18 @@ static int py_security_descriptor_set_sacl(PyObject *py_obj, PyObject *value, vo
 {
        struct security_descriptor *object = (struct security_descriptor *)pytalloc_get_ptr(py_obj);
        talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->sacl));
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->sacl");
+               return -1;
+       }
        if (value == Py_None) {
                object->sacl = NULL;
        } else {
                object->sacl = NULL;
+               if (value == NULL) {
+                       PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct *object->sacl");
+                       return -1;
+               }
                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();
@@ -1446,10 +1692,18 @@ static int py_security_descriptor_set_dacl(PyObject *py_obj, PyObject *value, vo
 {
        struct security_descriptor *object = (struct security_descriptor *)pytalloc_get_ptr(py_obj);
        talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->dacl));
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->dacl");
+               return -1;
+       }
        if (value == Py_None) {
                object->dacl = NULL;
        } else {
                object->dacl = NULL;
+               if (value == NULL) {
+                       PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct *object->dacl");
+                       return -1;
+               }
                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();
@@ -1461,13 +1715,43 @@ static int py_security_descriptor_set_dacl(PyObject *py_obj, PyObject *value, vo
 }
 
 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 }
+       {
+               .name = discard_const_p(char, "revision"),
+               .get = py_security_descriptor_get_revision,
+               .set = py_security_descriptor_set_revision,
+               .doc = discard_const_p(char, "PIDL-generated element revision")
+       },
+       {
+               .name = discard_const_p(char, "type"),
+               .get = py_security_descriptor_get_type,
+               .set = py_security_descriptor_set_type,
+               .doc = discard_const_p(char, "PIDL-generated element type")
+       },
+       {
+               .name = discard_const_p(char, "owner_sid"),
+               .get = py_security_descriptor_get_owner_sid,
+               .set = py_security_descriptor_set_owner_sid,
+               .doc = discard_const_p(char, "PIDL-generated element owner_sid")
+       },
+       {
+               .name = discard_const_p(char, "group_sid"),
+               .get = py_security_descriptor_get_group_sid,
+               .set = py_security_descriptor_set_group_sid,
+               .doc = discard_const_p(char, "PIDL-generated element group_sid")
+       },
+       {
+               .name = discard_const_p(char, "sacl"),
+               .get = py_security_descriptor_get_sacl,
+               .set = py_security_descriptor_set_sacl,
+               .doc = discard_const_p(char, "PIDL-generated element sacl")
+       },
+       {
+               .name = discard_const_p(char, "dacl"),
+               .get = py_security_descriptor_get_dacl,
+               .set = py_security_descriptor_set_dacl,
+               .doc = discard_const_p(char, "PIDL-generated element dacl")
+       },
+       { .name = NULL }
 };
 
 static PyObject *py_security_descriptor_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
@@ -1478,22 +1762,31 @@ static PyObject *py_security_descriptor_new(PyTypeObject *type, PyObject *args,
 static PyObject *py_security_descriptor_ndr_pack(PyObject *py_obj)
 {
        struct security_descriptor *object = (struct security_descriptor *)pytalloc_get_ptr(py_obj);
+       PyObject *ret = NULL;
        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);
+       TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
+       if (tmp_ctx == NULL) {
+               PyErr_SetNdrError(NDR_ERR_ALLOC);
+               return NULL;
+       }
+       err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_security_descriptor);
        if (err != NDR_ERR_SUCCESS) {
+               TALLOC_FREE(tmp_ctx);
                PyErr_SetNdrError(err);
                return NULL;
        }
 
-       return PyString_FromStringAndSize((char *)blob.data, blob.length);
+       ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
+       TALLOC_FREE(tmp_ctx);
+       return ret;
 }
 
 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;
+       Py_ssize_t blob_length = 0;
        enum ndr_err_code err;
        const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
        PyObject *allow_remaining_obj = NULL;
@@ -1551,7 +1844,6 @@ static PyTypeObject security_descriptor_Type = {
        .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,
 };
 
@@ -1567,6 +1859,10 @@ static PyObject *py_sec_desc_buf_get_sd_size(PyObject *obj, void *closure)
 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);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->sd_size");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->sd_size));
                if (PyLong_Check(value)) {
@@ -1616,10 +1912,18 @@ static int py_sec_desc_buf_set_sd(PyObject *py_obj, PyObject *value, void *closu
 {
        struct sec_desc_buf *object = (struct sec_desc_buf *)pytalloc_get_ptr(py_obj);
        talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->sd));
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->sd");
+               return -1;
+       }
        if (value == Py_None) {
                object->sd = NULL;
        } else {
                object->sd = NULL;
+               if (value == NULL) {
+                       PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct *object->sd");
+                       return -1;
+               }
                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();
@@ -1631,9 +1935,19 @@ static int py_sec_desc_buf_set_sd(PyObject *py_obj, PyObject *value, void *closu
 }
 
 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 }
+       {
+               .name = discard_const_p(char, "sd_size"),
+               .get = py_sec_desc_buf_get_sd_size,
+               .set = py_sec_desc_buf_set_sd_size,
+               .doc = discard_const_p(char, "PIDL-generated element sd_size")
+       },
+       {
+               .name = discard_const_p(char, "sd"),
+               .get = py_sec_desc_buf_get_sd,
+               .set = py_sec_desc_buf_set_sd,
+               .doc = discard_const_p(char, "PIDL-generated element sd")
+       },
+       { .name = NULL }
 };
 
 static PyObject *py_sec_desc_buf_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
@@ -1644,22 +1958,31 @@ static PyObject *py_sec_desc_buf_new(PyTypeObject *type, PyObject *args, PyObjec
 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);
+       PyObject *ret = NULL;
        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);
+       TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
+       if (tmp_ctx == NULL) {
+               PyErr_SetNdrError(NDR_ERR_ALLOC);
+               return NULL;
+       }
+       err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_sec_desc_buf);
        if (err != NDR_ERR_SUCCESS) {
+               TALLOC_FREE(tmp_ctx);
                PyErr_SetNdrError(err);
                return NULL;
        }
 
-       return PyString_FromStringAndSize((char *)blob.data, blob.length);
+       ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
+       TALLOC_FREE(tmp_ctx);
+       return ret;
 }
 
 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;
+       Py_ssize_t blob_length = 0;
        enum ndr_err_code err;
        const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
        PyObject *allow_remaining_obj = NULL;
@@ -1717,7 +2040,6 @@ static PyTypeObject sec_desc_buf_Type = {
        .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,
 };
 
@@ -1733,6 +2055,10 @@ static PyObject *py_security_token_get_num_sids(PyObject *obj, void *closure)
 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);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->num_sids");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->num_sids));
                if (PyLong_Check(value)) {
@@ -1787,6 +2113,10 @@ static PyObject *py_security_token_get_sids(PyObject *obj, void *closure)
 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);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->sids");
+               return -1;
+       }
        PY_CHECK_TYPE(&PyList_Type, value, return -1;);
        {
                int sids_cntr_0;
@@ -1794,6 +2124,10 @@ static int py_security_token_set_sids(PyObject *py_obj, PyObject *value, void *c
                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++) {
+                       if (PyList_GET_ITEM(value, sids_cntr_0) == NULL) {
+                               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->sids[sids_cntr_0]");
+                               return -1;
+                       }
                        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();
@@ -1816,6 +2150,10 @@ static PyObject *py_security_token_get_privilege_mask(PyObject *obj, void *closu
 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 (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->privilege_mask");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->privilege_mask));
                if (PyLong_Check(value)) {
@@ -1859,6 +2197,10 @@ static PyObject *py_security_token_get_rights_mask(PyObject *obj, void *closure)
 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 (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->rights_mask");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->rights_mask));
                if (PyLong_Check(value)) {
@@ -1892,11 +2234,31 @@ static int py_security_token_set_rights_mask(PyObject *py_obj, PyObject *value,
 }
 
 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 }
+       {
+               .name = discard_const_p(char, "num_sids"),
+               .get = py_security_token_get_num_sids,
+               .set = py_security_token_set_num_sids,
+               .doc = discard_const_p(char, "PIDL-generated element num_sids")
+       },
+       {
+               .name = discard_const_p(char, "sids"),
+               .get = py_security_token_get_sids,
+               .set = py_security_token_set_sids,
+               .doc = discard_const_p(char, "PIDL-generated element sids")
+       },
+       {
+               .name = discard_const_p(char, "privilege_mask"),
+               .get = py_security_token_get_privilege_mask,
+               .set = py_security_token_set_privilege_mask,
+               .doc = discard_const_p(char, "PIDL-generated element privilege_mask")
+       },
+       {
+               .name = discard_const_p(char, "rights_mask"),
+               .get = py_security_token_get_rights_mask,
+               .set = py_security_token_set_rights_mask,
+               .doc = discard_const_p(char, "PIDL-generated element rights_mask")
+       },
+       { .name = NULL }
 };
 
 static PyObject *py_security_token_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
@@ -1907,22 +2269,31 @@ static PyObject *py_security_token_new(PyTypeObject *type, PyObject *args, PyObj
 static PyObject *py_security_token_ndr_pack(PyObject *py_obj)
 {
        struct security_token *object = (struct security_token *)pytalloc_get_ptr(py_obj);
+       PyObject *ret = NULL;
        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);
+       TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
+       if (tmp_ctx == NULL) {
+               PyErr_SetNdrError(NDR_ERR_ALLOC);
+               return NULL;
+       }
+       err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_security_token);
        if (err != NDR_ERR_SUCCESS) {
+               TALLOC_FREE(tmp_ctx);
                PyErr_SetNdrError(err);
                return NULL;
        }
 
-       return PyString_FromStringAndSize((char *)blob.data, blob.length);
+       ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
+       TALLOC_FREE(tmp_ctx);
+       return ret;
 }
 
 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;
+       Py_ssize_t blob_length = 0;
        enum ndr_err_code err;
        const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
        PyObject *allow_remaining_obj = NULL;
@@ -1980,7 +2351,6 @@ static PyTypeObject security_token_Type = {
        .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,
 };
 
@@ -1996,6 +2366,10 @@ static PyObject *py_security_unix_token_get_uid(PyObject *obj, void *closure)
 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);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->uid");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->uid));
                if (PyLong_Check(value)) {
@@ -2039,6 +2413,10 @@ static PyObject *py_security_unix_token_get_gid(PyObject *obj, void *closure)
 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);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->gid");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->gid));
                if (PyLong_Check(value)) {
@@ -2082,6 +2460,10 @@ static PyObject *py_security_unix_token_get_ngroups(PyObject *obj, void *closure
 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);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->ngroups");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->ngroups));
                if (PyLong_Check(value)) {
@@ -2136,6 +2518,10 @@ static PyObject *py_security_unix_token_get_groups(PyObject *obj, void *closure)
 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);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->groups");
+               return -1;
+       }
        PY_CHECK_TYPE(&PyList_Type, value, return -1;);
        {
                int groups_cntr_0;
@@ -2143,6 +2529,10 @@ static int py_security_unix_token_set_groups(PyObject *py_obj, PyObject *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++) {
+                       if (PyList_GET_ITEM(value, groups_cntr_0) == NULL) {
+                               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->groups[groups_cntr_0]");
+                               return -1;
+                       }
                        {
                                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->groups[groups_cntr_0]));
                                if (PyLong_Check(PyList_GET_ITEM(value, groups_cntr_0))) {
@@ -2178,11 +2568,31 @@ static int py_security_unix_token_set_groups(PyObject *py_obj, PyObject *value,
 }
 
 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 }
+       {
+               .name = discard_const_p(char, "uid"),
+               .get = py_security_unix_token_get_uid,
+               .set = py_security_unix_token_set_uid,
+               .doc = discard_const_p(char, "PIDL-generated element uid")
+       },
+       {
+               .name = discard_const_p(char, "gid"),
+               .get = py_security_unix_token_get_gid,
+               .set = py_security_unix_token_set_gid,
+               .doc = discard_const_p(char, "PIDL-generated element gid")
+       },
+       {
+               .name = discard_const_p(char, "ngroups"),
+               .get = py_security_unix_token_get_ngroups,
+               .set = py_security_unix_token_set_ngroups,
+               .doc = discard_const_p(char, "PIDL-generated element ngroups")
+       },
+       {
+               .name = discard_const_p(char, "groups"),
+               .get = py_security_unix_token_get_groups,
+               .set = py_security_unix_token_set_groups,
+               .doc = discard_const_p(char, "PIDL-generated element groups")
+       },
+       { .name = NULL }
 };
 
 static PyObject *py_security_unix_token_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
@@ -2193,22 +2603,31 @@ static PyObject *py_security_unix_token_new(PyTypeObject *type, PyObject *args,
 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);
+       PyObject *ret = NULL;
        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);
+       TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
+       if (tmp_ctx == NULL) {
+               PyErr_SetNdrError(NDR_ERR_ALLOC);
+               return NULL;
+       }
+       err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_security_unix_token);
        if (err != NDR_ERR_SUCCESS) {
+               TALLOC_FREE(tmp_ctx);
                PyErr_SetNdrError(err);
                return NULL;
        }
 
-       return PyString_FromStringAndSize((char *)blob.data, blob.length);
+       ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
+       TALLOC_FREE(tmp_ctx);
+       return ret;
 }
 
 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;
+       Py_ssize_t blob_length = 0;
        enum ndr_err_code err;
        const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
        PyObject *allow_remaining_obj = NULL;
@@ -2266,11 +2685,292 @@ static PyTypeObject security_unix_token_Type = {
        .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_LSAP_TOKEN_INFO_INTEGRITY_get_Flags(PyObject *obj, void *closure)
+{
+       struct LSAP_TOKEN_INFO_INTEGRITY *object = (struct LSAP_TOKEN_INFO_INTEGRITY *)pytalloc_get_ptr(obj);
+       PyObject *py_Flags;
+       py_Flags = ndr_PyLong_FromUnsignedLongLong((uint32_t)object->Flags);
+       return py_Flags;
+}
+
+static int py_LSAP_TOKEN_INFO_INTEGRITY_set_Flags(PyObject *py_obj, PyObject *value, void *closure)
+{
+       struct LSAP_TOKEN_INFO_INTEGRITY *object = (struct LSAP_TOKEN_INFO_INTEGRITY *)pytalloc_get_ptr(py_obj);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->Flags");
+               return -1;
+       }
+       {
+               const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->Flags));
+               if (PyLong_Check(value)) {
+                       unsigned long long test_var;
+                       test_var = PyLong_AsUnsignedLongLong(value);
+                       if (PyErr_Occurred() != NULL) {
+                               return -1;
+                       }
+                       if (test_var > uint_max) {
+                               PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %llu",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->Flags = test_var;
+               } else if (PyInt_Check(value)) {
+                       long test_var;
+                       test_var = PyInt_AsLong(value);
+                       if (test_var < 0 || test_var > uint_max) {
+                               PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %ld",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->Flags = test_var;
+               } 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_LSAP_TOKEN_INFO_INTEGRITY_get_TokenIL(PyObject *obj, void *closure)
+{
+       struct LSAP_TOKEN_INFO_INTEGRITY *object = (struct LSAP_TOKEN_INFO_INTEGRITY *)pytalloc_get_ptr(obj);
+       PyObject *py_TokenIL;
+       py_TokenIL = ndr_PyLong_FromUnsignedLongLong((uint32_t)object->TokenIL);
+       return py_TokenIL;
+}
+
+static int py_LSAP_TOKEN_INFO_INTEGRITY_set_TokenIL(PyObject *py_obj, PyObject *value, void *closure)
+{
+       struct LSAP_TOKEN_INFO_INTEGRITY *object = (struct LSAP_TOKEN_INFO_INTEGRITY *)pytalloc_get_ptr(py_obj);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->TokenIL");
+               return -1;
+       }
+       {
+               const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->TokenIL));
+               if (PyLong_Check(value)) {
+                       unsigned long long test_var;
+                       test_var = PyLong_AsUnsignedLongLong(value);
+                       if (PyErr_Occurred() != NULL) {
+                               return -1;
+                       }
+                       if (test_var > uint_max) {
+                               PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %llu",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->TokenIL = test_var;
+               } else if (PyInt_Check(value)) {
+                       long test_var;
+                       test_var = PyInt_AsLong(value);
+                       if (test_var < 0 || test_var > uint_max) {
+                               PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %ld",\
+                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                               return -1;
+                       }
+                       object->TokenIL = test_var;
+               } 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_LSAP_TOKEN_INFO_INTEGRITY_get_MachineId(PyObject *obj, void *closure)
+{
+       struct LSAP_TOKEN_INFO_INTEGRITY *object = (struct LSAP_TOKEN_INFO_INTEGRITY *)pytalloc_get_ptr(obj);
+       PyObject *py_MachineId;
+       py_MachineId = PyList_New(32);
+       if (py_MachineId == NULL) {
+               return NULL;
+       }
+       {
+               int MachineId_cntr_0;
+               for (MachineId_cntr_0 = 0; MachineId_cntr_0 < (32); MachineId_cntr_0++) {
+                       PyObject *py_MachineId_0;
+                       py_MachineId_0 = PyInt_FromLong((uint16_t)object->MachineId[MachineId_cntr_0]);
+                       PyList_SetItem(py_MachineId, MachineId_cntr_0, py_MachineId_0);
+               }
+       }
+       return py_MachineId;
+}
+
+static int py_LSAP_TOKEN_INFO_INTEGRITY_set_MachineId(PyObject *py_obj, PyObject *value, void *closure)
+{
+       struct LSAP_TOKEN_INFO_INTEGRITY *object = (struct LSAP_TOKEN_INFO_INTEGRITY *)pytalloc_get_ptr(py_obj);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->MachineId");
+               return -1;
+       }
+       PY_CHECK_TYPE(&PyList_Type, value, return -1;);
+       {
+               int MachineId_cntr_0;
+               if (ARRAY_SIZE(object->MachineId) != PyList_GET_SIZE(value)) {
+                       PyErr_Format(PyExc_TypeError, "Expected list of type %s, length %zu, got %zd", Py_TYPE(value)->tp_name, ARRAY_SIZE(object->MachineId),  PyList_GET_SIZE(value));
+                       return -1;
+               }
+               for (MachineId_cntr_0 = 0; MachineId_cntr_0 < PyList_GET_SIZE(value); MachineId_cntr_0++) {
+                       if (PyList_GET_ITEM(value, MachineId_cntr_0) == NULL) {
+                               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->MachineId[MachineId_cntr_0]");
+                               return -1;
+                       }
+                       {
+                               const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->MachineId[MachineId_cntr_0]));
+                               if (PyLong_Check(PyList_GET_ITEM(value, MachineId_cntr_0))) {
+                                       unsigned long long test_var;
+                                       test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, MachineId_cntr_0));
+                                       if (PyErr_Occurred() != NULL) {
+                                               return -1;
+                                       }
+                                       if (test_var > uint_max) {
+                                               PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %llu",\
+                                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                                               return -1;
+                                       }
+                                       object->MachineId[MachineId_cntr_0] = test_var;
+                               } else if (PyInt_Check(PyList_GET_ITEM(value, MachineId_cntr_0))) {
+                                       long test_var;
+                                       test_var = PyInt_AsLong(PyList_GET_ITEM(value, MachineId_cntr_0));
+                                       if (test_var < 0 || test_var > uint_max) {
+                                               PyErr_Format(PyExc_OverflowError, "Expected type %s or %s within range 0 - %llu, got %ld",\
+                                                 PyInt_Type.tp_name, PyLong_Type.tp_name, uint_max, test_var);
+                                               return -1;
+                                       }
+                                       object->MachineId[MachineId_cntr_0] = test_var;
+                               } 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_LSAP_TOKEN_INFO_INTEGRITY_getsetters[] = {
+       {
+               .name = discard_const_p(char, "Flags"),
+               .get = py_LSAP_TOKEN_INFO_INTEGRITY_get_Flags,
+               .set = py_LSAP_TOKEN_INFO_INTEGRITY_set_Flags,
+               .doc = discard_const_p(char, "PIDL-generated element Flags")
+       },
+       {
+               .name = discard_const_p(char, "TokenIL"),
+               .get = py_LSAP_TOKEN_INFO_INTEGRITY_get_TokenIL,
+               .set = py_LSAP_TOKEN_INFO_INTEGRITY_set_TokenIL,
+               .doc = discard_const_p(char, "PIDL-generated element TokenIL")
+       },
+       {
+               .name = discard_const_p(char, "MachineId"),
+               .get = py_LSAP_TOKEN_INFO_INTEGRITY_get_MachineId,
+               .set = py_LSAP_TOKEN_INFO_INTEGRITY_set_MachineId,
+               .doc = discard_const_p(char, "PIDL-generated element MachineId")
+       },
+       { .name = NULL }
+};
+
+static PyObject *py_LSAP_TOKEN_INFO_INTEGRITY_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
+{
+       return pytalloc_new(struct LSAP_TOKEN_INFO_INTEGRITY, type);
+}
+
+static PyObject *py_LSAP_TOKEN_INFO_INTEGRITY_ndr_pack(PyObject *py_obj)
+{
+       struct LSAP_TOKEN_INFO_INTEGRITY *object = (struct LSAP_TOKEN_INFO_INTEGRITY *)pytalloc_get_ptr(py_obj);
+       PyObject *ret = NULL;
+       DATA_BLOB blob;
+       enum ndr_err_code err;
+       TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
+       if (tmp_ctx == NULL) {
+               PyErr_SetNdrError(NDR_ERR_ALLOC);
+               return NULL;
+       }
+       err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_LSAP_TOKEN_INFO_INTEGRITY);
+       if (err != NDR_ERR_SUCCESS) {
+               TALLOC_FREE(tmp_ctx);
+               PyErr_SetNdrError(err);
+               return NULL;
+       }
+
+       ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
+       TALLOC_FREE(tmp_ctx);
+       return ret;
+}
+
+static PyObject *py_LSAP_TOKEN_INFO_INTEGRITY_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
+{
+       struct LSAP_TOKEN_INFO_INTEGRITY *object = (struct LSAP_TOKEN_INFO_INTEGRITY *)pytalloc_get_ptr(py_obj);
+       DATA_BLOB blob;
+       Py_ssize_t 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_LSAP_TOKEN_INFO_INTEGRITY);
+       } else {
+               err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_LSAP_TOKEN_INFO_INTEGRITY);
+       }
+       if (err != NDR_ERR_SUCCESS) {
+               PyErr_SetNdrError(err);
+               return NULL;
+       }
+
+       Py_RETURN_NONE;
+}
+
+static PyObject *py_LSAP_TOKEN_INFO_INTEGRITY_ndr_print(PyObject *py_obj)
+{
+       struct LSAP_TOKEN_INFO_INTEGRITY *object = (struct LSAP_TOKEN_INFO_INTEGRITY *)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_LSAP_TOKEN_INFO_INTEGRITY, "LSAP_TOKEN_INFO_INTEGRITY", object);
+       ret = PyString_FromString(retstr);
+       talloc_free(retstr);
+
+       return ret;
+}
+
+static PyMethodDef py_LSAP_TOKEN_INFO_INTEGRITY_methods[] = {
+       { "__ndr_pack__", (PyCFunction)py_LSAP_TOKEN_INFO_INTEGRITY_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
+       { "__ndr_unpack__", (PyCFunction)py_LSAP_TOKEN_INFO_INTEGRITY_ndr_unpack, METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
+       { "__ndr_print__", (PyCFunction)py_LSAP_TOKEN_INFO_INTEGRITY_ndr_print, METH_VARARGS, "S.ndr_print(object) -> None\nNDR print" },
+       { NULL, NULL, 0, NULL }
+};
+
+
+static PyTypeObject LSAP_TOKEN_INFO_INTEGRITY_Type = {
+       PyObject_HEAD_INIT(NULL) 0,
+       .tp_name = "security.LSAP_TOKEN_INFO_INTEGRITY",
+       .tp_getset = py_LSAP_TOKEN_INFO_INTEGRITY_getsetters,
+       .tp_methods = py_LSAP_TOKEN_INFO_INTEGRITY_methods,
+       .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+       .tp_new = py_LSAP_TOKEN_INFO_INTEGRITY_new,
+};
+
+
 static PyObject *py_generic_mapping_get_generic_read(PyObject *obj, void *closure)
 {
        struct generic_mapping *object = (struct generic_mapping *)pytalloc_get_ptr(obj);
@@ -2282,6 +2982,10 @@ static PyObject *py_generic_mapping_get_generic_read(PyObject *obj, void *closur
 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);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->generic_read");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->generic_read));
                if (PyLong_Check(value)) {
@@ -2325,6 +3029,10 @@ static PyObject *py_generic_mapping_get_generic_write(PyObject *obj, void *closu
 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);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->generic_write");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->generic_write));
                if (PyLong_Check(value)) {
@@ -2368,6 +3076,10 @@ static PyObject *py_generic_mapping_get_generic_execute(PyObject *obj, void *clo
 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);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->generic_execute");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->generic_execute));
                if (PyLong_Check(value)) {
@@ -2411,6 +3123,10 @@ static PyObject *py_generic_mapping_get_generic_all(PyObject *obj, void *closure
 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);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->generic_all");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->generic_all));
                if (PyLong_Check(value)) {
@@ -2444,11 +3160,31 @@ static int py_generic_mapping_set_generic_all(PyObject *py_obj, PyObject *value,
 }
 
 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 }
+       {
+               .name = discard_const_p(char, "generic_read"),
+               .get = py_generic_mapping_get_generic_read,
+               .set = py_generic_mapping_set_generic_read,
+               .doc = discard_const_p(char, "PIDL-generated element generic_read")
+       },
+       {
+               .name = discard_const_p(char, "generic_write"),
+               .get = py_generic_mapping_get_generic_write,
+               .set = py_generic_mapping_set_generic_write,
+               .doc = discard_const_p(char, "PIDL-generated element generic_write")
+       },
+       {
+               .name = discard_const_p(char, "generic_execute"),
+               .get = py_generic_mapping_get_generic_execute,
+               .set = py_generic_mapping_set_generic_execute,
+               .doc = discard_const_p(char, "PIDL-generated element generic_execute")
+       },
+       {
+               .name = discard_const_p(char, "generic_all"),
+               .get = py_generic_mapping_get_generic_all,
+               .set = py_generic_mapping_set_generic_all,
+               .doc = discard_const_p(char, "PIDL-generated element generic_all")
+       },
+       { .name = NULL }
 };
 
 static PyObject *py_generic_mapping_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
@@ -2463,7 +3199,6 @@ static PyTypeObject generic_mapping_Type = {
        .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,
 };
 
@@ -2479,6 +3214,10 @@ static PyObject *py_standard_mapping_get_std_read(PyObject *obj, void *closure)
 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);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->std_read");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->std_read));
                if (PyLong_Check(value)) {
@@ -2522,6 +3261,10 @@ static PyObject *py_standard_mapping_get_std_write(PyObject *obj, void *closure)
 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);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->std_write");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->std_write));
                if (PyLong_Check(value)) {
@@ -2565,6 +3308,10 @@ static PyObject *py_standard_mapping_get_std_execute(PyObject *obj, void *closur
 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);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->std_execute");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->std_execute));
                if (PyLong_Check(value)) {
@@ -2608,6 +3355,10 @@ static PyObject *py_standard_mapping_get_std_all(PyObject *obj, void *closure)
 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);
+       if (value == NULL) {
+               PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->std_all");
+               return -1;
+       }
        {
                const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->std_all));
                if (PyLong_Check(value)) {
@@ -2641,11 +3392,31 @@ static int py_standard_mapping_set_std_all(PyObject *py_obj, PyObject *value, vo
 }
 
 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 }
+       {
+               .name = discard_const_p(char, "std_read"),
+               .get = py_standard_mapping_get_std_read,
+               .set = py_standard_mapping_set_std_read,
+               .doc = discard_const_p(char, "PIDL-generated element std_read")
+       },
+       {
+               .name = discard_const_p(char, "std_write"),
+               .get = py_standard_mapping_get_std_write,
+               .set = py_standard_mapping_set_std_write,
+               .doc = discard_const_p(char, "PIDL-generated element std_write")
+       },
+       {
+               .name = discard_const_p(char, "std_execute"),
+               .get = py_standard_mapping_get_std_execute,
+               .set = py_standard_mapping_set_std_execute,
+               .doc = discard_const_p(char, "PIDL-generated element std_execute")
+       },
+       {
+               .name = discard_const_p(char, "std_all"),
+               .get = py_standard_mapping_get_std_all,
+               .set = py_standard_mapping_set_std_all,
+               .doc = discard_const_p(char, "PIDL-generated element std_all")
+       },
+       { .name = NULL }
 };
 
 static PyObject *py_standard_mapping_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
@@ -2660,7 +3431,6 @@ static PyTypeObject standard_mapping_Type = {
        .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,
 };
 
@@ -2695,7 +3465,6 @@ static PyObject *syntax_security_new(PyTypeObject *type, PyObject *args, PyObjec
 static PyTypeObject security_SyntaxType = {
        PyObject_HEAD_INIT(NULL) 0,
        .tp_name = "security.security",
-       .tp_basicsize = sizeof(pytalloc_Object),
        .tp_doc = "abstract_syntax()\n",
        .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
        .tp_new = syntax_security_new,
@@ -2724,8 +3493,8 @@ void initsecurity(void)
        if (dep_samba_dcerpc_base == NULL)
                return;
 
-       Object_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "Object");
-       if (Object_Type == NULL)
+       BaseObject_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "BaseObject");
+       if (BaseObject_Type == NULL)
                return;
 
        GUID_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_misc, "GUID");
@@ -2740,29 +3509,43 @@ void initsecurity(void)
        if (ndr_syntax_id_Type == NULL)
                return;
 
-       dom_sid_Type.tp_base = Object_Type;
+       dom_sid_Type.tp_base = BaseObject_Type;
+       dom_sid_Type.tp_basicsize = pytalloc_BaseObject_size();
+
+       security_ace_object_Type.tp_base = BaseObject_Type;
+       security_ace_object_Type.tp_basicsize = pytalloc_BaseObject_size();
 
-       security_ace_object_Type.tp_base = Object_Type;
+       security_ace_Type.tp_base = BaseObject_Type;
+       security_ace_Type.tp_basicsize = pytalloc_BaseObject_size();
 
-       security_ace_Type.tp_base = Object_Type;
+       security_acl_Type.tp_base = BaseObject_Type;
+       security_acl_Type.tp_basicsize = pytalloc_BaseObject_size();
 
-       security_acl_Type.tp_base = Object_Type;
+       security_descriptor_Type.tp_base = BaseObject_Type;
+       security_descriptor_Type.tp_basicsize = pytalloc_BaseObject_size();
 
-       security_descriptor_Type.tp_base = Object_Type;
+       sec_desc_buf_Type.tp_base = BaseObject_Type;
+       sec_desc_buf_Type.tp_basicsize = pytalloc_BaseObject_size();
 
-       sec_desc_buf_Type.tp_base = Object_Type;
+       security_token_Type.tp_base = BaseObject_Type;
+       security_token_Type.tp_basicsize = pytalloc_BaseObject_size();
 
-       security_token_Type.tp_base = Object_Type;
+       security_unix_token_Type.tp_base = BaseObject_Type;
+       security_unix_token_Type.tp_basicsize = pytalloc_BaseObject_size();
 
-       security_unix_token_Type.tp_base = Object_Type;
+       LSAP_TOKEN_INFO_INTEGRITY_Type.tp_base = BaseObject_Type;
+       LSAP_TOKEN_INFO_INTEGRITY_Type.tp_basicsize = pytalloc_BaseObject_size();
 
-       generic_mapping_Type.tp_base = Object_Type;
+       generic_mapping_Type.tp_base = BaseObject_Type;
+       generic_mapping_Type.tp_basicsize = pytalloc_BaseObject_size();
 
-       standard_mapping_Type.tp_base = Object_Type;
+       standard_mapping_Type.tp_base = BaseObject_Type;
+       standard_mapping_Type.tp_basicsize = pytalloc_BaseObject_size();
 
        security_InterfaceType.tp_base = ClientConnection_Type;
 
        security_SyntaxType.tp_base = ndr_syntax_id_Type;
+       security_SyntaxType.tp_basicsize = pytalloc_BaseObject_size();
 
        if (PyType_Ready(&dom_sid_Type) < 0)
                return;
@@ -2780,6 +3563,8 @@ void initsecurity(void)
                return;
        if (PyType_Ready(&security_unix_token_Type) < 0)
                return;
+       if (PyType_Ready(&LSAP_TOKEN_INFO_INTEGRITY_Type) < 0)
+               return;
        if (PyType_Ready(&generic_mapping_Type) < 0)
                return;
        if (PyType_Ready(&standard_mapping_Type) < 0)
@@ -2815,6 +3600,9 @@ void initsecurity(void)
 #ifdef PY_UNIX_TOKEN_PATCH
        PY_UNIX_TOKEN_PATCH(&security_unix_token_Type);
 #endif
+#ifdef PY_LSAP_TOKEN_INFO_INTEGRITY_PATCH
+       PY_LSAP_TOKEN_INFO_INTEGRITY_PATCH(&LSAP_TOKEN_INFO_INTEGRITY_Type);
+#endif
 #ifdef PY_GENERIC_MAPPING_PATCH
        PY_GENERIC_MAPPING_PATCH(&generic_mapping_Type);
 #endif
@@ -2963,6 +3751,13 @@ void initsecurity(void)
        PyModule_AddObject(m, "NAME_NT_SERVICE", PyString_FromString("NT SERVICE"));
        PyModule_AddObject(m, "SID_NT_NT_SERVICE", PyString_FromString("S-1-5-80"));
        PyModule_AddObject(m, "SID_NT_TRUSTED_INSTALLER", PyString_FromString("S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464"));
+       PyModule_AddObject(m, "SID_AUTHENTICATION_AUTHORITY_ASSERTED_IDENTITY", PyString_FromString("S-1-18-1"));
+       PyModule_AddObject(m, "SID_SERVICE_ASSERTED_IDENTITY", PyString_FromString("S-1-18-2"));
+       PyModule_AddObject(m, "SID_NT_NFS_SUBSYSTEM", PyString_FromString("S-1-5-88"));
+       PyModule_AddObject(m, "SID_NT_NFS_USER", PyString_FromString("S-1-5-88-1"));
+       PyModule_AddObject(m, "SID_NT_NFS_GROUP", PyString_FromString("S-1-5-88-2"));
+       PyModule_AddObject(m, "SID_NT_NFS_MASK", PyString_FromString("S-1-5-88-3"));
+       PyModule_AddObject(m, "SID_NT_NFS_OTHERS", PyString_FromString("S-1-5-88-4"));
        PyModule_AddObject(m, "DOMAIN_RID_LOGON", ndr_PyLong_FromUnsignedLongLong(9));
        PyModule_AddObject(m, "DOMAIN_RID_ENTERPRISE_READONLY_DCS", ndr_PyLong_FromUnsignedLongLong(498));
        PyModule_AddObject(m, "DOMAIN_RID_ADMINISTRATOR", ndr_PyLong_FromUnsignedLongLong(500));
@@ -3175,6 +3970,8 @@ void initsecurity(void)
        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 *)&LSAP_TOKEN_INFO_INTEGRITY_Type);
+       PyModule_AddObject(m, "LSAP_TOKEN_INFO_INTEGRITY", (PyObject *)(void *)&LSAP_TOKEN_INFO_INTEGRITY_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);