LCOV - code coverage report
Current view: top level - bin/default/librpc/gen_ndr - py_xattr.c (source / functions) Hit Total Coverage
Test: coverage report for abartlet/fix-coverage dd10fb34 Lines: 266 2185 12.2 %
Date: 2021-09-23 10:06:22 Functions: 18 179 10.1 %

          Line data    Source code
       1             : 
       2             : /* Python wrapper functions auto-generated by pidl */
       3             : #define PY_SSIZE_T_CLEAN 1 /* We use Py_ssize_t for PyArg_ParseTupleAndKeywords */
       4             : #include <Python.h>
       5             : #include "python/py3compat.h"
       6             : #include "includes.h"
       7             : #include "python/modules.h"
       8             : #include <pytalloc.h>
       9             : #include "librpc/rpc/pyrpc.h"
      10             : #include "librpc/rpc/pyrpc_util.h"
      11             : #include "bin/default/librpc/gen_ndr/ndr_xattr.h"
      12             : 
      13             : 
      14             : /*
      15             :  * Suppress compiler warnings if the generated code does not call these
      16             :  * functions
      17             :  */
      18             : #ifndef _MAYBE_UNUSED_
      19             : #ifdef __has_attribute
      20             : #if __has_attribute(unused)
      21             : #define _MAYBE_UNUSED_ __attribute__ ((unused))
      22             : #else
      23             : #define _MAYBE_UNUSED_
      24             : #endif
      25             : #endif
      26             : #endif
      27             : /*
      28             :  * These functions are here to ensure they can be optimized out by
      29             :  * the compiler based on the constant input values
      30             :  */
      31             : 
      32         758 : static inline unsigned long long ndr_sizeof2uintmax(size_t var_size)
      33             : {
      34         758 :         switch (var_size) {
      35           0 :         case 8:
      36           0 :                 return UINT64_MAX;
      37           0 :         case 4:
      38           0 :                 return UINT32_MAX;
      39         758 :         case 2:
      40         758 :                 return UINT16_MAX;
      41           0 :         case 1:
      42           0 :                 return UINT8_MAX;
      43             :         }
      44             : 
      45           0 :         return 0;
      46             : }
      47             : 
      48             : static inline _MAYBE_UNUSED_ long long ndr_sizeof2intmax(size_t var_size)
      49             : {
      50             :         switch (var_size) {
      51             :         case 8:
      52             :                 return INT64_MAX;
      53             :         case 4:
      54             :                 return INT32_MAX;
      55             :         case 2:
      56             :                 return INT16_MAX;
      57             :         case 1:
      58             :                 return INT8_MAX;
      59             :         }
      60             : 
      61             :         return 0;
      62             : }
      63             : 
      64             : #include "librpc/gen_ndr/security.h"
      65             : static PyTypeObject xattr_DosInfoFFFFCompat_Type;
      66             : static PyTypeObject xattr_DosInfo1_Type;
      67             : static PyTypeObject xattr_DosInfo2Old_Type;
      68             : static PyTypeObject xattr_DosInfo3_Type;
      69             : static PyTypeObject xattr_DosInfo4_Type;
      70             : static PyTypeObject xattr_DosInfo_Type;
      71             : static PyTypeObject xattr_DosAttrib_Type;
      72             : static PyTypeObject xattr_DOSATTRIB_Type;
      73             : static PyTypeObject xattr_EA_Type;
      74             : static PyTypeObject xattr_DosEAs_Type;
      75             : static PyTypeObject tdb_xattrs_Type;
      76             : static PyTypeObject xattr_DosStream_Type;
      77             : static PyTypeObject xattr_DosStreams_Type;
      78             : static PyTypeObject security_descriptor_hash_v2_Type;
      79             : static PyTypeObject security_descriptor_hash_v3_Type;
      80             : static PyTypeObject security_descriptor_hash_v4_Type;
      81             : static PyTypeObject xattr_NTACL_Info_Type;
      82             : static PyTypeObject xattr_NTACL_Type;
      83             : static PyTypeObject xattr_sys_acl_hash_wrapper_Type;
      84             : 
      85             : static PyTypeObject *BaseObject_Type;
      86             : static PyTypeObject *security_descriptor_Type;
      87             : #include "librpc/ndr/py_xattr.c"
      88             : 
      89             : 
      90           0 : static PyObject *py_xattr_DosInfoFFFFCompat_get_attrib(PyObject *obj, void *closure)
      91             : {
      92           0 :         struct xattr_DosInfoFFFFCompat *object = (struct xattr_DosInfoFFFFCompat *)pytalloc_get_ptr(obj);
      93             :         PyObject *py_attrib;
      94           0 :         py_attrib = PyLong_FromUnsignedLongLong((uint32_t)object->attrib);
      95           0 :         return py_attrib;
      96             : }
      97             : 
      98           0 : static int py_xattr_DosInfoFFFFCompat_set_attrib(PyObject *py_obj, PyObject *value, void *closure)
      99             : {
     100           0 :         struct xattr_DosInfoFFFFCompat *object = (struct xattr_DosInfoFFFFCompat *)pytalloc_get_ptr(py_obj);
     101           0 :         if (value == NULL) {
     102           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->attrib");
     103           0 :                 return -1;
     104             :         }
     105             :         {
     106           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->attrib));
     107           0 :                 if (PyLong_Check(value)) {
     108             :                         unsigned long long test_var;
     109           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     110           0 :                         if (PyErr_Occurred() != NULL) {
     111           0 :                                 return -1;
     112             :                         }
     113           0 :                         if (test_var > uint_max) {
     114           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
     115             :                                   PyLong_Type.tp_name, uint_max, test_var);
     116           0 :                                 return -1;
     117             :                         }
     118           0 :                         object->attrib = test_var;
     119             :                 } else {
     120           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
     121             :                           PyLong_Type.tp_name);
     122           0 :                         return -1;
     123             :                 }
     124             :         }
     125           0 :         return 0;
     126             : }
     127             : 
     128             : static PyGetSetDef py_xattr_DosInfoFFFFCompat_getsetters[] = {
     129             :         {
     130             :                 .name = discard_const_p(char, "attrib"),
     131             :                 .get = py_xattr_DosInfoFFFFCompat_get_attrib,
     132             :                 .set = py_xattr_DosInfoFFFFCompat_set_attrib,
     133             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
     134             :         },
     135             :         { .name = NULL }
     136             : };
     137             : 
     138           0 : static PyObject *py_xattr_DosInfoFFFFCompat_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     139             : {
     140           0 :         return pytalloc_new(struct xattr_DosInfoFFFFCompat, type);
     141             : }
     142             : 
     143             : 
     144             : static PyTypeObject xattr_DosInfoFFFFCompat_Type = {
     145             :         PyVarObject_HEAD_INIT(NULL, 0)
     146             :         .tp_name = "xattr.DosInfoFFFFCompat",
     147             :         .tp_getset = py_xattr_DosInfoFFFFCompat_getsetters,
     148             :         .tp_methods = NULL,
     149             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
     150             :         .tp_new = py_xattr_DosInfoFFFFCompat_new,
     151             : };
     152             : 
     153             : 
     154           0 : static PyObject *py_xattr_DosInfo1_get_attrib(PyObject *obj, void *closure)
     155             : {
     156           0 :         struct xattr_DosInfo1 *object = (struct xattr_DosInfo1 *)pytalloc_get_ptr(obj);
     157             :         PyObject *py_attrib;
     158           0 :         py_attrib = PyLong_FromUnsignedLongLong((uint32_t)object->attrib);
     159           0 :         return py_attrib;
     160             : }
     161             : 
     162           0 : static int py_xattr_DosInfo1_set_attrib(PyObject *py_obj, PyObject *value, void *closure)
     163             : {
     164           0 :         struct xattr_DosInfo1 *object = (struct xattr_DosInfo1 *)pytalloc_get_ptr(py_obj);
     165           0 :         if (value == NULL) {
     166           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->attrib");
     167           0 :                 return -1;
     168             :         }
     169             :         {
     170           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->attrib));
     171           0 :                 if (PyLong_Check(value)) {
     172             :                         unsigned long long test_var;
     173           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     174           0 :                         if (PyErr_Occurred() != NULL) {
     175           0 :                                 return -1;
     176             :                         }
     177           0 :                         if (test_var > uint_max) {
     178           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
     179             :                                   PyLong_Type.tp_name, uint_max, test_var);
     180           0 :                                 return -1;
     181             :                         }
     182           0 :                         object->attrib = test_var;
     183             :                 } else {
     184           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
     185             :                           PyLong_Type.tp_name);
     186           0 :                         return -1;
     187             :                 }
     188             :         }
     189           0 :         return 0;
     190             : }
     191             : 
     192           0 : static PyObject *py_xattr_DosInfo1_get_ea_size(PyObject *obj, void *closure)
     193             : {
     194           0 :         struct xattr_DosInfo1 *object = (struct xattr_DosInfo1 *)pytalloc_get_ptr(obj);
     195             :         PyObject *py_ea_size;
     196           0 :         py_ea_size = PyLong_FromUnsignedLongLong((uint32_t)object->ea_size);
     197           0 :         return py_ea_size;
     198             : }
     199             : 
     200           0 : static int py_xattr_DosInfo1_set_ea_size(PyObject *py_obj, PyObject *value, void *closure)
     201             : {
     202           0 :         struct xattr_DosInfo1 *object = (struct xattr_DosInfo1 *)pytalloc_get_ptr(py_obj);
     203           0 :         if (value == NULL) {
     204           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->ea_size");
     205           0 :                 return -1;
     206             :         }
     207             :         {
     208           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->ea_size));
     209           0 :                 if (PyLong_Check(value)) {
     210             :                         unsigned long long test_var;
     211           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     212           0 :                         if (PyErr_Occurred() != NULL) {
     213           0 :                                 return -1;
     214             :                         }
     215           0 :                         if (test_var > uint_max) {
     216           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
     217             :                                   PyLong_Type.tp_name, uint_max, test_var);
     218           0 :                                 return -1;
     219             :                         }
     220           0 :                         object->ea_size = test_var;
     221             :                 } else {
     222           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
     223             :                           PyLong_Type.tp_name);
     224           0 :                         return -1;
     225             :                 }
     226             :         }
     227           0 :         return 0;
     228             : }
     229             : 
     230           0 : static PyObject *py_xattr_DosInfo1_get_size(PyObject *obj, void *closure)
     231             : {
     232           0 :         struct xattr_DosInfo1 *object = (struct xattr_DosInfo1 *)pytalloc_get_ptr(obj);
     233             :         PyObject *py_size;
     234           0 :         py_size = PyLong_FromUnsignedLongLong(object->size);
     235           0 :         return py_size;
     236             : }
     237             : 
     238           0 : static int py_xattr_DosInfo1_set_size(PyObject *py_obj, PyObject *value, void *closure)
     239             : {
     240           0 :         struct xattr_DosInfo1 *object = (struct xattr_DosInfo1 *)pytalloc_get_ptr(py_obj);
     241           0 :         if (value == NULL) {
     242           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->size");
     243           0 :                 return -1;
     244             :         }
     245             :         {
     246           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->size));
     247           0 :                 if (PyLong_Check(value)) {
     248             :                         unsigned long long test_var;
     249           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     250           0 :                         if (PyErr_Occurred() != NULL) {
     251           0 :                                 return -1;
     252             :                         }
     253           0 :                         if (test_var > uint_max) {
     254           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
     255             :                                   PyLong_Type.tp_name, uint_max, test_var);
     256           0 :                                 return -1;
     257             :                         }
     258           0 :                         object->size = test_var;
     259             :                 } else {
     260           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
     261             :                           PyLong_Type.tp_name);
     262           0 :                         return -1;
     263             :                 }
     264             :         }
     265           0 :         return 0;
     266             : }
     267             : 
     268           0 : static PyObject *py_xattr_DosInfo1_get_alloc_size(PyObject *obj, void *closure)
     269             : {
     270           0 :         struct xattr_DosInfo1 *object = (struct xattr_DosInfo1 *)pytalloc_get_ptr(obj);
     271             :         PyObject *py_alloc_size;
     272           0 :         py_alloc_size = PyLong_FromUnsignedLongLong(object->alloc_size);
     273           0 :         return py_alloc_size;
     274             : }
     275             : 
     276           0 : static int py_xattr_DosInfo1_set_alloc_size(PyObject *py_obj, PyObject *value, void *closure)
     277             : {
     278           0 :         struct xattr_DosInfo1 *object = (struct xattr_DosInfo1 *)pytalloc_get_ptr(py_obj);
     279           0 :         if (value == NULL) {
     280           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->alloc_size");
     281           0 :                 return -1;
     282             :         }
     283             :         {
     284           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->alloc_size));
     285           0 :                 if (PyLong_Check(value)) {
     286             :                         unsigned long long test_var;
     287           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     288           0 :                         if (PyErr_Occurred() != NULL) {
     289           0 :                                 return -1;
     290             :                         }
     291           0 :                         if (test_var > uint_max) {
     292           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
     293             :                                   PyLong_Type.tp_name, uint_max, test_var);
     294           0 :                                 return -1;
     295             :                         }
     296           0 :                         object->alloc_size = test_var;
     297             :                 } else {
     298           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
     299             :                           PyLong_Type.tp_name);
     300           0 :                         return -1;
     301             :                 }
     302             :         }
     303           0 :         return 0;
     304             : }
     305             : 
     306           0 : static PyObject *py_xattr_DosInfo1_get_create_time(PyObject *obj, void *closure)
     307             : {
     308           0 :         struct xattr_DosInfo1 *object = (struct xattr_DosInfo1 *)pytalloc_get_ptr(obj);
     309             :         PyObject *py_create_time;
     310           0 :         py_create_time = PyLong_FromUnsignedLongLong(object->create_time);
     311           0 :         return py_create_time;
     312             : }
     313             : 
     314           0 : static int py_xattr_DosInfo1_set_create_time(PyObject *py_obj, PyObject *value, void *closure)
     315             : {
     316           0 :         struct xattr_DosInfo1 *object = (struct xattr_DosInfo1 *)pytalloc_get_ptr(py_obj);
     317           0 :         if (value == NULL) {
     318           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->create_time");
     319           0 :                 return -1;
     320             :         }
     321             :         {
     322           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->create_time));
     323           0 :                 if (PyLong_Check(value)) {
     324             :                         unsigned long long test_var;
     325           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     326           0 :                         if (PyErr_Occurred() != NULL) {
     327           0 :                                 return -1;
     328             :                         }
     329           0 :                         if (test_var > uint_max) {
     330           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
     331             :                                   PyLong_Type.tp_name, uint_max, test_var);
     332           0 :                                 return -1;
     333             :                         }
     334           0 :                         object->create_time = test_var;
     335             :                 } else {
     336           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
     337             :                           PyLong_Type.tp_name);
     338           0 :                         return -1;
     339             :                 }
     340             :         }
     341           0 :         return 0;
     342             : }
     343             : 
     344           0 : static PyObject *py_xattr_DosInfo1_get_change_time(PyObject *obj, void *closure)
     345             : {
     346           0 :         struct xattr_DosInfo1 *object = (struct xattr_DosInfo1 *)pytalloc_get_ptr(obj);
     347             :         PyObject *py_change_time;
     348           0 :         py_change_time = PyLong_FromUnsignedLongLong(object->change_time);
     349           0 :         return py_change_time;
     350             : }
     351             : 
     352           0 : static int py_xattr_DosInfo1_set_change_time(PyObject *py_obj, PyObject *value, void *closure)
     353             : {
     354           0 :         struct xattr_DosInfo1 *object = (struct xattr_DosInfo1 *)pytalloc_get_ptr(py_obj);
     355           0 :         if (value == NULL) {
     356           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->change_time");
     357           0 :                 return -1;
     358             :         }
     359             :         {
     360           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->change_time));
     361           0 :                 if (PyLong_Check(value)) {
     362             :                         unsigned long long test_var;
     363           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     364           0 :                         if (PyErr_Occurred() != NULL) {
     365           0 :                                 return -1;
     366             :                         }
     367           0 :                         if (test_var > uint_max) {
     368           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
     369             :                                   PyLong_Type.tp_name, uint_max, test_var);
     370           0 :                                 return -1;
     371             :                         }
     372           0 :                         object->change_time = test_var;
     373             :                 } else {
     374           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
     375             :                           PyLong_Type.tp_name);
     376           0 :                         return -1;
     377             :                 }
     378             :         }
     379           0 :         return 0;
     380             : }
     381             : 
     382             : static PyGetSetDef py_xattr_DosInfo1_getsetters[] = {
     383             :         {
     384             :                 .name = discard_const_p(char, "attrib"),
     385             :                 .get = py_xattr_DosInfo1_get_attrib,
     386             :                 .set = py_xattr_DosInfo1_set_attrib,
     387             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
     388             :         },
     389             :         {
     390             :                 .name = discard_const_p(char, "ea_size"),
     391             :                 .get = py_xattr_DosInfo1_get_ea_size,
     392             :                 .set = py_xattr_DosInfo1_set_ea_size,
     393             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
     394             :         },
     395             :         {
     396             :                 .name = discard_const_p(char, "size"),
     397             :                 .get = py_xattr_DosInfo1_get_size,
     398             :                 .set = py_xattr_DosInfo1_set_size,
     399             :                 .doc = discard_const_p(char, "PIDL-generated element of base type udlong")
     400             :         },
     401             :         {
     402             :                 .name = discard_const_p(char, "alloc_size"),
     403             :                 .get = py_xattr_DosInfo1_get_alloc_size,
     404             :                 .set = py_xattr_DosInfo1_set_alloc_size,
     405             :                 .doc = discard_const_p(char, "PIDL-generated element of base type udlong")
     406             :         },
     407             :         {
     408             :                 .name = discard_const_p(char, "create_time"),
     409             :                 .get = py_xattr_DosInfo1_get_create_time,
     410             :                 .set = py_xattr_DosInfo1_set_create_time,
     411             :                 .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
     412             :         },
     413             :         {
     414             :                 .name = discard_const_p(char, "change_time"),
     415             :                 .get = py_xattr_DosInfo1_get_change_time,
     416             :                 .set = py_xattr_DosInfo1_set_change_time,
     417             :                 .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
     418             :         },
     419             :         { .name = NULL }
     420             : };
     421             : 
     422           0 : static PyObject *py_xattr_DosInfo1_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     423             : {
     424           0 :         return pytalloc_new(struct xattr_DosInfo1, type);
     425             : }
     426             : 
     427             : 
     428             : static PyTypeObject xattr_DosInfo1_Type = {
     429             :         PyVarObject_HEAD_INIT(NULL, 0)
     430             :         .tp_name = "xattr.DosInfo1",
     431             :         .tp_getset = py_xattr_DosInfo1_getsetters,
     432             :         .tp_methods = NULL,
     433             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
     434             :         .tp_new = py_xattr_DosInfo1_new,
     435             : };
     436             : 
     437             : 
     438           0 : static PyObject *py_xattr_DosInfo2Old_get_flags(PyObject *obj, void *closure)
     439             : {
     440           0 :         struct xattr_DosInfo2Old *object = (struct xattr_DosInfo2Old *)pytalloc_get_ptr(obj);
     441             :         PyObject *py_flags;
     442           0 :         py_flags = PyLong_FromUnsignedLongLong((uint32_t)object->flags);
     443           0 :         return py_flags;
     444             : }
     445             : 
     446           0 : static int py_xattr_DosInfo2Old_set_flags(PyObject *py_obj, PyObject *value, void *closure)
     447             : {
     448           0 :         struct xattr_DosInfo2Old *object = (struct xattr_DosInfo2Old *)pytalloc_get_ptr(py_obj);
     449           0 :         if (value == NULL) {
     450           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->flags");
     451           0 :                 return -1;
     452             :         }
     453             :         {
     454           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->flags));
     455           0 :                 if (PyLong_Check(value)) {
     456             :                         unsigned long long test_var;
     457           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     458           0 :                         if (PyErr_Occurred() != NULL) {
     459           0 :                                 return -1;
     460             :                         }
     461           0 :                         if (test_var > uint_max) {
     462           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
     463             :                                   PyLong_Type.tp_name, uint_max, test_var);
     464           0 :                                 return -1;
     465             :                         }
     466           0 :                         object->flags = test_var;
     467             :                 } else {
     468           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
     469             :                           PyLong_Type.tp_name);
     470           0 :                         return -1;
     471             :                 }
     472             :         }
     473           0 :         return 0;
     474             : }
     475             : 
     476           0 : static PyObject *py_xattr_DosInfo2Old_get_attrib(PyObject *obj, void *closure)
     477             : {
     478           0 :         struct xattr_DosInfo2Old *object = (struct xattr_DosInfo2Old *)pytalloc_get_ptr(obj);
     479             :         PyObject *py_attrib;
     480           0 :         py_attrib = PyLong_FromUnsignedLongLong((uint32_t)object->attrib);
     481           0 :         return py_attrib;
     482             : }
     483             : 
     484           0 : static int py_xattr_DosInfo2Old_set_attrib(PyObject *py_obj, PyObject *value, void *closure)
     485             : {
     486           0 :         struct xattr_DosInfo2Old *object = (struct xattr_DosInfo2Old *)pytalloc_get_ptr(py_obj);
     487           0 :         if (value == NULL) {
     488           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->attrib");
     489           0 :                 return -1;
     490             :         }
     491             :         {
     492           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->attrib));
     493           0 :                 if (PyLong_Check(value)) {
     494             :                         unsigned long long test_var;
     495           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     496           0 :                         if (PyErr_Occurred() != NULL) {
     497           0 :                                 return -1;
     498             :                         }
     499           0 :                         if (test_var > uint_max) {
     500           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
     501             :                                   PyLong_Type.tp_name, uint_max, test_var);
     502           0 :                                 return -1;
     503             :                         }
     504           0 :                         object->attrib = test_var;
     505             :                 } else {
     506           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
     507             :                           PyLong_Type.tp_name);
     508           0 :                         return -1;
     509             :                 }
     510             :         }
     511           0 :         return 0;
     512             : }
     513             : 
     514           0 : static PyObject *py_xattr_DosInfo2Old_get_ea_size(PyObject *obj, void *closure)
     515             : {
     516           0 :         struct xattr_DosInfo2Old *object = (struct xattr_DosInfo2Old *)pytalloc_get_ptr(obj);
     517             :         PyObject *py_ea_size;
     518           0 :         py_ea_size = PyLong_FromUnsignedLongLong((uint32_t)object->ea_size);
     519           0 :         return py_ea_size;
     520             : }
     521             : 
     522           0 : static int py_xattr_DosInfo2Old_set_ea_size(PyObject *py_obj, PyObject *value, void *closure)
     523             : {
     524           0 :         struct xattr_DosInfo2Old *object = (struct xattr_DosInfo2Old *)pytalloc_get_ptr(py_obj);
     525           0 :         if (value == NULL) {
     526           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->ea_size");
     527           0 :                 return -1;
     528             :         }
     529             :         {
     530           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->ea_size));
     531           0 :                 if (PyLong_Check(value)) {
     532             :                         unsigned long long test_var;
     533           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     534           0 :                         if (PyErr_Occurred() != NULL) {
     535           0 :                                 return -1;
     536             :                         }
     537           0 :                         if (test_var > uint_max) {
     538           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
     539             :                                   PyLong_Type.tp_name, uint_max, test_var);
     540           0 :                                 return -1;
     541             :                         }
     542           0 :                         object->ea_size = test_var;
     543             :                 } else {
     544           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
     545             :                           PyLong_Type.tp_name);
     546           0 :                         return -1;
     547             :                 }
     548             :         }
     549           0 :         return 0;
     550             : }
     551             : 
     552           0 : static PyObject *py_xattr_DosInfo2Old_get_size(PyObject *obj, void *closure)
     553             : {
     554           0 :         struct xattr_DosInfo2Old *object = (struct xattr_DosInfo2Old *)pytalloc_get_ptr(obj);
     555             :         PyObject *py_size;
     556           0 :         py_size = PyLong_FromUnsignedLongLong(object->size);
     557           0 :         return py_size;
     558             : }
     559             : 
     560           0 : static int py_xattr_DosInfo2Old_set_size(PyObject *py_obj, PyObject *value, void *closure)
     561             : {
     562           0 :         struct xattr_DosInfo2Old *object = (struct xattr_DosInfo2Old *)pytalloc_get_ptr(py_obj);
     563           0 :         if (value == NULL) {
     564           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->size");
     565           0 :                 return -1;
     566             :         }
     567             :         {
     568           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->size));
     569           0 :                 if (PyLong_Check(value)) {
     570             :                         unsigned long long test_var;
     571           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     572           0 :                         if (PyErr_Occurred() != NULL) {
     573           0 :                                 return -1;
     574             :                         }
     575           0 :                         if (test_var > uint_max) {
     576           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
     577             :                                   PyLong_Type.tp_name, uint_max, test_var);
     578           0 :                                 return -1;
     579             :                         }
     580           0 :                         object->size = test_var;
     581             :                 } else {
     582           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
     583             :                           PyLong_Type.tp_name);
     584           0 :                         return -1;
     585             :                 }
     586             :         }
     587           0 :         return 0;
     588             : }
     589             : 
     590           0 : static PyObject *py_xattr_DosInfo2Old_get_alloc_size(PyObject *obj, void *closure)
     591             : {
     592           0 :         struct xattr_DosInfo2Old *object = (struct xattr_DosInfo2Old *)pytalloc_get_ptr(obj);
     593             :         PyObject *py_alloc_size;
     594           0 :         py_alloc_size = PyLong_FromUnsignedLongLong(object->alloc_size);
     595           0 :         return py_alloc_size;
     596             : }
     597             : 
     598           0 : static int py_xattr_DosInfo2Old_set_alloc_size(PyObject *py_obj, PyObject *value, void *closure)
     599             : {
     600           0 :         struct xattr_DosInfo2Old *object = (struct xattr_DosInfo2Old *)pytalloc_get_ptr(py_obj);
     601           0 :         if (value == NULL) {
     602           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->alloc_size");
     603           0 :                 return -1;
     604             :         }
     605             :         {
     606           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->alloc_size));
     607           0 :                 if (PyLong_Check(value)) {
     608             :                         unsigned long long test_var;
     609           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     610           0 :                         if (PyErr_Occurred() != NULL) {
     611           0 :                                 return -1;
     612             :                         }
     613           0 :                         if (test_var > uint_max) {
     614           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
     615             :                                   PyLong_Type.tp_name, uint_max, test_var);
     616           0 :                                 return -1;
     617             :                         }
     618           0 :                         object->alloc_size = test_var;
     619             :                 } else {
     620           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
     621             :                           PyLong_Type.tp_name);
     622           0 :                         return -1;
     623             :                 }
     624             :         }
     625           0 :         return 0;
     626             : }
     627             : 
     628           0 : static PyObject *py_xattr_DosInfo2Old_get_create_time(PyObject *obj, void *closure)
     629             : {
     630           0 :         struct xattr_DosInfo2Old *object = (struct xattr_DosInfo2Old *)pytalloc_get_ptr(obj);
     631             :         PyObject *py_create_time;
     632           0 :         py_create_time = PyLong_FromUnsignedLongLong(object->create_time);
     633           0 :         return py_create_time;
     634             : }
     635             : 
     636           0 : static int py_xattr_DosInfo2Old_set_create_time(PyObject *py_obj, PyObject *value, void *closure)
     637             : {
     638           0 :         struct xattr_DosInfo2Old *object = (struct xattr_DosInfo2Old *)pytalloc_get_ptr(py_obj);
     639           0 :         if (value == NULL) {
     640           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->create_time");
     641           0 :                 return -1;
     642             :         }
     643             :         {
     644           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->create_time));
     645           0 :                 if (PyLong_Check(value)) {
     646             :                         unsigned long long test_var;
     647           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     648           0 :                         if (PyErr_Occurred() != NULL) {
     649           0 :                                 return -1;
     650             :                         }
     651           0 :                         if (test_var > uint_max) {
     652           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
     653             :                                   PyLong_Type.tp_name, uint_max, test_var);
     654           0 :                                 return -1;
     655             :                         }
     656           0 :                         object->create_time = test_var;
     657             :                 } else {
     658           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
     659             :                           PyLong_Type.tp_name);
     660           0 :                         return -1;
     661             :                 }
     662             :         }
     663           0 :         return 0;
     664             : }
     665             : 
     666           0 : static PyObject *py_xattr_DosInfo2Old_get_change_time(PyObject *obj, void *closure)
     667             : {
     668           0 :         struct xattr_DosInfo2Old *object = (struct xattr_DosInfo2Old *)pytalloc_get_ptr(obj);
     669             :         PyObject *py_change_time;
     670           0 :         py_change_time = PyLong_FromUnsignedLongLong(object->change_time);
     671           0 :         return py_change_time;
     672             : }
     673             : 
     674           0 : static int py_xattr_DosInfo2Old_set_change_time(PyObject *py_obj, PyObject *value, void *closure)
     675             : {
     676           0 :         struct xattr_DosInfo2Old *object = (struct xattr_DosInfo2Old *)pytalloc_get_ptr(py_obj);
     677           0 :         if (value == NULL) {
     678           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->change_time");
     679           0 :                 return -1;
     680             :         }
     681             :         {
     682           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->change_time));
     683           0 :                 if (PyLong_Check(value)) {
     684             :                         unsigned long long test_var;
     685           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     686           0 :                         if (PyErr_Occurred() != NULL) {
     687           0 :                                 return -1;
     688             :                         }
     689           0 :                         if (test_var > uint_max) {
     690           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
     691             :                                   PyLong_Type.tp_name, uint_max, test_var);
     692           0 :                                 return -1;
     693             :                         }
     694           0 :                         object->change_time = test_var;
     695             :                 } else {
     696           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
     697             :                           PyLong_Type.tp_name);
     698           0 :                         return -1;
     699             :                 }
     700             :         }
     701           0 :         return 0;
     702             : }
     703             : 
     704           0 : static PyObject *py_xattr_DosInfo2Old_get_write_time(PyObject *obj, void *closure)
     705             : {
     706           0 :         struct xattr_DosInfo2Old *object = (struct xattr_DosInfo2Old *)pytalloc_get_ptr(obj);
     707             :         PyObject *py_write_time;
     708           0 :         py_write_time = PyLong_FromUnsignedLongLong(object->write_time);
     709           0 :         return py_write_time;
     710             : }
     711             : 
     712           0 : static int py_xattr_DosInfo2Old_set_write_time(PyObject *py_obj, PyObject *value, void *closure)
     713             : {
     714           0 :         struct xattr_DosInfo2Old *object = (struct xattr_DosInfo2Old *)pytalloc_get_ptr(py_obj);
     715           0 :         if (value == NULL) {
     716           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->write_time");
     717           0 :                 return -1;
     718             :         }
     719             :         {
     720           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->write_time));
     721           0 :                 if (PyLong_Check(value)) {
     722             :                         unsigned long long test_var;
     723           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     724           0 :                         if (PyErr_Occurred() != NULL) {
     725           0 :                                 return -1;
     726             :                         }
     727           0 :                         if (test_var > uint_max) {
     728           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
     729             :                                   PyLong_Type.tp_name, uint_max, test_var);
     730           0 :                                 return -1;
     731             :                         }
     732           0 :                         object->write_time = test_var;
     733             :                 } else {
     734           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
     735             :                           PyLong_Type.tp_name);
     736           0 :                         return -1;
     737             :                 }
     738             :         }
     739           0 :         return 0;
     740             : }
     741             : 
     742           0 : static PyObject *py_xattr_DosInfo2Old_get_name(PyObject *obj, void *closure)
     743             : {
     744           0 :         struct xattr_DosInfo2Old *object = (struct xattr_DosInfo2Old *)pytalloc_get_ptr(obj);
     745             :         PyObject *py_name;
     746           0 :         py_name = PyString_FromStringOrNULL(object->name);
     747           0 :         return py_name;
     748             : }
     749             : 
     750           0 : static int py_xattr_DosInfo2Old_set_name(PyObject *py_obj, PyObject *value, void *closure)
     751             : {
     752           0 :         struct xattr_DosInfo2Old *object = (struct xattr_DosInfo2Old *)pytalloc_get_ptr(py_obj);
     753           0 :         if (value == NULL) {
     754           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->name");
     755           0 :                 return -1;
     756             :         }
     757             :         {
     758             :                 const char *test_str;
     759             :                 const char *talloc_str;
     760           0 :                 PyObject *unicode = NULL;
     761           0 :                 if (PyUnicode_Check(value)) {
     762           0 :                         unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
     763           0 :                         if (unicode == NULL) {
     764           0 :                                 PyErr_NoMemory();
     765           0 :                                 return -1;
     766             :                         }
     767           0 :                         test_str = PyBytes_AS_STRING(unicode);
     768           0 :                 } else if (PyBytes_Check(value)) {
     769           0 :                         test_str = PyBytes_AS_STRING(value);
     770             :                 } else {
     771           0 :                         PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
     772           0 :                         return -1;
     773             :                 }
     774           0 :                 talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
     775           0 :                 if (unicode != NULL) {
     776           0 :                         Py_DECREF(unicode);
     777             :                 }
     778           0 :                 if (talloc_str == NULL) {
     779           0 :                         PyErr_NoMemory();
     780           0 :                         return -1;
     781             :                 }
     782           0 :                 object->name = talloc_str;
     783             :         }
     784           0 :         return 0;
     785             : }
     786             : 
     787             : static PyGetSetDef py_xattr_DosInfo2Old_getsetters[] = {
     788             :         {
     789             :                 .name = discard_const_p(char, "flags"),
     790             :                 .get = py_xattr_DosInfo2Old_get_flags,
     791             :                 .set = py_xattr_DosInfo2Old_set_flags,
     792             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
     793             :         },
     794             :         {
     795             :                 .name = discard_const_p(char, "attrib"),
     796             :                 .get = py_xattr_DosInfo2Old_get_attrib,
     797             :                 .set = py_xattr_DosInfo2Old_set_attrib,
     798             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
     799             :         },
     800             :         {
     801             :                 .name = discard_const_p(char, "ea_size"),
     802             :                 .get = py_xattr_DosInfo2Old_get_ea_size,
     803             :                 .set = py_xattr_DosInfo2Old_set_ea_size,
     804             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
     805             :         },
     806             :         {
     807             :                 .name = discard_const_p(char, "size"),
     808             :                 .get = py_xattr_DosInfo2Old_get_size,
     809             :                 .set = py_xattr_DosInfo2Old_set_size,
     810             :                 .doc = discard_const_p(char, "PIDL-generated element of base type udlong")
     811             :         },
     812             :         {
     813             :                 .name = discard_const_p(char, "alloc_size"),
     814             :                 .get = py_xattr_DosInfo2Old_get_alloc_size,
     815             :                 .set = py_xattr_DosInfo2Old_set_alloc_size,
     816             :                 .doc = discard_const_p(char, "PIDL-generated element of base type udlong")
     817             :         },
     818             :         {
     819             :                 .name = discard_const_p(char, "create_time"),
     820             :                 .get = py_xattr_DosInfo2Old_get_create_time,
     821             :                 .set = py_xattr_DosInfo2Old_set_create_time,
     822             :                 .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
     823             :         },
     824             :         {
     825             :                 .name = discard_const_p(char, "change_time"),
     826             :                 .get = py_xattr_DosInfo2Old_get_change_time,
     827             :                 .set = py_xattr_DosInfo2Old_set_change_time,
     828             :                 .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
     829             :         },
     830             :         {
     831             :                 .name = discard_const_p(char, "write_time"),
     832             :                 .get = py_xattr_DosInfo2Old_get_write_time,
     833             :                 .set = py_xattr_DosInfo2Old_set_write_time,
     834             :                 .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
     835             :         },
     836             :         {
     837             :                 .name = discard_const_p(char, "name"),
     838             :                 .get = py_xattr_DosInfo2Old_get_name,
     839             :                 .set = py_xattr_DosInfo2Old_set_name,
     840             :                 .doc = discard_const_p(char, "PIDL-generated element of base type string")
     841             :         },
     842             :         { .name = NULL }
     843             : };
     844             : 
     845           0 : static PyObject *py_xattr_DosInfo2Old_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     846             : {
     847           0 :         return pytalloc_new(struct xattr_DosInfo2Old, type);
     848             : }
     849             : 
     850             : 
     851             : static PyTypeObject xattr_DosInfo2Old_Type = {
     852             :         PyVarObject_HEAD_INIT(NULL, 0)
     853             :         .tp_name = "xattr.DosInfo2Old",
     854             :         .tp_getset = py_xattr_DosInfo2Old_getsetters,
     855             :         .tp_methods = NULL,
     856             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
     857             :         .tp_new = py_xattr_DosInfo2Old_new,
     858             : };
     859             : 
     860             : 
     861           0 : static PyObject *py_xattr_DosInfo3_get_valid_flags(PyObject *obj, void *closure)
     862             : {
     863           0 :         struct xattr_DosInfo3 *object = (struct xattr_DosInfo3 *)pytalloc_get_ptr(obj);
     864             :         PyObject *py_valid_flags;
     865           0 :         py_valid_flags = PyLong_FromUnsignedLongLong((uint32_t)object->valid_flags);
     866           0 :         return py_valid_flags;
     867             : }
     868             : 
     869           0 : static int py_xattr_DosInfo3_set_valid_flags(PyObject *py_obj, PyObject *value, void *closure)
     870             : {
     871           0 :         struct xattr_DosInfo3 *object = (struct xattr_DosInfo3 *)pytalloc_get_ptr(py_obj);
     872           0 :         if (value == NULL) {
     873           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->valid_flags");
     874           0 :                 return -1;
     875             :         }
     876             :         {
     877           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->valid_flags));
     878           0 :                 if (PyLong_Check(value)) {
     879             :                         unsigned long long test_var;
     880           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     881           0 :                         if (PyErr_Occurred() != NULL) {
     882           0 :                                 return -1;
     883             :                         }
     884           0 :                         if (test_var > uint_max) {
     885           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
     886             :                                   PyLong_Type.tp_name, uint_max, test_var);
     887           0 :                                 return -1;
     888             :                         }
     889           0 :                         object->valid_flags = test_var;
     890             :                 } else {
     891           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
     892             :                           PyLong_Type.tp_name);
     893           0 :                         return -1;
     894             :                 }
     895             :         }
     896           0 :         return 0;
     897             : }
     898             : 
     899           0 : static PyObject *py_xattr_DosInfo3_get_attrib(PyObject *obj, void *closure)
     900             : {
     901           0 :         struct xattr_DosInfo3 *object = (struct xattr_DosInfo3 *)pytalloc_get_ptr(obj);
     902             :         PyObject *py_attrib;
     903           0 :         py_attrib = PyLong_FromUnsignedLongLong((uint32_t)object->attrib);
     904           0 :         return py_attrib;
     905             : }
     906             : 
     907           0 : static int py_xattr_DosInfo3_set_attrib(PyObject *py_obj, PyObject *value, void *closure)
     908             : {
     909           0 :         struct xattr_DosInfo3 *object = (struct xattr_DosInfo3 *)pytalloc_get_ptr(py_obj);
     910           0 :         if (value == NULL) {
     911           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->attrib");
     912           0 :                 return -1;
     913             :         }
     914             :         {
     915           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->attrib));
     916           0 :                 if (PyLong_Check(value)) {
     917             :                         unsigned long long test_var;
     918           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     919           0 :                         if (PyErr_Occurred() != NULL) {
     920           0 :                                 return -1;
     921             :                         }
     922           0 :                         if (test_var > uint_max) {
     923           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
     924             :                                   PyLong_Type.tp_name, uint_max, test_var);
     925           0 :                                 return -1;
     926             :                         }
     927           0 :                         object->attrib = test_var;
     928             :                 } else {
     929           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
     930             :                           PyLong_Type.tp_name);
     931           0 :                         return -1;
     932             :                 }
     933             :         }
     934           0 :         return 0;
     935             : }
     936             : 
     937           0 : static PyObject *py_xattr_DosInfo3_get_ea_size(PyObject *obj, void *closure)
     938             : {
     939           0 :         struct xattr_DosInfo3 *object = (struct xattr_DosInfo3 *)pytalloc_get_ptr(obj);
     940             :         PyObject *py_ea_size;
     941           0 :         py_ea_size = PyLong_FromUnsignedLongLong((uint32_t)object->ea_size);
     942           0 :         return py_ea_size;
     943             : }
     944             : 
     945           0 : static int py_xattr_DosInfo3_set_ea_size(PyObject *py_obj, PyObject *value, void *closure)
     946             : {
     947           0 :         struct xattr_DosInfo3 *object = (struct xattr_DosInfo3 *)pytalloc_get_ptr(py_obj);
     948           0 :         if (value == NULL) {
     949           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->ea_size");
     950           0 :                 return -1;
     951             :         }
     952             :         {
     953           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->ea_size));
     954           0 :                 if (PyLong_Check(value)) {
     955             :                         unsigned long long test_var;
     956           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     957           0 :                         if (PyErr_Occurred() != NULL) {
     958           0 :                                 return -1;
     959             :                         }
     960           0 :                         if (test_var > uint_max) {
     961           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
     962             :                                   PyLong_Type.tp_name, uint_max, test_var);
     963           0 :                                 return -1;
     964             :                         }
     965           0 :                         object->ea_size = test_var;
     966             :                 } else {
     967           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
     968             :                           PyLong_Type.tp_name);
     969           0 :                         return -1;
     970             :                 }
     971             :         }
     972           0 :         return 0;
     973             : }
     974             : 
     975           0 : static PyObject *py_xattr_DosInfo3_get_size(PyObject *obj, void *closure)
     976             : {
     977           0 :         struct xattr_DosInfo3 *object = (struct xattr_DosInfo3 *)pytalloc_get_ptr(obj);
     978             :         PyObject *py_size;
     979           0 :         py_size = PyLong_FromUnsignedLongLong(object->size);
     980           0 :         return py_size;
     981             : }
     982             : 
     983           0 : static int py_xattr_DosInfo3_set_size(PyObject *py_obj, PyObject *value, void *closure)
     984             : {
     985           0 :         struct xattr_DosInfo3 *object = (struct xattr_DosInfo3 *)pytalloc_get_ptr(py_obj);
     986           0 :         if (value == NULL) {
     987           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->size");
     988           0 :                 return -1;
     989             :         }
     990             :         {
     991           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->size));
     992           0 :                 if (PyLong_Check(value)) {
     993             :                         unsigned long long test_var;
     994           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     995           0 :                         if (PyErr_Occurred() != NULL) {
     996           0 :                                 return -1;
     997             :                         }
     998           0 :                         if (test_var > uint_max) {
     999           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    1000             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1001           0 :                                 return -1;
    1002             :                         }
    1003           0 :                         object->size = test_var;
    1004             :                 } else {
    1005           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    1006             :                           PyLong_Type.tp_name);
    1007           0 :                         return -1;
    1008             :                 }
    1009             :         }
    1010           0 :         return 0;
    1011             : }
    1012             : 
    1013           0 : static PyObject *py_xattr_DosInfo3_get_alloc_size(PyObject *obj, void *closure)
    1014             : {
    1015           0 :         struct xattr_DosInfo3 *object = (struct xattr_DosInfo3 *)pytalloc_get_ptr(obj);
    1016             :         PyObject *py_alloc_size;
    1017           0 :         py_alloc_size = PyLong_FromUnsignedLongLong(object->alloc_size);
    1018           0 :         return py_alloc_size;
    1019             : }
    1020             : 
    1021           0 : static int py_xattr_DosInfo3_set_alloc_size(PyObject *py_obj, PyObject *value, void *closure)
    1022             : {
    1023           0 :         struct xattr_DosInfo3 *object = (struct xattr_DosInfo3 *)pytalloc_get_ptr(py_obj);
    1024           0 :         if (value == NULL) {
    1025           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->alloc_size");
    1026           0 :                 return -1;
    1027             :         }
    1028             :         {
    1029           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->alloc_size));
    1030           0 :                 if (PyLong_Check(value)) {
    1031             :                         unsigned long long test_var;
    1032           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1033           0 :                         if (PyErr_Occurred() != NULL) {
    1034           0 :                                 return -1;
    1035             :                         }
    1036           0 :                         if (test_var > uint_max) {
    1037           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    1038             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1039           0 :                                 return -1;
    1040             :                         }
    1041           0 :                         object->alloc_size = test_var;
    1042             :                 } else {
    1043           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    1044             :                           PyLong_Type.tp_name);
    1045           0 :                         return -1;
    1046             :                 }
    1047             :         }
    1048           0 :         return 0;
    1049             : }
    1050             : 
    1051           0 : static PyObject *py_xattr_DosInfo3_get_create_time(PyObject *obj, void *closure)
    1052             : {
    1053           0 :         struct xattr_DosInfo3 *object = (struct xattr_DosInfo3 *)pytalloc_get_ptr(obj);
    1054             :         PyObject *py_create_time;
    1055           0 :         py_create_time = PyLong_FromUnsignedLongLong(object->create_time);
    1056           0 :         return py_create_time;
    1057             : }
    1058             : 
    1059           0 : static int py_xattr_DosInfo3_set_create_time(PyObject *py_obj, PyObject *value, void *closure)
    1060             : {
    1061           0 :         struct xattr_DosInfo3 *object = (struct xattr_DosInfo3 *)pytalloc_get_ptr(py_obj);
    1062           0 :         if (value == NULL) {
    1063           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->create_time");
    1064           0 :                 return -1;
    1065             :         }
    1066             :         {
    1067           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->create_time));
    1068           0 :                 if (PyLong_Check(value)) {
    1069             :                         unsigned long long test_var;
    1070           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1071           0 :                         if (PyErr_Occurred() != NULL) {
    1072           0 :                                 return -1;
    1073             :                         }
    1074           0 :                         if (test_var > uint_max) {
    1075           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    1076             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1077           0 :                                 return -1;
    1078             :                         }
    1079           0 :                         object->create_time = test_var;
    1080             :                 } else {
    1081           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    1082             :                           PyLong_Type.tp_name);
    1083           0 :                         return -1;
    1084             :                 }
    1085             :         }
    1086           0 :         return 0;
    1087             : }
    1088             : 
    1089           0 : static PyObject *py_xattr_DosInfo3_get_change_time(PyObject *obj, void *closure)
    1090             : {
    1091           0 :         struct xattr_DosInfo3 *object = (struct xattr_DosInfo3 *)pytalloc_get_ptr(obj);
    1092             :         PyObject *py_change_time;
    1093           0 :         py_change_time = PyLong_FromUnsignedLongLong(object->change_time);
    1094           0 :         return py_change_time;
    1095             : }
    1096             : 
    1097           0 : static int py_xattr_DosInfo3_set_change_time(PyObject *py_obj, PyObject *value, void *closure)
    1098             : {
    1099           0 :         struct xattr_DosInfo3 *object = (struct xattr_DosInfo3 *)pytalloc_get_ptr(py_obj);
    1100           0 :         if (value == NULL) {
    1101           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->change_time");
    1102           0 :                 return -1;
    1103             :         }
    1104             :         {
    1105           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->change_time));
    1106           0 :                 if (PyLong_Check(value)) {
    1107             :                         unsigned long long test_var;
    1108           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1109           0 :                         if (PyErr_Occurred() != NULL) {
    1110           0 :                                 return -1;
    1111             :                         }
    1112           0 :                         if (test_var > uint_max) {
    1113           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    1114             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1115           0 :                                 return -1;
    1116             :                         }
    1117           0 :                         object->change_time = test_var;
    1118             :                 } else {
    1119           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    1120             :                           PyLong_Type.tp_name);
    1121           0 :                         return -1;
    1122             :                 }
    1123             :         }
    1124           0 :         return 0;
    1125             : }
    1126             : 
    1127             : static PyGetSetDef py_xattr_DosInfo3_getsetters[] = {
    1128             :         {
    1129             :                 .name = discard_const_p(char, "valid_flags"),
    1130             :                 .get = py_xattr_DosInfo3_get_valid_flags,
    1131             :                 .set = py_xattr_DosInfo3_set_valid_flags,
    1132             :                 .doc = discard_const_p(char, "PIDL-generated element of base type xattr_DosInfoValidFlags")
    1133             :         },
    1134             :         {
    1135             :                 .name = discard_const_p(char, "attrib"),
    1136             :                 .get = py_xattr_DosInfo3_get_attrib,
    1137             :                 .set = py_xattr_DosInfo3_set_attrib,
    1138             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    1139             :         },
    1140             :         {
    1141             :                 .name = discard_const_p(char, "ea_size"),
    1142             :                 .get = py_xattr_DosInfo3_get_ea_size,
    1143             :                 .set = py_xattr_DosInfo3_set_ea_size,
    1144             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    1145             :         },
    1146             :         {
    1147             :                 .name = discard_const_p(char, "size"),
    1148             :                 .get = py_xattr_DosInfo3_get_size,
    1149             :                 .set = py_xattr_DosInfo3_set_size,
    1150             :                 .doc = discard_const_p(char, "PIDL-generated element of base type udlong")
    1151             :         },
    1152             :         {
    1153             :                 .name = discard_const_p(char, "alloc_size"),
    1154             :                 .get = py_xattr_DosInfo3_get_alloc_size,
    1155             :                 .set = py_xattr_DosInfo3_set_alloc_size,
    1156             :                 .doc = discard_const_p(char, "PIDL-generated element of base type udlong")
    1157             :         },
    1158             :         {
    1159             :                 .name = discard_const_p(char, "create_time"),
    1160             :                 .get = py_xattr_DosInfo3_get_create_time,
    1161             :                 .set = py_xattr_DosInfo3_set_create_time,
    1162             :                 .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
    1163             :         },
    1164             :         {
    1165             :                 .name = discard_const_p(char, "change_time"),
    1166             :                 .get = py_xattr_DosInfo3_get_change_time,
    1167             :                 .set = py_xattr_DosInfo3_set_change_time,
    1168             :                 .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
    1169             :         },
    1170             :         { .name = NULL }
    1171             : };
    1172             : 
    1173           0 : static PyObject *py_xattr_DosInfo3_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1174             : {
    1175           0 :         return pytalloc_new(struct xattr_DosInfo3, type);
    1176             : }
    1177             : 
    1178             : 
    1179             : static PyTypeObject xattr_DosInfo3_Type = {
    1180             :         PyVarObject_HEAD_INIT(NULL, 0)
    1181             :         .tp_name = "xattr.DosInfo3",
    1182             :         .tp_getset = py_xattr_DosInfo3_getsetters,
    1183             :         .tp_methods = NULL,
    1184             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    1185             :         .tp_new = py_xattr_DosInfo3_new,
    1186             : };
    1187             : 
    1188             : 
    1189           0 : static PyObject *py_xattr_DosInfo4_get_valid_flags(PyObject *obj, void *closure)
    1190             : {
    1191           0 :         struct xattr_DosInfo4 *object = (struct xattr_DosInfo4 *)pytalloc_get_ptr(obj);
    1192             :         PyObject *py_valid_flags;
    1193           0 :         py_valid_flags = PyLong_FromUnsignedLongLong((uint32_t)object->valid_flags);
    1194           0 :         return py_valid_flags;
    1195             : }
    1196             : 
    1197           0 : static int py_xattr_DosInfo4_set_valid_flags(PyObject *py_obj, PyObject *value, void *closure)
    1198             : {
    1199           0 :         struct xattr_DosInfo4 *object = (struct xattr_DosInfo4 *)pytalloc_get_ptr(py_obj);
    1200           0 :         if (value == NULL) {
    1201           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->valid_flags");
    1202           0 :                 return -1;
    1203             :         }
    1204             :         {
    1205           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->valid_flags));
    1206           0 :                 if (PyLong_Check(value)) {
    1207             :                         unsigned long long test_var;
    1208           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1209           0 :                         if (PyErr_Occurred() != NULL) {
    1210           0 :                                 return -1;
    1211             :                         }
    1212           0 :                         if (test_var > uint_max) {
    1213           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    1214             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1215           0 :                                 return -1;
    1216             :                         }
    1217           0 :                         object->valid_flags = test_var;
    1218             :                 } else {
    1219           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    1220             :                           PyLong_Type.tp_name);
    1221           0 :                         return -1;
    1222             :                 }
    1223             :         }
    1224           0 :         return 0;
    1225             : }
    1226             : 
    1227           0 : static PyObject *py_xattr_DosInfo4_get_attrib(PyObject *obj, void *closure)
    1228             : {
    1229           0 :         struct xattr_DosInfo4 *object = (struct xattr_DosInfo4 *)pytalloc_get_ptr(obj);
    1230             :         PyObject *py_attrib;
    1231           0 :         py_attrib = PyLong_FromUnsignedLongLong((uint32_t)object->attrib);
    1232           0 :         return py_attrib;
    1233             : }
    1234             : 
    1235           0 : static int py_xattr_DosInfo4_set_attrib(PyObject *py_obj, PyObject *value, void *closure)
    1236             : {
    1237           0 :         struct xattr_DosInfo4 *object = (struct xattr_DosInfo4 *)pytalloc_get_ptr(py_obj);
    1238           0 :         if (value == NULL) {
    1239           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->attrib");
    1240           0 :                 return -1;
    1241             :         }
    1242             :         {
    1243           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->attrib));
    1244           0 :                 if (PyLong_Check(value)) {
    1245             :                         unsigned long long test_var;
    1246           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1247           0 :                         if (PyErr_Occurred() != NULL) {
    1248           0 :                                 return -1;
    1249             :                         }
    1250           0 :                         if (test_var > uint_max) {
    1251           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    1252             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1253           0 :                                 return -1;
    1254             :                         }
    1255           0 :                         object->attrib = test_var;
    1256             :                 } else {
    1257           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    1258             :                           PyLong_Type.tp_name);
    1259           0 :                         return -1;
    1260             :                 }
    1261             :         }
    1262           0 :         return 0;
    1263             : }
    1264             : 
    1265           0 : static PyObject *py_xattr_DosInfo4_get_itime(PyObject *obj, void *closure)
    1266             : {
    1267           0 :         struct xattr_DosInfo4 *object = (struct xattr_DosInfo4 *)pytalloc_get_ptr(obj);
    1268             :         PyObject *py_itime;
    1269           0 :         py_itime = PyLong_FromUnsignedLongLong(object->itime);
    1270           0 :         return py_itime;
    1271             : }
    1272             : 
    1273           0 : static int py_xattr_DosInfo4_set_itime(PyObject *py_obj, PyObject *value, void *closure)
    1274             : {
    1275           0 :         struct xattr_DosInfo4 *object = (struct xattr_DosInfo4 *)pytalloc_get_ptr(py_obj);
    1276           0 :         if (value == NULL) {
    1277           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->itime");
    1278           0 :                 return -1;
    1279             :         }
    1280             :         {
    1281           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->itime));
    1282           0 :                 if (PyLong_Check(value)) {
    1283             :                         unsigned long long test_var;
    1284           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1285           0 :                         if (PyErr_Occurred() != NULL) {
    1286           0 :                                 return -1;
    1287             :                         }
    1288           0 :                         if (test_var > uint_max) {
    1289           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    1290             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1291           0 :                                 return -1;
    1292             :                         }
    1293           0 :                         object->itime = test_var;
    1294             :                 } else {
    1295           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    1296             :                           PyLong_Type.tp_name);
    1297           0 :                         return -1;
    1298             :                 }
    1299             :         }
    1300           0 :         return 0;
    1301             : }
    1302             : 
    1303           0 : static PyObject *py_xattr_DosInfo4_get_create_time(PyObject *obj, void *closure)
    1304             : {
    1305           0 :         struct xattr_DosInfo4 *object = (struct xattr_DosInfo4 *)pytalloc_get_ptr(obj);
    1306             :         PyObject *py_create_time;
    1307           0 :         py_create_time = PyLong_FromUnsignedLongLong(object->create_time);
    1308           0 :         return py_create_time;
    1309             : }
    1310             : 
    1311           0 : static int py_xattr_DosInfo4_set_create_time(PyObject *py_obj, PyObject *value, void *closure)
    1312             : {
    1313           0 :         struct xattr_DosInfo4 *object = (struct xattr_DosInfo4 *)pytalloc_get_ptr(py_obj);
    1314           0 :         if (value == NULL) {
    1315           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->create_time");
    1316           0 :                 return -1;
    1317             :         }
    1318             :         {
    1319           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->create_time));
    1320           0 :                 if (PyLong_Check(value)) {
    1321             :                         unsigned long long test_var;
    1322           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1323           0 :                         if (PyErr_Occurred() != NULL) {
    1324           0 :                                 return -1;
    1325             :                         }
    1326           0 :                         if (test_var > uint_max) {
    1327           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    1328             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1329           0 :                                 return -1;
    1330             :                         }
    1331           0 :                         object->create_time = test_var;
    1332             :                 } else {
    1333           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    1334             :                           PyLong_Type.tp_name);
    1335           0 :                         return -1;
    1336             :                 }
    1337             :         }
    1338           0 :         return 0;
    1339             : }
    1340             : 
    1341             : static PyGetSetDef py_xattr_DosInfo4_getsetters[] = {
    1342             :         {
    1343             :                 .name = discard_const_p(char, "valid_flags"),
    1344             :                 .get = py_xattr_DosInfo4_get_valid_flags,
    1345             :                 .set = py_xattr_DosInfo4_set_valid_flags,
    1346             :                 .doc = discard_const_p(char, "PIDL-generated element of base type xattr_DosInfoValidFlags")
    1347             :         },
    1348             :         {
    1349             :                 .name = discard_const_p(char, "attrib"),
    1350             :                 .get = py_xattr_DosInfo4_get_attrib,
    1351             :                 .set = py_xattr_DosInfo4_set_attrib,
    1352             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    1353             :         },
    1354             :         {
    1355             :                 .name = discard_const_p(char, "itime"),
    1356             :                 .get = py_xattr_DosInfo4_get_itime,
    1357             :                 .set = py_xattr_DosInfo4_set_itime,
    1358             :                 .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
    1359             :         },
    1360             :         {
    1361             :                 .name = discard_const_p(char, "create_time"),
    1362             :                 .get = py_xattr_DosInfo4_get_create_time,
    1363             :                 .set = py_xattr_DosInfo4_set_create_time,
    1364             :                 .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
    1365             :         },
    1366             :         { .name = NULL }
    1367             : };
    1368             : 
    1369           0 : static PyObject *py_xattr_DosInfo4_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1370             : {
    1371           0 :         return pytalloc_new(struct xattr_DosInfo4, type);
    1372             : }
    1373             : 
    1374             : 
    1375             : static PyTypeObject xattr_DosInfo4_Type = {
    1376             :         PyVarObject_HEAD_INIT(NULL, 0)
    1377             :         .tp_name = "xattr.DosInfo4",
    1378             :         .tp_getset = py_xattr_DosInfo4_getsetters,
    1379             :         .tp_methods = NULL,
    1380             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    1381             :         .tp_new = py_xattr_DosInfo4_new,
    1382             : };
    1383             : 
    1384           0 : static PyObject *py_import_xattr_DosInfo(TALLOC_CTX *mem_ctx, int level, union xattr_DosInfo *in)
    1385             : {
    1386             :         PyObject *ret;
    1387             : 
    1388           0 :         switch (level) {
    1389           0 :                 case 0xFFFF:
    1390           0 :                         ret = pytalloc_reference_ex(&xattr_DosInfoFFFFCompat_Type, mem_ctx, &in->compatinfoFFFF);
    1391           0 :                         return ret;
    1392             : 
    1393           0 :                 case 1:
    1394           0 :                         ret = pytalloc_reference_ex(&xattr_DosInfo1_Type, mem_ctx, &in->info1);
    1395           0 :                         return ret;
    1396             : 
    1397           0 :                 case 2:
    1398           0 :                         ret = pytalloc_reference_ex(&xattr_DosInfo2Old_Type, mem_ctx, &in->oldinfo2);
    1399           0 :                         return ret;
    1400             : 
    1401           0 :                 case 3:
    1402           0 :                         ret = pytalloc_reference_ex(&xattr_DosInfo3_Type, mem_ctx, &in->info3);
    1403           0 :                         return ret;
    1404             : 
    1405           0 :                 case 4:
    1406           0 :                         ret = pytalloc_reference_ex(&xattr_DosInfo4_Type, mem_ctx, &in->info4);
    1407           0 :                         return ret;
    1408             : 
    1409             :         }
    1410           0 :         PyErr_SetString(PyExc_TypeError, "unknown union level");
    1411           0 :         return NULL;
    1412             : }
    1413             : 
    1414           0 : static union xattr_DosInfo *py_export_xattr_DosInfo(TALLOC_CTX *mem_ctx, int level, PyObject *in)
    1415             : {
    1416           0 :         union xattr_DosInfo *ret = talloc_zero(mem_ctx, union xattr_DosInfo);
    1417           0 :         switch (level) {
    1418           0 :                 case 0xFFFF:
    1419           0 :                         if (in == NULL) {
    1420           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->compatinfoFFFF");
    1421           0 :                                 talloc_free(ret); return NULL;
    1422             :                         }
    1423           0 :                         PY_CHECK_TYPE(&xattr_DosInfoFFFFCompat_Type, in, talloc_free(ret); return NULL;);
    1424           0 :                         if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
    1425           0 :                                 PyErr_NoMemory();
    1426           0 :                                 talloc_free(ret); return NULL;
    1427             :                         }
    1428           0 :                         ret->compatinfoFFFF = *(struct xattr_DosInfoFFFFCompat *)pytalloc_get_ptr(in);
    1429           0 :                         break;
    1430             : 
    1431           0 :                 case 1:
    1432           0 :                         if (in == NULL) {
    1433           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->info1");
    1434           0 :                                 talloc_free(ret); return NULL;
    1435             :                         }
    1436           0 :                         PY_CHECK_TYPE(&xattr_DosInfo1_Type, in, talloc_free(ret); return NULL;);
    1437           0 :                         if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
    1438           0 :                                 PyErr_NoMemory();
    1439           0 :                                 talloc_free(ret); return NULL;
    1440             :                         }
    1441           0 :                         ret->info1 = *(struct xattr_DosInfo1 *)pytalloc_get_ptr(in);
    1442           0 :                         break;
    1443             : 
    1444           0 :                 case 2:
    1445           0 :                         if (in == NULL) {
    1446           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->oldinfo2");
    1447           0 :                                 talloc_free(ret); return NULL;
    1448             :                         }
    1449           0 :                         PY_CHECK_TYPE(&xattr_DosInfo2Old_Type, in, talloc_free(ret); return NULL;);
    1450           0 :                         if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
    1451           0 :                                 PyErr_NoMemory();
    1452           0 :                                 talloc_free(ret); return NULL;
    1453             :                         }
    1454           0 :                         ret->oldinfo2 = *(struct xattr_DosInfo2Old *)pytalloc_get_ptr(in);
    1455           0 :                         break;
    1456             : 
    1457           0 :                 case 3:
    1458           0 :                         if (in == NULL) {
    1459           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->info3");
    1460           0 :                                 talloc_free(ret); return NULL;
    1461             :                         }
    1462           0 :                         PY_CHECK_TYPE(&xattr_DosInfo3_Type, in, talloc_free(ret); return NULL;);
    1463           0 :                         if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
    1464           0 :                                 PyErr_NoMemory();
    1465           0 :                                 talloc_free(ret); return NULL;
    1466             :                         }
    1467           0 :                         ret->info3 = *(struct xattr_DosInfo3 *)pytalloc_get_ptr(in);
    1468           0 :                         break;
    1469             : 
    1470           0 :                 case 4:
    1471           0 :                         if (in == NULL) {
    1472           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->info4");
    1473           0 :                                 talloc_free(ret); return NULL;
    1474             :                         }
    1475           0 :                         PY_CHECK_TYPE(&xattr_DosInfo4_Type, in, talloc_free(ret); return NULL;);
    1476           0 :                         if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
    1477           0 :                                 PyErr_NoMemory();
    1478           0 :                                 talloc_free(ret); return NULL;
    1479             :                         }
    1480           0 :                         ret->info4 = *(struct xattr_DosInfo4 *)pytalloc_get_ptr(in);
    1481           0 :                         break;
    1482             : 
    1483           0 :                 default:
    1484           0 :                         PyErr_SetString(PyExc_TypeError, "invalid union level value");
    1485           0 :                         talloc_free(ret);
    1486           0 :                         ret = NULL;
    1487             :         }
    1488             : 
    1489           0 :         return ret;
    1490             : }
    1491             : 
    1492           0 : static PyObject *py_xattr_DosInfo_import(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1493             : {
    1494           0 :         const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
    1495           0 :         PyObject *mem_ctx_obj = NULL;
    1496           0 :         TALLOC_CTX *mem_ctx = NULL;
    1497           0 :         int level = 0;
    1498           0 :         PyObject *in_obj = NULL;
    1499           0 :         union xattr_DosInfo *in = NULL;
    1500             : 
    1501           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:import",
    1502             :                 discard_const_p(char *, kwnames),
    1503             :                 &mem_ctx_obj,
    1504             :                 &level,
    1505             :                 &in_obj)) {
    1506           0 :                 return NULL;
    1507             :         }
    1508           0 :         mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
    1509           0 :         if (mem_ctx == NULL) {
    1510           0 :                 PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
    1511           0 :                 return NULL;
    1512             :         }
    1513           0 :         in = (union xattr_DosInfo *)pytalloc_get_ptr(in_obj);
    1514           0 :         if (in == NULL) {
    1515           0 :                 PyErr_Format(PyExc_TypeError, "in needs to be a pointer to union xattr_DosInfo!");
    1516           0 :                 return NULL;
    1517             :         }
    1518             : 
    1519           0 :         return py_import_xattr_DosInfo(mem_ctx, level, in);
    1520             : }
    1521             : 
    1522           0 : static PyObject *py_xattr_DosInfo_export(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1523             : {
    1524           0 :         const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
    1525           0 :         PyObject *mem_ctx_obj = NULL;
    1526           0 :         TALLOC_CTX *mem_ctx = NULL;
    1527           0 :         int level = 0;
    1528           0 :         PyObject *in = NULL;
    1529           0 :         union xattr_DosInfo *out = NULL;
    1530             : 
    1531           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:export",
    1532             :                 discard_const_p(char *, kwnames),
    1533             :                 &mem_ctx_obj,
    1534             :                 &level,
    1535             :                 &in)) {
    1536           0 :                 return NULL;
    1537             :         }
    1538           0 :         mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
    1539           0 :         if (mem_ctx == NULL) {
    1540           0 :                 PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
    1541           0 :                 return NULL;
    1542             :         }
    1543             : 
    1544           0 :         out = py_export_xattr_DosInfo(mem_ctx, level, in);
    1545           0 :         if (out == NULL) {
    1546           0 :                 return NULL;
    1547             :         }
    1548             : 
    1549           0 :         return pytalloc_GenericObject_reference(out);
    1550             : }
    1551             : 
    1552             : static PyMethodDef py_xattr_DosInfo_methods[] = {
    1553             :         { "__import__", PY_DISCARD_FUNC_SIG(PyCFunction,py_xattr_DosInfo_import),
    1554             :                 METH_VARARGS|METH_KEYWORDS|METH_CLASS,
    1555             :                 "T.__import__(mem_ctx, level, in) => ret." },
    1556             :         { "__export__", PY_DISCARD_FUNC_SIG(PyCFunction,py_xattr_DosInfo_export),
    1557             :                 METH_VARARGS|METH_KEYWORDS|METH_CLASS,
    1558             :                 "T.__export__(mem_ctx, level, in) => ret." },
    1559             :         { NULL, NULL, 0, NULL }
    1560             : };
    1561             : 
    1562           0 : static PyObject *py_xattr_DosInfo_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1563             : {
    1564           0 :         PyErr_Format(PyExc_TypeError, "New %s Objects are not supported", type->tp_name);
    1565           0 :         return NULL;
    1566             : }
    1567             : 
    1568             : 
    1569             : static PyTypeObject xattr_DosInfo_Type = {
    1570             :         PyVarObject_HEAD_INIT(NULL, 0)
    1571             :         .tp_name = "xattr.DosInfo",
    1572             :         .tp_getset = NULL,
    1573             :         .tp_methods = py_xattr_DosInfo_methods,
    1574             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    1575             :         .tp_new = py_xattr_DosInfo_new,
    1576             : };
    1577             : 
    1578             : 
    1579           0 : static PyObject *py_xattr_DosAttrib_get_version(PyObject *obj, void *closure)
    1580             : {
    1581           0 :         struct xattr_DosAttrib *object = (struct xattr_DosAttrib *)pytalloc_get_ptr(obj);
    1582             :         PyObject *py_version;
    1583           0 :         py_version = PyLong_FromLong((uint16_t)object->version);
    1584           0 :         return py_version;
    1585             : }
    1586             : 
    1587           0 : static int py_xattr_DosAttrib_set_version(PyObject *py_obj, PyObject *value, void *closure)
    1588             : {
    1589           0 :         struct xattr_DosAttrib *object = (struct xattr_DosAttrib *)pytalloc_get_ptr(py_obj);
    1590           0 :         if (value == NULL) {
    1591           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->version");
    1592           0 :                 return -1;
    1593             :         }
    1594             :         {
    1595           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->version));
    1596           0 :                 if (PyLong_Check(value)) {
    1597             :                         unsigned long long test_var;
    1598           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1599           0 :                         if (PyErr_Occurred() != NULL) {
    1600           0 :                                 return -1;
    1601             :                         }
    1602           0 :                         if (test_var > uint_max) {
    1603           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    1604             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1605           0 :                                 return -1;
    1606             :                         }
    1607           0 :                         object->version = test_var;
    1608             :                 } else {
    1609           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    1610             :                           PyLong_Type.tp_name);
    1611           0 :                         return -1;
    1612             :                 }
    1613             :         }
    1614           0 :         return 0;
    1615             : }
    1616             : 
    1617           0 : static PyObject *py_xattr_DosAttrib_get_info(PyObject *obj, void *closure)
    1618             : {
    1619           0 :         struct xattr_DosAttrib *object = (struct xattr_DosAttrib *)pytalloc_get_ptr(obj);
    1620             :         PyObject *py_info;
    1621           0 :         py_info = pyrpc_import_union(&xattr_DosInfo_Type, pytalloc_get_mem_ctx(obj), object->version, &object->info, "union xattr_DosInfo");
    1622           0 :         if (py_info == NULL) {
    1623           0 :                 return NULL;
    1624             :         }
    1625           0 :         return py_info;
    1626             : }
    1627             : 
    1628           0 : static int py_xattr_DosAttrib_set_info(PyObject *py_obj, PyObject *value, void *closure)
    1629             : {
    1630           0 :         struct xattr_DosAttrib *object = (struct xattr_DosAttrib *)pytalloc_get_ptr(py_obj);
    1631           0 :         if (value == NULL) {
    1632           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->info");
    1633           0 :                 return -1;
    1634             :         }
    1635             :         {
    1636             :                 union xattr_DosInfo *info_switch_0;
    1637           0 :                 info_switch_0 = (union xattr_DosInfo *)pyrpc_export_union(&xattr_DosInfo_Type, pytalloc_get_mem_ctx(py_obj), object->version, value, "union xattr_DosInfo");
    1638           0 :                 if (info_switch_0 == NULL) {
    1639           0 :                         return -1;
    1640             :                 }
    1641           0 :                 object->info = *info_switch_0;
    1642             :         }
    1643           0 :         return 0;
    1644             : }
    1645             : 
    1646             : static PyGetSetDef py_xattr_DosAttrib_getsetters[] = {
    1647             :         {
    1648             :                 .name = discard_const_p(char, "version"),
    1649             :                 .get = py_xattr_DosAttrib_get_version,
    1650             :                 .set = py_xattr_DosAttrib_set_version,
    1651             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
    1652             :         },
    1653             :         {
    1654             :                 .name = discard_const_p(char, "info"),
    1655             :                 .get = py_xattr_DosAttrib_get_info,
    1656             :                 .set = py_xattr_DosAttrib_set_info,
    1657             :                 .doc = discard_const_p(char, "PIDL-generated element of base type xattr_DosInfo")
    1658             :         },
    1659             :         { .name = NULL }
    1660             : };
    1661             : 
    1662           0 : static PyObject *py_xattr_DosAttrib_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1663             : {
    1664           0 :         return pytalloc_new(struct xattr_DosAttrib, type);
    1665             : }
    1666             : 
    1667           0 : static PyObject *py_xattr_DosAttrib_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
    1668             : {
    1669           0 :         struct xattr_DosAttrib *object = (struct xattr_DosAttrib *)pytalloc_get_ptr(py_obj);
    1670           0 :         PyObject *ret = NULL;
    1671             :         DATA_BLOB blob;
    1672             :         enum ndr_err_code err;
    1673           0 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
    1674           0 :         if (tmp_ctx == NULL) {
    1675           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    1676           0 :                 return NULL;
    1677             :         }
    1678           0 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_xattr_DosAttrib);
    1679           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    1680           0 :                 TALLOC_FREE(tmp_ctx);
    1681           0 :                 PyErr_SetNdrError(err);
    1682           0 :                 return NULL;
    1683             :         }
    1684             : 
    1685           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    1686           0 :         TALLOC_FREE(tmp_ctx);
    1687           0 :         return ret;
    1688             : }
    1689             : 
    1690           0 : static PyObject *py_xattr_DosAttrib_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    1691             : {
    1692           0 :         struct xattr_DosAttrib *object = (struct xattr_DosAttrib *)pytalloc_get_ptr(py_obj);
    1693           0 :         DATA_BLOB blob = {.data = NULL, .length = 0};
    1694           0 :         Py_ssize_t blob_length = 0;
    1695             :         enum ndr_err_code err;
    1696           0 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
    1697           0 :         PyObject *allow_remaining_obj = NULL;
    1698           0 :         bool allow_remaining = false;
    1699             : 
    1700           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
    1701             :                 discard_const_p(char *, kwnames),
    1702             :                 &blob.data, &blob_length,
    1703             :                 &allow_remaining_obj)) {
    1704           0 :                 return NULL;
    1705             :         }
    1706           0 :         blob.length = blob_length;
    1707             : 
    1708           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    1709           0 :                 allow_remaining = true;
    1710             :         }
    1711             : 
    1712           0 :         if (allow_remaining) {
    1713           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_xattr_DosAttrib);
    1714             :         } else {
    1715           0 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_xattr_DosAttrib);
    1716             :         }
    1717           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    1718           0 :                 PyErr_SetNdrError(err);
    1719           0 :                 return NULL;
    1720             :         }
    1721             : 
    1722           0 :         Py_RETURN_NONE;
    1723             : }
    1724             : 
    1725           0 : static PyObject *py_xattr_DosAttrib_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    1726             : {
    1727           0 :         struct xattr_DosAttrib *object = (struct xattr_DosAttrib *)pytalloc_get_ptr(py_obj);
    1728             :         PyObject *ret;
    1729             :         char *retstr;
    1730             : 
    1731           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_xattr_DosAttrib, "xattr_DosAttrib", object);
    1732           0 :         ret = PyUnicode_FromString(retstr);
    1733           0 :         talloc_free(retstr);
    1734             : 
    1735           0 :         return ret;
    1736             : }
    1737             : 
    1738             : static PyMethodDef py_xattr_DosAttrib_methods[] = {
    1739             :         { "__ndr_pack__", (PyCFunction)py_xattr_DosAttrib_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
    1740             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_xattr_DosAttrib_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
    1741             :         { "__ndr_print__", (PyCFunction)py_xattr_DosAttrib_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
    1742             :         { NULL, NULL, 0, NULL }
    1743             : };
    1744             : 
    1745             : 
    1746             : static PyTypeObject xattr_DosAttrib_Type = {
    1747             :         PyVarObject_HEAD_INIT(NULL, 0)
    1748             :         .tp_name = "xattr.DosAttrib",
    1749             :         .tp_getset = py_xattr_DosAttrib_getsetters,
    1750             :         .tp_methods = py_xattr_DosAttrib_methods,
    1751             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    1752             :         .tp_new = py_xattr_DosAttrib_new,
    1753             : };
    1754             : 
    1755             : 
    1756           0 : static PyObject *py_xattr_DOSATTRIB_get_attrib_hex(PyObject *obj, void *closure)
    1757             : {
    1758           0 :         struct xattr_DOSATTRIB *object = (struct xattr_DOSATTRIB *)pytalloc_get_ptr(obj);
    1759             :         PyObject *py_attrib_hex;
    1760           0 :         py_attrib_hex = PyString_FromStringOrNULL(object->attrib_hex);
    1761           0 :         return py_attrib_hex;
    1762             : }
    1763             : 
    1764           0 : static int py_xattr_DOSATTRIB_set_attrib_hex(PyObject *py_obj, PyObject *value, void *closure)
    1765             : {
    1766           0 :         struct xattr_DOSATTRIB *object = (struct xattr_DOSATTRIB *)pytalloc_get_ptr(py_obj);
    1767           0 :         if (value == NULL) {
    1768           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->attrib_hex");
    1769           0 :                 return -1;
    1770             :         }
    1771             :         {
    1772             :                 const char *test_str;
    1773             :                 const char *talloc_str;
    1774           0 :                 PyObject *unicode = NULL;
    1775           0 :                 if (PyUnicode_Check(value)) {
    1776           0 :                         unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
    1777           0 :                         if (unicode == NULL) {
    1778           0 :                                 PyErr_NoMemory();
    1779           0 :                                 return -1;
    1780             :                         }
    1781           0 :                         test_str = PyBytes_AS_STRING(unicode);
    1782           0 :                 } else if (PyBytes_Check(value)) {
    1783           0 :                         test_str = PyBytes_AS_STRING(value);
    1784             :                 } else {
    1785           0 :                         PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
    1786           0 :                         return -1;
    1787             :                 }
    1788           0 :                 talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
    1789           0 :                 if (unicode != NULL) {
    1790           0 :                         Py_DECREF(unicode);
    1791             :                 }
    1792           0 :                 if (talloc_str == NULL) {
    1793           0 :                         PyErr_NoMemory();
    1794           0 :                         return -1;
    1795             :                 }
    1796           0 :                 object->attrib_hex = talloc_str;
    1797             :         }
    1798           0 :         return 0;
    1799             : }
    1800             : 
    1801           0 : static PyObject *py_xattr_DOSATTRIB_get_version(PyObject *obj, void *closure)
    1802             : {
    1803           0 :         struct xattr_DOSATTRIB *object = (struct xattr_DOSATTRIB *)pytalloc_get_ptr(obj);
    1804             :         PyObject *py_version;
    1805           0 :         py_version = PyLong_FromLong((uint16_t)object->version);
    1806           0 :         return py_version;
    1807             : }
    1808             : 
    1809           0 : static int py_xattr_DOSATTRIB_set_version(PyObject *py_obj, PyObject *value, void *closure)
    1810             : {
    1811           0 :         struct xattr_DOSATTRIB *object = (struct xattr_DOSATTRIB *)pytalloc_get_ptr(py_obj);
    1812           0 :         if (value == NULL) {
    1813           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->version");
    1814           0 :                 return -1;
    1815             :         }
    1816             :         {
    1817           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->version));
    1818           0 :                 if (PyLong_Check(value)) {
    1819             :                         unsigned long long test_var;
    1820           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1821           0 :                         if (PyErr_Occurred() != NULL) {
    1822           0 :                                 return -1;
    1823             :                         }
    1824           0 :                         if (test_var > uint_max) {
    1825           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    1826             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1827           0 :                                 return -1;
    1828             :                         }
    1829           0 :                         object->version = test_var;
    1830             :                 } else {
    1831           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    1832             :                           PyLong_Type.tp_name);
    1833           0 :                         return -1;
    1834             :                 }
    1835             :         }
    1836           0 :         return 0;
    1837             : }
    1838             : 
    1839           0 : static PyObject *py_xattr_DOSATTRIB_get_info(PyObject *obj, void *closure)
    1840             : {
    1841           0 :         struct xattr_DOSATTRIB *object = (struct xattr_DOSATTRIB *)pytalloc_get_ptr(obj);
    1842             :         PyObject *py_info;
    1843           0 :         py_info = pyrpc_import_union(&xattr_DosInfo_Type, pytalloc_get_mem_ctx(obj), object->version, &object->info, "union xattr_DosInfo");
    1844           0 :         if (py_info == NULL) {
    1845           0 :                 return NULL;
    1846             :         }
    1847           0 :         return py_info;
    1848             : }
    1849             : 
    1850           0 : static int py_xattr_DOSATTRIB_set_info(PyObject *py_obj, PyObject *value, void *closure)
    1851             : {
    1852           0 :         struct xattr_DOSATTRIB *object = (struct xattr_DOSATTRIB *)pytalloc_get_ptr(py_obj);
    1853           0 :         if (value == NULL) {
    1854           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->info");
    1855           0 :                 return -1;
    1856             :         }
    1857             :         {
    1858             :                 union xattr_DosInfo *info_switch_0;
    1859           0 :                 info_switch_0 = (union xattr_DosInfo *)pyrpc_export_union(&xattr_DosInfo_Type, pytalloc_get_mem_ctx(py_obj), object->version, value, "union xattr_DosInfo");
    1860           0 :                 if (info_switch_0 == NULL) {
    1861           0 :                         return -1;
    1862             :                 }
    1863           0 :                 object->info = *info_switch_0;
    1864             :         }
    1865           0 :         return 0;
    1866             : }
    1867             : 
    1868             : static PyGetSetDef py_xattr_DOSATTRIB_getsetters[] = {
    1869             :         {
    1870             :                 .name = discard_const_p(char, "attrib_hex"),
    1871             :                 .get = py_xattr_DOSATTRIB_get_attrib_hex,
    1872             :                 .set = py_xattr_DOSATTRIB_set_attrib_hex,
    1873             :                 .doc = discard_const_p(char, "PIDL-generated element of base type string")
    1874             :         },
    1875             :         {
    1876             :                 .name = discard_const_p(char, "version"),
    1877             :                 .get = py_xattr_DOSATTRIB_get_version,
    1878             :                 .set = py_xattr_DOSATTRIB_set_version,
    1879             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
    1880             :         },
    1881             :         {
    1882             :                 .name = discard_const_p(char, "info"),
    1883             :                 .get = py_xattr_DOSATTRIB_get_info,
    1884             :                 .set = py_xattr_DOSATTRIB_set_info,
    1885             :                 .doc = discard_const_p(char, "PIDL-generated element of base type xattr_DosInfo")
    1886             :         },
    1887             :         { .name = NULL }
    1888             : };
    1889             : 
    1890           2 : static PyObject *py_xattr_DOSATTRIB_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1891             : {
    1892           2 :         return pytalloc_new(struct xattr_DOSATTRIB, type);
    1893             : }
    1894             : 
    1895           0 : static PyObject *py_xattr_DOSATTRIB_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
    1896             : {
    1897           0 :         struct xattr_DOSATTRIB *object = (struct xattr_DOSATTRIB *)pytalloc_get_ptr(py_obj);
    1898           0 :         PyObject *ret = NULL;
    1899             :         DATA_BLOB blob;
    1900             :         enum ndr_err_code err;
    1901           0 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
    1902           0 :         if (tmp_ctx == NULL) {
    1903           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    1904           0 :                 return NULL;
    1905             :         }
    1906           0 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_xattr_DOSATTRIB);
    1907           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    1908           0 :                 TALLOC_FREE(tmp_ctx);
    1909           0 :                 PyErr_SetNdrError(err);
    1910           0 :                 return NULL;
    1911             :         }
    1912             : 
    1913           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    1914           0 :         TALLOC_FREE(tmp_ctx);
    1915           0 :         return ret;
    1916             : }
    1917             : 
    1918           2 : static PyObject *py_xattr_DOSATTRIB_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    1919             : {
    1920           2 :         struct xattr_DOSATTRIB *object = (struct xattr_DOSATTRIB *)pytalloc_get_ptr(py_obj);
    1921           2 :         DATA_BLOB blob = {.data = NULL, .length = 0};
    1922           2 :         Py_ssize_t blob_length = 0;
    1923             :         enum ndr_err_code err;
    1924           2 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
    1925           2 :         PyObject *allow_remaining_obj = NULL;
    1926           2 :         bool allow_remaining = false;
    1927             : 
    1928           2 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
    1929             :                 discard_const_p(char *, kwnames),
    1930             :                 &blob.data, &blob_length,
    1931             :                 &allow_remaining_obj)) {
    1932           0 :                 return NULL;
    1933             :         }
    1934           2 :         blob.length = blob_length;
    1935             : 
    1936           2 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    1937           0 :                 allow_remaining = true;
    1938             :         }
    1939             : 
    1940           2 :         if (allow_remaining) {
    1941           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_xattr_DOSATTRIB);
    1942             :         } else {
    1943           2 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_xattr_DOSATTRIB);
    1944             :         }
    1945           2 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    1946           0 :                 PyErr_SetNdrError(err);
    1947           0 :                 return NULL;
    1948             :         }
    1949             : 
    1950           2 :         Py_RETURN_NONE;
    1951             : }
    1952             : 
    1953           2 : static PyObject *py_xattr_DOSATTRIB_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    1954             : {
    1955           2 :         struct xattr_DOSATTRIB *object = (struct xattr_DOSATTRIB *)pytalloc_get_ptr(py_obj);
    1956             :         PyObject *ret;
    1957             :         char *retstr;
    1958             : 
    1959           2 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_xattr_DOSATTRIB, "xattr_DOSATTRIB", object);
    1960           2 :         ret = PyUnicode_FromString(retstr);
    1961           2 :         talloc_free(retstr);
    1962             : 
    1963           2 :         return ret;
    1964             : }
    1965             : 
    1966             : static PyMethodDef py_xattr_DOSATTRIB_methods[] = {
    1967             :         { "__ndr_pack__", (PyCFunction)py_xattr_DOSATTRIB_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
    1968             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_xattr_DOSATTRIB_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
    1969             :         { "__ndr_print__", (PyCFunction)py_xattr_DOSATTRIB_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
    1970             :         { NULL, NULL, 0, NULL }
    1971             : };
    1972             : 
    1973             : 
    1974             : static PyTypeObject xattr_DOSATTRIB_Type = {
    1975             :         PyVarObject_HEAD_INIT(NULL, 0)
    1976             :         .tp_name = "xattr.DOSATTRIB",
    1977             :         .tp_getset = py_xattr_DOSATTRIB_getsetters,
    1978             :         .tp_methods = py_xattr_DOSATTRIB_methods,
    1979             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    1980             :         .tp_new = py_xattr_DOSATTRIB_new,
    1981             : };
    1982             : 
    1983             : 
    1984           0 : static PyObject *py_xattr_EA_get_name(PyObject *obj, void *closure)
    1985             : {
    1986           0 :         struct xattr_EA *object = (struct xattr_EA *)pytalloc_get_ptr(obj);
    1987             :         PyObject *py_name;
    1988           0 :         py_name = PyString_FromStringOrNULL(object->name);
    1989           0 :         return py_name;
    1990             : }
    1991             : 
    1992           0 : static int py_xattr_EA_set_name(PyObject *py_obj, PyObject *value, void *closure)
    1993             : {
    1994           0 :         struct xattr_EA *object = (struct xattr_EA *)pytalloc_get_ptr(py_obj);
    1995           0 :         if (value == NULL) {
    1996           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->name");
    1997           0 :                 return -1;
    1998             :         }
    1999             :         {
    2000             :                 const char *test_str;
    2001             :                 const char *talloc_str;
    2002           0 :                 PyObject *unicode = NULL;
    2003           0 :                 if (PyUnicode_Check(value)) {
    2004           0 :                         unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
    2005           0 :                         if (unicode == NULL) {
    2006           0 :                                 PyErr_NoMemory();
    2007           0 :                                 return -1;
    2008             :                         }
    2009           0 :                         test_str = PyBytes_AS_STRING(unicode);
    2010           0 :                 } else if (PyBytes_Check(value)) {
    2011           0 :                         test_str = PyBytes_AS_STRING(value);
    2012             :                 } else {
    2013           0 :                         PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
    2014           0 :                         return -1;
    2015             :                 }
    2016           0 :                 talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
    2017           0 :                 if (unicode != NULL) {
    2018           0 :                         Py_DECREF(unicode);
    2019             :                 }
    2020           0 :                 if (talloc_str == NULL) {
    2021           0 :                         PyErr_NoMemory();
    2022           0 :                         return -1;
    2023             :                 }
    2024           0 :                 object->name = talloc_str;
    2025             :         }
    2026           0 :         return 0;
    2027             : }
    2028             : 
    2029           0 : static PyObject *py_xattr_EA_get_value(PyObject *obj, void *closure)
    2030             : {
    2031           0 :         struct xattr_EA *object = (struct xattr_EA *)pytalloc_get_ptr(obj);
    2032             :         PyObject *py_value;
    2033           0 :         py_value = PyBytes_FromStringAndSize((char *)(object->value).data, (object->value).length);
    2034           0 :         return py_value;
    2035             : }
    2036             : 
    2037           0 : static int py_xattr_EA_set_value(PyObject *py_obj, PyObject *value, void *closure)
    2038             : {
    2039           0 :         struct xattr_EA *object = (struct xattr_EA *)pytalloc_get_ptr(py_obj);
    2040           0 :         if (value == NULL) {
    2041           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->value");
    2042           0 :                 return -1;
    2043             :         }
    2044           0 :         object->value = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
    2045           0 :         return 0;
    2046             : }
    2047             : 
    2048             : static PyGetSetDef py_xattr_EA_getsetters[] = {
    2049             :         {
    2050             :                 .name = discard_const_p(char, "name"),
    2051             :                 .get = py_xattr_EA_get_name,
    2052             :                 .set = py_xattr_EA_set_name,
    2053             :                 .doc = discard_const_p(char, "PIDL-generated element of base type string")
    2054             :         },
    2055             :         {
    2056             :                 .name = discard_const_p(char, "value"),
    2057             :                 .get = py_xattr_EA_get_value,
    2058             :                 .set = py_xattr_EA_set_value,
    2059             :                 .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
    2060             :         },
    2061             :         { .name = NULL }
    2062             : };
    2063             : 
    2064           0 : static PyObject *py_xattr_EA_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    2065             : {
    2066           0 :         return pytalloc_new(struct xattr_EA, type);
    2067             : }
    2068             : 
    2069             : 
    2070             : static PyTypeObject xattr_EA_Type = {
    2071             :         PyVarObject_HEAD_INIT(NULL, 0)
    2072             :         .tp_name = "xattr.EA",
    2073             :         .tp_getset = py_xattr_EA_getsetters,
    2074             :         .tp_methods = NULL,
    2075             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    2076             :         .tp_new = py_xattr_EA_new,
    2077             : };
    2078             : 
    2079             : 
    2080           0 : static PyObject *py_xattr_DosEAs_get_num_eas(PyObject *obj, void *closure)
    2081             : {
    2082           0 :         struct xattr_DosEAs *object = (struct xattr_DosEAs *)pytalloc_get_ptr(obj);
    2083             :         PyObject *py_num_eas;
    2084           0 :         py_num_eas = PyLong_FromLong((uint16_t)object->num_eas);
    2085           0 :         return py_num_eas;
    2086             : }
    2087             : 
    2088           0 : static int py_xattr_DosEAs_set_num_eas(PyObject *py_obj, PyObject *value, void *closure)
    2089             : {
    2090           0 :         struct xattr_DosEAs *object = (struct xattr_DosEAs *)pytalloc_get_ptr(py_obj);
    2091           0 :         if (value == NULL) {
    2092           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->num_eas");
    2093           0 :                 return -1;
    2094             :         }
    2095             :         {
    2096           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->num_eas));
    2097           0 :                 if (PyLong_Check(value)) {
    2098             :                         unsigned long long test_var;
    2099           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    2100           0 :                         if (PyErr_Occurred() != NULL) {
    2101           0 :                                 return -1;
    2102             :                         }
    2103           0 :                         if (test_var > uint_max) {
    2104           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    2105             :                                   PyLong_Type.tp_name, uint_max, test_var);
    2106           0 :                                 return -1;
    2107             :                         }
    2108           0 :                         object->num_eas = test_var;
    2109             :                 } else {
    2110           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    2111             :                           PyLong_Type.tp_name);
    2112           0 :                         return -1;
    2113             :                 }
    2114             :         }
    2115           0 :         return 0;
    2116             : }
    2117             : 
    2118           0 : static PyObject *py_xattr_DosEAs_get_eas(PyObject *obj, void *closure)
    2119             : {
    2120           0 :         struct xattr_DosEAs *object = (struct xattr_DosEAs *)pytalloc_get_ptr(obj);
    2121             :         PyObject *py_eas;
    2122           0 :         if (object->eas == NULL) {
    2123           0 :                 Py_RETURN_NONE;
    2124             :         }
    2125           0 :         if (object->eas == NULL) {
    2126           0 :                 py_eas = Py_None;
    2127           0 :                 Py_INCREF(py_eas);
    2128             :         } else {
    2129           0 :                 py_eas = PyList_New(object->num_eas);
    2130           0 :                 if (py_eas == NULL) {
    2131           0 :                         return NULL;
    2132             :                 }
    2133             :                 {
    2134             :                         int eas_cntr_1;
    2135           0 :                         for (eas_cntr_1 = 0; eas_cntr_1 < (object->num_eas); eas_cntr_1++) {
    2136             :                                 PyObject *py_eas_1;
    2137           0 :                                 py_eas_1 = pytalloc_reference_ex(&xattr_EA_Type, object->eas, &object->eas[eas_cntr_1]);
    2138           0 :                                 PyList_SetItem(py_eas, eas_cntr_1, py_eas_1);
    2139             :                         }
    2140             :                 }
    2141             :         }
    2142           0 :         return py_eas;
    2143             : }
    2144             : 
    2145           0 : static int py_xattr_DosEAs_set_eas(PyObject *py_obj, PyObject *value, void *closure)
    2146             : {
    2147           0 :         struct xattr_DosEAs *object = (struct xattr_DosEAs *)pytalloc_get_ptr(py_obj);
    2148           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->eas));
    2149           0 :         if (value == NULL) {
    2150           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->eas");
    2151           0 :                 return -1;
    2152             :         }
    2153           0 :         if (value == Py_None) {
    2154           0 :                 object->eas = NULL;
    2155             :         } else {
    2156           0 :                 object->eas = NULL;
    2157           0 :                 PY_CHECK_TYPE(&PyList_Type, value, return -1;);
    2158             :                 {
    2159             :                         int eas_cntr_1;
    2160           0 :                         object->eas = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->eas, PyList_GET_SIZE(value));
    2161           0 :                         if (!object->eas) { return -1;; }
    2162           0 :                         talloc_set_name_const(object->eas, "ARRAY: object->eas");
    2163           0 :                         for (eas_cntr_1 = 0; eas_cntr_1 < PyList_GET_SIZE(value); eas_cntr_1++) {
    2164           0 :                                 if (PyList_GET_ITEM(value, eas_cntr_1) == NULL) {
    2165           0 :                                         PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->eas[eas_cntr_1]");
    2166           0 :                                         return -1;
    2167             :                                 }
    2168           0 :                                 PY_CHECK_TYPE(&xattr_EA_Type, PyList_GET_ITEM(value, eas_cntr_1), return -1;);
    2169           0 :                                 if (talloc_reference(object->eas, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, eas_cntr_1))) == NULL) {
    2170           0 :                                         PyErr_NoMemory();
    2171           0 :                                         return -1;
    2172             :                                 }
    2173           0 :                                 object->eas[eas_cntr_1] = *(struct xattr_EA *)pytalloc_get_ptr(PyList_GET_ITEM(value, eas_cntr_1));
    2174             :                         }
    2175             :                 }
    2176             :         }
    2177           0 :         return 0;
    2178             : }
    2179             : 
    2180             : static PyGetSetDef py_xattr_DosEAs_getsetters[] = {
    2181             :         {
    2182             :                 .name = discard_const_p(char, "num_eas"),
    2183             :                 .get = py_xattr_DosEAs_get_num_eas,
    2184             :                 .set = py_xattr_DosEAs_set_num_eas,
    2185             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
    2186             :         },
    2187             :         {
    2188             :                 .name = discard_const_p(char, "eas"),
    2189             :                 .get = py_xattr_DosEAs_get_eas,
    2190             :                 .set = py_xattr_DosEAs_set_eas,
    2191             :                 .doc = discard_const_p(char, "PIDL-generated element of base type xattr_EA")
    2192             :         },
    2193             :         { .name = NULL }
    2194             : };
    2195             : 
    2196           0 : static PyObject *py_xattr_DosEAs_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    2197             : {
    2198           0 :         return pytalloc_new(struct xattr_DosEAs, type);
    2199             : }
    2200             : 
    2201           0 : static PyObject *py_xattr_DosEAs_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
    2202             : {
    2203           0 :         struct xattr_DosEAs *object = (struct xattr_DosEAs *)pytalloc_get_ptr(py_obj);
    2204           0 :         PyObject *ret = NULL;
    2205             :         DATA_BLOB blob;
    2206             :         enum ndr_err_code err;
    2207           0 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
    2208           0 :         if (tmp_ctx == NULL) {
    2209           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    2210           0 :                 return NULL;
    2211             :         }
    2212           0 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_xattr_DosEAs);
    2213           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    2214           0 :                 TALLOC_FREE(tmp_ctx);
    2215           0 :                 PyErr_SetNdrError(err);
    2216           0 :                 return NULL;
    2217             :         }
    2218             : 
    2219           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    2220           0 :         TALLOC_FREE(tmp_ctx);
    2221           0 :         return ret;
    2222             : }
    2223             : 
    2224           0 : static PyObject *py_xattr_DosEAs_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    2225             : {
    2226           0 :         struct xattr_DosEAs *object = (struct xattr_DosEAs *)pytalloc_get_ptr(py_obj);
    2227           0 :         DATA_BLOB blob = {.data = NULL, .length = 0};
    2228           0 :         Py_ssize_t blob_length = 0;
    2229             :         enum ndr_err_code err;
    2230           0 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
    2231           0 :         PyObject *allow_remaining_obj = NULL;
    2232           0 :         bool allow_remaining = false;
    2233             : 
    2234           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
    2235             :                 discard_const_p(char *, kwnames),
    2236             :                 &blob.data, &blob_length,
    2237             :                 &allow_remaining_obj)) {
    2238           0 :                 return NULL;
    2239             :         }
    2240           0 :         blob.length = blob_length;
    2241             : 
    2242           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    2243           0 :                 allow_remaining = true;
    2244             :         }
    2245             : 
    2246           0 :         if (allow_remaining) {
    2247           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_xattr_DosEAs);
    2248             :         } else {
    2249           0 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_xattr_DosEAs);
    2250             :         }
    2251           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    2252           0 :                 PyErr_SetNdrError(err);
    2253           0 :                 return NULL;
    2254             :         }
    2255             : 
    2256           0 :         Py_RETURN_NONE;
    2257             : }
    2258             : 
    2259           0 : static PyObject *py_xattr_DosEAs_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    2260             : {
    2261           0 :         struct xattr_DosEAs *object = (struct xattr_DosEAs *)pytalloc_get_ptr(py_obj);
    2262             :         PyObject *ret;
    2263             :         char *retstr;
    2264             : 
    2265           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_xattr_DosEAs, "xattr_DosEAs", object);
    2266           0 :         ret = PyUnicode_FromString(retstr);
    2267           0 :         talloc_free(retstr);
    2268             : 
    2269           0 :         return ret;
    2270             : }
    2271             : 
    2272             : static PyMethodDef py_xattr_DosEAs_methods[] = {
    2273             :         { "__ndr_pack__", (PyCFunction)py_xattr_DosEAs_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
    2274             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_xattr_DosEAs_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
    2275             :         { "__ndr_print__", (PyCFunction)py_xattr_DosEAs_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
    2276             :         { NULL, NULL, 0, NULL }
    2277             : };
    2278             : 
    2279             : 
    2280             : static PyTypeObject xattr_DosEAs_Type = {
    2281             :         PyVarObject_HEAD_INIT(NULL, 0)
    2282             :         .tp_name = "xattr.DosEAs",
    2283             :         .tp_getset = py_xattr_DosEAs_getsetters,
    2284             :         .tp_methods = py_xattr_DosEAs_methods,
    2285             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    2286             :         .tp_new = py_xattr_DosEAs_new,
    2287             : };
    2288             : 
    2289             : 
    2290           0 : static PyObject *py_tdb_xattrs_get_num_eas(PyObject *obj, void *closure)
    2291             : {
    2292           0 :         struct tdb_xattrs *object = (struct tdb_xattrs *)pytalloc_get_ptr(obj);
    2293             :         PyObject *py_num_eas;
    2294           0 :         py_num_eas = PyLong_FromUnsignedLongLong((uint32_t)object->num_eas);
    2295           0 :         return py_num_eas;
    2296             : }
    2297             : 
    2298           0 : static int py_tdb_xattrs_set_num_eas(PyObject *py_obj, PyObject *value, void *closure)
    2299             : {
    2300           0 :         struct tdb_xattrs *object = (struct tdb_xattrs *)pytalloc_get_ptr(py_obj);
    2301           0 :         if (value == NULL) {
    2302           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->num_eas");
    2303           0 :                 return -1;
    2304             :         }
    2305             :         {
    2306           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->num_eas));
    2307           0 :                 if (PyLong_Check(value)) {
    2308             :                         unsigned long long test_var;
    2309           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    2310           0 :                         if (PyErr_Occurred() != NULL) {
    2311           0 :                                 return -1;
    2312             :                         }
    2313           0 :                         if (test_var > uint_max) {
    2314           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    2315             :                                   PyLong_Type.tp_name, uint_max, test_var);
    2316           0 :                                 return -1;
    2317             :                         }
    2318           0 :                         object->num_eas = test_var;
    2319             :                 } else {
    2320           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    2321             :                           PyLong_Type.tp_name);
    2322           0 :                         return -1;
    2323             :                 }
    2324             :         }
    2325           0 :         return 0;
    2326             : }
    2327             : 
    2328           0 : static PyObject *py_tdb_xattrs_get_eas(PyObject *obj, void *closure)
    2329             : {
    2330           0 :         struct tdb_xattrs *object = (struct tdb_xattrs *)pytalloc_get_ptr(obj);
    2331             :         PyObject *py_eas;
    2332           0 :         py_eas = PyList_New(object->num_eas);
    2333           0 :         if (py_eas == NULL) {
    2334           0 :                 return NULL;
    2335             :         }
    2336             :         {
    2337             :                 int eas_cntr_0;
    2338           0 :                 for (eas_cntr_0 = 0; eas_cntr_0 < (object->num_eas); eas_cntr_0++) {
    2339             :                         PyObject *py_eas_0;
    2340           0 :                         py_eas_0 = pytalloc_reference_ex(&xattr_EA_Type, object->eas, &object->eas[eas_cntr_0]);
    2341           0 :                         PyList_SetItem(py_eas, eas_cntr_0, py_eas_0);
    2342             :                 }
    2343             :         }
    2344           0 :         return py_eas;
    2345             : }
    2346             : 
    2347           0 : static int py_tdb_xattrs_set_eas(PyObject *py_obj, PyObject *value, void *closure)
    2348             : {
    2349           0 :         struct tdb_xattrs *object = (struct tdb_xattrs *)pytalloc_get_ptr(py_obj);
    2350           0 :         if (value == NULL) {
    2351           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->eas");
    2352           0 :                 return -1;
    2353             :         }
    2354           0 :         PY_CHECK_TYPE(&PyList_Type, value, return -1;);
    2355             :         {
    2356             :                 int eas_cntr_0;
    2357           0 :                 object->eas = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->eas, PyList_GET_SIZE(value));
    2358           0 :                 if (!object->eas) { return -1;; }
    2359           0 :                 talloc_set_name_const(object->eas, "ARRAY: object->eas");
    2360           0 :                 for (eas_cntr_0 = 0; eas_cntr_0 < PyList_GET_SIZE(value); eas_cntr_0++) {
    2361           0 :                         if (PyList_GET_ITEM(value, eas_cntr_0) == NULL) {
    2362           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->eas[eas_cntr_0]");
    2363           0 :                                 return -1;
    2364             :                         }
    2365           0 :                         PY_CHECK_TYPE(&xattr_EA_Type, PyList_GET_ITEM(value, eas_cntr_0), return -1;);
    2366           0 :                         if (talloc_reference(object->eas, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, eas_cntr_0))) == NULL) {
    2367           0 :                                 PyErr_NoMemory();
    2368           0 :                                 return -1;
    2369             :                         }
    2370           0 :                         object->eas[eas_cntr_0] = *(struct xattr_EA *)pytalloc_get_ptr(PyList_GET_ITEM(value, eas_cntr_0));
    2371             :                 }
    2372             :         }
    2373           0 :         return 0;
    2374             : }
    2375             : 
    2376             : static PyGetSetDef py_tdb_xattrs_getsetters[] = {
    2377             :         {
    2378             :                 .name = discard_const_p(char, "num_eas"),
    2379             :                 .get = py_tdb_xattrs_get_num_eas,
    2380             :                 .set = py_tdb_xattrs_set_num_eas,
    2381             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    2382             :         },
    2383             :         {
    2384             :                 .name = discard_const_p(char, "eas"),
    2385             :                 .get = py_tdb_xattrs_get_eas,
    2386             :                 .set = py_tdb_xattrs_set_eas,
    2387             :                 .doc = discard_const_p(char, "PIDL-generated element of base type xattr_EA")
    2388             :         },
    2389             :         { .name = NULL }
    2390             : };
    2391             : 
    2392           0 : static PyObject *py_tdb_xattrs_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    2393             : {
    2394           0 :         return pytalloc_new(struct tdb_xattrs, type);
    2395             : }
    2396             : 
    2397           0 : static PyObject *py_tdb_xattrs_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
    2398             : {
    2399           0 :         struct tdb_xattrs *object = (struct tdb_xattrs *)pytalloc_get_ptr(py_obj);
    2400           0 :         PyObject *ret = NULL;
    2401             :         DATA_BLOB blob;
    2402             :         enum ndr_err_code err;
    2403           0 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
    2404           0 :         if (tmp_ctx == NULL) {
    2405           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    2406           0 :                 return NULL;
    2407             :         }
    2408           0 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_tdb_xattrs);
    2409           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    2410           0 :                 TALLOC_FREE(tmp_ctx);
    2411           0 :                 PyErr_SetNdrError(err);
    2412           0 :                 return NULL;
    2413             :         }
    2414             : 
    2415           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    2416           0 :         TALLOC_FREE(tmp_ctx);
    2417           0 :         return ret;
    2418             : }
    2419             : 
    2420           0 : static PyObject *py_tdb_xattrs_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    2421             : {
    2422           0 :         struct tdb_xattrs *object = (struct tdb_xattrs *)pytalloc_get_ptr(py_obj);
    2423           0 :         DATA_BLOB blob = {.data = NULL, .length = 0};
    2424           0 :         Py_ssize_t blob_length = 0;
    2425             :         enum ndr_err_code err;
    2426           0 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
    2427           0 :         PyObject *allow_remaining_obj = NULL;
    2428           0 :         bool allow_remaining = false;
    2429             : 
    2430           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
    2431             :                 discard_const_p(char *, kwnames),
    2432             :                 &blob.data, &blob_length,
    2433             :                 &allow_remaining_obj)) {
    2434           0 :                 return NULL;
    2435             :         }
    2436           0 :         blob.length = blob_length;
    2437             : 
    2438           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    2439           0 :                 allow_remaining = true;
    2440             :         }
    2441             : 
    2442           0 :         if (allow_remaining) {
    2443           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_tdb_xattrs);
    2444             :         } else {
    2445           0 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_tdb_xattrs);
    2446             :         }
    2447           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    2448           0 :                 PyErr_SetNdrError(err);
    2449           0 :                 return NULL;
    2450             :         }
    2451             : 
    2452           0 :         Py_RETURN_NONE;
    2453             : }
    2454             : 
    2455           0 : static PyObject *py_tdb_xattrs_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    2456             : {
    2457           0 :         struct tdb_xattrs *object = (struct tdb_xattrs *)pytalloc_get_ptr(py_obj);
    2458             :         PyObject *ret;
    2459             :         char *retstr;
    2460             : 
    2461           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_tdb_xattrs, "tdb_xattrs", object);
    2462           0 :         ret = PyUnicode_FromString(retstr);
    2463           0 :         talloc_free(retstr);
    2464             : 
    2465           0 :         return ret;
    2466             : }
    2467             : 
    2468             : static PyMethodDef py_tdb_xattrs_methods[] = {
    2469             :         { "__ndr_pack__", (PyCFunction)py_tdb_xattrs_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
    2470             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_tdb_xattrs_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
    2471             :         { "__ndr_print__", (PyCFunction)py_tdb_xattrs_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
    2472             :         { NULL, NULL, 0, NULL }
    2473             : };
    2474             : 
    2475             : 
    2476             : static PyTypeObject tdb_xattrs_Type = {
    2477             :         PyVarObject_HEAD_INIT(NULL, 0)
    2478             :         .tp_name = "xattr.tdb_xattrs",
    2479             :         .tp_getset = py_tdb_xattrs_getsetters,
    2480             :         .tp_methods = py_tdb_xattrs_methods,
    2481             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    2482             :         .tp_new = py_tdb_xattrs_new,
    2483             : };
    2484             : 
    2485             : 
    2486           0 : static PyObject *py_xattr_DosStream_get_flags(PyObject *obj, void *closure)
    2487             : {
    2488           0 :         struct xattr_DosStream *object = (struct xattr_DosStream *)pytalloc_get_ptr(obj);
    2489             :         PyObject *py_flags;
    2490           0 :         py_flags = PyLong_FromUnsignedLongLong((uint32_t)object->flags);
    2491           0 :         return py_flags;
    2492             : }
    2493             : 
    2494           0 : static int py_xattr_DosStream_set_flags(PyObject *py_obj, PyObject *value, void *closure)
    2495             : {
    2496           0 :         struct xattr_DosStream *object = (struct xattr_DosStream *)pytalloc_get_ptr(py_obj);
    2497           0 :         if (value == NULL) {
    2498           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->flags");
    2499           0 :                 return -1;
    2500             :         }
    2501             :         {
    2502           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->flags));
    2503           0 :                 if (PyLong_Check(value)) {
    2504             :                         unsigned long long test_var;
    2505           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    2506           0 :                         if (PyErr_Occurred() != NULL) {
    2507           0 :                                 return -1;
    2508             :                         }
    2509           0 :                         if (test_var > uint_max) {
    2510           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    2511             :                                   PyLong_Type.tp_name, uint_max, test_var);
    2512           0 :                                 return -1;
    2513             :                         }
    2514           0 :                         object->flags = test_var;
    2515             :                 } else {
    2516           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    2517             :                           PyLong_Type.tp_name);
    2518           0 :                         return -1;
    2519             :                 }
    2520             :         }
    2521           0 :         return 0;
    2522             : }
    2523             : 
    2524           0 : static PyObject *py_xattr_DosStream_get_size(PyObject *obj, void *closure)
    2525             : {
    2526           0 :         struct xattr_DosStream *object = (struct xattr_DosStream *)pytalloc_get_ptr(obj);
    2527             :         PyObject *py_size;
    2528           0 :         py_size = PyLong_FromUnsignedLongLong(object->size);
    2529           0 :         return py_size;
    2530             : }
    2531             : 
    2532           0 : static int py_xattr_DosStream_set_size(PyObject *py_obj, PyObject *value, void *closure)
    2533             : {
    2534           0 :         struct xattr_DosStream *object = (struct xattr_DosStream *)pytalloc_get_ptr(py_obj);
    2535           0 :         if (value == NULL) {
    2536           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->size");
    2537           0 :                 return -1;
    2538             :         }
    2539             :         {
    2540           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->size));
    2541           0 :                 if (PyLong_Check(value)) {
    2542             :                         unsigned long long test_var;
    2543           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    2544           0 :                         if (PyErr_Occurred() != NULL) {
    2545           0 :                                 return -1;
    2546             :                         }
    2547           0 :                         if (test_var > uint_max) {
    2548           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    2549             :                                   PyLong_Type.tp_name, uint_max, test_var);
    2550           0 :                                 return -1;
    2551             :                         }
    2552           0 :                         object->size = test_var;
    2553             :                 } else {
    2554           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    2555             :                           PyLong_Type.tp_name);
    2556           0 :                         return -1;
    2557             :                 }
    2558             :         }
    2559           0 :         return 0;
    2560             : }
    2561             : 
    2562           0 : static PyObject *py_xattr_DosStream_get_alloc_size(PyObject *obj, void *closure)
    2563             : {
    2564           0 :         struct xattr_DosStream *object = (struct xattr_DosStream *)pytalloc_get_ptr(obj);
    2565             :         PyObject *py_alloc_size;
    2566           0 :         py_alloc_size = PyLong_FromUnsignedLongLong(object->alloc_size);
    2567           0 :         return py_alloc_size;
    2568             : }
    2569             : 
    2570           0 : static int py_xattr_DosStream_set_alloc_size(PyObject *py_obj, PyObject *value, void *closure)
    2571             : {
    2572           0 :         struct xattr_DosStream *object = (struct xattr_DosStream *)pytalloc_get_ptr(py_obj);
    2573           0 :         if (value == NULL) {
    2574           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->alloc_size");
    2575           0 :                 return -1;
    2576             :         }
    2577             :         {
    2578           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->alloc_size));
    2579           0 :                 if (PyLong_Check(value)) {
    2580             :                         unsigned long long test_var;
    2581           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    2582           0 :                         if (PyErr_Occurred() != NULL) {
    2583           0 :                                 return -1;
    2584             :                         }
    2585           0 :                         if (test_var > uint_max) {
    2586           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    2587             :                                   PyLong_Type.tp_name, uint_max, test_var);
    2588           0 :                                 return -1;
    2589             :                         }
    2590           0 :                         object->alloc_size = test_var;
    2591             :                 } else {
    2592           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    2593             :                           PyLong_Type.tp_name);
    2594           0 :                         return -1;
    2595             :                 }
    2596             :         }
    2597           0 :         return 0;
    2598             : }
    2599             : 
    2600           0 : static PyObject *py_xattr_DosStream_get_name(PyObject *obj, void *closure)
    2601             : {
    2602           0 :         struct xattr_DosStream *object = (struct xattr_DosStream *)pytalloc_get_ptr(obj);
    2603             :         PyObject *py_name;
    2604           0 :         py_name = PyString_FromStringOrNULL(object->name);
    2605           0 :         return py_name;
    2606             : }
    2607             : 
    2608           0 : static int py_xattr_DosStream_set_name(PyObject *py_obj, PyObject *value, void *closure)
    2609             : {
    2610           0 :         struct xattr_DosStream *object = (struct xattr_DosStream *)pytalloc_get_ptr(py_obj);
    2611           0 :         if (value == NULL) {
    2612           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->name");
    2613           0 :                 return -1;
    2614             :         }
    2615             :         {
    2616             :                 const char *test_str;
    2617             :                 const char *talloc_str;
    2618           0 :                 PyObject *unicode = NULL;
    2619           0 :                 if (PyUnicode_Check(value)) {
    2620           0 :                         unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
    2621           0 :                         if (unicode == NULL) {
    2622           0 :                                 PyErr_NoMemory();
    2623           0 :                                 return -1;
    2624             :                         }
    2625           0 :                         test_str = PyBytes_AS_STRING(unicode);
    2626           0 :                 } else if (PyBytes_Check(value)) {
    2627           0 :                         test_str = PyBytes_AS_STRING(value);
    2628             :                 } else {
    2629           0 :                         PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
    2630           0 :                         return -1;
    2631             :                 }
    2632           0 :                 talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
    2633           0 :                 if (unicode != NULL) {
    2634           0 :                         Py_DECREF(unicode);
    2635             :                 }
    2636           0 :                 if (talloc_str == NULL) {
    2637           0 :                         PyErr_NoMemory();
    2638           0 :                         return -1;
    2639             :                 }
    2640           0 :                 object->name = talloc_str;
    2641             :         }
    2642           0 :         return 0;
    2643             : }
    2644             : 
    2645             : static PyGetSetDef py_xattr_DosStream_getsetters[] = {
    2646             :         {
    2647             :                 .name = discard_const_p(char, "flags"),
    2648             :                 .get = py_xattr_DosStream_get_flags,
    2649             :                 .set = py_xattr_DosStream_set_flags,
    2650             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    2651             :         },
    2652             :         {
    2653             :                 .name = discard_const_p(char, "size"),
    2654             :                 .get = py_xattr_DosStream_get_size,
    2655             :                 .set = py_xattr_DosStream_set_size,
    2656             :                 .doc = discard_const_p(char, "PIDL-generated element of base type udlong")
    2657             :         },
    2658             :         {
    2659             :                 .name = discard_const_p(char, "alloc_size"),
    2660             :                 .get = py_xattr_DosStream_get_alloc_size,
    2661             :                 .set = py_xattr_DosStream_set_alloc_size,
    2662             :                 .doc = discard_const_p(char, "PIDL-generated element of base type udlong")
    2663             :         },
    2664             :         {
    2665             :                 .name = discard_const_p(char, "name"),
    2666             :                 .get = py_xattr_DosStream_get_name,
    2667             :                 .set = py_xattr_DosStream_set_name,
    2668             :                 .doc = discard_const_p(char, "PIDL-generated element of base type string")
    2669             :         },
    2670             :         { .name = NULL }
    2671             : };
    2672             : 
    2673           0 : static PyObject *py_xattr_DosStream_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    2674             : {
    2675           0 :         return pytalloc_new(struct xattr_DosStream, type);
    2676             : }
    2677             : 
    2678             : 
    2679             : static PyTypeObject xattr_DosStream_Type = {
    2680             :         PyVarObject_HEAD_INIT(NULL, 0)
    2681             :         .tp_name = "xattr.DosStream",
    2682             :         .tp_getset = py_xattr_DosStream_getsetters,
    2683             :         .tp_methods = NULL,
    2684             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    2685             :         .tp_new = py_xattr_DosStream_new,
    2686             : };
    2687             : 
    2688             : 
    2689           0 : static PyObject *py_xattr_DosStreams_get_num_streams(PyObject *obj, void *closure)
    2690             : {
    2691           0 :         struct xattr_DosStreams *object = (struct xattr_DosStreams *)pytalloc_get_ptr(obj);
    2692             :         PyObject *py_num_streams;
    2693           0 :         py_num_streams = PyLong_FromUnsignedLongLong((uint32_t)object->num_streams);
    2694           0 :         return py_num_streams;
    2695             : }
    2696             : 
    2697           0 : static int py_xattr_DosStreams_set_num_streams(PyObject *py_obj, PyObject *value, void *closure)
    2698             : {
    2699           0 :         struct xattr_DosStreams *object = (struct xattr_DosStreams *)pytalloc_get_ptr(py_obj);
    2700           0 :         if (value == NULL) {
    2701           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->num_streams");
    2702           0 :                 return -1;
    2703             :         }
    2704             :         {
    2705           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->num_streams));
    2706           0 :                 if (PyLong_Check(value)) {
    2707             :                         unsigned long long test_var;
    2708           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    2709           0 :                         if (PyErr_Occurred() != NULL) {
    2710           0 :                                 return -1;
    2711             :                         }
    2712           0 :                         if (test_var > uint_max) {
    2713           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    2714             :                                   PyLong_Type.tp_name, uint_max, test_var);
    2715           0 :                                 return -1;
    2716             :                         }
    2717           0 :                         object->num_streams = test_var;
    2718             :                 } else {
    2719           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    2720             :                           PyLong_Type.tp_name);
    2721           0 :                         return -1;
    2722             :                 }
    2723             :         }
    2724           0 :         return 0;
    2725             : }
    2726             : 
    2727           0 : static PyObject *py_xattr_DosStreams_get_streams(PyObject *obj, void *closure)
    2728             : {
    2729           0 :         struct xattr_DosStreams *object = (struct xattr_DosStreams *)pytalloc_get_ptr(obj);
    2730             :         PyObject *py_streams;
    2731           0 :         if (object->streams == NULL) {
    2732           0 :                 Py_RETURN_NONE;
    2733             :         }
    2734           0 :         if (object->streams == NULL) {
    2735           0 :                 py_streams = Py_None;
    2736           0 :                 Py_INCREF(py_streams);
    2737             :         } else {
    2738           0 :                 py_streams = PyList_New(object->num_streams);
    2739           0 :                 if (py_streams == NULL) {
    2740           0 :                         return NULL;
    2741             :                 }
    2742             :                 {
    2743             :                         int streams_cntr_1;
    2744           0 :                         for (streams_cntr_1 = 0; streams_cntr_1 < (object->num_streams); streams_cntr_1++) {
    2745             :                                 PyObject *py_streams_1;
    2746           0 :                                 py_streams_1 = pytalloc_reference_ex(&xattr_DosStream_Type, object->streams, &object->streams[streams_cntr_1]);
    2747           0 :                                 PyList_SetItem(py_streams, streams_cntr_1, py_streams_1);
    2748             :                         }
    2749             :                 }
    2750             :         }
    2751           0 :         return py_streams;
    2752             : }
    2753             : 
    2754           0 : static int py_xattr_DosStreams_set_streams(PyObject *py_obj, PyObject *value, void *closure)
    2755             : {
    2756           0 :         struct xattr_DosStreams *object = (struct xattr_DosStreams *)pytalloc_get_ptr(py_obj);
    2757           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->streams));
    2758           0 :         if (value == NULL) {
    2759           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->streams");
    2760           0 :                 return -1;
    2761             :         }
    2762           0 :         if (value == Py_None) {
    2763           0 :                 object->streams = NULL;
    2764             :         } else {
    2765           0 :                 object->streams = NULL;
    2766           0 :                 PY_CHECK_TYPE(&PyList_Type, value, return -1;);
    2767             :                 {
    2768             :                         int streams_cntr_1;
    2769           0 :                         object->streams = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->streams, PyList_GET_SIZE(value));
    2770           0 :                         if (!object->streams) { return -1;; }
    2771           0 :                         talloc_set_name_const(object->streams, "ARRAY: object->streams");
    2772           0 :                         for (streams_cntr_1 = 0; streams_cntr_1 < PyList_GET_SIZE(value); streams_cntr_1++) {
    2773           0 :                                 if (PyList_GET_ITEM(value, streams_cntr_1) == NULL) {
    2774           0 :                                         PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->streams[streams_cntr_1]");
    2775           0 :                                         return -1;
    2776             :                                 }
    2777           0 :                                 PY_CHECK_TYPE(&xattr_DosStream_Type, PyList_GET_ITEM(value, streams_cntr_1), return -1;);
    2778           0 :                                 if (talloc_reference(object->streams, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, streams_cntr_1))) == NULL) {
    2779           0 :                                         PyErr_NoMemory();
    2780           0 :                                         return -1;
    2781             :                                 }
    2782           0 :                                 object->streams[streams_cntr_1] = *(struct xattr_DosStream *)pytalloc_get_ptr(PyList_GET_ITEM(value, streams_cntr_1));
    2783             :                         }
    2784             :                 }
    2785             :         }
    2786           0 :         return 0;
    2787             : }
    2788             : 
    2789             : static PyGetSetDef py_xattr_DosStreams_getsetters[] = {
    2790             :         {
    2791             :                 .name = discard_const_p(char, "num_streams"),
    2792             :                 .get = py_xattr_DosStreams_get_num_streams,
    2793             :                 .set = py_xattr_DosStreams_set_num_streams,
    2794             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    2795             :         },
    2796             :         {
    2797             :                 .name = discard_const_p(char, "streams"),
    2798             :                 .get = py_xattr_DosStreams_get_streams,
    2799             :                 .set = py_xattr_DosStreams_set_streams,
    2800             :                 .doc = discard_const_p(char, "PIDL-generated element of base type xattr_DosStream")
    2801             :         },
    2802             :         { .name = NULL }
    2803             : };
    2804             : 
    2805           0 : static PyObject *py_xattr_DosStreams_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    2806             : {
    2807           0 :         return pytalloc_new(struct xattr_DosStreams, type);
    2808             : }
    2809             : 
    2810           0 : static PyObject *py_xattr_DosStreams_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
    2811             : {
    2812           0 :         struct xattr_DosStreams *object = (struct xattr_DosStreams *)pytalloc_get_ptr(py_obj);
    2813           0 :         PyObject *ret = NULL;
    2814             :         DATA_BLOB blob;
    2815             :         enum ndr_err_code err;
    2816           0 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
    2817           0 :         if (tmp_ctx == NULL) {
    2818           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    2819           0 :                 return NULL;
    2820             :         }
    2821           0 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_xattr_DosStreams);
    2822           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    2823           0 :                 TALLOC_FREE(tmp_ctx);
    2824           0 :                 PyErr_SetNdrError(err);
    2825           0 :                 return NULL;
    2826             :         }
    2827             : 
    2828           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    2829           0 :         TALLOC_FREE(tmp_ctx);
    2830           0 :         return ret;
    2831             : }
    2832             : 
    2833           0 : static PyObject *py_xattr_DosStreams_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    2834             : {
    2835           0 :         struct xattr_DosStreams *object = (struct xattr_DosStreams *)pytalloc_get_ptr(py_obj);
    2836           0 :         DATA_BLOB blob = {.data = NULL, .length = 0};
    2837           0 :         Py_ssize_t blob_length = 0;
    2838             :         enum ndr_err_code err;
    2839           0 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
    2840           0 :         PyObject *allow_remaining_obj = NULL;
    2841           0 :         bool allow_remaining = false;
    2842             : 
    2843           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
    2844             :                 discard_const_p(char *, kwnames),
    2845             :                 &blob.data, &blob_length,
    2846             :                 &allow_remaining_obj)) {
    2847           0 :                 return NULL;
    2848             :         }
    2849           0 :         blob.length = blob_length;
    2850             : 
    2851           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    2852           0 :                 allow_remaining = true;
    2853             :         }
    2854             : 
    2855           0 :         if (allow_remaining) {
    2856           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_xattr_DosStreams);
    2857             :         } else {
    2858           0 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_xattr_DosStreams);
    2859             :         }
    2860           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    2861           0 :                 PyErr_SetNdrError(err);
    2862           0 :                 return NULL;
    2863             :         }
    2864             : 
    2865           0 :         Py_RETURN_NONE;
    2866             : }
    2867             : 
    2868           0 : static PyObject *py_xattr_DosStreams_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    2869             : {
    2870           0 :         struct xattr_DosStreams *object = (struct xattr_DosStreams *)pytalloc_get_ptr(py_obj);
    2871             :         PyObject *ret;
    2872             :         char *retstr;
    2873             : 
    2874           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_xattr_DosStreams, "xattr_DosStreams", object);
    2875           0 :         ret = PyUnicode_FromString(retstr);
    2876           0 :         talloc_free(retstr);
    2877             : 
    2878           0 :         return ret;
    2879             : }
    2880             : 
    2881             : static PyMethodDef py_xattr_DosStreams_methods[] = {
    2882             :         { "__ndr_pack__", (PyCFunction)py_xattr_DosStreams_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
    2883             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_xattr_DosStreams_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
    2884             :         { "__ndr_print__", (PyCFunction)py_xattr_DosStreams_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
    2885             :         { NULL, NULL, 0, NULL }
    2886             : };
    2887             : 
    2888             : 
    2889             : static PyTypeObject xattr_DosStreams_Type = {
    2890             :         PyVarObject_HEAD_INIT(NULL, 0)
    2891             :         .tp_name = "xattr.DosStreams",
    2892             :         .tp_getset = py_xattr_DosStreams_getsetters,
    2893             :         .tp_methods = py_xattr_DosStreams_methods,
    2894             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    2895             :         .tp_new = py_xattr_DosStreams_new,
    2896             : };
    2897             : 
    2898             : 
    2899           0 : static PyObject *py_security_descriptor_hash_v2_get_sd(PyObject *obj, void *closure)
    2900             : {
    2901           0 :         struct security_descriptor_hash_v2 *object = (struct security_descriptor_hash_v2 *)pytalloc_get_ptr(obj);
    2902             :         PyObject *py_sd;
    2903           0 :         if (object->sd == NULL) {
    2904           0 :                 Py_RETURN_NONE;
    2905             :         }
    2906           0 :         if (object->sd == NULL) {
    2907           0 :                 py_sd = Py_None;
    2908           0 :                 Py_INCREF(py_sd);
    2909             :         } else {
    2910           0 :                 py_sd = pytalloc_reference_ex(security_descriptor_Type, object->sd, object->sd);
    2911             :         }
    2912           0 :         return py_sd;
    2913             : }
    2914             : 
    2915           0 : static int py_security_descriptor_hash_v2_set_sd(PyObject *py_obj, PyObject *value, void *closure)
    2916             : {
    2917           0 :         struct security_descriptor_hash_v2 *object = (struct security_descriptor_hash_v2 *)pytalloc_get_ptr(py_obj);
    2918           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->sd));
    2919           0 :         if (value == NULL) {
    2920           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->sd");
    2921           0 :                 return -1;
    2922             :         }
    2923           0 :         if (value == Py_None) {
    2924           0 :                 object->sd = NULL;
    2925             :         } else {
    2926           0 :                 object->sd = NULL;
    2927           0 :                 PY_CHECK_TYPE(security_descriptor_Type, value, return -1;);
    2928           0 :                 if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
    2929           0 :                         PyErr_NoMemory();
    2930           0 :                         return -1;
    2931             :                 }
    2932           0 :                 object->sd = (struct security_descriptor *)pytalloc_get_ptr(value);
    2933             :         }
    2934           0 :         return 0;
    2935             : }
    2936             : 
    2937           0 : static PyObject *py_security_descriptor_hash_v2_get_hash(PyObject *obj, void *closure)
    2938             : {
    2939           0 :         struct security_descriptor_hash_v2 *object = (struct security_descriptor_hash_v2 *)pytalloc_get_ptr(obj);
    2940             :         PyObject *py_hash;
    2941           0 :         py_hash = PyList_New(16);
    2942           0 :         if (py_hash == NULL) {
    2943           0 :                 return NULL;
    2944             :         }
    2945             :         {
    2946             :                 int hash_cntr_0;
    2947           0 :                 for (hash_cntr_0 = 0; hash_cntr_0 < (16); hash_cntr_0++) {
    2948             :                         PyObject *py_hash_0;
    2949           0 :                         py_hash_0 = PyLong_FromLong((uint16_t)object->hash[hash_cntr_0]);
    2950           0 :                         PyList_SetItem(py_hash, hash_cntr_0, py_hash_0);
    2951             :                 }
    2952             :         }
    2953           0 :         return py_hash;
    2954             : }
    2955             : 
    2956           0 : static int py_security_descriptor_hash_v2_set_hash(PyObject *py_obj, PyObject *value, void *closure)
    2957             : {
    2958           0 :         struct security_descriptor_hash_v2 *object = (struct security_descriptor_hash_v2 *)pytalloc_get_ptr(py_obj);
    2959           0 :         if (value == NULL) {
    2960           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->hash");
    2961           0 :                 return -1;
    2962             :         }
    2963           0 :         PY_CHECK_TYPE(&PyList_Type, value, return -1;);
    2964             :         {
    2965             :                 int hash_cntr_0;
    2966           0 :                 if (ARRAY_SIZE(object->hash) != PyList_GET_SIZE(value)) {
    2967           0 :                         PyErr_Format(PyExc_TypeError, "Expected list of type %s, length %zu, got %zd", Py_TYPE(value)->tp_name, ARRAY_SIZE(object->hash),  PyList_GET_SIZE(value));
    2968           0 :                         return -1;
    2969             :                 }
    2970           0 :                 for (hash_cntr_0 = 0; hash_cntr_0 < PyList_GET_SIZE(value); hash_cntr_0++) {
    2971           0 :                         if (PyList_GET_ITEM(value, hash_cntr_0) == NULL) {
    2972           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->hash[hash_cntr_0]");
    2973           0 :                                 return -1;
    2974             :                         }
    2975             :                         {
    2976           0 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->hash[hash_cntr_0]));
    2977           0 :                                 if (PyLong_Check(PyList_GET_ITEM(value, hash_cntr_0))) {
    2978             :                                         unsigned long long test_var;
    2979           0 :                                         test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, hash_cntr_0));
    2980           0 :                                         if (PyErr_Occurred() != NULL) {
    2981           0 :                                                 return -1;
    2982             :                                         }
    2983           0 :                                         if (test_var > uint_max) {
    2984           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    2985             :                                                   PyLong_Type.tp_name, uint_max, test_var);
    2986           0 :                                                 return -1;
    2987             :                                         }
    2988           0 :                                         object->hash[hash_cntr_0] = test_var;
    2989             :                                 } else {
    2990           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    2991             :                                           PyLong_Type.tp_name);
    2992           0 :                                         return -1;
    2993             :                                 }
    2994             :                         }
    2995             :                 }
    2996             :         }
    2997           0 :         return 0;
    2998             : }
    2999             : 
    3000             : static PyGetSetDef py_security_descriptor_hash_v2_getsetters[] = {
    3001             :         {
    3002             :                 .name = discard_const_p(char, "sd"),
    3003             :                 .get = py_security_descriptor_hash_v2_get_sd,
    3004             :                 .set = py_security_descriptor_hash_v2_set_sd,
    3005             :                 .doc = discard_const_p(char, "PIDL-generated element of base type security_descriptor")
    3006             :         },
    3007             :         {
    3008             :                 .name = discard_const_p(char, "hash"),
    3009             :                 .get = py_security_descriptor_hash_v2_get_hash,
    3010             :                 .set = py_security_descriptor_hash_v2_set_hash,
    3011             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
    3012             :         },
    3013             :         { .name = NULL }
    3014             : };
    3015             : 
    3016           0 : static PyObject *py_security_descriptor_hash_v2_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    3017             : {
    3018           0 :         return pytalloc_new(struct security_descriptor_hash_v2, type);
    3019             : }
    3020             : 
    3021           0 : static PyObject *py_security_descriptor_hash_v2_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
    3022             : {
    3023           0 :         struct security_descriptor_hash_v2 *object = (struct security_descriptor_hash_v2 *)pytalloc_get_ptr(py_obj);
    3024           0 :         PyObject *ret = NULL;
    3025             :         DATA_BLOB blob;
    3026             :         enum ndr_err_code err;
    3027           0 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
    3028           0 :         if (tmp_ctx == NULL) {
    3029           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    3030           0 :                 return NULL;
    3031             :         }
    3032           0 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_security_descriptor_hash_v2);
    3033           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    3034           0 :                 TALLOC_FREE(tmp_ctx);
    3035           0 :                 PyErr_SetNdrError(err);
    3036           0 :                 return NULL;
    3037             :         }
    3038             : 
    3039           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    3040           0 :         TALLOC_FREE(tmp_ctx);
    3041           0 :         return ret;
    3042             : }
    3043             : 
    3044           0 : static PyObject *py_security_descriptor_hash_v2_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    3045             : {
    3046           0 :         struct security_descriptor_hash_v2 *object = (struct security_descriptor_hash_v2 *)pytalloc_get_ptr(py_obj);
    3047           0 :         DATA_BLOB blob = {.data = NULL, .length = 0};
    3048           0 :         Py_ssize_t blob_length = 0;
    3049             :         enum ndr_err_code err;
    3050           0 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
    3051           0 :         PyObject *allow_remaining_obj = NULL;
    3052           0 :         bool allow_remaining = false;
    3053             : 
    3054           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
    3055             :                 discard_const_p(char *, kwnames),
    3056             :                 &blob.data, &blob_length,
    3057             :                 &allow_remaining_obj)) {
    3058           0 :                 return NULL;
    3059             :         }
    3060           0 :         blob.length = blob_length;
    3061             : 
    3062           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    3063           0 :                 allow_remaining = true;
    3064             :         }
    3065             : 
    3066           0 :         if (allow_remaining) {
    3067           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_security_descriptor_hash_v2);
    3068             :         } else {
    3069           0 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_security_descriptor_hash_v2);
    3070             :         }
    3071           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    3072           0 :                 PyErr_SetNdrError(err);
    3073           0 :                 return NULL;
    3074             :         }
    3075             : 
    3076           0 :         Py_RETURN_NONE;
    3077             : }
    3078             : 
    3079           0 : static PyObject *py_security_descriptor_hash_v2_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    3080             : {
    3081           0 :         struct security_descriptor_hash_v2 *object = (struct security_descriptor_hash_v2 *)pytalloc_get_ptr(py_obj);
    3082             :         PyObject *ret;
    3083             :         char *retstr;
    3084             : 
    3085           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_security_descriptor_hash_v2, "security_descriptor_hash_v2", object);
    3086           0 :         ret = PyUnicode_FromString(retstr);
    3087           0 :         talloc_free(retstr);
    3088             : 
    3089           0 :         return ret;
    3090             : }
    3091             : 
    3092             : static PyMethodDef py_security_descriptor_hash_v2_methods[] = {
    3093             :         { "__ndr_pack__", (PyCFunction)py_security_descriptor_hash_v2_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
    3094             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_security_descriptor_hash_v2_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
    3095             :         { "__ndr_print__", (PyCFunction)py_security_descriptor_hash_v2_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
    3096             :         { NULL, NULL, 0, NULL }
    3097             : };
    3098             : 
    3099             : 
    3100             : static PyTypeObject security_descriptor_hash_v2_Type = {
    3101             :         PyVarObject_HEAD_INIT(NULL, 0)
    3102             :         .tp_name = "xattr.security_descriptor_hash_v2",
    3103             :         .tp_getset = py_security_descriptor_hash_v2_getsetters,
    3104             :         .tp_methods = py_security_descriptor_hash_v2_methods,
    3105             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    3106             :         .tp_new = py_security_descriptor_hash_v2_new,
    3107             : };
    3108             : 
    3109             : 
    3110           0 : static PyObject *py_security_descriptor_hash_v3_get_sd(PyObject *obj, void *closure)
    3111             : {
    3112           0 :         struct security_descriptor_hash_v3 *object = (struct security_descriptor_hash_v3 *)pytalloc_get_ptr(obj);
    3113             :         PyObject *py_sd;
    3114           0 :         if (object->sd == NULL) {
    3115           0 :                 Py_RETURN_NONE;
    3116             :         }
    3117           0 :         if (object->sd == NULL) {
    3118           0 :                 py_sd = Py_None;
    3119           0 :                 Py_INCREF(py_sd);
    3120             :         } else {
    3121           0 :                 py_sd = pytalloc_reference_ex(security_descriptor_Type, object->sd, object->sd);
    3122             :         }
    3123           0 :         return py_sd;
    3124             : }
    3125             : 
    3126           0 : static int py_security_descriptor_hash_v3_set_sd(PyObject *py_obj, PyObject *value, void *closure)
    3127             : {
    3128           0 :         struct security_descriptor_hash_v3 *object = (struct security_descriptor_hash_v3 *)pytalloc_get_ptr(py_obj);
    3129           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->sd));
    3130           0 :         if (value == NULL) {
    3131           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->sd");
    3132           0 :                 return -1;
    3133             :         }
    3134           0 :         if (value == Py_None) {
    3135           0 :                 object->sd = NULL;
    3136             :         } else {
    3137           0 :                 object->sd = NULL;
    3138           0 :                 PY_CHECK_TYPE(security_descriptor_Type, value, return -1;);
    3139           0 :                 if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
    3140           0 :                         PyErr_NoMemory();
    3141           0 :                         return -1;
    3142             :                 }
    3143           0 :                 object->sd = (struct security_descriptor *)pytalloc_get_ptr(value);
    3144             :         }
    3145           0 :         return 0;
    3146             : }
    3147             : 
    3148           0 : static PyObject *py_security_descriptor_hash_v3_get_hash_type(PyObject *obj, void *closure)
    3149             : {
    3150           0 :         struct security_descriptor_hash_v3 *object = (struct security_descriptor_hash_v3 *)pytalloc_get_ptr(obj);
    3151             :         PyObject *py_hash_type;
    3152           0 :         py_hash_type = PyLong_FromLong((uint16_t)object->hash_type);
    3153           0 :         return py_hash_type;
    3154             : }
    3155             : 
    3156           0 : static int py_security_descriptor_hash_v3_set_hash_type(PyObject *py_obj, PyObject *value, void *closure)
    3157             : {
    3158           0 :         struct security_descriptor_hash_v3 *object = (struct security_descriptor_hash_v3 *)pytalloc_get_ptr(py_obj);
    3159           0 :         if (value == NULL) {
    3160           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->hash_type");
    3161           0 :                 return -1;
    3162             :         }
    3163             :         {
    3164           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->hash_type));
    3165           0 :                 if (PyLong_Check(value)) {
    3166             :                         unsigned long long test_var;
    3167           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    3168           0 :                         if (PyErr_Occurred() != NULL) {
    3169           0 :                                 return -1;
    3170             :                         }
    3171           0 :                         if (test_var > uint_max) {
    3172           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    3173             :                                   PyLong_Type.tp_name, uint_max, test_var);
    3174           0 :                                 return -1;
    3175             :                         }
    3176           0 :                         object->hash_type = test_var;
    3177             :                 } else {
    3178           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    3179             :                           PyLong_Type.tp_name);
    3180           0 :                         return -1;
    3181             :                 }
    3182             :         }
    3183           0 :         return 0;
    3184             : }
    3185             : 
    3186           0 : static PyObject *py_security_descriptor_hash_v3_get_hash(PyObject *obj, void *closure)
    3187             : {
    3188           0 :         struct security_descriptor_hash_v3 *object = (struct security_descriptor_hash_v3 *)pytalloc_get_ptr(obj);
    3189             :         PyObject *py_hash;
    3190           0 :         py_hash = PyList_New(64);
    3191           0 :         if (py_hash == NULL) {
    3192           0 :                 return NULL;
    3193             :         }
    3194             :         {
    3195             :                 int hash_cntr_0;
    3196           0 :                 for (hash_cntr_0 = 0; hash_cntr_0 < (64); hash_cntr_0++) {
    3197             :                         PyObject *py_hash_0;
    3198           0 :                         py_hash_0 = PyLong_FromLong((uint16_t)object->hash[hash_cntr_0]);
    3199           0 :                         PyList_SetItem(py_hash, hash_cntr_0, py_hash_0);
    3200             :                 }
    3201             :         }
    3202           0 :         return py_hash;
    3203             : }
    3204             : 
    3205           0 : static int py_security_descriptor_hash_v3_set_hash(PyObject *py_obj, PyObject *value, void *closure)
    3206             : {
    3207           0 :         struct security_descriptor_hash_v3 *object = (struct security_descriptor_hash_v3 *)pytalloc_get_ptr(py_obj);
    3208           0 :         if (value == NULL) {
    3209           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->hash");
    3210           0 :                 return -1;
    3211             :         }
    3212           0 :         PY_CHECK_TYPE(&PyList_Type, value, return -1;);
    3213             :         {
    3214             :                 int hash_cntr_0;
    3215           0 :                 if (ARRAY_SIZE(object->hash) != PyList_GET_SIZE(value)) {
    3216           0 :                         PyErr_Format(PyExc_TypeError, "Expected list of type %s, length %zu, got %zd", Py_TYPE(value)->tp_name, ARRAY_SIZE(object->hash),  PyList_GET_SIZE(value));
    3217           0 :                         return -1;
    3218             :                 }
    3219           0 :                 for (hash_cntr_0 = 0; hash_cntr_0 < PyList_GET_SIZE(value); hash_cntr_0++) {
    3220           0 :                         if (PyList_GET_ITEM(value, hash_cntr_0) == NULL) {
    3221           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->hash[hash_cntr_0]");
    3222           0 :                                 return -1;
    3223             :                         }
    3224             :                         {
    3225           0 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->hash[hash_cntr_0]));
    3226           0 :                                 if (PyLong_Check(PyList_GET_ITEM(value, hash_cntr_0))) {
    3227             :                                         unsigned long long test_var;
    3228           0 :                                         test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, hash_cntr_0));
    3229           0 :                                         if (PyErr_Occurred() != NULL) {
    3230           0 :                                                 return -1;
    3231             :                                         }
    3232           0 :                                         if (test_var > uint_max) {
    3233           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    3234             :                                                   PyLong_Type.tp_name, uint_max, test_var);
    3235           0 :                                                 return -1;
    3236             :                                         }
    3237           0 :                                         object->hash[hash_cntr_0] = test_var;
    3238             :                                 } else {
    3239           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    3240             :                                           PyLong_Type.tp_name);
    3241           0 :                                         return -1;
    3242             :                                 }
    3243             :                         }
    3244             :                 }
    3245             :         }
    3246           0 :         return 0;
    3247             : }
    3248             : 
    3249             : static PyGetSetDef py_security_descriptor_hash_v3_getsetters[] = {
    3250             :         {
    3251             :                 .name = discard_const_p(char, "sd"),
    3252             :                 .get = py_security_descriptor_hash_v3_get_sd,
    3253             :                 .set = py_security_descriptor_hash_v3_set_sd,
    3254             :                 .doc = discard_const_p(char, "PIDL-generated element of base type security_descriptor")
    3255             :         },
    3256             :         {
    3257             :                 .name = discard_const_p(char, "hash_type"),
    3258             :                 .get = py_security_descriptor_hash_v3_get_hash_type,
    3259             :                 .set = py_security_descriptor_hash_v3_set_hash_type,
    3260             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
    3261             :         },
    3262             :         {
    3263             :                 .name = discard_const_p(char, "hash"),
    3264             :                 .get = py_security_descriptor_hash_v3_get_hash,
    3265             :                 .set = py_security_descriptor_hash_v3_set_hash,
    3266             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
    3267             :         },
    3268             :         { .name = NULL }
    3269             : };
    3270             : 
    3271           0 : static PyObject *py_security_descriptor_hash_v3_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    3272             : {
    3273           0 :         return pytalloc_new(struct security_descriptor_hash_v3, type);
    3274             : }
    3275             : 
    3276           0 : static PyObject *py_security_descriptor_hash_v3_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
    3277             : {
    3278           0 :         struct security_descriptor_hash_v3 *object = (struct security_descriptor_hash_v3 *)pytalloc_get_ptr(py_obj);
    3279           0 :         PyObject *ret = NULL;
    3280             :         DATA_BLOB blob;
    3281             :         enum ndr_err_code err;
    3282           0 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
    3283           0 :         if (tmp_ctx == NULL) {
    3284           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    3285           0 :                 return NULL;
    3286             :         }
    3287           0 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_security_descriptor_hash_v3);
    3288           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    3289           0 :                 TALLOC_FREE(tmp_ctx);
    3290           0 :                 PyErr_SetNdrError(err);
    3291           0 :                 return NULL;
    3292             :         }
    3293             : 
    3294           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    3295           0 :         TALLOC_FREE(tmp_ctx);
    3296           0 :         return ret;
    3297             : }
    3298             : 
    3299           0 : static PyObject *py_security_descriptor_hash_v3_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    3300             : {
    3301           0 :         struct security_descriptor_hash_v3 *object = (struct security_descriptor_hash_v3 *)pytalloc_get_ptr(py_obj);
    3302           0 :         DATA_BLOB blob = {.data = NULL, .length = 0};
    3303           0 :         Py_ssize_t blob_length = 0;
    3304             :         enum ndr_err_code err;
    3305           0 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
    3306           0 :         PyObject *allow_remaining_obj = NULL;
    3307           0 :         bool allow_remaining = false;
    3308             : 
    3309           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
    3310             :                 discard_const_p(char *, kwnames),
    3311             :                 &blob.data, &blob_length,
    3312             :                 &allow_remaining_obj)) {
    3313           0 :                 return NULL;
    3314             :         }
    3315           0 :         blob.length = blob_length;
    3316             : 
    3317           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    3318           0 :                 allow_remaining = true;
    3319             :         }
    3320             : 
    3321           0 :         if (allow_remaining) {
    3322           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_security_descriptor_hash_v3);
    3323             :         } else {
    3324           0 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_security_descriptor_hash_v3);
    3325             :         }
    3326           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    3327           0 :                 PyErr_SetNdrError(err);
    3328           0 :                 return NULL;
    3329             :         }
    3330             : 
    3331           0 :         Py_RETURN_NONE;
    3332             : }
    3333             : 
    3334           0 : static PyObject *py_security_descriptor_hash_v3_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    3335             : {
    3336           0 :         struct security_descriptor_hash_v3 *object = (struct security_descriptor_hash_v3 *)pytalloc_get_ptr(py_obj);
    3337             :         PyObject *ret;
    3338             :         char *retstr;
    3339             : 
    3340           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_security_descriptor_hash_v3, "security_descriptor_hash_v3", object);
    3341           0 :         ret = PyUnicode_FromString(retstr);
    3342           0 :         talloc_free(retstr);
    3343             : 
    3344           0 :         return ret;
    3345             : }
    3346             : 
    3347             : static PyMethodDef py_security_descriptor_hash_v3_methods[] = {
    3348             :         { "__ndr_pack__", (PyCFunction)py_security_descriptor_hash_v3_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
    3349             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_security_descriptor_hash_v3_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
    3350             :         { "__ndr_print__", (PyCFunction)py_security_descriptor_hash_v3_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
    3351             :         { NULL, NULL, 0, NULL }
    3352             : };
    3353             : 
    3354             : 
    3355             : static PyTypeObject security_descriptor_hash_v3_Type = {
    3356             :         PyVarObject_HEAD_INIT(NULL, 0)
    3357             :         .tp_name = "xattr.security_descriptor_hash_v3",
    3358             :         .tp_getset = py_security_descriptor_hash_v3_getsetters,
    3359             :         .tp_methods = py_security_descriptor_hash_v3_methods,
    3360             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    3361             :         .tp_new = py_security_descriptor_hash_v3_new,
    3362             : };
    3363             : 
    3364             : 
    3365         105 : static PyObject *py_security_descriptor_hash_v4_get_sd(PyObject *obj, void *closure)
    3366             : {
    3367         105 :         struct security_descriptor_hash_v4 *object = (struct security_descriptor_hash_v4 *)pytalloc_get_ptr(obj);
    3368             :         PyObject *py_sd;
    3369         105 :         if (object->sd == NULL) {
    3370           0 :                 Py_RETURN_NONE;
    3371             :         }
    3372         105 :         if (object->sd == NULL) {
    3373           0 :                 py_sd = Py_None;
    3374           0 :                 Py_INCREF(py_sd);
    3375             :         } else {
    3376         105 :                 py_sd = pytalloc_reference_ex(security_descriptor_Type, object->sd, object->sd);
    3377             :         }
    3378         105 :         return py_sd;
    3379             : }
    3380             : 
    3381           0 : static int py_security_descriptor_hash_v4_set_sd(PyObject *py_obj, PyObject *value, void *closure)
    3382             : {
    3383           0 :         struct security_descriptor_hash_v4 *object = (struct security_descriptor_hash_v4 *)pytalloc_get_ptr(py_obj);
    3384           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->sd));
    3385           0 :         if (value == NULL) {
    3386           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->sd");
    3387           0 :                 return -1;
    3388             :         }
    3389           0 :         if (value == Py_None) {
    3390           0 :                 object->sd = NULL;
    3391             :         } else {
    3392           0 :                 object->sd = NULL;
    3393           0 :                 PY_CHECK_TYPE(security_descriptor_Type, value, return -1;);
    3394           0 :                 if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
    3395           0 :                         PyErr_NoMemory();
    3396           0 :                         return -1;
    3397             :                 }
    3398           0 :                 object->sd = (struct security_descriptor *)pytalloc_get_ptr(value);
    3399             :         }
    3400           0 :         return 0;
    3401             : }
    3402             : 
    3403           0 : static PyObject *py_security_descriptor_hash_v4_get_hash_type(PyObject *obj, void *closure)
    3404             : {
    3405           0 :         struct security_descriptor_hash_v4 *object = (struct security_descriptor_hash_v4 *)pytalloc_get_ptr(obj);
    3406             :         PyObject *py_hash_type;
    3407           0 :         py_hash_type = PyLong_FromLong((uint16_t)object->hash_type);
    3408           0 :         return py_hash_type;
    3409             : }
    3410             : 
    3411           0 : static int py_security_descriptor_hash_v4_set_hash_type(PyObject *py_obj, PyObject *value, void *closure)
    3412             : {
    3413           0 :         struct security_descriptor_hash_v4 *object = (struct security_descriptor_hash_v4 *)pytalloc_get_ptr(py_obj);
    3414           0 :         if (value == NULL) {
    3415           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->hash_type");
    3416           0 :                 return -1;
    3417             :         }
    3418             :         {
    3419           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->hash_type));
    3420           0 :                 if (PyLong_Check(value)) {
    3421             :                         unsigned long long test_var;
    3422           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    3423           0 :                         if (PyErr_Occurred() != NULL) {
    3424           0 :                                 return -1;
    3425             :                         }
    3426           0 :                         if (test_var > uint_max) {
    3427           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    3428             :                                   PyLong_Type.tp_name, uint_max, test_var);
    3429           0 :                                 return -1;
    3430             :                         }
    3431           0 :                         object->hash_type = test_var;
    3432             :                 } else {
    3433           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    3434             :                           PyLong_Type.tp_name);
    3435           0 :                         return -1;
    3436             :                 }
    3437             :         }
    3438           0 :         return 0;
    3439             : }
    3440             : 
    3441           0 : static PyObject *py_security_descriptor_hash_v4_get_hash(PyObject *obj, void *closure)
    3442             : {
    3443           0 :         struct security_descriptor_hash_v4 *object = (struct security_descriptor_hash_v4 *)pytalloc_get_ptr(obj);
    3444             :         PyObject *py_hash;
    3445           0 :         py_hash = PyList_New(64);
    3446           0 :         if (py_hash == NULL) {
    3447           0 :                 return NULL;
    3448             :         }
    3449             :         {
    3450             :                 int hash_cntr_0;
    3451           0 :                 for (hash_cntr_0 = 0; hash_cntr_0 < (64); hash_cntr_0++) {
    3452             :                         PyObject *py_hash_0;
    3453           0 :                         py_hash_0 = PyLong_FromLong((uint16_t)object->hash[hash_cntr_0]);
    3454           0 :                         PyList_SetItem(py_hash, hash_cntr_0, py_hash_0);
    3455             :                 }
    3456             :         }
    3457           0 :         return py_hash;
    3458             : }
    3459             : 
    3460           0 : static int py_security_descriptor_hash_v4_set_hash(PyObject *py_obj, PyObject *value, void *closure)
    3461             : {
    3462           0 :         struct security_descriptor_hash_v4 *object = (struct security_descriptor_hash_v4 *)pytalloc_get_ptr(py_obj);
    3463           0 :         if (value == NULL) {
    3464           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->hash");
    3465           0 :                 return -1;
    3466             :         }
    3467           0 :         PY_CHECK_TYPE(&PyList_Type, value, return -1;);
    3468             :         {
    3469             :                 int hash_cntr_0;
    3470           0 :                 if (ARRAY_SIZE(object->hash) != PyList_GET_SIZE(value)) {
    3471           0 :                         PyErr_Format(PyExc_TypeError, "Expected list of type %s, length %zu, got %zd", Py_TYPE(value)->tp_name, ARRAY_SIZE(object->hash),  PyList_GET_SIZE(value));
    3472           0 :                         return -1;
    3473             :                 }
    3474           0 :                 for (hash_cntr_0 = 0; hash_cntr_0 < PyList_GET_SIZE(value); hash_cntr_0++) {
    3475           0 :                         if (PyList_GET_ITEM(value, hash_cntr_0) == NULL) {
    3476           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->hash[hash_cntr_0]");
    3477           0 :                                 return -1;
    3478             :                         }
    3479             :                         {
    3480           0 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->hash[hash_cntr_0]));
    3481           0 :                                 if (PyLong_Check(PyList_GET_ITEM(value, hash_cntr_0))) {
    3482             :                                         unsigned long long test_var;
    3483           0 :                                         test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, hash_cntr_0));
    3484           0 :                                         if (PyErr_Occurred() != NULL) {
    3485           0 :                                                 return -1;
    3486             :                                         }
    3487           0 :                                         if (test_var > uint_max) {
    3488           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    3489             :                                                   PyLong_Type.tp_name, uint_max, test_var);
    3490           0 :                                                 return -1;
    3491             :                                         }
    3492           0 :                                         object->hash[hash_cntr_0] = test_var;
    3493             :                                 } else {
    3494           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    3495             :                                           PyLong_Type.tp_name);
    3496           0 :                                         return -1;
    3497             :                                 }
    3498             :                         }
    3499             :                 }
    3500             :         }
    3501           0 :         return 0;
    3502             : }
    3503             : 
    3504           0 : static PyObject *py_security_descriptor_hash_v4_get_description(PyObject *obj, void *closure)
    3505             : {
    3506           0 :         struct security_descriptor_hash_v4 *object = (struct security_descriptor_hash_v4 *)pytalloc_get_ptr(obj);
    3507             :         PyObject *py_description;
    3508           0 :         py_description = PyString_FromStringOrNULL(object->description);
    3509           0 :         return py_description;
    3510             : }
    3511             : 
    3512           0 : static int py_security_descriptor_hash_v4_set_description(PyObject *py_obj, PyObject *value, void *closure)
    3513             : {
    3514           0 :         struct security_descriptor_hash_v4 *object = (struct security_descriptor_hash_v4 *)pytalloc_get_ptr(py_obj);
    3515           0 :         if (value == NULL) {
    3516           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->description");
    3517           0 :                 return -1;
    3518             :         }
    3519             :         {
    3520             :                 const char *test_str;
    3521             :                 const char *talloc_str;
    3522           0 :                 PyObject *unicode = NULL;
    3523           0 :                 if (PyUnicode_Check(value)) {
    3524           0 :                         unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
    3525           0 :                         if (unicode == NULL) {
    3526           0 :                                 PyErr_NoMemory();
    3527           0 :                                 return -1;
    3528             :                         }
    3529           0 :                         test_str = PyBytes_AS_STRING(unicode);
    3530           0 :                 } else if (PyBytes_Check(value)) {
    3531           0 :                         test_str = PyBytes_AS_STRING(value);
    3532             :                 } else {
    3533           0 :                         PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
    3534           0 :                         return -1;
    3535             :                 }
    3536           0 :                 talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
    3537           0 :                 if (unicode != NULL) {
    3538           0 :                         Py_DECREF(unicode);
    3539             :                 }
    3540           0 :                 if (talloc_str == NULL) {
    3541           0 :                         PyErr_NoMemory();
    3542           0 :                         return -1;
    3543             :                 }
    3544           0 :                 object->description = talloc_str;
    3545             :         }
    3546           0 :         return 0;
    3547             : }
    3548             : 
    3549           0 : static PyObject *py_security_descriptor_hash_v4_get_time(PyObject *obj, void *closure)
    3550             : {
    3551           0 :         struct security_descriptor_hash_v4 *object = (struct security_descriptor_hash_v4 *)pytalloc_get_ptr(obj);
    3552             :         PyObject *py_time;
    3553           0 :         py_time = PyLong_FromUnsignedLongLong(object->time);
    3554           0 :         return py_time;
    3555             : }
    3556             : 
    3557           0 : static int py_security_descriptor_hash_v4_set_time(PyObject *py_obj, PyObject *value, void *closure)
    3558             : {
    3559           0 :         struct security_descriptor_hash_v4 *object = (struct security_descriptor_hash_v4 *)pytalloc_get_ptr(py_obj);
    3560           0 :         if (value == NULL) {
    3561           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->time");
    3562           0 :                 return -1;
    3563             :         }
    3564             :         {
    3565           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->time));
    3566           0 :                 if (PyLong_Check(value)) {
    3567             :                         unsigned long long test_var;
    3568           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    3569           0 :                         if (PyErr_Occurred() != NULL) {
    3570           0 :                                 return -1;
    3571             :                         }
    3572           0 :                         if (test_var > uint_max) {
    3573           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    3574             :                                   PyLong_Type.tp_name, uint_max, test_var);
    3575           0 :                                 return -1;
    3576             :                         }
    3577           0 :                         object->time = test_var;
    3578             :                 } else {
    3579           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    3580             :                           PyLong_Type.tp_name);
    3581           0 :                         return -1;
    3582             :                 }
    3583             :         }
    3584           0 :         return 0;
    3585             : }
    3586             : 
    3587           0 : static PyObject *py_security_descriptor_hash_v4_get_sys_acl_hash(PyObject *obj, void *closure)
    3588             : {
    3589           0 :         struct security_descriptor_hash_v4 *object = (struct security_descriptor_hash_v4 *)pytalloc_get_ptr(obj);
    3590             :         PyObject *py_sys_acl_hash;
    3591           0 :         py_sys_acl_hash = PyList_New(64);
    3592           0 :         if (py_sys_acl_hash == NULL) {
    3593           0 :                 return NULL;
    3594             :         }
    3595             :         {
    3596             :                 int sys_acl_hash_cntr_0;
    3597           0 :                 for (sys_acl_hash_cntr_0 = 0; sys_acl_hash_cntr_0 < (64); sys_acl_hash_cntr_0++) {
    3598             :                         PyObject *py_sys_acl_hash_0;
    3599           0 :                         py_sys_acl_hash_0 = PyLong_FromLong((uint16_t)object->sys_acl_hash[sys_acl_hash_cntr_0]);
    3600           0 :                         PyList_SetItem(py_sys_acl_hash, sys_acl_hash_cntr_0, py_sys_acl_hash_0);
    3601             :                 }
    3602             :         }
    3603           0 :         return py_sys_acl_hash;
    3604             : }
    3605             : 
    3606           0 : static int py_security_descriptor_hash_v4_set_sys_acl_hash(PyObject *py_obj, PyObject *value, void *closure)
    3607             : {
    3608           0 :         struct security_descriptor_hash_v4 *object = (struct security_descriptor_hash_v4 *)pytalloc_get_ptr(py_obj);
    3609           0 :         if (value == NULL) {
    3610           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->sys_acl_hash");
    3611           0 :                 return -1;
    3612             :         }
    3613           0 :         PY_CHECK_TYPE(&PyList_Type, value, return -1;);
    3614             :         {
    3615             :                 int sys_acl_hash_cntr_0;
    3616           0 :                 if (ARRAY_SIZE(object->sys_acl_hash) != PyList_GET_SIZE(value)) {
    3617           0 :                         PyErr_Format(PyExc_TypeError, "Expected list of type %s, length %zu, got %zd", Py_TYPE(value)->tp_name, ARRAY_SIZE(object->sys_acl_hash),  PyList_GET_SIZE(value));
    3618           0 :                         return -1;
    3619             :                 }
    3620           0 :                 for (sys_acl_hash_cntr_0 = 0; sys_acl_hash_cntr_0 < PyList_GET_SIZE(value); sys_acl_hash_cntr_0++) {
    3621           0 :                         if (PyList_GET_ITEM(value, sys_acl_hash_cntr_0) == NULL) {
    3622           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->sys_acl_hash[sys_acl_hash_cntr_0]");
    3623           0 :                                 return -1;
    3624             :                         }
    3625             :                         {
    3626           0 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->sys_acl_hash[sys_acl_hash_cntr_0]));
    3627           0 :                                 if (PyLong_Check(PyList_GET_ITEM(value, sys_acl_hash_cntr_0))) {
    3628             :                                         unsigned long long test_var;
    3629           0 :                                         test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, sys_acl_hash_cntr_0));
    3630           0 :                                         if (PyErr_Occurred() != NULL) {
    3631           0 :                                                 return -1;
    3632             :                                         }
    3633           0 :                                         if (test_var > uint_max) {
    3634           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    3635             :                                                   PyLong_Type.tp_name, uint_max, test_var);
    3636           0 :                                                 return -1;
    3637             :                                         }
    3638           0 :                                         object->sys_acl_hash[sys_acl_hash_cntr_0] = test_var;
    3639             :                                 } else {
    3640           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    3641             :                                           PyLong_Type.tp_name);
    3642           0 :                                         return -1;
    3643             :                                 }
    3644             :                         }
    3645             :                 }
    3646             :         }
    3647           0 :         return 0;
    3648             : }
    3649             : 
    3650             : static PyGetSetDef py_security_descriptor_hash_v4_getsetters[] = {
    3651             :         {
    3652             :                 .name = discard_const_p(char, "sd"),
    3653             :                 .get = py_security_descriptor_hash_v4_get_sd,
    3654             :                 .set = py_security_descriptor_hash_v4_set_sd,
    3655             :                 .doc = discard_const_p(char, "PIDL-generated element of base type security_descriptor")
    3656             :         },
    3657             :         {
    3658             :                 .name = discard_const_p(char, "hash_type"),
    3659             :                 .get = py_security_descriptor_hash_v4_get_hash_type,
    3660             :                 .set = py_security_descriptor_hash_v4_set_hash_type,
    3661             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
    3662             :         },
    3663             :         {
    3664             :                 .name = discard_const_p(char, "hash"),
    3665             :                 .get = py_security_descriptor_hash_v4_get_hash,
    3666             :                 .set = py_security_descriptor_hash_v4_set_hash,
    3667             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
    3668             :         },
    3669             :         {
    3670             :                 .name = discard_const_p(char, "description"),
    3671             :                 .get = py_security_descriptor_hash_v4_get_description,
    3672             :                 .set = py_security_descriptor_hash_v4_set_description,
    3673             :                 .doc = discard_const_p(char, "PIDL-generated element of base type string")
    3674             :         },
    3675             :         {
    3676             :                 .name = discard_const_p(char, "time"),
    3677             :                 .get = py_security_descriptor_hash_v4_get_time,
    3678             :                 .set = py_security_descriptor_hash_v4_set_time,
    3679             :                 .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
    3680             :         },
    3681             :         {
    3682             :                 .name = discard_const_p(char, "sys_acl_hash"),
    3683             :                 .get = py_security_descriptor_hash_v4_get_sys_acl_hash,
    3684             :                 .set = py_security_descriptor_hash_v4_set_sys_acl_hash,
    3685             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
    3686             :         },
    3687             :         { .name = NULL }
    3688             : };
    3689             : 
    3690           0 : static PyObject *py_security_descriptor_hash_v4_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    3691             : {
    3692           0 :         return pytalloc_new(struct security_descriptor_hash_v4, type);
    3693             : }
    3694             : 
    3695           0 : static PyObject *py_security_descriptor_hash_v4_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
    3696             : {
    3697           0 :         struct security_descriptor_hash_v4 *object = (struct security_descriptor_hash_v4 *)pytalloc_get_ptr(py_obj);
    3698           0 :         PyObject *ret = NULL;
    3699             :         DATA_BLOB blob;
    3700             :         enum ndr_err_code err;
    3701           0 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
    3702           0 :         if (tmp_ctx == NULL) {
    3703           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    3704           0 :                 return NULL;
    3705             :         }
    3706           0 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_security_descriptor_hash_v4);
    3707           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    3708           0 :                 TALLOC_FREE(tmp_ctx);
    3709           0 :                 PyErr_SetNdrError(err);
    3710           0 :                 return NULL;
    3711             :         }
    3712             : 
    3713           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    3714           0 :         TALLOC_FREE(tmp_ctx);
    3715           0 :         return ret;
    3716             : }
    3717             : 
    3718           0 : static PyObject *py_security_descriptor_hash_v4_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    3719             : {
    3720           0 :         struct security_descriptor_hash_v4 *object = (struct security_descriptor_hash_v4 *)pytalloc_get_ptr(py_obj);
    3721           0 :         DATA_BLOB blob = {.data = NULL, .length = 0};
    3722           0 :         Py_ssize_t blob_length = 0;
    3723             :         enum ndr_err_code err;
    3724           0 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
    3725           0 :         PyObject *allow_remaining_obj = NULL;
    3726           0 :         bool allow_remaining = false;
    3727             : 
    3728           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
    3729             :                 discard_const_p(char *, kwnames),
    3730             :                 &blob.data, &blob_length,
    3731             :                 &allow_remaining_obj)) {
    3732           0 :                 return NULL;
    3733             :         }
    3734           0 :         blob.length = blob_length;
    3735             : 
    3736           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    3737           0 :                 allow_remaining = true;
    3738             :         }
    3739             : 
    3740           0 :         if (allow_remaining) {
    3741           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_security_descriptor_hash_v4);
    3742             :         } else {
    3743           0 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_security_descriptor_hash_v4);
    3744             :         }
    3745           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    3746           0 :                 PyErr_SetNdrError(err);
    3747           0 :                 return NULL;
    3748             :         }
    3749             : 
    3750           0 :         Py_RETURN_NONE;
    3751             : }
    3752             : 
    3753           0 : static PyObject *py_security_descriptor_hash_v4_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    3754             : {
    3755           0 :         struct security_descriptor_hash_v4 *object = (struct security_descriptor_hash_v4 *)pytalloc_get_ptr(py_obj);
    3756             :         PyObject *ret;
    3757             :         char *retstr;
    3758             : 
    3759           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_security_descriptor_hash_v4, "security_descriptor_hash_v4", object);
    3760           0 :         ret = PyUnicode_FromString(retstr);
    3761           0 :         talloc_free(retstr);
    3762             : 
    3763           0 :         return ret;
    3764             : }
    3765             : 
    3766             : static PyMethodDef py_security_descriptor_hash_v4_methods[] = {
    3767             :         { "__ndr_pack__", (PyCFunction)py_security_descriptor_hash_v4_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
    3768             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_security_descriptor_hash_v4_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
    3769             :         { "__ndr_print__", (PyCFunction)py_security_descriptor_hash_v4_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
    3770             :         { NULL, NULL, 0, NULL }
    3771             : };
    3772             : 
    3773             : 
    3774             : static PyTypeObject security_descriptor_hash_v4_Type = {
    3775             :         PyVarObject_HEAD_INIT(NULL, 0)
    3776             :         .tp_name = "xattr.security_descriptor_hash_v4",
    3777             :         .tp_getset = py_security_descriptor_hash_v4_getsetters,
    3778             :         .tp_methods = py_security_descriptor_hash_v4_methods,
    3779             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    3780             :         .tp_new = py_security_descriptor_hash_v4_new,
    3781             : };
    3782             : 
    3783         173 : static PyObject *py_import_xattr_NTACL_Info(TALLOC_CTX *mem_ctx, int level, union xattr_NTACL_Info *in)
    3784             : {
    3785             :         PyObject *ret;
    3786             : 
    3787         173 :         switch (level) {
    3788          68 :                 case 1:
    3789          68 :                         if (in->sd == NULL) {
    3790           0 :                                 ret = Py_None;
    3791           0 :                                 Py_INCREF(ret);
    3792             :                         } else {
    3793          68 :                                 ret = pytalloc_reference_ex(security_descriptor_Type, in->sd, in->sd);
    3794             :                         }
    3795          66 :                         return ret;
    3796             : 
    3797           0 :                 case 2:
    3798           0 :                         if (in->sd_hs2 == NULL) {
    3799           0 :                                 ret = Py_None;
    3800           0 :                                 Py_INCREF(ret);
    3801             :                         } else {
    3802           0 :                                 ret = pytalloc_reference_ex(&security_descriptor_hash_v2_Type, in->sd_hs2, in->sd_hs2);
    3803             :                         }
    3804           0 :                         return ret;
    3805             : 
    3806           0 :                 case 3:
    3807           0 :                         if (in->sd_hs3 == NULL) {
    3808           0 :                                 ret = Py_None;
    3809           0 :                                 Py_INCREF(ret);
    3810             :                         } else {
    3811           0 :                                 ret = pytalloc_reference_ex(&security_descriptor_hash_v3_Type, in->sd_hs3, in->sd_hs3);
    3812             :                         }
    3813           0 :                         return ret;
    3814             : 
    3815         105 :                 case 4:
    3816         105 :                         if (in->sd_hs4 == NULL) {
    3817           0 :                                 ret = Py_None;
    3818           0 :                                 Py_INCREF(ret);
    3819             :                         } else {
    3820         105 :                                 ret = pytalloc_reference_ex(&security_descriptor_hash_v4_Type, in->sd_hs4, in->sd_hs4);
    3821             :                         }
    3822         105 :                         return ret;
    3823             : 
    3824             :         }
    3825           0 :         PyErr_SetString(PyExc_TypeError, "unknown union level");
    3826           0 :         return NULL;
    3827             : }
    3828             : 
    3829        1074 : static union xattr_NTACL_Info *py_export_xattr_NTACL_Info(TALLOC_CTX *mem_ctx, int level, PyObject *in)
    3830             : {
    3831        1074 :         union xattr_NTACL_Info *ret = talloc_zero(mem_ctx, union xattr_NTACL_Info);
    3832        1074 :         switch (level) {
    3833        1074 :                 case 1:
    3834        1074 :                         if (in == NULL) {
    3835           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->sd");
    3836           0 :                                 talloc_free(ret); return NULL;
    3837             :                         }
    3838        1074 :                         if (in == Py_None) {
    3839           0 :                                 ret->sd = NULL;
    3840             :                         } else {
    3841        1074 :                                 ret->sd = NULL;
    3842        1074 :                                 PY_CHECK_TYPE(security_descriptor_Type, in, talloc_free(ret); return NULL;);
    3843        1074 :                                 if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
    3844           0 :                                         PyErr_NoMemory();
    3845           0 :                                         talloc_free(ret); return NULL;
    3846             :                                 }
    3847        1074 :                                 ret->sd = (struct security_descriptor *)pytalloc_get_ptr(in);
    3848             :                         }
    3849         758 :                         break;
    3850             : 
    3851           0 :                 case 2:
    3852           0 :                         if (in == NULL) {
    3853           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->sd_hs2");
    3854           0 :                                 talloc_free(ret); return NULL;
    3855             :                         }
    3856           0 :                         if (in == Py_None) {
    3857           0 :                                 ret->sd_hs2 = NULL;
    3858             :                         } else {
    3859           0 :                                 ret->sd_hs2 = NULL;
    3860           0 :                                 PY_CHECK_TYPE(&security_descriptor_hash_v2_Type, in, talloc_free(ret); return NULL;);
    3861           0 :                                 if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
    3862           0 :                                         PyErr_NoMemory();
    3863           0 :                                         talloc_free(ret); return NULL;
    3864             :                                 }
    3865           0 :                                 ret->sd_hs2 = (struct security_descriptor_hash_v2 *)pytalloc_get_ptr(in);
    3866             :                         }
    3867           0 :                         break;
    3868             : 
    3869           0 :                 case 3:
    3870           0 :                         if (in == NULL) {
    3871           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->sd_hs3");
    3872           0 :                                 talloc_free(ret); return NULL;
    3873             :                         }
    3874           0 :                         if (in == Py_None) {
    3875           0 :                                 ret->sd_hs3 = NULL;
    3876             :                         } else {
    3877           0 :                                 ret->sd_hs3 = NULL;
    3878           0 :                                 PY_CHECK_TYPE(&security_descriptor_hash_v3_Type, in, talloc_free(ret); return NULL;);
    3879           0 :                                 if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
    3880           0 :                                         PyErr_NoMemory();
    3881           0 :                                         talloc_free(ret); return NULL;
    3882             :                                 }
    3883           0 :                                 ret->sd_hs3 = (struct security_descriptor_hash_v3 *)pytalloc_get_ptr(in);
    3884             :                         }
    3885           0 :                         break;
    3886             : 
    3887           0 :                 case 4:
    3888           0 :                         if (in == NULL) {
    3889           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->sd_hs4");
    3890           0 :                                 talloc_free(ret); return NULL;
    3891             :                         }
    3892           0 :                         if (in == Py_None) {
    3893           0 :                                 ret->sd_hs4 = NULL;
    3894             :                         } else {
    3895           0 :                                 ret->sd_hs4 = NULL;
    3896           0 :                                 PY_CHECK_TYPE(&security_descriptor_hash_v4_Type, in, talloc_free(ret); return NULL;);
    3897           0 :                                 if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
    3898           0 :                                         PyErr_NoMemory();
    3899           0 :                                         talloc_free(ret); return NULL;
    3900             :                                 }
    3901           0 :                                 ret->sd_hs4 = (struct security_descriptor_hash_v4 *)pytalloc_get_ptr(in);
    3902             :                         }
    3903           0 :                         break;
    3904             : 
    3905           0 :                 default:
    3906           0 :                         PyErr_SetString(PyExc_TypeError, "invalid union level value");
    3907           0 :                         talloc_free(ret);
    3908           0 :                         ret = NULL;
    3909             :         }
    3910             : 
    3911         758 :         return ret;
    3912             : }
    3913             : 
    3914         173 : static PyObject *py_xattr_NTACL_Info_import(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    3915             : {
    3916         173 :         const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
    3917         173 :         PyObject *mem_ctx_obj = NULL;
    3918         173 :         TALLOC_CTX *mem_ctx = NULL;
    3919         173 :         int level = 0;
    3920         173 :         PyObject *in_obj = NULL;
    3921         173 :         union xattr_NTACL_Info *in = NULL;
    3922             : 
    3923         173 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:import",
    3924             :                 discard_const_p(char *, kwnames),
    3925             :                 &mem_ctx_obj,
    3926             :                 &level,
    3927             :                 &in_obj)) {
    3928           0 :                 return NULL;
    3929             :         }
    3930         173 :         mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
    3931         173 :         if (mem_ctx == NULL) {
    3932           0 :                 PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
    3933           0 :                 return NULL;
    3934             :         }
    3935         173 :         in = (union xattr_NTACL_Info *)pytalloc_get_ptr(in_obj);
    3936         173 :         if (in == NULL) {
    3937           0 :                 PyErr_Format(PyExc_TypeError, "in needs to be a pointer to union xattr_NTACL_Info!");
    3938           0 :                 return NULL;
    3939             :         }
    3940             : 
    3941         173 :         return py_import_xattr_NTACL_Info(mem_ctx, level, in);
    3942             : }
    3943             : 
    3944        1074 : static PyObject *py_xattr_NTACL_Info_export(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    3945             : {
    3946        1074 :         const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
    3947        1074 :         PyObject *mem_ctx_obj = NULL;
    3948        1074 :         TALLOC_CTX *mem_ctx = NULL;
    3949        1074 :         int level = 0;
    3950        1074 :         PyObject *in = NULL;
    3951        1074 :         union xattr_NTACL_Info *out = NULL;
    3952             : 
    3953        1074 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:export",
    3954             :                 discard_const_p(char *, kwnames),
    3955             :                 &mem_ctx_obj,
    3956             :                 &level,
    3957             :                 &in)) {
    3958           0 :                 return NULL;
    3959             :         }
    3960        1074 :         mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
    3961        1074 :         if (mem_ctx == NULL) {
    3962           0 :                 PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
    3963           0 :                 return NULL;
    3964             :         }
    3965             : 
    3966        1074 :         out = py_export_xattr_NTACL_Info(mem_ctx, level, in);
    3967        1074 :         if (out == NULL) {
    3968           0 :                 return NULL;
    3969             :         }
    3970             : 
    3971        1074 :         return pytalloc_GenericObject_reference(out);
    3972             : }
    3973             : 
    3974             : static PyMethodDef py_xattr_NTACL_Info_methods[] = {
    3975             :         { "__import__", PY_DISCARD_FUNC_SIG(PyCFunction,py_xattr_NTACL_Info_import),
    3976             :                 METH_VARARGS|METH_KEYWORDS|METH_CLASS,
    3977             :                 "T.__import__(mem_ctx, level, in) => ret." },
    3978             :         { "__export__", PY_DISCARD_FUNC_SIG(PyCFunction,py_xattr_NTACL_Info_export),
    3979             :                 METH_VARARGS|METH_KEYWORDS|METH_CLASS,
    3980             :                 "T.__export__(mem_ctx, level, in) => ret." },
    3981             :         { NULL, NULL, 0, NULL }
    3982             : };
    3983             : 
    3984           0 : static PyObject *py_xattr_NTACL_Info_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    3985             : {
    3986           0 :         PyErr_Format(PyExc_TypeError, "New %s Objects are not supported", type->tp_name);
    3987           0 :         return NULL;
    3988             : }
    3989             : 
    3990             : 
    3991             : static PyTypeObject xattr_NTACL_Info_Type = {
    3992             :         PyVarObject_HEAD_INIT(NULL, 0)
    3993             :         .tp_name = "xattr.NTACL_Info",
    3994             :         .tp_getset = NULL,
    3995             :         .tp_methods = py_xattr_NTACL_Info_methods,
    3996             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    3997             :         .tp_new = py_xattr_NTACL_Info_new,
    3998             : };
    3999             : 
    4000             : 
    4001         488 : static PyObject *py_xattr_NTACL_get_version(PyObject *obj, void *closure)
    4002             : {
    4003         488 :         struct xattr_NTACL *object = (struct xattr_NTACL *)pytalloc_get_ptr(obj);
    4004             :         PyObject *py_version;
    4005         488 :         py_version = PyLong_FromLong((uint16_t)object->version);
    4006         488 :         return py_version;
    4007             : }
    4008             : 
    4009        1078 : static int py_xattr_NTACL_set_version(PyObject *py_obj, PyObject *value, void *closure)
    4010             : {
    4011        1078 :         struct xattr_NTACL *object = (struct xattr_NTACL *)pytalloc_get_ptr(py_obj);
    4012        1078 :         if (value == NULL) {
    4013           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->version");
    4014           0 :                 return -1;
    4015             :         }
    4016             :         {
    4017        1078 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->version));
    4018        1078 :                 if (PyLong_Check(value)) {
    4019             :                         unsigned long long test_var;
    4020        1078 :                         test_var = PyLong_AsUnsignedLongLong(value);
    4021        1078 :                         if (PyErr_Occurred() != NULL) {
    4022           0 :                                 return -1;
    4023             :                         }
    4024        1078 :                         if (test_var > uint_max) {
    4025           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    4026             :                                   PyLong_Type.tp_name, uint_max, test_var);
    4027           0 :                                 return -1;
    4028             :                         }
    4029        1078 :                         object->version = test_var;
    4030             :                 } else {
    4031           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    4032             :                           PyLong_Type.tp_name);
    4033           0 :                         return -1;
    4034             :                 }
    4035             :         }
    4036        1078 :         return 0;
    4037             : }
    4038             : 
    4039         173 : static PyObject *py_xattr_NTACL_get_info(PyObject *obj, void *closure)
    4040             : {
    4041         173 :         struct xattr_NTACL *object = (struct xattr_NTACL *)pytalloc_get_ptr(obj);
    4042             :         PyObject *py_info;
    4043         173 :         py_info = pyrpc_import_union(&xattr_NTACL_Info_Type, pytalloc_get_mem_ctx(obj), object->version, &object->info, "union xattr_NTACL_Info");
    4044         173 :         if (py_info == NULL) {
    4045           0 :                 return NULL;
    4046             :         }
    4047         173 :         return py_info;
    4048             : }
    4049             : 
    4050        1074 : static int py_xattr_NTACL_set_info(PyObject *py_obj, PyObject *value, void *closure)
    4051             : {
    4052        1074 :         struct xattr_NTACL *object = (struct xattr_NTACL *)pytalloc_get_ptr(py_obj);
    4053        1074 :         if (value == NULL) {
    4054           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->info");
    4055           0 :                 return -1;
    4056             :         }
    4057             :         {
    4058             :                 union xattr_NTACL_Info *info_switch_0;
    4059        1074 :                 info_switch_0 = (union xattr_NTACL_Info *)pyrpc_export_union(&xattr_NTACL_Info_Type, pytalloc_get_mem_ctx(py_obj), object->version, value, "union xattr_NTACL_Info");
    4060        1074 :                 if (info_switch_0 == NULL) {
    4061           0 :                         return -1;
    4062             :                 }
    4063        1074 :                 object->info = *info_switch_0;
    4064             :         }
    4065        1074 :         return 0;
    4066             : }
    4067             : 
    4068             : static PyGetSetDef py_xattr_NTACL_getsetters[] = {
    4069             :         {
    4070             :                 .name = discard_const_p(char, "version"),
    4071             :                 .get = py_xattr_NTACL_get_version,
    4072             :                 .set = py_xattr_NTACL_set_version,
    4073             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
    4074             :         },
    4075             :         {
    4076             :                 .name = discard_const_p(char, "info"),
    4077             :                 .get = py_xattr_NTACL_get_info,
    4078             :                 .set = py_xattr_NTACL_set_info,
    4079             :                 .doc = discard_const_p(char, "PIDL-generated element of base type xattr_NTACL_Info")
    4080             :         },
    4081             :         { .name = NULL }
    4082             : };
    4083             : 
    4084        1251 : static PyObject *py_xattr_NTACL_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    4085             : {
    4086        1251 :         return pytalloc_new(struct xattr_NTACL, type);
    4087             : }
    4088             : 
    4089        1078 : static PyObject *py_xattr_NTACL_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
    4090             : {
    4091        1078 :         struct xattr_NTACL *object = (struct xattr_NTACL *)pytalloc_get_ptr(py_obj);
    4092        1078 :         PyObject *ret = NULL;
    4093             :         DATA_BLOB blob;
    4094             :         enum ndr_err_code err;
    4095        1078 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
    4096        1078 :         if (tmp_ctx == NULL) {
    4097           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    4098           0 :                 return NULL;
    4099             :         }
    4100        1078 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_xattr_NTACL);
    4101        1078 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    4102           0 :                 TALLOC_FREE(tmp_ctx);
    4103           0 :                 PyErr_SetNdrError(err);
    4104           0 :                 return NULL;
    4105             :         }
    4106             : 
    4107        1078 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    4108        1078 :         TALLOC_FREE(tmp_ctx);
    4109        1078 :         return ret;
    4110             : }
    4111             : 
    4112         173 : static PyObject *py_xattr_NTACL_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    4113             : {
    4114         173 :         struct xattr_NTACL *object = (struct xattr_NTACL *)pytalloc_get_ptr(py_obj);
    4115         173 :         DATA_BLOB blob = {.data = NULL, .length = 0};
    4116         173 :         Py_ssize_t blob_length = 0;
    4117             :         enum ndr_err_code err;
    4118         173 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
    4119         173 :         PyObject *allow_remaining_obj = NULL;
    4120         173 :         bool allow_remaining = false;
    4121             : 
    4122         173 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
    4123             :                 discard_const_p(char *, kwnames),
    4124             :                 &blob.data, &blob_length,
    4125             :                 &allow_remaining_obj)) {
    4126           0 :                 return NULL;
    4127             :         }
    4128         173 :         blob.length = blob_length;
    4129             : 
    4130         173 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    4131           0 :                 allow_remaining = true;
    4132             :         }
    4133             : 
    4134         171 :         if (allow_remaining) {
    4135           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_xattr_NTACL);
    4136             :         } else {
    4137         173 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_xattr_NTACL);
    4138             :         }
    4139         173 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    4140           0 :                 PyErr_SetNdrError(err);
    4141           0 :                 return NULL;
    4142             :         }
    4143             : 
    4144         173 :         Py_RETURN_NONE;
    4145             : }
    4146             : 
    4147           0 : static PyObject *py_xattr_NTACL_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    4148             : {
    4149           0 :         struct xattr_NTACL *object = (struct xattr_NTACL *)pytalloc_get_ptr(py_obj);
    4150             :         PyObject *ret;
    4151             :         char *retstr;
    4152             : 
    4153           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_xattr_NTACL, "xattr_NTACL", object);
    4154           0 :         ret = PyUnicode_FromString(retstr);
    4155           0 :         talloc_free(retstr);
    4156             : 
    4157           0 :         return ret;
    4158             : }
    4159             : 
    4160             : static PyMethodDef py_xattr_NTACL_methods[] = {
    4161             :         { "__ndr_pack__", (PyCFunction)py_xattr_NTACL_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
    4162             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_xattr_NTACL_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
    4163             :         { "__ndr_print__", (PyCFunction)py_xattr_NTACL_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
    4164             :         { NULL, NULL, 0, NULL }
    4165             : };
    4166             : 
    4167             : 
    4168             : static PyTypeObject xattr_NTACL_Type = {
    4169             :         PyVarObject_HEAD_INIT(NULL, 0)
    4170             :         .tp_name = "xattr.NTACL",
    4171             :         .tp_getset = py_xattr_NTACL_getsetters,
    4172             :         .tp_methods = py_xattr_NTACL_methods,
    4173             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    4174             :         .tp_new = py_xattr_NTACL_new,
    4175             : };
    4176             : 
    4177             : 
    4178           0 : static PyObject *py_xattr_sys_acl_hash_wrapper_get_acl_as_blob(PyObject *obj, void *closure)
    4179             : {
    4180           0 :         struct xattr_sys_acl_hash_wrapper *object = (struct xattr_sys_acl_hash_wrapper *)pytalloc_get_ptr(obj);
    4181             :         PyObject *py_acl_as_blob;
    4182           0 :         py_acl_as_blob = PyBytes_FromStringAndSize((char *)(object->acl_as_blob).data, (object->acl_as_blob).length);
    4183           0 :         return py_acl_as_blob;
    4184             : }
    4185             : 
    4186           0 : static int py_xattr_sys_acl_hash_wrapper_set_acl_as_blob(PyObject *py_obj, PyObject *value, void *closure)
    4187             : {
    4188           0 :         struct xattr_sys_acl_hash_wrapper *object = (struct xattr_sys_acl_hash_wrapper *)pytalloc_get_ptr(py_obj);
    4189           0 :         if (value == NULL) {
    4190           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->acl_as_blob");
    4191           0 :                 return -1;
    4192             :         }
    4193           0 :         object->acl_as_blob = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
    4194           0 :         return 0;
    4195             : }
    4196             : 
    4197           0 : static PyObject *py_xattr_sys_acl_hash_wrapper_get_owner(PyObject *obj, void *closure)
    4198             : {
    4199           0 :         struct xattr_sys_acl_hash_wrapper *object = (struct xattr_sys_acl_hash_wrapper *)pytalloc_get_ptr(obj);
    4200             :         PyObject *py_owner;
    4201           0 :         py_owner = PyLong_FromUnsignedLongLong(object->owner);
    4202           0 :         return py_owner;
    4203             : }
    4204             : 
    4205           0 : static int py_xattr_sys_acl_hash_wrapper_set_owner(PyObject *py_obj, PyObject *value, void *closure)
    4206             : {
    4207           0 :         struct xattr_sys_acl_hash_wrapper *object = (struct xattr_sys_acl_hash_wrapper *)pytalloc_get_ptr(py_obj);
    4208           0 :         if (value == NULL) {
    4209           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->owner");
    4210           0 :                 return -1;
    4211             :         }
    4212             :         {
    4213           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->owner));
    4214           0 :                 if (PyLong_Check(value)) {
    4215             :                         unsigned long long test_var;
    4216           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    4217           0 :                         if (PyErr_Occurred() != NULL) {
    4218           0 :                                 return -1;
    4219             :                         }
    4220           0 :                         if (test_var > uint_max) {
    4221           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    4222             :                                   PyLong_Type.tp_name, uint_max, test_var);
    4223           0 :                                 return -1;
    4224             :                         }
    4225           0 :                         object->owner = test_var;
    4226             :                 } else {
    4227           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    4228             :                           PyLong_Type.tp_name);
    4229           0 :                         return -1;
    4230             :                 }
    4231             :         }
    4232           0 :         return 0;
    4233             : }
    4234             : 
    4235           0 : static PyObject *py_xattr_sys_acl_hash_wrapper_get_group(PyObject *obj, void *closure)
    4236             : {
    4237           0 :         struct xattr_sys_acl_hash_wrapper *object = (struct xattr_sys_acl_hash_wrapper *)pytalloc_get_ptr(obj);
    4238             :         PyObject *py_group;
    4239           0 :         py_group = PyLong_FromUnsignedLongLong(object->group);
    4240           0 :         return py_group;
    4241             : }
    4242             : 
    4243           0 : static int py_xattr_sys_acl_hash_wrapper_set_group(PyObject *py_obj, PyObject *value, void *closure)
    4244             : {
    4245           0 :         struct xattr_sys_acl_hash_wrapper *object = (struct xattr_sys_acl_hash_wrapper *)pytalloc_get_ptr(py_obj);
    4246           0 :         if (value == NULL) {
    4247           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->group");
    4248           0 :                 return -1;
    4249             :         }
    4250             :         {
    4251           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->group));
    4252           0 :                 if (PyLong_Check(value)) {
    4253             :                         unsigned long long test_var;
    4254           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    4255           0 :                         if (PyErr_Occurred() != NULL) {
    4256           0 :                                 return -1;
    4257             :                         }
    4258           0 :                         if (test_var > uint_max) {
    4259           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    4260             :                                   PyLong_Type.tp_name, uint_max, test_var);
    4261           0 :                                 return -1;
    4262             :                         }
    4263           0 :                         object->group = test_var;
    4264             :                 } else {
    4265           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    4266             :                           PyLong_Type.tp_name);
    4267           0 :                         return -1;
    4268             :                 }
    4269             :         }
    4270           0 :         return 0;
    4271             : }
    4272             : 
    4273           0 : static PyObject *py_xattr_sys_acl_hash_wrapper_get_mode(PyObject *obj, void *closure)
    4274             : {
    4275           0 :         struct xattr_sys_acl_hash_wrapper *object = (struct xattr_sys_acl_hash_wrapper *)pytalloc_get_ptr(obj);
    4276             :         PyObject *py_mode;
    4277           0 :         py_mode = PyLong_FromUnsignedLongLong((uint32_t)object->mode);
    4278           0 :         return py_mode;
    4279             : }
    4280             : 
    4281           0 : static int py_xattr_sys_acl_hash_wrapper_set_mode(PyObject *py_obj, PyObject *value, void *closure)
    4282             : {
    4283           0 :         struct xattr_sys_acl_hash_wrapper *object = (struct xattr_sys_acl_hash_wrapper *)pytalloc_get_ptr(py_obj);
    4284           0 :         if (value == NULL) {
    4285           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->mode");
    4286           0 :                 return -1;
    4287             :         }
    4288             :         {
    4289           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->mode));
    4290           0 :                 if (PyLong_Check(value)) {
    4291             :                         unsigned long long test_var;
    4292           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    4293           0 :                         if (PyErr_Occurred() != NULL) {
    4294           0 :                                 return -1;
    4295             :                         }
    4296           0 :                         if (test_var > uint_max) {
    4297           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    4298             :                                   PyLong_Type.tp_name, uint_max, test_var);
    4299           0 :                                 return -1;
    4300             :                         }
    4301           0 :                         object->mode = test_var;
    4302             :                 } else {
    4303           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    4304             :                           PyLong_Type.tp_name);
    4305           0 :                         return -1;
    4306             :                 }
    4307             :         }
    4308           0 :         return 0;
    4309             : }
    4310             : 
    4311             : static PyGetSetDef py_xattr_sys_acl_hash_wrapper_getsetters[] = {
    4312             :         {
    4313             :                 .name = discard_const_p(char, "acl_as_blob"),
    4314             :                 .get = py_xattr_sys_acl_hash_wrapper_get_acl_as_blob,
    4315             :                 .set = py_xattr_sys_acl_hash_wrapper_set_acl_as_blob,
    4316             :                 .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
    4317             :         },
    4318             :         {
    4319             :                 .name = discard_const_p(char, "owner"),
    4320             :                 .get = py_xattr_sys_acl_hash_wrapper_get_owner,
    4321             :                 .set = py_xattr_sys_acl_hash_wrapper_set_owner,
    4322             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uid_t")
    4323             :         },
    4324             :         {
    4325             :                 .name = discard_const_p(char, "group"),
    4326             :                 .get = py_xattr_sys_acl_hash_wrapper_get_group,
    4327             :                 .set = py_xattr_sys_acl_hash_wrapper_set_group,
    4328             :                 .doc = discard_const_p(char, "PIDL-generated element of base type gid_t")
    4329             :         },
    4330             :         {
    4331             :                 .name = discard_const_p(char, "mode"),
    4332             :                 .get = py_xattr_sys_acl_hash_wrapper_get_mode,
    4333             :                 .set = py_xattr_sys_acl_hash_wrapper_set_mode,
    4334             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    4335             :         },
    4336             :         { .name = NULL }
    4337             : };
    4338             : 
    4339           0 : static PyObject *py_xattr_sys_acl_hash_wrapper_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    4340             : {
    4341           0 :         return pytalloc_new(struct xattr_sys_acl_hash_wrapper, type);
    4342             : }
    4343             : 
    4344             : 
    4345             : static PyTypeObject xattr_sys_acl_hash_wrapper_Type = {
    4346             :         PyVarObject_HEAD_INIT(NULL, 0)
    4347             :         .tp_name = "xattr.sys_acl_hash_wrapper",
    4348             :         .tp_getset = py_xattr_sys_acl_hash_wrapper_getsetters,
    4349             :         .tp_methods = NULL,
    4350             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    4351             :         .tp_new = py_xattr_sys_acl_hash_wrapper_new,
    4352             : };
    4353             : 
    4354             : static PyMethodDef xattr_methods[] = {
    4355             :         { NULL, NULL, 0, NULL }
    4356             : };
    4357             : 
    4358             : static struct PyModuleDef moduledef = {
    4359             :         PyModuleDef_HEAD_INIT,
    4360             :         .m_name = "xattr",
    4361             :         .m_doc = "xattr DCE/RPC",
    4362             :         .m_size = -1,
    4363             :         .m_methods = xattr_methods,
    4364             : };
    4365        1539 : MODULE_INIT_FUNC(xattr)
    4366             : {
    4367        1539 :         PyObject *m = NULL;
    4368        1539 :         PyObject *dep_samba_dcerpc_security = NULL;
    4369        1539 :         PyObject *dep_talloc = NULL;
    4370             : 
    4371        1539 :         dep_samba_dcerpc_security = PyImport_ImportModule("samba.dcerpc.security");
    4372        1539 :         if (dep_samba_dcerpc_security == NULL)
    4373           0 :                 goto out;
    4374             : 
    4375        1539 :         dep_talloc = PyImport_ImportModule("talloc");
    4376        1539 :         if (dep_talloc == NULL)
    4377           0 :                 goto out;
    4378             : 
    4379        1539 :         BaseObject_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "BaseObject");
    4380        1539 :         if (BaseObject_Type == NULL)
    4381           0 :                 goto out;
    4382             : 
    4383        1539 :         security_descriptor_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_security, "descriptor");
    4384        1539 :         if (security_descriptor_Type == NULL)
    4385           0 :                 goto out;
    4386             : 
    4387        1539 :         xattr_DosInfoFFFFCompat_Type.tp_base = BaseObject_Type;
    4388        1539 :         xattr_DosInfoFFFFCompat_Type.tp_basicsize = pytalloc_BaseObject_size();
    4389             : 
    4390        1539 :         xattr_DosInfo1_Type.tp_base = BaseObject_Type;
    4391        1539 :         xattr_DosInfo1_Type.tp_basicsize = pytalloc_BaseObject_size();
    4392             : 
    4393        1539 :         xattr_DosInfo2Old_Type.tp_base = BaseObject_Type;
    4394        1539 :         xattr_DosInfo2Old_Type.tp_basicsize = pytalloc_BaseObject_size();
    4395             : 
    4396        1539 :         xattr_DosInfo3_Type.tp_base = BaseObject_Type;
    4397        1539 :         xattr_DosInfo3_Type.tp_basicsize = pytalloc_BaseObject_size();
    4398             : 
    4399        1539 :         xattr_DosInfo4_Type.tp_base = BaseObject_Type;
    4400        1539 :         xattr_DosInfo4_Type.tp_basicsize = pytalloc_BaseObject_size();
    4401             : 
    4402        1539 :         xattr_DosInfo_Type.tp_base = BaseObject_Type;
    4403        1539 :         xattr_DosInfo_Type.tp_basicsize = pytalloc_BaseObject_size();
    4404             : 
    4405        1539 :         xattr_DosAttrib_Type.tp_base = BaseObject_Type;
    4406        1539 :         xattr_DosAttrib_Type.tp_basicsize = pytalloc_BaseObject_size();
    4407             : 
    4408        1539 :         xattr_DOSATTRIB_Type.tp_base = BaseObject_Type;
    4409        1539 :         xattr_DOSATTRIB_Type.tp_basicsize = pytalloc_BaseObject_size();
    4410             : 
    4411        1539 :         xattr_EA_Type.tp_base = BaseObject_Type;
    4412        1539 :         xattr_EA_Type.tp_basicsize = pytalloc_BaseObject_size();
    4413             : 
    4414        1539 :         xattr_DosEAs_Type.tp_base = BaseObject_Type;
    4415        1539 :         xattr_DosEAs_Type.tp_basicsize = pytalloc_BaseObject_size();
    4416             : 
    4417        1539 :         tdb_xattrs_Type.tp_base = BaseObject_Type;
    4418        1539 :         tdb_xattrs_Type.tp_basicsize = pytalloc_BaseObject_size();
    4419             : 
    4420        1539 :         xattr_DosStream_Type.tp_base = BaseObject_Type;
    4421        1539 :         xattr_DosStream_Type.tp_basicsize = pytalloc_BaseObject_size();
    4422             : 
    4423        1539 :         xattr_DosStreams_Type.tp_base = BaseObject_Type;
    4424        1539 :         xattr_DosStreams_Type.tp_basicsize = pytalloc_BaseObject_size();
    4425             : 
    4426        1539 :         security_descriptor_hash_v2_Type.tp_base = BaseObject_Type;
    4427        1539 :         security_descriptor_hash_v2_Type.tp_basicsize = pytalloc_BaseObject_size();
    4428             : 
    4429        1539 :         security_descriptor_hash_v3_Type.tp_base = BaseObject_Type;
    4430        1539 :         security_descriptor_hash_v3_Type.tp_basicsize = pytalloc_BaseObject_size();
    4431             : 
    4432        1539 :         security_descriptor_hash_v4_Type.tp_base = BaseObject_Type;
    4433        1539 :         security_descriptor_hash_v4_Type.tp_basicsize = pytalloc_BaseObject_size();
    4434             : 
    4435        1539 :         xattr_NTACL_Info_Type.tp_base = BaseObject_Type;
    4436        1539 :         xattr_NTACL_Info_Type.tp_basicsize = pytalloc_BaseObject_size();
    4437             : 
    4438        1539 :         xattr_NTACL_Type.tp_base = BaseObject_Type;
    4439        1539 :         xattr_NTACL_Type.tp_basicsize = pytalloc_BaseObject_size();
    4440             : 
    4441        1539 :         xattr_sys_acl_hash_wrapper_Type.tp_base = BaseObject_Type;
    4442        1539 :         xattr_sys_acl_hash_wrapper_Type.tp_basicsize = pytalloc_BaseObject_size();
    4443             : 
    4444        1539 :         if (PyType_Ready(&xattr_DosInfoFFFFCompat_Type) < 0)
    4445           0 :                 goto out;
    4446        1539 :         if (PyType_Ready(&xattr_DosInfo1_Type) < 0)
    4447           0 :                 goto out;
    4448        1539 :         if (PyType_Ready(&xattr_DosInfo2Old_Type) < 0)
    4449           0 :                 goto out;
    4450        1539 :         if (PyType_Ready(&xattr_DosInfo3_Type) < 0)
    4451           0 :                 goto out;
    4452        1539 :         if (PyType_Ready(&xattr_DosInfo4_Type) < 0)
    4453           0 :                 goto out;
    4454        1539 :         if (PyType_Ready(&xattr_DosInfo_Type) < 0)
    4455           0 :                 goto out;
    4456        1539 :         if (PyType_Ready(&xattr_DosAttrib_Type) < 0)
    4457           0 :                 goto out;
    4458        1539 :         if (PyType_Ready(&xattr_DOSATTRIB_Type) < 0)
    4459           0 :                 goto out;
    4460        1539 :         if (PyType_Ready(&xattr_EA_Type) < 0)
    4461           0 :                 goto out;
    4462        1539 :         if (PyType_Ready(&xattr_DosEAs_Type) < 0)
    4463           0 :                 goto out;
    4464        1539 :         if (PyType_Ready(&tdb_xattrs_Type) < 0)
    4465           0 :                 goto out;
    4466        1539 :         if (PyType_Ready(&xattr_DosStream_Type) < 0)
    4467           0 :                 goto out;
    4468        1539 :         if (PyType_Ready(&xattr_DosStreams_Type) < 0)
    4469           0 :                 goto out;
    4470        1539 :         if (PyType_Ready(&security_descriptor_hash_v2_Type) < 0)
    4471           0 :                 goto out;
    4472        1539 :         if (PyType_Ready(&security_descriptor_hash_v3_Type) < 0)
    4473           0 :                 goto out;
    4474        1539 :         if (PyType_Ready(&security_descriptor_hash_v4_Type) < 0)
    4475           0 :                 goto out;
    4476        1539 :         if (PyType_Ready(&xattr_NTACL_Info_Type) < 0)
    4477           0 :                 goto out;
    4478        1539 :         if (PyType_Ready(&xattr_NTACL_Type) < 0)
    4479           0 :                 goto out;
    4480        1539 :         if (PyType_Ready(&xattr_sys_acl_hash_wrapper_Type) < 0)
    4481           0 :                 goto out;
    4482             : #ifdef PY_DOSINFOFFFFCOMPAT_PATCH
    4483             :         PY_DOSINFOFFFFCOMPAT_PATCH(&xattr_DosInfoFFFFCompat_Type);
    4484             : #endif
    4485             : #ifdef PY_DOSINFO1_PATCH
    4486             :         PY_DOSINFO1_PATCH(&xattr_DosInfo1_Type);
    4487             : #endif
    4488             : #ifdef PY_DOSINFO2OLD_PATCH
    4489             :         PY_DOSINFO2OLD_PATCH(&xattr_DosInfo2Old_Type);
    4490             : #endif
    4491             : #ifdef PY_DOSINFO3_PATCH
    4492             :         PY_DOSINFO3_PATCH(&xattr_DosInfo3_Type);
    4493             : #endif
    4494             : #ifdef PY_DOSINFO4_PATCH
    4495             :         PY_DOSINFO4_PATCH(&xattr_DosInfo4_Type);
    4496             : #endif
    4497             : #ifdef PY_DOSINFO_PATCH
    4498             :         PY_DOSINFO_PATCH(&xattr_DosInfo_Type);
    4499             : #endif
    4500             : #ifdef PY_DOSATTRIB_PATCH
    4501             :         PY_DOSATTRIB_PATCH(&xattr_DosAttrib_Type);
    4502             : #endif
    4503             : #ifdef PY_DOSATTRIB_PATCH
    4504             :         PY_DOSATTRIB_PATCH(&xattr_DOSATTRIB_Type);
    4505             : #endif
    4506             : #ifdef PY_EA_PATCH
    4507             :         PY_EA_PATCH(&xattr_EA_Type);
    4508             : #endif
    4509             : #ifdef PY_DOSEAS_PATCH
    4510             :         PY_DOSEAS_PATCH(&xattr_DosEAs_Type);
    4511             : #endif
    4512             : #ifdef PY_TDB_XATTRS_PATCH
    4513             :         PY_TDB_XATTRS_PATCH(&tdb_xattrs_Type);
    4514             : #endif
    4515             : #ifdef PY_DOSSTREAM_PATCH
    4516             :         PY_DOSSTREAM_PATCH(&xattr_DosStream_Type);
    4517             : #endif
    4518             : #ifdef PY_DOSSTREAMS_PATCH
    4519             :         PY_DOSSTREAMS_PATCH(&xattr_DosStreams_Type);
    4520             : #endif
    4521             : #ifdef PY_SECURITY_DESCRIPTOR_HASH_V2_PATCH
    4522             :         PY_SECURITY_DESCRIPTOR_HASH_V2_PATCH(&security_descriptor_hash_v2_Type);
    4523             : #endif
    4524             : #ifdef PY_SECURITY_DESCRIPTOR_HASH_V3_PATCH
    4525             :         PY_SECURITY_DESCRIPTOR_HASH_V3_PATCH(&security_descriptor_hash_v3_Type);
    4526             : #endif
    4527             : #ifdef PY_SECURITY_DESCRIPTOR_HASH_V4_PATCH
    4528             :         PY_SECURITY_DESCRIPTOR_HASH_V4_PATCH(&security_descriptor_hash_v4_Type);
    4529             : #endif
    4530             : #ifdef PY_NTACL_INFO_PATCH
    4531             :         PY_NTACL_INFO_PATCH(&xattr_NTACL_Info_Type);
    4532             : #endif
    4533             : #ifdef PY_NTACL_PATCH
    4534        1539 :         PY_NTACL_PATCH(&xattr_NTACL_Type);
    4535             : #endif
    4536             : #ifdef PY_SYS_ACL_HASH_WRAPPER_PATCH
    4537             :         PY_SYS_ACL_HASH_WRAPPER_PATCH(&xattr_sys_acl_hash_wrapper_Type);
    4538             : #endif
    4539             : 
    4540        1539 :         m = PyModule_Create(&moduledef);
    4541        1539 :         if (m == NULL)
    4542           0 :                 goto out;
    4543             : 
    4544        1539 :         PyModule_AddObject(m, "XATTR_DOSATTRIB_NAME", PyUnicode_FromString("user.DosAttrib"));
    4545        1539 :         PyModule_AddObject(m, "XATTR_DOSATTRIB_NAME_S3", PyUnicode_FromString("user.DOSATTRIB"));
    4546        1539 :         PyModule_AddObject(m, "XATTR_DOSATTRIB_ESTIMATED_SIZE", PyLong_FromUnsignedLongLong(64));
    4547        1539 :         PyModule_AddObject(m, "XATTR_DOSEAS_NAME", PyUnicode_FromString("user.DosEAs"));
    4548        1539 :         PyModule_AddObject(m, "XATTR_DOSSTREAMS_NAME", PyUnicode_FromString("user.DosStreams"));
    4549        1539 :         PyModule_AddObject(m, "XATTR_STREAM_FLAG_INTERNAL", PyLong_FromUnsignedLongLong(0x00000001));
    4550        1539 :         PyModule_AddObject(m, "XATTR_DOSSTREAM_PREFIX", PyUnicode_FromString("user.DosStream."));
    4551        1539 :         PyModule_AddObject(m, "XATTR_MAX_STREAM_SIZE", PyLong_FromUnsignedLongLong(0x4000));
    4552        1539 :         PyModule_AddObject(m, "XATTR_MAX_STREAM_SIZE_TDB", PyLong_FromUnsignedLongLong(0x100000));
    4553        1539 :         PyModule_AddObject(m, "XATTR_NTACL_NAME", PyUnicode_FromString("security.NTACL"));
    4554        1539 :         PyModule_AddObject(m, "XATTR_SD_HASH_SIZE", PyLong_FromUnsignedLongLong(64));
    4555        1539 :         PyModule_AddObject(m, "XATTR_SD_HASH_TYPE_NONE", PyLong_FromUnsignedLongLong(0x0));
    4556        1539 :         PyModule_AddObject(m, "XATTR_SD_HASH_TYPE_SHA256", PyLong_FromUnsignedLongLong(0x1));
    4557        1539 :         PyModule_AddObject(m, "XATTR_DOSINFO_ATTRIB", PyLong_FromUnsignedLongLong((uint32_t)XATTR_DOSINFO_ATTRIB));
    4558        1539 :         PyModule_AddObject(m, "XATTR_DOSINFO_EA_SIZE", PyLong_FromUnsignedLongLong((uint32_t)XATTR_DOSINFO_EA_SIZE));
    4559        1539 :         PyModule_AddObject(m, "XATTR_DOSINFO_SIZE", PyLong_FromUnsignedLongLong((uint32_t)XATTR_DOSINFO_SIZE));
    4560        1539 :         PyModule_AddObject(m, "XATTR_DOSINFO_ALLOC_SIZE", PyLong_FromUnsignedLongLong((uint32_t)XATTR_DOSINFO_ALLOC_SIZE));
    4561        1539 :         PyModule_AddObject(m, "XATTR_DOSINFO_CREATE_TIME", PyLong_FromUnsignedLongLong((uint32_t)XATTR_DOSINFO_CREATE_TIME));
    4562        1539 :         PyModule_AddObject(m, "XATTR_DOSINFO_CHANGE_TIME", PyLong_FromUnsignedLongLong((uint32_t)XATTR_DOSINFO_CHANGE_TIME));
    4563        1539 :         PyModule_AddObject(m, "XATTR_DOSINFO_ITIME", PyLong_FromUnsignedLongLong((uint32_t)XATTR_DOSINFO_ITIME));
    4564        1539 :         Py_INCREF((PyObject *)(void *)&xattr_DosInfoFFFFCompat_Type);
    4565        1539 :         PyModule_AddObject(m, "DosInfoFFFFCompat", (PyObject *)(void *)&xattr_DosInfoFFFFCompat_Type);
    4566        1539 :         Py_INCREF((PyObject *)(void *)&xattr_DosInfo1_Type);
    4567        1539 :         PyModule_AddObject(m, "DosInfo1", (PyObject *)(void *)&xattr_DosInfo1_Type);
    4568        1539 :         Py_INCREF((PyObject *)(void *)&xattr_DosInfo2Old_Type);
    4569        1539 :         PyModule_AddObject(m, "DosInfo2Old", (PyObject *)(void *)&xattr_DosInfo2Old_Type);
    4570        1539 :         Py_INCREF((PyObject *)(void *)&xattr_DosInfo3_Type);
    4571        1539 :         PyModule_AddObject(m, "DosInfo3", (PyObject *)(void *)&xattr_DosInfo3_Type);
    4572        1539 :         Py_INCREF((PyObject *)(void *)&xattr_DosInfo4_Type);
    4573        1539 :         PyModule_AddObject(m, "DosInfo4", (PyObject *)(void *)&xattr_DosInfo4_Type);
    4574        1539 :         Py_INCREF((PyObject *)(void *)&xattr_DosInfo_Type);
    4575        1539 :         PyModule_AddObject(m, "DosInfo", (PyObject *)(void *)&xattr_DosInfo_Type);
    4576        1539 :         Py_INCREF((PyObject *)(void *)&xattr_DosAttrib_Type);
    4577        1539 :         PyModule_AddObject(m, "DosAttrib", (PyObject *)(void *)&xattr_DosAttrib_Type);
    4578        1539 :         Py_INCREF((PyObject *)(void *)&xattr_DOSATTRIB_Type);
    4579        1539 :         PyModule_AddObject(m, "DOSATTRIB", (PyObject *)(void *)&xattr_DOSATTRIB_Type);
    4580        1539 :         Py_INCREF((PyObject *)(void *)&xattr_EA_Type);
    4581        1539 :         PyModule_AddObject(m, "EA", (PyObject *)(void *)&xattr_EA_Type);
    4582        1539 :         Py_INCREF((PyObject *)(void *)&xattr_DosEAs_Type);
    4583        1539 :         PyModule_AddObject(m, "DosEAs", (PyObject *)(void *)&xattr_DosEAs_Type);
    4584        1539 :         Py_INCREF((PyObject *)(void *)&tdb_xattrs_Type);
    4585        1539 :         PyModule_AddObject(m, "tdb_xattrs", (PyObject *)(void *)&tdb_xattrs_Type);
    4586        1539 :         Py_INCREF((PyObject *)(void *)&xattr_DosStream_Type);
    4587        1539 :         PyModule_AddObject(m, "DosStream", (PyObject *)(void *)&xattr_DosStream_Type);
    4588        1539 :         Py_INCREF((PyObject *)(void *)&xattr_DosStreams_Type);
    4589        1539 :         PyModule_AddObject(m, "DosStreams", (PyObject *)(void *)&xattr_DosStreams_Type);
    4590        1539 :         Py_INCREF((PyObject *)(void *)&security_descriptor_hash_v2_Type);
    4591        1539 :         PyModule_AddObject(m, "security_descriptor_hash_v2", (PyObject *)(void *)&security_descriptor_hash_v2_Type);
    4592        1539 :         Py_INCREF((PyObject *)(void *)&security_descriptor_hash_v3_Type);
    4593        1539 :         PyModule_AddObject(m, "security_descriptor_hash_v3", (PyObject *)(void *)&security_descriptor_hash_v3_Type);
    4594        1539 :         Py_INCREF((PyObject *)(void *)&security_descriptor_hash_v4_Type);
    4595        1539 :         PyModule_AddObject(m, "security_descriptor_hash_v4", (PyObject *)(void *)&security_descriptor_hash_v4_Type);
    4596        1539 :         Py_INCREF((PyObject *)(void *)&xattr_NTACL_Info_Type);
    4597        1539 :         PyModule_AddObject(m, "NTACL_Info", (PyObject *)(void *)&xattr_NTACL_Info_Type);
    4598        1539 :         Py_INCREF((PyObject *)(void *)&xattr_NTACL_Type);
    4599        1539 :         PyModule_AddObject(m, "NTACL", (PyObject *)(void *)&xattr_NTACL_Type);
    4600        1539 :         Py_INCREF((PyObject *)(void *)&xattr_sys_acl_hash_wrapper_Type);
    4601        1539 :         PyModule_AddObject(m, "sys_acl_hash_wrapper", (PyObject *)(void *)&xattr_sys_acl_hash_wrapper_Type);
    4602             : #ifdef PY_MOD_XATTR_PATCH
    4603             :         PY_MOD_XATTR_PATCH(m);
    4604             : #endif
    4605        1539 :         out:
    4606        1539 :         Py_XDECREF(dep_samba_dcerpc_security);
    4607        1539 :         Py_XDECREF(dep_talloc);
    4608        1539 :         return m;
    4609             : 
    4610             : }

Generated by: LCOV version 1.13