LCOV - code coverage report
Current view: top level - bin/default/librpc/gen_ndr - py_gkdi.c (source / functions) Hit Total Coverage
Test: coverage report for master 2f515e9b Lines: 894 2214 40.4 %
Date: 2024-04-21 15:09:00 Functions: 97 162 59.9 %

          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 "lib/replace/system/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_gkdi.h"
      12             : #include "bin/default/librpc/gen_ndr/ndr_gkdi_c.h"
      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       29754 : static inline unsigned long long ndr_sizeof2uintmax(size_t var_size)
      33             : {
      34       29754 :         switch (var_size) {
      35           0 :         case 8:
      36           0 :                 return UINT64_MAX;
      37          58 :         case 4:
      38          58 :                 return UINT32_MAX;
      39           0 :         case 2:
      40           0 :                 return UINT16_MAX;
      41       29696 :         case 1:
      42       29696 :                 return UINT8_MAX;
      43             :         }
      44             : 
      45           0 :         return 0;
      46             : }
      47             : 
      48           0 : static inline _MAYBE_UNUSED_ long long ndr_sizeof2intmax(size_t var_size)
      49             : {
      50           0 :         switch (var_size) {
      51           0 :         case 8:
      52           0 :                 return INT64_MAX;
      53           0 :         case 4:
      54           0 :                 return INT32_MAX;
      55           0 :         case 2:
      56           0 :                 return INT16_MAX;
      57           0 :         case 1:
      58           0 :                 return INT8_MAX;
      59             :         }
      60             : 
      61           0 :         return 0;
      62             : }
      63             : 
      64             : #include "librpc/gen_ndr/misc.h"
      65             : static PyTypeObject KeyEnvelope_Type;
      66             : static PyTypeObject GroupKeyEnvelope_Type;
      67             : static PyTypeObject KdfParameters_Type;
      68             : static PyTypeObject FfcDhParameters_Type;
      69             : static PyTypeObject GkdiDerivationCtx_Type;
      70             : static PyTypeObject gkdi_InterfaceType;
      71             : static PyTypeObject gkdi_GetKey_Type;
      72             : 
      73             : static PyTypeObject *GUID_Type;
      74             : static PyTypeObject *BaseObject_Type;
      75             : static PyTypeObject *ClientConnection_Type;
      76             : static PyTypeObject *ndr_syntax_id_Type;
      77             : 
      78           1 : static PyObject *py_KeyEnvelope_get_version(PyObject *obj, void *closure)
      79             : {
      80           1 :         struct KeyEnvelope *object = pytalloc_get_ptr(obj);
      81           1 :         PyObject *py_version;
      82           1 :         py_version = PyLong_FromUnsignedLongLong((uint32_t)(object->version));
      83           1 :         return py_version;
      84             : }
      85             : 
      86           1 : static int py_KeyEnvelope_set_version(PyObject *py_obj, PyObject *value, void *closure)
      87             : {
      88           1 :         struct KeyEnvelope *object = pytalloc_get_ptr(py_obj);
      89           1 :         if (value == NULL) {
      90           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->version");
      91           0 :                 return -1;
      92             :         }
      93             :         {
      94           1 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->version));
      95           1 :                 if (PyLong_Check(value)) {
      96           1 :                         unsigned long long test_var;
      97           1 :                         test_var = PyLong_AsUnsignedLongLong(value);
      98           1 :                         if (PyErr_Occurred() != NULL) {
      99           0 :                                 return -1;
     100             :                         }
     101           1 :                         if (test_var > uint_max) {
     102           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
     103             :                                   PyLong_Type.tp_name, uint_max, test_var);
     104           0 :                                 return -1;
     105             :                         }
     106           1 :                         object->version = test_var;
     107             :                 } else {
     108           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
     109             :                           PyLong_Type.tp_name);
     110           0 :                         return -1;
     111             :                 }
     112             :         }
     113           1 :         return 0;
     114             : }
     115             : 
     116           1 : static PyObject *py_KeyEnvelope_get_magic(PyObject *obj, void *closure)
     117             : {
     118           1 :         struct KeyEnvelope *object = pytalloc_get_ptr(obj);
     119           1 :         PyObject *py_magic;
     120           1 :         py_magic = PyLong_FromUnsignedLongLong((uint32_t)(object->magic));
     121           1 :         return py_magic;
     122             : }
     123             : 
     124           0 : static int py_KeyEnvelope_set_magic(PyObject *py_obj, PyObject *value, void *closure)
     125             : {
     126           0 :         struct KeyEnvelope *object = pytalloc_get_ptr(py_obj);
     127           0 :         if (value == NULL) {
     128           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->magic");
     129           0 :                 return -1;
     130             :         }
     131             :         {
     132           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->magic));
     133           0 :                 if (PyLong_Check(value)) {
     134           0 :                         unsigned long long test_var;
     135           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     136           0 :                         if (PyErr_Occurred() != NULL) {
     137           0 :                                 return -1;
     138             :                         }
     139           0 :                         if (test_var > uint_max) {
     140           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
     141             :                                   PyLong_Type.tp_name, uint_max, test_var);
     142           0 :                                 return -1;
     143             :                         }
     144           0 :                         object->magic = test_var;
     145             :                 } else {
     146           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
     147             :                           PyLong_Type.tp_name);
     148           0 :                         return -1;
     149             :                 }
     150             :         }
     151           0 :         return 0;
     152             : }
     153             : 
     154           1 : static PyObject *py_KeyEnvelope_get_flags(PyObject *obj, void *closure)
     155             : {
     156           1 :         struct KeyEnvelope *object = pytalloc_get_ptr(obj);
     157           1 :         PyObject *py_flags;
     158           1 :         py_flags = PyLong_FromUnsignedLongLong((uint32_t)(object->flags));
     159           1 :         return py_flags;
     160             : }
     161             : 
     162           1 : static int py_KeyEnvelope_set_flags(PyObject *py_obj, PyObject *value, void *closure)
     163             : {
     164           1 :         struct KeyEnvelope *object = pytalloc_get_ptr(py_obj);
     165           1 :         if (value == NULL) {
     166           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->flags");
     167           0 :                 return -1;
     168             :         }
     169             :         {
     170           1 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->flags));
     171           1 :                 if (PyLong_Check(value)) {
     172           1 :                         unsigned long long test_var;
     173           1 :                         test_var = PyLong_AsUnsignedLongLong(value);
     174           1 :                         if (PyErr_Occurred() != NULL) {
     175           0 :                                 return -1;
     176             :                         }
     177           1 :                         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           1 :                         object->flags = 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           1 :         return 0;
     190             : }
     191             : 
     192          33 : static PyObject *py_KeyEnvelope_get_l0_index(PyObject *obj, void *closure)
     193             : {
     194          33 :         struct KeyEnvelope *object = pytalloc_get_ptr(obj);
     195           1 :         PyObject *py_l0_index;
     196          33 :         py_l0_index = PyLong_FromUnsignedLongLong((uint32_t)(object->l0_index));
     197          33 :         return py_l0_index;
     198             : }
     199             : 
     200           1 : static int py_KeyEnvelope_set_l0_index(PyObject *py_obj, PyObject *value, void *closure)
     201             : {
     202           1 :         struct KeyEnvelope *object = pytalloc_get_ptr(py_obj);
     203           1 :         if (value == NULL) {
     204           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->l0_index");
     205           0 :                 return -1;
     206             :         }
     207             :         {
     208           1 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->l0_index));
     209           1 :                 if (PyLong_Check(value)) {
     210           1 :                         unsigned long long test_var;
     211           1 :                         test_var = PyLong_AsUnsignedLongLong(value);
     212           1 :                         if (PyErr_Occurred() != NULL) {
     213           0 :                                 return -1;
     214             :                         }
     215           1 :                         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           1 :                         object->l0_index = 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           1 :         return 0;
     228             : }
     229             : 
     230          33 : static PyObject *py_KeyEnvelope_get_l1_index(PyObject *obj, void *closure)
     231             : {
     232          33 :         struct KeyEnvelope *object = pytalloc_get_ptr(obj);
     233           1 :         PyObject *py_l1_index;
     234          33 :         py_l1_index = PyLong_FromUnsignedLongLong((uint32_t)(object->l1_index));
     235          33 :         return py_l1_index;
     236             : }
     237             : 
     238           1 : static int py_KeyEnvelope_set_l1_index(PyObject *py_obj, PyObject *value, void *closure)
     239             : {
     240           1 :         struct KeyEnvelope *object = pytalloc_get_ptr(py_obj);
     241           1 :         if (value == NULL) {
     242           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->l1_index");
     243           0 :                 return -1;
     244             :         }
     245             :         {
     246           1 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->l1_index));
     247           1 :                 if (PyLong_Check(value)) {
     248           1 :                         unsigned long long test_var;
     249           1 :                         test_var = PyLong_AsUnsignedLongLong(value);
     250           1 :                         if (PyErr_Occurred() != NULL) {
     251           0 :                                 return -1;
     252             :                         }
     253           1 :                         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           1 :                         object->l1_index = 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           1 :         return 0;
     266             : }
     267             : 
     268          33 : static PyObject *py_KeyEnvelope_get_l2_index(PyObject *obj, void *closure)
     269             : {
     270          33 :         struct KeyEnvelope *object = pytalloc_get_ptr(obj);
     271           1 :         PyObject *py_l2_index;
     272          33 :         py_l2_index = PyLong_FromUnsignedLongLong((uint32_t)(object->l2_index));
     273          33 :         return py_l2_index;
     274             : }
     275             : 
     276           1 : static int py_KeyEnvelope_set_l2_index(PyObject *py_obj, PyObject *value, void *closure)
     277             : {
     278           1 :         struct KeyEnvelope *object = pytalloc_get_ptr(py_obj);
     279           1 :         if (value == NULL) {
     280           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->l2_index");
     281           0 :                 return -1;
     282             :         }
     283             :         {
     284           1 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->l2_index));
     285           1 :                 if (PyLong_Check(value)) {
     286           1 :                         unsigned long long test_var;
     287           1 :                         test_var = PyLong_AsUnsignedLongLong(value);
     288           1 :                         if (PyErr_Occurred() != NULL) {
     289           0 :                                 return -1;
     290             :                         }
     291           1 :                         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           1 :                         object->l2_index = 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           1 :         return 0;
     304             : }
     305             : 
     306           1 : static PyObject *py_KeyEnvelope_get_root_key_id(PyObject *obj, void *closure)
     307             : {
     308           1 :         struct KeyEnvelope *object = pytalloc_get_ptr(obj);
     309           1 :         PyObject *py_root_key_id;
     310           1 :         py_root_key_id = pytalloc_reference_ex(GUID_Type, pytalloc_get_mem_ctx(obj), &object->root_key_id);
     311           1 :         return py_root_key_id;
     312             : }
     313             : 
     314           1 : static int py_KeyEnvelope_set_root_key_id(PyObject *py_obj, PyObject *value, void *closure)
     315             : {
     316           1 :         struct KeyEnvelope *object = pytalloc_get_ptr(py_obj);
     317           1 :         if (value == NULL) {
     318           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->root_key_id");
     319           0 :                 return -1;
     320             :         }
     321           1 :         PY_CHECK_TYPE(GUID_Type, value, return -1;);
     322           1 :         if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
     323           0 :                 PyErr_NoMemory();
     324           0 :                 return -1;
     325             :         }
     326           1 :         object->root_key_id = *(struct GUID *)pytalloc_get_ptr(value);
     327           1 :         return 0;
     328             : }
     329             : 
     330           1 : static PyObject *py_KeyEnvelope_get_additional_info_len(PyObject *obj, void *closure)
     331             : {
     332           1 :         struct KeyEnvelope *object = pytalloc_get_ptr(obj);
     333           1 :         PyObject *py_additional_info_len;
     334           1 :         py_additional_info_len = PyLong_FromUnsignedLongLong((uint32_t)(object->additional_info_len));
     335           1 :         return py_additional_info_len;
     336             : }
     337             : 
     338           1 : static int py_KeyEnvelope_set_additional_info_len(PyObject *py_obj, PyObject *value, void *closure)
     339             : {
     340           1 :         struct KeyEnvelope *object = pytalloc_get_ptr(py_obj);
     341           1 :         if (value == NULL) {
     342           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->additional_info_len");
     343           0 :                 return -1;
     344             :         }
     345             :         {
     346           1 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->additional_info_len));
     347           1 :                 if (PyLong_Check(value)) {
     348           1 :                         unsigned long long test_var;
     349           1 :                         test_var = PyLong_AsUnsignedLongLong(value);
     350           1 :                         if (PyErr_Occurred() != NULL) {
     351           0 :                                 return -1;
     352             :                         }
     353           1 :                         if (test_var > uint_max) {
     354           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
     355             :                                   PyLong_Type.tp_name, uint_max, test_var);
     356           0 :                                 return -1;
     357             :                         }
     358           1 :                         object->additional_info_len = test_var;
     359             :                 } else {
     360           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
     361             :                           PyLong_Type.tp_name);
     362           0 :                         return -1;
     363             :                 }
     364             :         }
     365           1 :         return 0;
     366             : }
     367             : 
     368           1 : static PyObject *py_KeyEnvelope_get_domain_name_len(PyObject *obj, void *closure)
     369             : {
     370           1 :         struct KeyEnvelope *object = pytalloc_get_ptr(obj);
     371           1 :         PyObject *py_domain_name_len;
     372           1 :         py_domain_name_len = PyLong_FromUnsignedLongLong((uint32_t)(object->domain_name_len));
     373           1 :         return py_domain_name_len;
     374             : }
     375             : 
     376           0 : static int py_KeyEnvelope_set_domain_name_len(PyObject *py_obj, PyObject *value, void *closure)
     377             : {
     378           0 :         struct KeyEnvelope *object = pytalloc_get_ptr(py_obj);
     379           0 :         if (value == NULL) {
     380           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->domain_name_len");
     381           0 :                 return -1;
     382             :         }
     383             :         {
     384           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->domain_name_len));
     385           0 :                 if (PyLong_Check(value)) {
     386           0 :                         unsigned long long test_var;
     387           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     388           0 :                         if (PyErr_Occurred() != NULL) {
     389           0 :                                 return -1;
     390             :                         }
     391           0 :                         if (test_var > uint_max) {
     392           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
     393             :                                   PyLong_Type.tp_name, uint_max, test_var);
     394           0 :                                 return -1;
     395             :                         }
     396           0 :                         object->domain_name_len = test_var;
     397             :                 } else {
     398           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
     399             :                           PyLong_Type.tp_name);
     400           0 :                         return -1;
     401             :                 }
     402             :         }
     403           0 :         return 0;
     404             : }
     405             : 
     406           1 : static PyObject *py_KeyEnvelope_get_forest_name_len(PyObject *obj, void *closure)
     407             : {
     408           1 :         struct KeyEnvelope *object = pytalloc_get_ptr(obj);
     409           1 :         PyObject *py_forest_name_len;
     410           1 :         py_forest_name_len = PyLong_FromUnsignedLongLong((uint32_t)(object->forest_name_len));
     411           1 :         return py_forest_name_len;
     412             : }
     413             : 
     414           0 : static int py_KeyEnvelope_set_forest_name_len(PyObject *py_obj, PyObject *value, void *closure)
     415             : {
     416           0 :         struct KeyEnvelope *object = pytalloc_get_ptr(py_obj);
     417           0 :         if (value == NULL) {
     418           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->forest_name_len");
     419           0 :                 return -1;
     420             :         }
     421             :         {
     422           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->forest_name_len));
     423           0 :                 if (PyLong_Check(value)) {
     424           0 :                         unsigned long long test_var;
     425           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     426           0 :                         if (PyErr_Occurred() != NULL) {
     427           0 :                                 return -1;
     428             :                         }
     429           0 :                         if (test_var > uint_max) {
     430           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
     431             :                                   PyLong_Type.tp_name, uint_max, test_var);
     432           0 :                                 return -1;
     433             :                         }
     434           0 :                         object->forest_name_len = test_var;
     435             :                 } else {
     436           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
     437             :                           PyLong_Type.tp_name);
     438           0 :                         return -1;
     439             :                 }
     440             :         }
     441           0 :         return 0;
     442             : }
     443             : 
     444           1 : static PyObject *py_KeyEnvelope_get_additional_info(PyObject *obj, void *closure)
     445             : {
     446           1 :         struct KeyEnvelope *object = pytalloc_get_ptr(obj);
     447           1 :         PyObject *py_additional_info;
     448           1 :         py_additional_info = PyList_New(object->additional_info_len);
     449           1 :         if (py_additional_info == NULL) {
     450           0 :                 return NULL;
     451             :         }
     452             :         {
     453             :                 int additional_info_cntr_0;
     454           1 :                 for (additional_info_cntr_0 = 0; additional_info_cntr_0 < (object->additional_info_len); additional_info_cntr_0++) {
     455           0 :                         PyObject *py_additional_info_0;
     456           0 :                         py_additional_info_0 = PyLong_FromLong((uint16_t)((object->additional_info)[additional_info_cntr_0]));
     457           0 :                         PyList_SetItem(py_additional_info, additional_info_cntr_0, py_additional_info_0);
     458             :                 }
     459             :         }
     460           0 :         return py_additional_info;
     461             : }
     462             : 
     463           1 : static int py_KeyEnvelope_set_additional_info(PyObject *py_obj, PyObject *value, void *closure)
     464             : {
     465           1 :         struct KeyEnvelope *object = pytalloc_get_ptr(py_obj);
     466           1 :         if (value == NULL) {
     467           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->additional_info");
     468           0 :                 return -1;
     469             :         }
     470           1 :         PY_CHECK_TYPE(&PyList_Type, value, return -1;);
     471             :         {
     472           1 :                 int additional_info_cntr_0;
     473           1 :                 object->additional_info = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->additional_info, PyList_GET_SIZE(value));
     474           1 :                 if (!object->additional_info) { return -1; }
     475           1 :                 talloc_set_name_const(object->additional_info, "ARRAY: object->additional_info");
     476           2 :                 for (additional_info_cntr_0 = 0; additional_info_cntr_0 < PyList_GET_SIZE(value); additional_info_cntr_0++) {
     477           0 :                         if (PyList_GET_ITEM(value, additional_info_cntr_0) == NULL) {
     478           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->additional_info)[additional_info_cntr_0]");
     479           0 :                                 return -1;
     480             :                         }
     481             :                         {
     482           0 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((object->additional_info)[additional_info_cntr_0]));
     483           0 :                                 if (PyLong_Check(PyList_GET_ITEM(value, additional_info_cntr_0))) {
     484           0 :                                         unsigned long long test_var;
     485           0 :                                         test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, additional_info_cntr_0));
     486           0 :                                         if (PyErr_Occurred() != NULL) {
     487           0 :                                                 return -1;
     488             :                                         }
     489           0 :                                         if (test_var > uint_max) {
     490           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
     491             :                                                   PyLong_Type.tp_name, uint_max, test_var);
     492           0 :                                                 return -1;
     493             :                                         }
     494           0 :                                         (object->additional_info)[additional_info_cntr_0] = test_var;
     495             :                                 } else {
     496           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",
     497             :                                           PyLong_Type.tp_name);
     498           0 :                                         return -1;
     499             :                                 }
     500             :                         }
     501             :                 }
     502             :         }
     503           0 :         return 0;
     504             : }
     505             : 
     506           1 : static PyObject *py_KeyEnvelope_get_domain_name(PyObject *obj, void *closure)
     507             : {
     508           1 :         struct KeyEnvelope *object = pytalloc_get_ptr(obj);
     509           1 :         PyObject *py_domain_name;
     510           1 :         py_domain_name = PyString_FromStringOrNULL(object->domain_name);
     511           1 :         return py_domain_name;
     512             : }
     513             : 
     514           1 : static int py_KeyEnvelope_set_domain_name(PyObject *py_obj, PyObject *value, void *closure)
     515             : {
     516           1 :         struct KeyEnvelope *object = pytalloc_get_ptr(py_obj);
     517           1 :         if (value == NULL) {
     518           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->domain_name");
     519           0 :                 return -1;
     520             :         }
     521             :         {
     522           1 :                 const char *test_str;
     523           1 :                 const char *talloc_str;
     524           1 :                 PyObject *unicode = NULL;
     525           1 :                 if (PyUnicode_Check(value)) {
     526           1 :                         unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
     527           1 :                         if (unicode == NULL) {
     528           0 :                                 return -1;
     529             :                         }
     530           1 :                         test_str = PyBytes_AS_STRING(unicode);
     531           0 :                 } else if (PyBytes_Check(value)) {
     532           0 :                         test_str = PyBytes_AS_STRING(value);
     533             :                 } else {
     534           0 :                         PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
     535           0 :                         return -1;
     536             :                 }
     537           1 :                 talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
     538           1 :                 if (unicode != NULL) {
     539           1 :                         Py_DECREF(unicode);
     540             :                 }
     541           1 :                 if (talloc_str == NULL) {
     542           0 :                         PyErr_NoMemory();
     543           0 :                         return -1;
     544             :                 }
     545           1 :                 object->domain_name = talloc_str;
     546             :         }
     547           1 :         return 0;
     548             : }
     549             : 
     550           1 : static PyObject *py_KeyEnvelope_get_forest_name(PyObject *obj, void *closure)
     551             : {
     552           1 :         struct KeyEnvelope *object = pytalloc_get_ptr(obj);
     553           1 :         PyObject *py_forest_name;
     554           1 :         py_forest_name = PyString_FromStringOrNULL(object->forest_name);
     555           1 :         return py_forest_name;
     556             : }
     557             : 
     558           1 : static int py_KeyEnvelope_set_forest_name(PyObject *py_obj, PyObject *value, void *closure)
     559             : {
     560           1 :         struct KeyEnvelope *object = pytalloc_get_ptr(py_obj);
     561           1 :         if (value == NULL) {
     562           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->forest_name");
     563           0 :                 return -1;
     564             :         }
     565             :         {
     566           1 :                 const char *test_str;
     567           1 :                 const char *talloc_str;
     568           1 :                 PyObject *unicode = NULL;
     569           1 :                 if (PyUnicode_Check(value)) {
     570           1 :                         unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
     571           1 :                         if (unicode == NULL) {
     572           0 :                                 return -1;
     573             :                         }
     574           1 :                         test_str = PyBytes_AS_STRING(unicode);
     575           0 :                 } else if (PyBytes_Check(value)) {
     576           0 :                         test_str = PyBytes_AS_STRING(value);
     577             :                 } else {
     578           0 :                         PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
     579           0 :                         return -1;
     580             :                 }
     581           1 :                 talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
     582           1 :                 if (unicode != NULL) {
     583           1 :                         Py_DECREF(unicode);
     584             :                 }
     585           1 :                 if (talloc_str == NULL) {
     586           0 :                         PyErr_NoMemory();
     587           0 :                         return -1;
     588             :                 }
     589           1 :                 object->forest_name = talloc_str;
     590             :         }
     591           1 :         return 0;
     592             : }
     593             : 
     594             : static PyGetSetDef py_KeyEnvelope_getsetters[] = {
     595             :         {
     596             :                 .name = discard_const_p(char, "version"),
     597             :                 .get = py_KeyEnvelope_get_version,
     598             :                 .set = py_KeyEnvelope_set_version,
     599             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
     600             :         },
     601             :         {
     602             :                 .name = discard_const_p(char, "magic"),
     603             :                 .get = py_KeyEnvelope_get_magic,
     604             :                 .set = py_KeyEnvelope_set_magic,
     605             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
     606             :         },
     607             :         {
     608             :                 .name = discard_const_p(char, "flags"),
     609             :                 .get = py_KeyEnvelope_get_flags,
     610             :                 .set = py_KeyEnvelope_set_flags,
     611             :                 .doc = discard_const_p(char, "PIDL-generated element of base type EnvelopeFlags")
     612             :         },
     613             :         {
     614             :                 .name = discard_const_p(char, "l0_index"),
     615             :                 .get = py_KeyEnvelope_get_l0_index,
     616             :                 .set = py_KeyEnvelope_set_l0_index,
     617             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
     618             :         },
     619             :         {
     620             :                 .name = discard_const_p(char, "l1_index"),
     621             :                 .get = py_KeyEnvelope_get_l1_index,
     622             :                 .set = py_KeyEnvelope_set_l1_index,
     623             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
     624             :         },
     625             :         {
     626             :                 .name = discard_const_p(char, "l2_index"),
     627             :                 .get = py_KeyEnvelope_get_l2_index,
     628             :                 .set = py_KeyEnvelope_set_l2_index,
     629             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
     630             :         },
     631             :         {
     632             :                 .name = discard_const_p(char, "root_key_id"),
     633             :                 .get = py_KeyEnvelope_get_root_key_id,
     634             :                 .set = py_KeyEnvelope_set_root_key_id,
     635             :                 .doc = discard_const_p(char, "PIDL-generated element of base type GUID")
     636             :         },
     637             :         {
     638             :                 .name = discard_const_p(char, "additional_info_len"),
     639             :                 .get = py_KeyEnvelope_get_additional_info_len,
     640             :                 .set = py_KeyEnvelope_set_additional_info_len,
     641             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
     642             :         },
     643             :         {
     644             :                 .name = discard_const_p(char, "domain_name_len"),
     645             :                 .get = py_KeyEnvelope_get_domain_name_len,
     646             :                 .set = py_KeyEnvelope_set_domain_name_len,
     647             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
     648             :         },
     649             :         {
     650             :                 .name = discard_const_p(char, "forest_name_len"),
     651             :                 .get = py_KeyEnvelope_get_forest_name_len,
     652             :                 .set = py_KeyEnvelope_set_forest_name_len,
     653             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
     654             :         },
     655             :         {
     656             :                 .name = discard_const_p(char, "additional_info"),
     657             :                 .get = py_KeyEnvelope_get_additional_info,
     658             :                 .set = py_KeyEnvelope_set_additional_info,
     659             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
     660             :         },
     661             :         {
     662             :                 .name = discard_const_p(char, "domain_name"),
     663             :                 .get = py_KeyEnvelope_get_domain_name,
     664             :                 .set = py_KeyEnvelope_set_domain_name,
     665             :                 .doc = discard_const_p(char, "PIDL-generated element of base type string")
     666             :         },
     667             :         {
     668             :                 .name = discard_const_p(char, "forest_name"),
     669             :                 .get = py_KeyEnvelope_get_forest_name,
     670             :                 .set = py_KeyEnvelope_set_forest_name,
     671             :                 .doc = discard_const_p(char, "PIDL-generated element of base type string")
     672             :         },
     673             :         { .name = NULL }
     674             : };
     675             : 
     676          34 : static PyObject *py_KeyEnvelope_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     677             : {
     678          34 :         return pytalloc_new(struct KeyEnvelope, type);
     679             : }
     680             : 
     681           1 : static PyObject *py_KeyEnvelope_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
     682             : {
     683           1 :         struct KeyEnvelope *object = pytalloc_get_ptr(py_obj);
     684           1 :         PyObject *ret = NULL;
     685           1 :         DATA_BLOB blob;
     686           1 :         enum ndr_err_code err;
     687           1 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
     688           1 :         if (tmp_ctx == NULL) {
     689           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
     690           0 :                 return NULL;
     691             :         }
     692           1 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_KeyEnvelope);
     693           1 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
     694           0 :                 TALLOC_FREE(tmp_ctx);
     695           0 :                 PyErr_SetNdrError(err);
     696           0 :                 return NULL;
     697             :         }
     698             : 
     699           1 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
     700           1 :         TALLOC_FREE(tmp_ctx);
     701           1 :         return ret;
     702             : }
     703             : 
     704          33 : static PyObject *py_KeyEnvelope_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
     705             : {
     706          33 :         struct KeyEnvelope *object = pytalloc_get_ptr(py_obj);
     707          33 :         DATA_BLOB blob = {.data = NULL, .length = 0};
     708          33 :         Py_ssize_t blob_length = 0;
     709           1 :         enum ndr_err_code err;
     710          33 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
     711          33 :         PyObject *allow_remaining_obj = NULL;
     712          33 :         bool allow_remaining = false;
     713             : 
     714          33 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
     715             :                 discard_const_p(char *, kwnames),
     716             :                 &blob.data, &blob_length,
     717             :                 &allow_remaining_obj)) {
     718           0 :                 return NULL;
     719             :         }
     720          33 :         blob.length = blob_length;
     721             : 
     722          33 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
     723           0 :                 allow_remaining = true;
     724             :         }
     725             : 
     726          32 :         if (allow_remaining) {
     727           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_KeyEnvelope);
     728             :         } else {
     729          33 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_KeyEnvelope);
     730             :         }
     731          33 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
     732           0 :                 PyErr_SetNdrError(err);
     733           0 :                 return NULL;
     734             :         }
     735             : 
     736          33 :         Py_RETURN_NONE;
     737             : }
     738             : 
     739           0 : static PyObject *py_KeyEnvelope_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
     740             : {
     741           0 :         struct KeyEnvelope *object = pytalloc_get_ptr(py_obj);
     742           0 :         PyObject *ret;
     743           0 :         char *retstr;
     744             : 
     745           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_KeyEnvelope, "KeyEnvelope", object);
     746           0 :         ret = PyUnicode_FromString(retstr);
     747           0 :         talloc_free(retstr);
     748             : 
     749           0 :         return ret;
     750             : }
     751             : 
     752             : static PyMethodDef py_KeyEnvelope_methods[] = {
     753             :         { "__ndr_pack__", (PyCFunction)py_KeyEnvelope_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
     754             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_KeyEnvelope_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
     755             :         { "__ndr_print__", (PyCFunction)py_KeyEnvelope_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
     756             :         { NULL, NULL, 0, NULL }
     757             : };
     758             : 
     759             : 
     760             : static PyTypeObject KeyEnvelope_Type = {
     761             :         PyVarObject_HEAD_INIT(NULL, 0)
     762             :         .tp_name = "gkdi.KeyEnvelope",
     763             :         .tp_getset = py_KeyEnvelope_getsetters,
     764             :         .tp_methods = py_KeyEnvelope_methods,
     765             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
     766             :         .tp_new = py_KeyEnvelope_new,
     767             : };
     768             : 
     769             : 
     770           1 : static PyObject *py_GroupKeyEnvelope_get_version(PyObject *obj, void *closure)
     771             : {
     772           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(obj);
     773           1 :         PyObject *py_version;
     774           1 :         py_version = PyLong_FromUnsignedLongLong((uint32_t)(object->version));
     775           1 :         return py_version;
     776             : }
     777             : 
     778           1 : static int py_GroupKeyEnvelope_set_version(PyObject *py_obj, PyObject *value, void *closure)
     779             : {
     780           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(py_obj);
     781           1 :         if (value == NULL) {
     782           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->version");
     783           0 :                 return -1;
     784             :         }
     785             :         {
     786           1 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->version));
     787           1 :                 if (PyLong_Check(value)) {
     788           1 :                         unsigned long long test_var;
     789           1 :                         test_var = PyLong_AsUnsignedLongLong(value);
     790           1 :                         if (PyErr_Occurred() != NULL) {
     791           0 :                                 return -1;
     792             :                         }
     793           1 :                         if (test_var > uint_max) {
     794           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
     795             :                                   PyLong_Type.tp_name, uint_max, test_var);
     796           0 :                                 return -1;
     797             :                         }
     798           1 :                         object->version = test_var;
     799             :                 } else {
     800           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
     801             :                           PyLong_Type.tp_name);
     802           0 :                         return -1;
     803             :                 }
     804             :         }
     805           1 :         return 0;
     806             : }
     807             : 
     808           1 : static PyObject *py_GroupKeyEnvelope_get_magic(PyObject *obj, void *closure)
     809             : {
     810           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(obj);
     811           1 :         PyObject *py_magic;
     812           1 :         py_magic = PyLong_FromUnsignedLongLong((uint32_t)(object->magic));
     813           1 :         return py_magic;
     814             : }
     815             : 
     816           0 : static int py_GroupKeyEnvelope_set_magic(PyObject *py_obj, PyObject *value, void *closure)
     817             : {
     818           0 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(py_obj);
     819           0 :         if (value == NULL) {
     820           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->magic");
     821           0 :                 return -1;
     822             :         }
     823             :         {
     824           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->magic));
     825           0 :                 if (PyLong_Check(value)) {
     826           0 :                         unsigned long long test_var;
     827           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     828           0 :                         if (PyErr_Occurred() != NULL) {
     829           0 :                                 return -1;
     830             :                         }
     831           0 :                         if (test_var > uint_max) {
     832           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
     833             :                                   PyLong_Type.tp_name, uint_max, test_var);
     834           0 :                                 return -1;
     835             :                         }
     836           0 :                         object->magic = test_var;
     837             :                 } else {
     838           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
     839             :                           PyLong_Type.tp_name);
     840           0 :                         return -1;
     841             :                 }
     842             :         }
     843           0 :         return 0;
     844             : }
     845             : 
     846           1 : static PyObject *py_GroupKeyEnvelope_get_flags(PyObject *obj, void *closure)
     847             : {
     848           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(obj);
     849           1 :         PyObject *py_flags;
     850           1 :         py_flags = PyLong_FromUnsignedLongLong((uint32_t)(object->flags));
     851           1 :         return py_flags;
     852             : }
     853             : 
     854           1 : static int py_GroupKeyEnvelope_set_flags(PyObject *py_obj, PyObject *value, void *closure)
     855             : {
     856           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(py_obj);
     857           1 :         if (value == NULL) {
     858           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->flags");
     859           0 :                 return -1;
     860             :         }
     861             :         {
     862           1 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->flags));
     863           1 :                 if (PyLong_Check(value)) {
     864           1 :                         unsigned long long test_var;
     865           1 :                         test_var = PyLong_AsUnsignedLongLong(value);
     866           1 :                         if (PyErr_Occurred() != NULL) {
     867           0 :                                 return -1;
     868             :                         }
     869           1 :                         if (test_var > uint_max) {
     870           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
     871             :                                   PyLong_Type.tp_name, uint_max, test_var);
     872           0 :                                 return -1;
     873             :                         }
     874           1 :                         object->flags = test_var;
     875             :                 } else {
     876           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
     877             :                           PyLong_Type.tp_name);
     878           0 :                         return -1;
     879             :                 }
     880             :         }
     881           1 :         return 0;
     882             : }
     883             : 
     884           1 : static PyObject *py_GroupKeyEnvelope_get_l0_index(PyObject *obj, void *closure)
     885             : {
     886           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(obj);
     887           1 :         PyObject *py_l0_index;
     888           1 :         py_l0_index = PyLong_FromUnsignedLongLong((uint32_t)(object->l0_index));
     889           1 :         return py_l0_index;
     890             : }
     891             : 
     892           1 : static int py_GroupKeyEnvelope_set_l0_index(PyObject *py_obj, PyObject *value, void *closure)
     893             : {
     894           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(py_obj);
     895           1 :         if (value == NULL) {
     896           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->l0_index");
     897           0 :                 return -1;
     898             :         }
     899             :         {
     900           1 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->l0_index));
     901           1 :                 if (PyLong_Check(value)) {
     902           1 :                         unsigned long long test_var;
     903           1 :                         test_var = PyLong_AsUnsignedLongLong(value);
     904           1 :                         if (PyErr_Occurred() != NULL) {
     905           0 :                                 return -1;
     906             :                         }
     907           1 :                         if (test_var > uint_max) {
     908           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
     909             :                                   PyLong_Type.tp_name, uint_max, test_var);
     910           0 :                                 return -1;
     911             :                         }
     912           1 :                         object->l0_index = test_var;
     913             :                 } else {
     914           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
     915             :                           PyLong_Type.tp_name);
     916           0 :                         return -1;
     917             :                 }
     918             :         }
     919           1 :         return 0;
     920             : }
     921             : 
     922           1 : static PyObject *py_GroupKeyEnvelope_get_l1_index(PyObject *obj, void *closure)
     923             : {
     924           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(obj);
     925           1 :         PyObject *py_l1_index;
     926           1 :         py_l1_index = PyLong_FromUnsignedLongLong((uint32_t)(object->l1_index));
     927           1 :         return py_l1_index;
     928             : }
     929             : 
     930           1 : static int py_GroupKeyEnvelope_set_l1_index(PyObject *py_obj, PyObject *value, void *closure)
     931             : {
     932           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(py_obj);
     933           1 :         if (value == NULL) {
     934           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->l1_index");
     935           0 :                 return -1;
     936             :         }
     937             :         {
     938           1 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->l1_index));
     939           1 :                 if (PyLong_Check(value)) {
     940           1 :                         unsigned long long test_var;
     941           1 :                         test_var = PyLong_AsUnsignedLongLong(value);
     942           1 :                         if (PyErr_Occurred() != NULL) {
     943           0 :                                 return -1;
     944             :                         }
     945           1 :                         if (test_var > uint_max) {
     946           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
     947             :                                   PyLong_Type.tp_name, uint_max, test_var);
     948           0 :                                 return -1;
     949             :                         }
     950           1 :                         object->l1_index = test_var;
     951             :                 } else {
     952           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
     953             :                           PyLong_Type.tp_name);
     954           0 :                         return -1;
     955             :                 }
     956             :         }
     957           1 :         return 0;
     958             : }
     959             : 
     960           1 : static PyObject *py_GroupKeyEnvelope_get_l2_index(PyObject *obj, void *closure)
     961             : {
     962           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(obj);
     963           1 :         PyObject *py_l2_index;
     964           1 :         py_l2_index = PyLong_FromUnsignedLongLong((uint32_t)(object->l2_index));
     965           1 :         return py_l2_index;
     966             : }
     967             : 
     968           1 : static int py_GroupKeyEnvelope_set_l2_index(PyObject *py_obj, PyObject *value, void *closure)
     969             : {
     970           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(py_obj);
     971           1 :         if (value == NULL) {
     972           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->l2_index");
     973           0 :                 return -1;
     974             :         }
     975             :         {
     976           1 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->l2_index));
     977           1 :                 if (PyLong_Check(value)) {
     978           1 :                         unsigned long long test_var;
     979           1 :                         test_var = PyLong_AsUnsignedLongLong(value);
     980           1 :                         if (PyErr_Occurred() != NULL) {
     981           0 :                                 return -1;
     982             :                         }
     983           1 :                         if (test_var > uint_max) {
     984           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
     985             :                                   PyLong_Type.tp_name, uint_max, test_var);
     986           0 :                                 return -1;
     987             :                         }
     988           1 :                         object->l2_index = test_var;
     989             :                 } else {
     990           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
     991             :                           PyLong_Type.tp_name);
     992           0 :                         return -1;
     993             :                 }
     994             :         }
     995           1 :         return 0;
     996             : }
     997             : 
     998           1 : static PyObject *py_GroupKeyEnvelope_get_root_key_id(PyObject *obj, void *closure)
     999             : {
    1000           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(obj);
    1001           1 :         PyObject *py_root_key_id;
    1002           1 :         py_root_key_id = pytalloc_reference_ex(GUID_Type, pytalloc_get_mem_ctx(obj), &object->root_key_id);
    1003           1 :         return py_root_key_id;
    1004             : }
    1005             : 
    1006           1 : static int py_GroupKeyEnvelope_set_root_key_id(PyObject *py_obj, PyObject *value, void *closure)
    1007             : {
    1008           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(py_obj);
    1009           1 :         if (value == NULL) {
    1010           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->root_key_id");
    1011           0 :                 return -1;
    1012             :         }
    1013           1 :         PY_CHECK_TYPE(GUID_Type, value, return -1;);
    1014           1 :         if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
    1015           0 :                 PyErr_NoMemory();
    1016           0 :                 return -1;
    1017             :         }
    1018           1 :         object->root_key_id = *(struct GUID *)pytalloc_get_ptr(value);
    1019           1 :         return 0;
    1020             : }
    1021             : 
    1022           1 : static PyObject *py_GroupKeyEnvelope_get_kdf_algorithm_len(PyObject *obj, void *closure)
    1023             : {
    1024           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(obj);
    1025           1 :         PyObject *py_kdf_algorithm_len;
    1026           1 :         py_kdf_algorithm_len = PyLong_FromUnsignedLongLong((uint32_t)(object->kdf_algorithm_len));
    1027           1 :         return py_kdf_algorithm_len;
    1028             : }
    1029             : 
    1030           0 : static int py_GroupKeyEnvelope_set_kdf_algorithm_len(PyObject *py_obj, PyObject *value, void *closure)
    1031             : {
    1032           0 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(py_obj);
    1033           0 :         if (value == NULL) {
    1034           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->kdf_algorithm_len");
    1035           0 :                 return -1;
    1036             :         }
    1037             :         {
    1038           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->kdf_algorithm_len));
    1039           0 :                 if (PyLong_Check(value)) {
    1040           0 :                         unsigned long long test_var;
    1041           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1042           0 :                         if (PyErr_Occurred() != NULL) {
    1043           0 :                                 return -1;
    1044             :                         }
    1045           0 :                         if (test_var > uint_max) {
    1046           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    1047             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1048           0 :                                 return -1;
    1049             :                         }
    1050           0 :                         object->kdf_algorithm_len = test_var;
    1051             :                 } else {
    1052           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    1053             :                           PyLong_Type.tp_name);
    1054           0 :                         return -1;
    1055             :                 }
    1056             :         }
    1057           0 :         return 0;
    1058             : }
    1059             : 
    1060           1 : static PyObject *py_GroupKeyEnvelope_get_kdf_parameters_len(PyObject *obj, void *closure)
    1061             : {
    1062           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(obj);
    1063           1 :         PyObject *py_kdf_parameters_len;
    1064           1 :         py_kdf_parameters_len = PyLong_FromUnsignedLongLong((uint32_t)(object->kdf_parameters_len));
    1065           1 :         return py_kdf_parameters_len;
    1066             : }
    1067             : 
    1068           1 : static int py_GroupKeyEnvelope_set_kdf_parameters_len(PyObject *py_obj, PyObject *value, void *closure)
    1069             : {
    1070           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(py_obj);
    1071           1 :         if (value == NULL) {
    1072           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->kdf_parameters_len");
    1073           0 :                 return -1;
    1074             :         }
    1075             :         {
    1076           1 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->kdf_parameters_len));
    1077           1 :                 if (PyLong_Check(value)) {
    1078           1 :                         unsigned long long test_var;
    1079           1 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1080           1 :                         if (PyErr_Occurred() != NULL) {
    1081           0 :                                 return -1;
    1082             :                         }
    1083           1 :                         if (test_var > uint_max) {
    1084           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    1085             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1086           0 :                                 return -1;
    1087             :                         }
    1088           1 :                         object->kdf_parameters_len = test_var;
    1089             :                 } else {
    1090           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    1091             :                           PyLong_Type.tp_name);
    1092           0 :                         return -1;
    1093             :                 }
    1094             :         }
    1095           1 :         return 0;
    1096             : }
    1097             : 
    1098           1 : static PyObject *py_GroupKeyEnvelope_get_secret_agreement_algorithm_len(PyObject *obj, void *closure)
    1099             : {
    1100           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(obj);
    1101           1 :         PyObject *py_secret_agreement_algorithm_len;
    1102           1 :         py_secret_agreement_algorithm_len = PyLong_FromUnsignedLongLong((uint32_t)(object->secret_agreement_algorithm_len));
    1103           1 :         return py_secret_agreement_algorithm_len;
    1104             : }
    1105             : 
    1106           0 : static int py_GroupKeyEnvelope_set_secret_agreement_algorithm_len(PyObject *py_obj, PyObject *value, void *closure)
    1107             : {
    1108           0 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(py_obj);
    1109           0 :         if (value == NULL) {
    1110           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->secret_agreement_algorithm_len");
    1111           0 :                 return -1;
    1112             :         }
    1113             :         {
    1114           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->secret_agreement_algorithm_len));
    1115           0 :                 if (PyLong_Check(value)) {
    1116           0 :                         unsigned long long test_var;
    1117           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1118           0 :                         if (PyErr_Occurred() != NULL) {
    1119           0 :                                 return -1;
    1120             :                         }
    1121           0 :                         if (test_var > uint_max) {
    1122           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    1123             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1124           0 :                                 return -1;
    1125             :                         }
    1126           0 :                         object->secret_agreement_algorithm_len = test_var;
    1127             :                 } else {
    1128           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    1129             :                           PyLong_Type.tp_name);
    1130           0 :                         return -1;
    1131             :                 }
    1132             :         }
    1133           0 :         return 0;
    1134             : }
    1135             : 
    1136           1 : static PyObject *py_GroupKeyEnvelope_get_secret_agreement_parameters_len(PyObject *obj, void *closure)
    1137             : {
    1138           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(obj);
    1139           1 :         PyObject *py_secret_agreement_parameters_len;
    1140           1 :         py_secret_agreement_parameters_len = PyLong_FromUnsignedLongLong((uint32_t)(object->secret_agreement_parameters_len));
    1141           1 :         return py_secret_agreement_parameters_len;
    1142             : }
    1143             : 
    1144           1 : static int py_GroupKeyEnvelope_set_secret_agreement_parameters_len(PyObject *py_obj, PyObject *value, void *closure)
    1145             : {
    1146           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(py_obj);
    1147           1 :         if (value == NULL) {
    1148           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->secret_agreement_parameters_len");
    1149           0 :                 return -1;
    1150             :         }
    1151             :         {
    1152           1 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->secret_agreement_parameters_len));
    1153           1 :                 if (PyLong_Check(value)) {
    1154           1 :                         unsigned long long test_var;
    1155           1 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1156           1 :                         if (PyErr_Occurred() != NULL) {
    1157           0 :                                 return -1;
    1158             :                         }
    1159           1 :                         if (test_var > uint_max) {
    1160           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    1161             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1162           0 :                                 return -1;
    1163             :                         }
    1164           1 :                         object->secret_agreement_parameters_len = test_var;
    1165             :                 } else {
    1166           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    1167             :                           PyLong_Type.tp_name);
    1168           0 :                         return -1;
    1169             :                 }
    1170             :         }
    1171           1 :         return 0;
    1172             : }
    1173             : 
    1174           1 : static PyObject *py_GroupKeyEnvelope_get_private_key_len(PyObject *obj, void *closure)
    1175             : {
    1176           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(obj);
    1177           1 :         PyObject *py_private_key_len;
    1178           1 :         py_private_key_len = PyLong_FromUnsignedLongLong((uint32_t)(object->private_key_len));
    1179           1 :         return py_private_key_len;
    1180             : }
    1181             : 
    1182           1 : static int py_GroupKeyEnvelope_set_private_key_len(PyObject *py_obj, PyObject *value, void *closure)
    1183             : {
    1184           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(py_obj);
    1185           1 :         if (value == NULL) {
    1186           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->private_key_len");
    1187           0 :                 return -1;
    1188             :         }
    1189             :         {
    1190           1 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->private_key_len));
    1191           1 :                 if (PyLong_Check(value)) {
    1192           1 :                         unsigned long long test_var;
    1193           1 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1194           1 :                         if (PyErr_Occurred() != NULL) {
    1195           0 :                                 return -1;
    1196             :                         }
    1197           1 :                         if (test_var > uint_max) {
    1198           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    1199             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1200           0 :                                 return -1;
    1201             :                         }
    1202           1 :                         object->private_key_len = test_var;
    1203             :                 } else {
    1204           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    1205             :                           PyLong_Type.tp_name);
    1206           0 :                         return -1;
    1207             :                 }
    1208             :         }
    1209           1 :         return 0;
    1210             : }
    1211             : 
    1212           1 : static PyObject *py_GroupKeyEnvelope_get_public_key_len(PyObject *obj, void *closure)
    1213             : {
    1214           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(obj);
    1215           1 :         PyObject *py_public_key_len;
    1216           1 :         py_public_key_len = PyLong_FromUnsignedLongLong((uint32_t)(object->public_key_len));
    1217           1 :         return py_public_key_len;
    1218             : }
    1219             : 
    1220           1 : static int py_GroupKeyEnvelope_set_public_key_len(PyObject *py_obj, PyObject *value, void *closure)
    1221             : {
    1222           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(py_obj);
    1223           1 :         if (value == NULL) {
    1224           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->public_key_len");
    1225           0 :                 return -1;
    1226             :         }
    1227             :         {
    1228           1 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->public_key_len));
    1229           1 :                 if (PyLong_Check(value)) {
    1230           1 :                         unsigned long long test_var;
    1231           1 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1232           1 :                         if (PyErr_Occurred() != NULL) {
    1233           0 :                                 return -1;
    1234             :                         }
    1235           1 :                         if (test_var > uint_max) {
    1236           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    1237             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1238           0 :                                 return -1;
    1239             :                         }
    1240           1 :                         object->public_key_len = test_var;
    1241             :                 } else {
    1242           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    1243             :                           PyLong_Type.tp_name);
    1244           0 :                         return -1;
    1245             :                 }
    1246             :         }
    1247           1 :         return 0;
    1248             : }
    1249             : 
    1250           1 : static PyObject *py_GroupKeyEnvelope_get_l1_key_len(PyObject *obj, void *closure)
    1251             : {
    1252           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(obj);
    1253           1 :         PyObject *py_l1_key_len;
    1254           1 :         py_l1_key_len = PyLong_FromUnsignedLongLong((uint32_t)(object->l1_key_len));
    1255           1 :         return py_l1_key_len;
    1256             : }
    1257             : 
    1258           1 : static int py_GroupKeyEnvelope_set_l1_key_len(PyObject *py_obj, PyObject *value, void *closure)
    1259             : {
    1260           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(py_obj);
    1261           1 :         if (value == NULL) {
    1262           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->l1_key_len");
    1263           0 :                 return -1;
    1264             :         }
    1265             :         {
    1266           1 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->l1_key_len));
    1267           1 :                 if (PyLong_Check(value)) {
    1268           1 :                         unsigned long long test_var;
    1269           1 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1270           1 :                         if (PyErr_Occurred() != NULL) {
    1271           0 :                                 return -1;
    1272             :                         }
    1273           1 :                         if (test_var > uint_max) {
    1274           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    1275             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1276           0 :                                 return -1;
    1277             :                         }
    1278           1 :                         object->l1_key_len = test_var;
    1279             :                 } else {
    1280           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    1281             :                           PyLong_Type.tp_name);
    1282           0 :                         return -1;
    1283             :                 }
    1284             :         }
    1285           1 :         return 0;
    1286             : }
    1287             : 
    1288           1 : static PyObject *py_GroupKeyEnvelope_get_l2_key_len(PyObject *obj, void *closure)
    1289             : {
    1290           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(obj);
    1291           1 :         PyObject *py_l2_key_len;
    1292           1 :         py_l2_key_len = PyLong_FromUnsignedLongLong((uint32_t)(object->l2_key_len));
    1293           1 :         return py_l2_key_len;
    1294             : }
    1295             : 
    1296           1 : static int py_GroupKeyEnvelope_set_l2_key_len(PyObject *py_obj, PyObject *value, void *closure)
    1297             : {
    1298           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(py_obj);
    1299           1 :         if (value == NULL) {
    1300           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->l2_key_len");
    1301           0 :                 return -1;
    1302             :         }
    1303             :         {
    1304           1 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->l2_key_len));
    1305           1 :                 if (PyLong_Check(value)) {
    1306           1 :                         unsigned long long test_var;
    1307           1 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1308           1 :                         if (PyErr_Occurred() != NULL) {
    1309           0 :                                 return -1;
    1310             :                         }
    1311           1 :                         if (test_var > uint_max) {
    1312           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    1313             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1314           0 :                                 return -1;
    1315             :                         }
    1316           1 :                         object->l2_key_len = test_var;
    1317             :                 } else {
    1318           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    1319             :                           PyLong_Type.tp_name);
    1320           0 :                         return -1;
    1321             :                 }
    1322             :         }
    1323           1 :         return 0;
    1324             : }
    1325             : 
    1326           1 : static PyObject *py_GroupKeyEnvelope_get_domain_name_len(PyObject *obj, void *closure)
    1327             : {
    1328           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(obj);
    1329           1 :         PyObject *py_domain_name_len;
    1330           1 :         py_domain_name_len = PyLong_FromUnsignedLongLong((uint32_t)(object->domain_name_len));
    1331           1 :         return py_domain_name_len;
    1332             : }
    1333             : 
    1334           0 : static int py_GroupKeyEnvelope_set_domain_name_len(PyObject *py_obj, PyObject *value, void *closure)
    1335             : {
    1336           0 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(py_obj);
    1337           0 :         if (value == NULL) {
    1338           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->domain_name_len");
    1339           0 :                 return -1;
    1340             :         }
    1341             :         {
    1342           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->domain_name_len));
    1343           0 :                 if (PyLong_Check(value)) {
    1344           0 :                         unsigned long long test_var;
    1345           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1346           0 :                         if (PyErr_Occurred() != NULL) {
    1347           0 :                                 return -1;
    1348             :                         }
    1349           0 :                         if (test_var > uint_max) {
    1350           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    1351             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1352           0 :                                 return -1;
    1353             :                         }
    1354           0 :                         object->domain_name_len = test_var;
    1355             :                 } else {
    1356           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    1357             :                           PyLong_Type.tp_name);
    1358           0 :                         return -1;
    1359             :                 }
    1360             :         }
    1361           0 :         return 0;
    1362             : }
    1363             : 
    1364           1 : static PyObject *py_GroupKeyEnvelope_get_forest_name_len(PyObject *obj, void *closure)
    1365             : {
    1366           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(obj);
    1367           1 :         PyObject *py_forest_name_len;
    1368           1 :         py_forest_name_len = PyLong_FromUnsignedLongLong((uint32_t)(object->forest_name_len));
    1369           1 :         return py_forest_name_len;
    1370             : }
    1371             : 
    1372           0 : static int py_GroupKeyEnvelope_set_forest_name_len(PyObject *py_obj, PyObject *value, void *closure)
    1373             : {
    1374           0 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(py_obj);
    1375           0 :         if (value == NULL) {
    1376           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->forest_name_len");
    1377           0 :                 return -1;
    1378             :         }
    1379             :         {
    1380           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->forest_name_len));
    1381           0 :                 if (PyLong_Check(value)) {
    1382           0 :                         unsigned long long test_var;
    1383           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1384           0 :                         if (PyErr_Occurred() != NULL) {
    1385           0 :                                 return -1;
    1386             :                         }
    1387           0 :                         if (test_var > uint_max) {
    1388           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    1389             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1390           0 :                                 return -1;
    1391             :                         }
    1392           0 :                         object->forest_name_len = test_var;
    1393             :                 } else {
    1394           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    1395             :                           PyLong_Type.tp_name);
    1396           0 :                         return -1;
    1397             :                 }
    1398             :         }
    1399           0 :         return 0;
    1400             : }
    1401             : 
    1402           1 : static PyObject *py_GroupKeyEnvelope_get_kdf_algorithm(PyObject *obj, void *closure)
    1403             : {
    1404           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(obj);
    1405           1 :         PyObject *py_kdf_algorithm;
    1406           1 :         py_kdf_algorithm = PyString_FromStringOrNULL(object->kdf_algorithm);
    1407           1 :         return py_kdf_algorithm;
    1408             : }
    1409             : 
    1410           1 : static int py_GroupKeyEnvelope_set_kdf_algorithm(PyObject *py_obj, PyObject *value, void *closure)
    1411             : {
    1412           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(py_obj);
    1413           1 :         if (value == NULL) {
    1414           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->kdf_algorithm");
    1415           0 :                 return -1;
    1416             :         }
    1417             :         {
    1418           1 :                 const char *test_str;
    1419           1 :                 const char *talloc_str;
    1420           1 :                 PyObject *unicode = NULL;
    1421           1 :                 if (PyUnicode_Check(value)) {
    1422           1 :                         unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
    1423           1 :                         if (unicode == NULL) {
    1424           0 :                                 return -1;
    1425             :                         }
    1426           1 :                         test_str = PyBytes_AS_STRING(unicode);
    1427           0 :                 } else if (PyBytes_Check(value)) {
    1428           0 :                         test_str = PyBytes_AS_STRING(value);
    1429             :                 } else {
    1430           0 :                         PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
    1431           0 :                         return -1;
    1432             :                 }
    1433           1 :                 talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
    1434           1 :                 if (unicode != NULL) {
    1435           1 :                         Py_DECREF(unicode);
    1436             :                 }
    1437           1 :                 if (talloc_str == NULL) {
    1438           0 :                         PyErr_NoMemory();
    1439           0 :                         return -1;
    1440             :                 }
    1441           1 :                 object->kdf_algorithm = talloc_str;
    1442             :         }
    1443           1 :         return 0;
    1444             : }
    1445             : 
    1446           1 : static PyObject *py_GroupKeyEnvelope_get_kdf_parameters(PyObject *obj, void *closure)
    1447             : {
    1448           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(obj);
    1449           1 :         PyObject *py_kdf_parameters;
    1450           1 :         py_kdf_parameters = PyList_New(object->kdf_parameters_len);
    1451           1 :         if (py_kdf_parameters == NULL) {
    1452           0 :                 return NULL;
    1453             :         }
    1454             :         {
    1455             :                 int kdf_parameters_cntr_0;
    1456          31 :                 for (kdf_parameters_cntr_0 = 0; kdf_parameters_cntr_0 < (object->kdf_parameters_len); kdf_parameters_cntr_0++) {
    1457          30 :                         PyObject *py_kdf_parameters_0;
    1458          30 :                         py_kdf_parameters_0 = PyLong_FromLong((uint16_t)((object->kdf_parameters)[kdf_parameters_cntr_0]));
    1459          30 :                         PyList_SetItem(py_kdf_parameters, kdf_parameters_cntr_0, py_kdf_parameters_0);
    1460             :                 }
    1461             :         }
    1462           0 :         return py_kdf_parameters;
    1463             : }
    1464             : 
    1465           1 : static int py_GroupKeyEnvelope_set_kdf_parameters(PyObject *py_obj, PyObject *value, void *closure)
    1466             : {
    1467           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(py_obj);
    1468           1 :         if (value == NULL) {
    1469           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->kdf_parameters");
    1470           0 :                 return -1;
    1471             :         }
    1472           1 :         PY_CHECK_TYPE(&PyList_Type, value, return -1;);
    1473             :         {
    1474           1 :                 int kdf_parameters_cntr_0;
    1475           1 :                 object->kdf_parameters = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->kdf_parameters, PyList_GET_SIZE(value));
    1476           1 :                 if (!object->kdf_parameters) { return -1; }
    1477           1 :                 talloc_set_name_const(object->kdf_parameters, "ARRAY: object->kdf_parameters");
    1478          32 :                 for (kdf_parameters_cntr_0 = 0; kdf_parameters_cntr_0 < PyList_GET_SIZE(value); kdf_parameters_cntr_0++) {
    1479          30 :                         if (PyList_GET_ITEM(value, kdf_parameters_cntr_0) == NULL) {
    1480           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->kdf_parameters)[kdf_parameters_cntr_0]");
    1481           0 :                                 return -1;
    1482             :                         }
    1483             :                         {
    1484          30 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((object->kdf_parameters)[kdf_parameters_cntr_0]));
    1485          30 :                                 if (PyLong_Check(PyList_GET_ITEM(value, kdf_parameters_cntr_0))) {
    1486          30 :                                         unsigned long long test_var;
    1487          30 :                                         test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, kdf_parameters_cntr_0));
    1488          30 :                                         if (PyErr_Occurred() != NULL) {
    1489           0 :                                                 return -1;
    1490             :                                         }
    1491          30 :                                         if (test_var > uint_max) {
    1492           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    1493             :                                                   PyLong_Type.tp_name, uint_max, test_var);
    1494           0 :                                                 return -1;
    1495             :                                         }
    1496          30 :                                         (object->kdf_parameters)[kdf_parameters_cntr_0] = test_var;
    1497             :                                 } else {
    1498           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    1499             :                                           PyLong_Type.tp_name);
    1500           0 :                                         return -1;
    1501             :                                 }
    1502             :                         }
    1503             :                 }
    1504             :         }
    1505           0 :         return 0;
    1506             : }
    1507             : 
    1508           1 : static PyObject *py_GroupKeyEnvelope_get_secret_agreement_algorithm(PyObject *obj, void *closure)
    1509             : {
    1510           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(obj);
    1511           1 :         PyObject *py_secret_agreement_algorithm;
    1512           1 :         py_secret_agreement_algorithm = PyString_FromStringOrNULL(object->secret_agreement_algorithm);
    1513           1 :         return py_secret_agreement_algorithm;
    1514             : }
    1515             : 
    1516           1 : static int py_GroupKeyEnvelope_set_secret_agreement_algorithm(PyObject *py_obj, PyObject *value, void *closure)
    1517             : {
    1518           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(py_obj);
    1519           1 :         if (value == NULL) {
    1520           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->secret_agreement_algorithm");
    1521           0 :                 return -1;
    1522             :         }
    1523             :         {
    1524           1 :                 const char *test_str;
    1525           1 :                 const char *talloc_str;
    1526           1 :                 PyObject *unicode = NULL;
    1527           1 :                 if (PyUnicode_Check(value)) {
    1528           1 :                         unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
    1529           1 :                         if (unicode == NULL) {
    1530           0 :                                 return -1;
    1531             :                         }
    1532           1 :                         test_str = PyBytes_AS_STRING(unicode);
    1533           0 :                 } else if (PyBytes_Check(value)) {
    1534           0 :                         test_str = PyBytes_AS_STRING(value);
    1535             :                 } else {
    1536           0 :                         PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
    1537           0 :                         return -1;
    1538             :                 }
    1539           1 :                 talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
    1540           1 :                 if (unicode != NULL) {
    1541           1 :                         Py_DECREF(unicode);
    1542             :                 }
    1543           1 :                 if (talloc_str == NULL) {
    1544           0 :                         PyErr_NoMemory();
    1545           0 :                         return -1;
    1546             :                 }
    1547           1 :                 object->secret_agreement_algorithm = talloc_str;
    1548             :         }
    1549           1 :         return 0;
    1550             : }
    1551             : 
    1552           1 : static PyObject *py_GroupKeyEnvelope_get_secret_agreement_parameters(PyObject *obj, void *closure)
    1553             : {
    1554           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(obj);
    1555           1 :         PyObject *py_secret_agreement_parameters;
    1556           1 :         py_secret_agreement_parameters = PyList_New(object->secret_agreement_parameters_len);
    1557           1 :         if (py_secret_agreement_parameters == NULL) {
    1558           0 :                 return NULL;
    1559             :         }
    1560             :         {
    1561             :                 int secret_agreement_parameters_cntr_0;
    1562         525 :                 for (secret_agreement_parameters_cntr_0 = 0; secret_agreement_parameters_cntr_0 < (object->secret_agreement_parameters_len); secret_agreement_parameters_cntr_0++) {
    1563         524 :                         PyObject *py_secret_agreement_parameters_0;
    1564         524 :                         py_secret_agreement_parameters_0 = PyLong_FromLong((uint16_t)((object->secret_agreement_parameters)[secret_agreement_parameters_cntr_0]));
    1565         524 :                         PyList_SetItem(py_secret_agreement_parameters, secret_agreement_parameters_cntr_0, py_secret_agreement_parameters_0);
    1566             :                 }
    1567             :         }
    1568           0 :         return py_secret_agreement_parameters;
    1569             : }
    1570             : 
    1571           1 : static int py_GroupKeyEnvelope_set_secret_agreement_parameters(PyObject *py_obj, PyObject *value, void *closure)
    1572             : {
    1573           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(py_obj);
    1574           1 :         if (value == NULL) {
    1575           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->secret_agreement_parameters");
    1576           0 :                 return -1;
    1577             :         }
    1578           1 :         PY_CHECK_TYPE(&PyList_Type, value, return -1;);
    1579             :         {
    1580           1 :                 int secret_agreement_parameters_cntr_0;
    1581           1 :                 object->secret_agreement_parameters = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->secret_agreement_parameters, PyList_GET_SIZE(value));
    1582           1 :                 if (!object->secret_agreement_parameters) { return -1; }
    1583           1 :                 talloc_set_name_const(object->secret_agreement_parameters, "ARRAY: object->secret_agreement_parameters");
    1584         526 :                 for (secret_agreement_parameters_cntr_0 = 0; secret_agreement_parameters_cntr_0 < PyList_GET_SIZE(value); secret_agreement_parameters_cntr_0++) {
    1585         524 :                         if (PyList_GET_ITEM(value, secret_agreement_parameters_cntr_0) == NULL) {
    1586           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->secret_agreement_parameters)[secret_agreement_parameters_cntr_0]");
    1587           0 :                                 return -1;
    1588             :                         }
    1589             :                         {
    1590         524 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((object->secret_agreement_parameters)[secret_agreement_parameters_cntr_0]));
    1591         524 :                                 if (PyLong_Check(PyList_GET_ITEM(value, secret_agreement_parameters_cntr_0))) {
    1592         524 :                                         unsigned long long test_var;
    1593         524 :                                         test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, secret_agreement_parameters_cntr_0));
    1594         524 :                                         if (PyErr_Occurred() != NULL) {
    1595           0 :                                                 return -1;
    1596             :                                         }
    1597         524 :                                         if (test_var > uint_max) {
    1598           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    1599             :                                                   PyLong_Type.tp_name, uint_max, test_var);
    1600           0 :                                                 return -1;
    1601             :                                         }
    1602         524 :                                         (object->secret_agreement_parameters)[secret_agreement_parameters_cntr_0] = test_var;
    1603             :                                 } else {
    1604           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    1605             :                                           PyLong_Type.tp_name);
    1606           0 :                                         return -1;
    1607             :                                 }
    1608             :                         }
    1609             :                 }
    1610             :         }
    1611           0 :         return 0;
    1612             : }
    1613             : 
    1614           1 : static PyObject *py_GroupKeyEnvelope_get_domain_name(PyObject *obj, void *closure)
    1615             : {
    1616           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(obj);
    1617           1 :         PyObject *py_domain_name;
    1618           1 :         py_domain_name = PyString_FromStringOrNULL(object->domain_name);
    1619           1 :         return py_domain_name;
    1620             : }
    1621             : 
    1622           1 : static int py_GroupKeyEnvelope_set_domain_name(PyObject *py_obj, PyObject *value, void *closure)
    1623             : {
    1624           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(py_obj);
    1625           1 :         if (value == NULL) {
    1626           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->domain_name");
    1627           0 :                 return -1;
    1628             :         }
    1629             :         {
    1630           1 :                 const char *test_str;
    1631           1 :                 const char *talloc_str;
    1632           1 :                 PyObject *unicode = NULL;
    1633           1 :                 if (PyUnicode_Check(value)) {
    1634           1 :                         unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
    1635           1 :                         if (unicode == NULL) {
    1636           0 :                                 return -1;
    1637             :                         }
    1638           1 :                         test_str = PyBytes_AS_STRING(unicode);
    1639           0 :                 } else if (PyBytes_Check(value)) {
    1640           0 :                         test_str = PyBytes_AS_STRING(value);
    1641             :                 } else {
    1642           0 :                         PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
    1643           0 :                         return -1;
    1644             :                 }
    1645           1 :                 talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
    1646           1 :                 if (unicode != NULL) {
    1647           1 :                         Py_DECREF(unicode);
    1648             :                 }
    1649           1 :                 if (talloc_str == NULL) {
    1650           0 :                         PyErr_NoMemory();
    1651           0 :                         return -1;
    1652             :                 }
    1653           1 :                 object->domain_name = talloc_str;
    1654             :         }
    1655           1 :         return 0;
    1656             : }
    1657             : 
    1658           1 : static PyObject *py_GroupKeyEnvelope_get_forest_name(PyObject *obj, void *closure)
    1659             : {
    1660           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(obj);
    1661           1 :         PyObject *py_forest_name;
    1662           1 :         py_forest_name = PyString_FromStringOrNULL(object->forest_name);
    1663           1 :         return py_forest_name;
    1664             : }
    1665             : 
    1666           1 : static int py_GroupKeyEnvelope_set_forest_name(PyObject *py_obj, PyObject *value, void *closure)
    1667             : {
    1668           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(py_obj);
    1669           1 :         if (value == NULL) {
    1670           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->forest_name");
    1671           0 :                 return -1;
    1672             :         }
    1673             :         {
    1674           1 :                 const char *test_str;
    1675           1 :                 const char *talloc_str;
    1676           1 :                 PyObject *unicode = NULL;
    1677           1 :                 if (PyUnicode_Check(value)) {
    1678           1 :                         unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
    1679           1 :                         if (unicode == NULL) {
    1680           0 :                                 return -1;
    1681             :                         }
    1682           1 :                         test_str = PyBytes_AS_STRING(unicode);
    1683           0 :                 } else if (PyBytes_Check(value)) {
    1684           0 :                         test_str = PyBytes_AS_STRING(value);
    1685             :                 } else {
    1686           0 :                         PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
    1687           0 :                         return -1;
    1688             :                 }
    1689           1 :                 talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
    1690           1 :                 if (unicode != NULL) {
    1691           1 :                         Py_DECREF(unicode);
    1692             :                 }
    1693           1 :                 if (talloc_str == NULL) {
    1694           0 :                         PyErr_NoMemory();
    1695           0 :                         return -1;
    1696             :                 }
    1697           1 :                 object->forest_name = talloc_str;
    1698             :         }
    1699           1 :         return 0;
    1700             : }
    1701             : 
    1702           1 : static PyObject *py_GroupKeyEnvelope_get_l1_key(PyObject *obj, void *closure)
    1703             : {
    1704           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(obj);
    1705           1 :         PyObject *py_l1_key;
    1706           1 :         py_l1_key = PyList_New(object->l1_key_len);
    1707           1 :         if (py_l1_key == NULL) {
    1708           0 :                 return NULL;
    1709             :         }
    1710             :         {
    1711             :                 int l1_key_cntr_0;
    1712          65 :                 for (l1_key_cntr_0 = 0; l1_key_cntr_0 < (object->l1_key_len); l1_key_cntr_0++) {
    1713          64 :                         PyObject *py_l1_key_0;
    1714          64 :                         py_l1_key_0 = PyLong_FromLong((uint16_t)((object->l1_key)[l1_key_cntr_0]));
    1715          64 :                         PyList_SetItem(py_l1_key, l1_key_cntr_0, py_l1_key_0);
    1716             :                 }
    1717             :         }
    1718           0 :         return py_l1_key;
    1719             : }
    1720             : 
    1721           1 : static int py_GroupKeyEnvelope_set_l1_key(PyObject *py_obj, PyObject *value, void *closure)
    1722             : {
    1723           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(py_obj);
    1724           1 :         if (value == NULL) {
    1725           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->l1_key");
    1726           0 :                 return -1;
    1727             :         }
    1728           1 :         PY_CHECK_TYPE(&PyList_Type, value, return -1;);
    1729             :         {
    1730           1 :                 int l1_key_cntr_0;
    1731           1 :                 object->l1_key = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->l1_key, PyList_GET_SIZE(value));
    1732           1 :                 if (!object->l1_key) { return -1; }
    1733           1 :                 talloc_set_name_const(object->l1_key, "ARRAY: object->l1_key");
    1734          66 :                 for (l1_key_cntr_0 = 0; l1_key_cntr_0 < PyList_GET_SIZE(value); l1_key_cntr_0++) {
    1735          64 :                         if (PyList_GET_ITEM(value, l1_key_cntr_0) == NULL) {
    1736           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->l1_key)[l1_key_cntr_0]");
    1737           0 :                                 return -1;
    1738             :                         }
    1739             :                         {
    1740          64 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((object->l1_key)[l1_key_cntr_0]));
    1741          64 :                                 if (PyLong_Check(PyList_GET_ITEM(value, l1_key_cntr_0))) {
    1742          64 :                                         unsigned long long test_var;
    1743          64 :                                         test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, l1_key_cntr_0));
    1744          64 :                                         if (PyErr_Occurred() != NULL) {
    1745           0 :                                                 return -1;
    1746             :                                         }
    1747          64 :                                         if (test_var > uint_max) {
    1748           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    1749             :                                                   PyLong_Type.tp_name, uint_max, test_var);
    1750           0 :                                                 return -1;
    1751             :                                         }
    1752          64 :                                         (object->l1_key)[l1_key_cntr_0] = test_var;
    1753             :                                 } else {
    1754           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    1755             :                                           PyLong_Type.tp_name);
    1756           0 :                                         return -1;
    1757             :                                 }
    1758             :                         }
    1759             :                 }
    1760             :         }
    1761           0 :         return 0;
    1762             : }
    1763             : 
    1764           1 : static PyObject *py_GroupKeyEnvelope_get_l2_key(PyObject *obj, void *closure)
    1765             : {
    1766           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(obj);
    1767           1 :         PyObject *py_l2_key;
    1768           1 :         py_l2_key = PyList_New(object->l2_key_len);
    1769           1 :         if (py_l2_key == NULL) {
    1770           0 :                 return NULL;
    1771             :         }
    1772             :         {
    1773             :                 int l2_key_cntr_0;
    1774          65 :                 for (l2_key_cntr_0 = 0; l2_key_cntr_0 < (object->l2_key_len); l2_key_cntr_0++) {
    1775          64 :                         PyObject *py_l2_key_0;
    1776          64 :                         py_l2_key_0 = PyLong_FromLong((uint16_t)((object->l2_key)[l2_key_cntr_0]));
    1777          64 :                         PyList_SetItem(py_l2_key, l2_key_cntr_0, py_l2_key_0);
    1778             :                 }
    1779             :         }
    1780           0 :         return py_l2_key;
    1781             : }
    1782             : 
    1783           1 : static int py_GroupKeyEnvelope_set_l2_key(PyObject *py_obj, PyObject *value, void *closure)
    1784             : {
    1785           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(py_obj);
    1786           1 :         if (value == NULL) {
    1787           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->l2_key");
    1788           0 :                 return -1;
    1789             :         }
    1790           1 :         PY_CHECK_TYPE(&PyList_Type, value, return -1;);
    1791             :         {
    1792           1 :                 int l2_key_cntr_0;
    1793           1 :                 object->l2_key = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->l2_key, PyList_GET_SIZE(value));
    1794           1 :                 if (!object->l2_key) { return -1; }
    1795           1 :                 talloc_set_name_const(object->l2_key, "ARRAY: object->l2_key");
    1796          66 :                 for (l2_key_cntr_0 = 0; l2_key_cntr_0 < PyList_GET_SIZE(value); l2_key_cntr_0++) {
    1797          64 :                         if (PyList_GET_ITEM(value, l2_key_cntr_0) == NULL) {
    1798           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->l2_key)[l2_key_cntr_0]");
    1799           0 :                                 return -1;
    1800             :                         }
    1801             :                         {
    1802          64 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((object->l2_key)[l2_key_cntr_0]));
    1803          64 :                                 if (PyLong_Check(PyList_GET_ITEM(value, l2_key_cntr_0))) {
    1804          64 :                                         unsigned long long test_var;
    1805          64 :                                         test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, l2_key_cntr_0));
    1806          64 :                                         if (PyErr_Occurred() != NULL) {
    1807           0 :                                                 return -1;
    1808             :                                         }
    1809          64 :                                         if (test_var > uint_max) {
    1810           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    1811             :                                                   PyLong_Type.tp_name, uint_max, test_var);
    1812           0 :                                                 return -1;
    1813             :                                         }
    1814          64 :                                         (object->l2_key)[l2_key_cntr_0] = test_var;
    1815             :                                 } else {
    1816           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    1817             :                                           PyLong_Type.tp_name);
    1818           0 :                                         return -1;
    1819             :                                 }
    1820             :                         }
    1821             :                 }
    1822             :         }
    1823           0 :         return 0;
    1824             : }
    1825             : 
    1826             : static PyGetSetDef py_GroupKeyEnvelope_getsetters[] = {
    1827             :         {
    1828             :                 .name = discard_const_p(char, "version"),
    1829             :                 .get = py_GroupKeyEnvelope_get_version,
    1830             :                 .set = py_GroupKeyEnvelope_set_version,
    1831             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    1832             :         },
    1833             :         {
    1834             :                 .name = discard_const_p(char, "magic"),
    1835             :                 .get = py_GroupKeyEnvelope_get_magic,
    1836             :                 .set = py_GroupKeyEnvelope_set_magic,
    1837             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    1838             :         },
    1839             :         {
    1840             :                 .name = discard_const_p(char, "flags"),
    1841             :                 .get = py_GroupKeyEnvelope_get_flags,
    1842             :                 .set = py_GroupKeyEnvelope_set_flags,
    1843             :                 .doc = discard_const_p(char, "PIDL-generated element of base type EnvelopeFlags")
    1844             :         },
    1845             :         {
    1846             :                 .name = discard_const_p(char, "l0_index"),
    1847             :                 .get = py_GroupKeyEnvelope_get_l0_index,
    1848             :                 .set = py_GroupKeyEnvelope_set_l0_index,
    1849             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    1850             :         },
    1851             :         {
    1852             :                 .name = discard_const_p(char, "l1_index"),
    1853             :                 .get = py_GroupKeyEnvelope_get_l1_index,
    1854             :                 .set = py_GroupKeyEnvelope_set_l1_index,
    1855             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    1856             :         },
    1857             :         {
    1858             :                 .name = discard_const_p(char, "l2_index"),
    1859             :                 .get = py_GroupKeyEnvelope_get_l2_index,
    1860             :                 .set = py_GroupKeyEnvelope_set_l2_index,
    1861             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    1862             :         },
    1863             :         {
    1864             :                 .name = discard_const_p(char, "root_key_id"),
    1865             :                 .get = py_GroupKeyEnvelope_get_root_key_id,
    1866             :                 .set = py_GroupKeyEnvelope_set_root_key_id,
    1867             :                 .doc = discard_const_p(char, "PIDL-generated element of base type GUID")
    1868             :         },
    1869             :         {
    1870             :                 .name = discard_const_p(char, "kdf_algorithm_len"),
    1871             :                 .get = py_GroupKeyEnvelope_get_kdf_algorithm_len,
    1872             :                 .set = py_GroupKeyEnvelope_set_kdf_algorithm_len,
    1873             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    1874             :         },
    1875             :         {
    1876             :                 .name = discard_const_p(char, "kdf_parameters_len"),
    1877             :                 .get = py_GroupKeyEnvelope_get_kdf_parameters_len,
    1878             :                 .set = py_GroupKeyEnvelope_set_kdf_parameters_len,
    1879             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    1880             :         },
    1881             :         {
    1882             :                 .name = discard_const_p(char, "secret_agreement_algorithm_len"),
    1883             :                 .get = py_GroupKeyEnvelope_get_secret_agreement_algorithm_len,
    1884             :                 .set = py_GroupKeyEnvelope_set_secret_agreement_algorithm_len,
    1885             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    1886             :         },
    1887             :         {
    1888             :                 .name = discard_const_p(char, "secret_agreement_parameters_len"),
    1889             :                 .get = py_GroupKeyEnvelope_get_secret_agreement_parameters_len,
    1890             :                 .set = py_GroupKeyEnvelope_set_secret_agreement_parameters_len,
    1891             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    1892             :         },
    1893             :         {
    1894             :                 .name = discard_const_p(char, "private_key_len"),
    1895             :                 .get = py_GroupKeyEnvelope_get_private_key_len,
    1896             :                 .set = py_GroupKeyEnvelope_set_private_key_len,
    1897             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    1898             :         },
    1899             :         {
    1900             :                 .name = discard_const_p(char, "public_key_len"),
    1901             :                 .get = py_GroupKeyEnvelope_get_public_key_len,
    1902             :                 .set = py_GroupKeyEnvelope_set_public_key_len,
    1903             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    1904             :         },
    1905             :         {
    1906             :                 .name = discard_const_p(char, "l1_key_len"),
    1907             :                 .get = py_GroupKeyEnvelope_get_l1_key_len,
    1908             :                 .set = py_GroupKeyEnvelope_set_l1_key_len,
    1909             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    1910             :         },
    1911             :         {
    1912             :                 .name = discard_const_p(char, "l2_key_len"),
    1913             :                 .get = py_GroupKeyEnvelope_get_l2_key_len,
    1914             :                 .set = py_GroupKeyEnvelope_set_l2_key_len,
    1915             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    1916             :         },
    1917             :         {
    1918             :                 .name = discard_const_p(char, "domain_name_len"),
    1919             :                 .get = py_GroupKeyEnvelope_get_domain_name_len,
    1920             :                 .set = py_GroupKeyEnvelope_set_domain_name_len,
    1921             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    1922             :         },
    1923             :         {
    1924             :                 .name = discard_const_p(char, "forest_name_len"),
    1925             :                 .get = py_GroupKeyEnvelope_get_forest_name_len,
    1926             :                 .set = py_GroupKeyEnvelope_set_forest_name_len,
    1927             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    1928             :         },
    1929             :         {
    1930             :                 .name = discard_const_p(char, "kdf_algorithm"),
    1931             :                 .get = py_GroupKeyEnvelope_get_kdf_algorithm,
    1932             :                 .set = py_GroupKeyEnvelope_set_kdf_algorithm,
    1933             :                 .doc = discard_const_p(char, "PIDL-generated element of base type string")
    1934             :         },
    1935             :         {
    1936             :                 .name = discard_const_p(char, "kdf_parameters"),
    1937             :                 .get = py_GroupKeyEnvelope_get_kdf_parameters,
    1938             :                 .set = py_GroupKeyEnvelope_set_kdf_parameters,
    1939             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
    1940             :         },
    1941             :         {
    1942             :                 .name = discard_const_p(char, "secret_agreement_algorithm"),
    1943             :                 .get = py_GroupKeyEnvelope_get_secret_agreement_algorithm,
    1944             :                 .set = py_GroupKeyEnvelope_set_secret_agreement_algorithm,
    1945             :                 .doc = discard_const_p(char, "PIDL-generated element of base type string")
    1946             :         },
    1947             :         {
    1948             :                 .name = discard_const_p(char, "secret_agreement_parameters"),
    1949             :                 .get = py_GroupKeyEnvelope_get_secret_agreement_parameters,
    1950             :                 .set = py_GroupKeyEnvelope_set_secret_agreement_parameters,
    1951             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
    1952             :         },
    1953             :         {
    1954             :                 .name = discard_const_p(char, "domain_name"),
    1955             :                 .get = py_GroupKeyEnvelope_get_domain_name,
    1956             :                 .set = py_GroupKeyEnvelope_set_domain_name,
    1957             :                 .doc = discard_const_p(char, "PIDL-generated element of base type string")
    1958             :         },
    1959             :         {
    1960             :                 .name = discard_const_p(char, "forest_name"),
    1961             :                 .get = py_GroupKeyEnvelope_get_forest_name,
    1962             :                 .set = py_GroupKeyEnvelope_set_forest_name,
    1963             :                 .doc = discard_const_p(char, "PIDL-generated element of base type string")
    1964             :         },
    1965             :         {
    1966             :                 .name = discard_const_p(char, "l1_key"),
    1967             :                 .get = py_GroupKeyEnvelope_get_l1_key,
    1968             :                 .set = py_GroupKeyEnvelope_set_l1_key,
    1969             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
    1970             :         },
    1971             :         {
    1972             :                 .name = discard_const_p(char, "l2_key"),
    1973             :                 .get = py_GroupKeyEnvelope_get_l2_key,
    1974             :                 .set = py_GroupKeyEnvelope_set_l2_key,
    1975             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
    1976             :         },
    1977             :         { .name = NULL }
    1978             : };
    1979             : 
    1980           2 : static PyObject *py_GroupKeyEnvelope_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1981             : {
    1982           2 :         return pytalloc_new(struct GroupKeyEnvelope, type);
    1983             : }
    1984             : 
    1985           1 : static PyObject *py_GroupKeyEnvelope_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
    1986             : {
    1987           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(py_obj);
    1988           1 :         PyObject *ret = NULL;
    1989           1 :         DATA_BLOB blob;
    1990           1 :         enum ndr_err_code err;
    1991           1 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
    1992           1 :         if (tmp_ctx == NULL) {
    1993           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    1994           0 :                 return NULL;
    1995             :         }
    1996           1 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_GroupKeyEnvelope);
    1997           1 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    1998           0 :                 TALLOC_FREE(tmp_ctx);
    1999           0 :                 PyErr_SetNdrError(err);
    2000           0 :                 return NULL;
    2001             :         }
    2002             : 
    2003           1 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    2004           1 :         TALLOC_FREE(tmp_ctx);
    2005           1 :         return ret;
    2006             : }
    2007             : 
    2008           1 : static PyObject *py_GroupKeyEnvelope_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    2009             : {
    2010           1 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(py_obj);
    2011           1 :         DATA_BLOB blob = {.data = NULL, .length = 0};
    2012           1 :         Py_ssize_t blob_length = 0;
    2013           1 :         enum ndr_err_code err;
    2014           1 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
    2015           1 :         PyObject *allow_remaining_obj = NULL;
    2016           1 :         bool allow_remaining = false;
    2017             : 
    2018           1 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
    2019             :                 discard_const_p(char *, kwnames),
    2020             :                 &blob.data, &blob_length,
    2021             :                 &allow_remaining_obj)) {
    2022           0 :                 return NULL;
    2023             :         }
    2024           1 :         blob.length = blob_length;
    2025             : 
    2026           1 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    2027           0 :                 allow_remaining = true;
    2028             :         }
    2029             : 
    2030           0 :         if (allow_remaining) {
    2031           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_GroupKeyEnvelope);
    2032             :         } else {
    2033           1 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_GroupKeyEnvelope);
    2034             :         }
    2035           1 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    2036           0 :                 PyErr_SetNdrError(err);
    2037           0 :                 return NULL;
    2038             :         }
    2039             : 
    2040           1 :         Py_RETURN_NONE;
    2041             : }
    2042             : 
    2043           0 : static PyObject *py_GroupKeyEnvelope_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    2044             : {
    2045           0 :         struct GroupKeyEnvelope *object = pytalloc_get_ptr(py_obj);
    2046           0 :         PyObject *ret;
    2047           0 :         char *retstr;
    2048             : 
    2049           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_GroupKeyEnvelope, "GroupKeyEnvelope", object);
    2050           0 :         ret = PyUnicode_FromString(retstr);
    2051           0 :         talloc_free(retstr);
    2052             : 
    2053           0 :         return ret;
    2054             : }
    2055             : 
    2056             : static PyMethodDef py_GroupKeyEnvelope_methods[] = {
    2057             :         { "__ndr_pack__", (PyCFunction)py_GroupKeyEnvelope_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
    2058             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_GroupKeyEnvelope_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
    2059             :         { "__ndr_print__", (PyCFunction)py_GroupKeyEnvelope_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
    2060             :         { NULL, NULL, 0, NULL }
    2061             : };
    2062             : 
    2063             : 
    2064             : static PyTypeObject GroupKeyEnvelope_Type = {
    2065             :         PyVarObject_HEAD_INIT(NULL, 0)
    2066             :         .tp_name = "gkdi.GroupKeyEnvelope",
    2067             :         .tp_getset = py_GroupKeyEnvelope_getsetters,
    2068             :         .tp_methods = py_GroupKeyEnvelope_methods,
    2069             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    2070             :         .tp_new = py_GroupKeyEnvelope_new,
    2071             : };
    2072             : 
    2073             : 
    2074           1 : static PyObject *py_KdfParameters_get_padding_0(PyObject *obj, void *closure)
    2075             : {
    2076           1 :         struct KdfParameters *object = pytalloc_get_ptr(obj);
    2077           1 :         PyObject *py_padding_0;
    2078           1 :         py_padding_0 = PyLong_FromUnsignedLongLong((uint32_t)(object->padding_0));
    2079           1 :         return py_padding_0;
    2080             : }
    2081             : 
    2082           0 : static int py_KdfParameters_set_padding_0(PyObject *py_obj, PyObject *value, void *closure)
    2083             : {
    2084           0 :         struct KdfParameters *object = pytalloc_get_ptr(py_obj);
    2085           0 :         if (value == NULL) {
    2086           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->padding_0");
    2087           0 :                 return -1;
    2088             :         }
    2089             :         {
    2090           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->padding_0));
    2091           0 :                 if (PyLong_Check(value)) {
    2092           0 :                         unsigned long long test_var;
    2093           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    2094           0 :                         if (PyErr_Occurred() != NULL) {
    2095           0 :                                 return -1;
    2096             :                         }
    2097           0 :                         if (test_var > uint_max) {
    2098           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    2099             :                                   PyLong_Type.tp_name, uint_max, test_var);
    2100           0 :                                 return -1;
    2101             :                         }
    2102           0 :                         object->padding_0 = test_var;
    2103             :                 } else {
    2104           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    2105             :                           PyLong_Type.tp_name);
    2106           0 :                         return -1;
    2107             :                 }
    2108             :         }
    2109           0 :         return 0;
    2110             : }
    2111             : 
    2112           1 : static PyObject *py_KdfParameters_get_padding_1(PyObject *obj, void *closure)
    2113             : {
    2114           1 :         struct KdfParameters *object = pytalloc_get_ptr(obj);
    2115           1 :         PyObject *py_padding_1;
    2116           1 :         py_padding_1 = PyLong_FromUnsignedLongLong((uint32_t)(object->padding_1));
    2117           1 :         return py_padding_1;
    2118             : }
    2119             : 
    2120           0 : static int py_KdfParameters_set_padding_1(PyObject *py_obj, PyObject *value, void *closure)
    2121             : {
    2122           0 :         struct KdfParameters *object = pytalloc_get_ptr(py_obj);
    2123           0 :         if (value == NULL) {
    2124           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->padding_1");
    2125           0 :                 return -1;
    2126             :         }
    2127             :         {
    2128           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->padding_1));
    2129           0 :                 if (PyLong_Check(value)) {
    2130           0 :                         unsigned long long test_var;
    2131           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    2132           0 :                         if (PyErr_Occurred() != NULL) {
    2133           0 :                                 return -1;
    2134             :                         }
    2135           0 :                         if (test_var > uint_max) {
    2136           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    2137             :                                   PyLong_Type.tp_name, uint_max, test_var);
    2138           0 :                                 return -1;
    2139             :                         }
    2140           0 :                         object->padding_1 = test_var;
    2141             :                 } else {
    2142           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    2143             :                           PyLong_Type.tp_name);
    2144           0 :                         return -1;
    2145             :                 }
    2146             :         }
    2147           0 :         return 0;
    2148             : }
    2149             : 
    2150           1 : static PyObject *py_KdfParameters_get_hash_algorithm_len(PyObject *obj, void *closure)
    2151             : {
    2152           1 :         struct KdfParameters *object = pytalloc_get_ptr(obj);
    2153           1 :         PyObject *py_hash_algorithm_len;
    2154           1 :         py_hash_algorithm_len = PyLong_FromUnsignedLongLong((uint32_t)(object->hash_algorithm_len));
    2155           1 :         return py_hash_algorithm_len;
    2156             : }
    2157             : 
    2158           0 : static int py_KdfParameters_set_hash_algorithm_len(PyObject *py_obj, PyObject *value, void *closure)
    2159             : {
    2160           0 :         struct KdfParameters *object = pytalloc_get_ptr(py_obj);
    2161           0 :         if (value == NULL) {
    2162           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->hash_algorithm_len");
    2163           0 :                 return -1;
    2164             :         }
    2165             :         {
    2166           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->hash_algorithm_len));
    2167           0 :                 if (PyLong_Check(value)) {
    2168           0 :                         unsigned long long test_var;
    2169           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    2170           0 :                         if (PyErr_Occurred() != NULL) {
    2171           0 :                                 return -1;
    2172             :                         }
    2173           0 :                         if (test_var > uint_max) {
    2174           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    2175             :                                   PyLong_Type.tp_name, uint_max, test_var);
    2176           0 :                                 return -1;
    2177             :                         }
    2178           0 :                         object->hash_algorithm_len = test_var;
    2179             :                 } else {
    2180           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    2181             :                           PyLong_Type.tp_name);
    2182           0 :                         return -1;
    2183             :                 }
    2184             :         }
    2185           0 :         return 0;
    2186             : }
    2187             : 
    2188           1 : static PyObject *py_KdfParameters_get_padding_2(PyObject *obj, void *closure)
    2189             : {
    2190           1 :         struct KdfParameters *object = pytalloc_get_ptr(obj);
    2191           1 :         PyObject *py_padding_2;
    2192           1 :         py_padding_2 = PyLong_FromUnsignedLongLong((uint32_t)(object->padding_2));
    2193           1 :         return py_padding_2;
    2194             : }
    2195             : 
    2196           0 : static int py_KdfParameters_set_padding_2(PyObject *py_obj, PyObject *value, void *closure)
    2197             : {
    2198           0 :         struct KdfParameters *object = pytalloc_get_ptr(py_obj);
    2199           0 :         if (value == NULL) {
    2200           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->padding_2");
    2201           0 :                 return -1;
    2202             :         }
    2203             :         {
    2204           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->padding_2));
    2205           0 :                 if (PyLong_Check(value)) {
    2206           0 :                         unsigned long long test_var;
    2207           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    2208           0 :                         if (PyErr_Occurred() != NULL) {
    2209           0 :                                 return -1;
    2210             :                         }
    2211           0 :                         if (test_var > uint_max) {
    2212           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    2213             :                                   PyLong_Type.tp_name, uint_max, test_var);
    2214           0 :                                 return -1;
    2215             :                         }
    2216           0 :                         object->padding_2 = test_var;
    2217             :                 } else {
    2218           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    2219             :                           PyLong_Type.tp_name);
    2220           0 :                         return -1;
    2221             :                 }
    2222             :         }
    2223           0 :         return 0;
    2224             : }
    2225             : 
    2226          97 : static PyObject *py_KdfParameters_get_hash_algorithm(PyObject *obj, void *closure)
    2227             : {
    2228          97 :         struct KdfParameters *object = pytalloc_get_ptr(obj);
    2229           1 :         PyObject *py_hash_algorithm;
    2230          97 :         py_hash_algorithm = PyString_FromStringOrNULL(object->hash_algorithm);
    2231          97 :         return py_hash_algorithm;
    2232             : }
    2233             : 
    2234          57 : static int py_KdfParameters_set_hash_algorithm(PyObject *py_obj, PyObject *value, void *closure)
    2235             : {
    2236          57 :         struct KdfParameters *object = pytalloc_get_ptr(py_obj);
    2237          57 :         if (value == NULL) {
    2238           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->hash_algorithm");
    2239           0 :                 return -1;
    2240             :         }
    2241             :         {
    2242           1 :                 const char *test_str;
    2243           1 :                 const char *talloc_str;
    2244          57 :                 PyObject *unicode = NULL;
    2245          57 :                 if (PyUnicode_Check(value)) {
    2246          57 :                         unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
    2247          57 :                         if (unicode == NULL) {
    2248           0 :                                 return -1;
    2249             :                         }
    2250          57 :                         test_str = PyBytes_AS_STRING(unicode);
    2251           0 :                 } else if (PyBytes_Check(value)) {
    2252           0 :                         test_str = PyBytes_AS_STRING(value);
    2253             :                 } else {
    2254           0 :                         PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
    2255           0 :                         return -1;
    2256             :                 }
    2257          57 :                 talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
    2258          57 :                 if (unicode != NULL) {
    2259          37 :                         Py_DECREF(unicode);
    2260             :                 }
    2261          57 :                 if (talloc_str == NULL) {
    2262           0 :                         PyErr_NoMemory();
    2263           0 :                         return -1;
    2264             :                 }
    2265          57 :                 object->hash_algorithm = talloc_str;
    2266             :         }
    2267          57 :         return 0;
    2268             : }
    2269             : 
    2270             : static PyGetSetDef py_KdfParameters_getsetters[] = {
    2271             :         {
    2272             :                 .name = discard_const_p(char, "padding_0"),
    2273             :                 .get = py_KdfParameters_get_padding_0,
    2274             :                 .set = py_KdfParameters_set_padding_0,
    2275             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    2276             :         },
    2277             :         {
    2278             :                 .name = discard_const_p(char, "padding_1"),
    2279             :                 .get = py_KdfParameters_get_padding_1,
    2280             :                 .set = py_KdfParameters_set_padding_1,
    2281             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    2282             :         },
    2283             :         {
    2284             :                 .name = discard_const_p(char, "hash_algorithm_len"),
    2285             :                 .get = py_KdfParameters_get_hash_algorithm_len,
    2286             :                 .set = py_KdfParameters_set_hash_algorithm_len,
    2287             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    2288             :         },
    2289             :         {
    2290             :                 .name = discard_const_p(char, "padding_2"),
    2291             :                 .get = py_KdfParameters_get_padding_2,
    2292             :                 .set = py_KdfParameters_set_padding_2,
    2293             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    2294             :         },
    2295             :         {
    2296             :                 .name = discard_const_p(char, "hash_algorithm"),
    2297             :                 .get = py_KdfParameters_get_hash_algorithm,
    2298             :                 .set = py_KdfParameters_set_hash_algorithm,
    2299             :                 .doc = discard_const_p(char, "PIDL-generated element of base type string")
    2300             :         },
    2301             :         { .name = NULL }
    2302             : };
    2303             : 
    2304         154 : static PyObject *py_KdfParameters_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    2305             : {
    2306         154 :         return pytalloc_new(struct KdfParameters, type);
    2307             : }
    2308             : 
    2309          57 : static PyObject *py_KdfParameters_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
    2310             : {
    2311          57 :         struct KdfParameters *object = pytalloc_get_ptr(py_obj);
    2312          57 :         PyObject *ret = NULL;
    2313           1 :         DATA_BLOB blob;
    2314           1 :         enum ndr_err_code err;
    2315          57 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
    2316          57 :         if (tmp_ctx == NULL) {
    2317           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    2318           0 :                 return NULL;
    2319             :         }
    2320          57 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_KdfParameters);
    2321          57 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    2322           0 :                 TALLOC_FREE(tmp_ctx);
    2323           0 :                 PyErr_SetNdrError(err);
    2324           0 :                 return NULL;
    2325             :         }
    2326             : 
    2327          57 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    2328          57 :         TALLOC_FREE(tmp_ctx);
    2329          57 :         return ret;
    2330             : }
    2331             : 
    2332          97 : static PyObject *py_KdfParameters_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    2333             : {
    2334          97 :         struct KdfParameters *object = pytalloc_get_ptr(py_obj);
    2335          97 :         DATA_BLOB blob = {.data = NULL, .length = 0};
    2336          97 :         Py_ssize_t blob_length = 0;
    2337           1 :         enum ndr_err_code err;
    2338          97 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
    2339          97 :         PyObject *allow_remaining_obj = NULL;
    2340          97 :         bool allow_remaining = false;
    2341             : 
    2342          97 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
    2343             :                 discard_const_p(char *, kwnames),
    2344             :                 &blob.data, &blob_length,
    2345             :                 &allow_remaining_obj)) {
    2346           0 :                 return NULL;
    2347             :         }
    2348          97 :         blob.length = blob_length;
    2349             : 
    2350          97 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    2351           0 :                 allow_remaining = true;
    2352             :         }
    2353             : 
    2354          96 :         if (allow_remaining) {
    2355           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_KdfParameters);
    2356             :         } else {
    2357          97 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_KdfParameters);
    2358             :         }
    2359          97 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    2360           0 :                 PyErr_SetNdrError(err);
    2361           0 :                 return NULL;
    2362             :         }
    2363             : 
    2364          97 :         Py_RETURN_NONE;
    2365             : }
    2366             : 
    2367           0 : static PyObject *py_KdfParameters_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    2368             : {
    2369           0 :         struct KdfParameters *object = pytalloc_get_ptr(py_obj);
    2370           0 :         PyObject *ret;
    2371           0 :         char *retstr;
    2372             : 
    2373           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_KdfParameters, "KdfParameters", object);
    2374           0 :         ret = PyUnicode_FromString(retstr);
    2375           0 :         talloc_free(retstr);
    2376             : 
    2377           0 :         return ret;
    2378             : }
    2379             : 
    2380             : static PyMethodDef py_KdfParameters_methods[] = {
    2381             :         { "__ndr_pack__", (PyCFunction)py_KdfParameters_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
    2382             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_KdfParameters_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
    2383             :         { "__ndr_print__", (PyCFunction)py_KdfParameters_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
    2384             :         { NULL, NULL, 0, NULL }
    2385             : };
    2386             : 
    2387             : 
    2388             : static PyTypeObject KdfParameters_Type = {
    2389             :         PyVarObject_HEAD_INIT(NULL, 0)
    2390             :         .tp_name = "gkdi.KdfParameters",
    2391             :         .tp_getset = py_KdfParameters_getsetters,
    2392             :         .tp_methods = py_KdfParameters_methods,
    2393             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    2394             :         .tp_new = py_KdfParameters_new,
    2395             : };
    2396             : 
    2397             : 
    2398           1 : static PyObject *py_FfcDhParameters_get_length(PyObject *obj, void *closure)
    2399             : {
    2400           1 :         struct FfcDhParameters *object = pytalloc_get_ptr(obj);
    2401           1 :         PyObject *py_length;
    2402           1 :         py_length = PyLong_FromUnsignedLongLong((uint32_t)(object->length));
    2403           1 :         return py_length;
    2404             : }
    2405             : 
    2406           0 : static int py_FfcDhParameters_set_length(PyObject *py_obj, PyObject *value, void *closure)
    2407             : {
    2408           0 :         struct FfcDhParameters *object = pytalloc_get_ptr(py_obj);
    2409           0 :         if (value == NULL) {
    2410           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->length");
    2411           0 :                 return -1;
    2412             :         }
    2413             :         {
    2414           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->length));
    2415           0 :                 if (PyLong_Check(value)) {
    2416           0 :                         unsigned long long test_var;
    2417           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    2418           0 :                         if (PyErr_Occurred() != NULL) {
    2419           0 :                                 return -1;
    2420             :                         }
    2421           0 :                         if (test_var > uint_max) {
    2422           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    2423             :                                   PyLong_Type.tp_name, uint_max, test_var);
    2424           0 :                                 return -1;
    2425             :                         }
    2426           0 :                         object->length = test_var;
    2427             :                 } else {
    2428           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    2429             :                           PyLong_Type.tp_name);
    2430           0 :                         return -1;
    2431             :                 }
    2432             :         }
    2433           0 :         return 0;
    2434             : }
    2435             : 
    2436           1 : static PyObject *py_FfcDhParameters_get_magic(PyObject *obj, void *closure)
    2437             : {
    2438           1 :         struct FfcDhParameters *object = pytalloc_get_ptr(obj);
    2439           1 :         PyObject *py_magic;
    2440           1 :         py_magic = PyLong_FromUnsignedLongLong((uint32_t)(object->magic));
    2441           1 :         return py_magic;
    2442             : }
    2443             : 
    2444           0 : static int py_FfcDhParameters_set_magic(PyObject *py_obj, PyObject *value, void *closure)
    2445             : {
    2446           0 :         struct FfcDhParameters *object = pytalloc_get_ptr(py_obj);
    2447           0 :         if (value == NULL) {
    2448           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->magic");
    2449           0 :                 return -1;
    2450             :         }
    2451             :         {
    2452           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->magic));
    2453           0 :                 if (PyLong_Check(value)) {
    2454           0 :                         unsigned long long test_var;
    2455           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    2456           0 :                         if (PyErr_Occurred() != NULL) {
    2457           0 :                                 return -1;
    2458             :                         }
    2459           0 :                         if (test_var > uint_max) {
    2460           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    2461             :                                   PyLong_Type.tp_name, uint_max, test_var);
    2462           0 :                                 return -1;
    2463             :                         }
    2464           0 :                         object->magic = test_var;
    2465             :                 } else {
    2466           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    2467             :                           PyLong_Type.tp_name);
    2468           0 :                         return -1;
    2469             :                 }
    2470             :         }
    2471           0 :         return 0;
    2472             : }
    2473             : 
    2474           1 : static PyObject *py_FfcDhParameters_get_key_length(PyObject *obj, void *closure)
    2475             : {
    2476           1 :         struct FfcDhParameters *object = pytalloc_get_ptr(obj);
    2477           1 :         PyObject *py_key_length;
    2478           1 :         py_key_length = PyLong_FromUnsignedLongLong((uint32_t)(object->key_length));
    2479           1 :         return py_key_length;
    2480             : }
    2481             : 
    2482          59 : static int py_FfcDhParameters_set_key_length(PyObject *py_obj, PyObject *value, void *closure)
    2483             : {
    2484          59 :         struct FfcDhParameters *object = pytalloc_get_ptr(py_obj);
    2485          59 :         if (value == NULL) {
    2486           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->key_length");
    2487           0 :                 return -1;
    2488             :         }
    2489             :         {
    2490          59 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->key_length));
    2491          59 :                 if (PyLong_Check(value)) {
    2492           1 :                         unsigned long long test_var;
    2493          59 :                         test_var = PyLong_AsUnsignedLongLong(value);
    2494          59 :                         if (PyErr_Occurred() != NULL) {
    2495           0 :                                 return -1;
    2496             :                         }
    2497          59 :                         if (test_var > uint_max) {
    2498           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    2499             :                                   PyLong_Type.tp_name, uint_max, test_var);
    2500           0 :                                 return -1;
    2501             :                         }
    2502          59 :                         object->key_length = test_var;
    2503             :                 } else {
    2504           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    2505             :                           PyLong_Type.tp_name);
    2506           0 :                         return -1;
    2507             :                 }
    2508             :         }
    2509          59 :         return 0;
    2510             : }
    2511             : 
    2512           1 : static PyObject *py_FfcDhParameters_get_field_order(PyObject *obj, void *closure)
    2513             : {
    2514           1 :         struct FfcDhParameters *object = pytalloc_get_ptr(obj);
    2515           1 :         PyObject *py_field_order;
    2516           1 :         py_field_order = PyList_New(object->key_length);
    2517           1 :         if (py_field_order == NULL) {
    2518           0 :                 return NULL;
    2519             :         }
    2520             :         {
    2521             :                 int field_order_cntr_0;
    2522         257 :                 for (field_order_cntr_0 = 0; field_order_cntr_0 < (object->key_length); field_order_cntr_0++) {
    2523         256 :                         PyObject *py_field_order_0;
    2524         256 :                         py_field_order_0 = PyLong_FromLong((uint16_t)((object->field_order)[field_order_cntr_0]));
    2525         256 :                         PyList_SetItem(py_field_order, field_order_cntr_0, py_field_order_0);
    2526             :                 }
    2527             :         }
    2528           0 :         return py_field_order;
    2529             : }
    2530             : 
    2531          59 : static int py_FfcDhParameters_set_field_order(PyObject *py_obj, PyObject *value, void *closure)
    2532             : {
    2533          59 :         struct FfcDhParameters *object = pytalloc_get_ptr(py_obj);
    2534          59 :         if (value == NULL) {
    2535           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->field_order");
    2536           0 :                 return -1;
    2537             :         }
    2538          59 :         PY_CHECK_TYPE(&PyList_Type, value, return -1;);
    2539             :         {
    2540           1 :                 int field_order_cntr_0;
    2541          59 :                 object->field_order = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->field_order, PyList_GET_SIZE(value));
    2542          59 :                 if (!object->field_order) { return -1; }
    2543          59 :                 talloc_set_name_const(object->field_order, "ARRAY: object->field_order");
    2544       15164 :                 for (field_order_cntr_0 = 0; field_order_cntr_0 < PyList_GET_SIZE(value); field_order_cntr_0++) {
    2545       15104 :                         if (PyList_GET_ITEM(value, field_order_cntr_0) == NULL) {
    2546           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->field_order)[field_order_cntr_0]");
    2547           0 :                                 return -1;
    2548             :                         }
    2549             :                         {
    2550       15104 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((object->field_order)[field_order_cntr_0]));
    2551       15104 :                                 if (PyLong_Check(PyList_GET_ITEM(value, field_order_cntr_0))) {
    2552         256 :                                         unsigned long long test_var;
    2553       15104 :                                         test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, field_order_cntr_0));
    2554       15104 :                                         if (PyErr_Occurred() != NULL) {
    2555           0 :                                                 return -1;
    2556             :                                         }
    2557       15104 :                                         if (test_var > uint_max) {
    2558           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    2559             :                                                   PyLong_Type.tp_name, uint_max, test_var);
    2560           0 :                                                 return -1;
    2561             :                                         }
    2562       15104 :                                         (object->field_order)[field_order_cntr_0] = test_var;
    2563             :                                 } else {
    2564           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    2565             :                                           PyLong_Type.tp_name);
    2566           0 :                                         return -1;
    2567             :                                 }
    2568             :                         }
    2569             :                 }
    2570             :         }
    2571          58 :         return 0;
    2572             : }
    2573             : 
    2574           1 : static PyObject *py_FfcDhParameters_get_generator(PyObject *obj, void *closure)
    2575             : {
    2576           1 :         struct FfcDhParameters *object = pytalloc_get_ptr(obj);
    2577           1 :         PyObject *py_generator;
    2578           1 :         py_generator = PyList_New(object->key_length);
    2579           1 :         if (py_generator == NULL) {
    2580           0 :                 return NULL;
    2581             :         }
    2582             :         {
    2583             :                 int generator_cntr_0;
    2584         257 :                 for (generator_cntr_0 = 0; generator_cntr_0 < (object->key_length); generator_cntr_0++) {
    2585         256 :                         PyObject *py_generator_0;
    2586         256 :                         py_generator_0 = PyLong_FromLong((uint16_t)((object->generator)[generator_cntr_0]));
    2587         256 :                         PyList_SetItem(py_generator, generator_cntr_0, py_generator_0);
    2588             :                 }
    2589             :         }
    2590           0 :         return py_generator;
    2591             : }
    2592             : 
    2593          59 : static int py_FfcDhParameters_set_generator(PyObject *py_obj, PyObject *value, void *closure)
    2594             : {
    2595          59 :         struct FfcDhParameters *object = pytalloc_get_ptr(py_obj);
    2596          59 :         if (value == NULL) {
    2597           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->generator");
    2598           0 :                 return -1;
    2599             :         }
    2600          59 :         PY_CHECK_TYPE(&PyList_Type, value, return -1;);
    2601             :         {
    2602           1 :                 int generator_cntr_0;
    2603          59 :                 object->generator = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->generator, PyList_GET_SIZE(value));
    2604          59 :                 if (!object->generator) { return -1; }
    2605          59 :                 talloc_set_name_const(object->generator, "ARRAY: object->generator");
    2606       15164 :                 for (generator_cntr_0 = 0; generator_cntr_0 < PyList_GET_SIZE(value); generator_cntr_0++) {
    2607       15104 :                         if (PyList_GET_ITEM(value, generator_cntr_0) == NULL) {
    2608           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->generator)[generator_cntr_0]");
    2609           0 :                                 return -1;
    2610             :                         }
    2611             :                         {
    2612       15104 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((object->generator)[generator_cntr_0]));
    2613       15104 :                                 if (PyLong_Check(PyList_GET_ITEM(value, generator_cntr_0))) {
    2614         256 :                                         unsigned long long test_var;
    2615       15104 :                                         test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, generator_cntr_0));
    2616       15104 :                                         if (PyErr_Occurred() != NULL) {
    2617           0 :                                                 return -1;
    2618             :                                         }
    2619       15104 :                                         if (test_var > uint_max) {
    2620           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    2621             :                                                   PyLong_Type.tp_name, uint_max, test_var);
    2622           0 :                                                 return -1;
    2623             :                                         }
    2624       15104 :                                         (object->generator)[generator_cntr_0] = test_var;
    2625             :                                 } else {
    2626           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    2627             :                                           PyLong_Type.tp_name);
    2628           0 :                                         return -1;
    2629             :                                 }
    2630             :                         }
    2631             :                 }
    2632             :         }
    2633          58 :         return 0;
    2634             : }
    2635             : 
    2636             : static PyGetSetDef py_FfcDhParameters_getsetters[] = {
    2637             :         {
    2638             :                 .name = discard_const_p(char, "length"),
    2639             :                 .get = py_FfcDhParameters_get_length,
    2640             :                 .set = py_FfcDhParameters_set_length,
    2641             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    2642             :         },
    2643             :         {
    2644             :                 .name = discard_const_p(char, "magic"),
    2645             :                 .get = py_FfcDhParameters_get_magic,
    2646             :                 .set = py_FfcDhParameters_set_magic,
    2647             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    2648             :         },
    2649             :         {
    2650             :                 .name = discard_const_p(char, "key_length"),
    2651             :                 .get = py_FfcDhParameters_get_key_length,
    2652             :                 .set = py_FfcDhParameters_set_key_length,
    2653             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    2654             :         },
    2655             :         {
    2656             :                 .name = discard_const_p(char, "field_order"),
    2657             :                 .get = py_FfcDhParameters_get_field_order,
    2658             :                 .set = py_FfcDhParameters_set_field_order,
    2659             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
    2660             :         },
    2661             :         {
    2662             :                 .name = discard_const_p(char, "generator"),
    2663             :                 .get = py_FfcDhParameters_get_generator,
    2664             :                 .set = py_FfcDhParameters_set_generator,
    2665             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
    2666             :         },
    2667             :         { .name = NULL }
    2668             : };
    2669             : 
    2670          60 : static PyObject *py_FfcDhParameters_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    2671             : {
    2672          60 :         return pytalloc_new(struct FfcDhParameters, type);
    2673             : }
    2674             : 
    2675          59 : static PyObject *py_FfcDhParameters_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
    2676             : {
    2677          59 :         struct FfcDhParameters *object = pytalloc_get_ptr(py_obj);
    2678          59 :         PyObject *ret = NULL;
    2679           1 :         DATA_BLOB blob;
    2680           1 :         enum ndr_err_code err;
    2681          59 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
    2682          59 :         if (tmp_ctx == NULL) {
    2683           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    2684           0 :                 return NULL;
    2685             :         }
    2686          59 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_FfcDhParameters);
    2687          59 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    2688           0 :                 TALLOC_FREE(tmp_ctx);
    2689           0 :                 PyErr_SetNdrError(err);
    2690           0 :                 return NULL;
    2691             :         }
    2692             : 
    2693          59 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    2694          59 :         TALLOC_FREE(tmp_ctx);
    2695          59 :         return ret;
    2696             : }
    2697             : 
    2698           1 : static PyObject *py_FfcDhParameters_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    2699             : {
    2700           1 :         struct FfcDhParameters *object = pytalloc_get_ptr(py_obj);
    2701           1 :         DATA_BLOB blob = {.data = NULL, .length = 0};
    2702           1 :         Py_ssize_t blob_length = 0;
    2703           1 :         enum ndr_err_code err;
    2704           1 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
    2705           1 :         PyObject *allow_remaining_obj = NULL;
    2706           1 :         bool allow_remaining = false;
    2707             : 
    2708           1 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
    2709             :                 discard_const_p(char *, kwnames),
    2710             :                 &blob.data, &blob_length,
    2711             :                 &allow_remaining_obj)) {
    2712           0 :                 return NULL;
    2713             :         }
    2714           1 :         blob.length = blob_length;
    2715             : 
    2716           1 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    2717           0 :                 allow_remaining = true;
    2718             :         }
    2719             : 
    2720           0 :         if (allow_remaining) {
    2721           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_FfcDhParameters);
    2722             :         } else {
    2723           1 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_FfcDhParameters);
    2724             :         }
    2725           1 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    2726           0 :                 PyErr_SetNdrError(err);
    2727           0 :                 return NULL;
    2728             :         }
    2729             : 
    2730           1 :         Py_RETURN_NONE;
    2731             : }
    2732             : 
    2733           0 : static PyObject *py_FfcDhParameters_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    2734             : {
    2735           0 :         struct FfcDhParameters *object = pytalloc_get_ptr(py_obj);
    2736           0 :         PyObject *ret;
    2737           0 :         char *retstr;
    2738             : 
    2739           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_FfcDhParameters, "FfcDhParameters", object);
    2740           0 :         ret = PyUnicode_FromString(retstr);
    2741           0 :         talloc_free(retstr);
    2742             : 
    2743           0 :         return ret;
    2744             : }
    2745             : 
    2746             : static PyMethodDef py_FfcDhParameters_methods[] = {
    2747             :         { "__ndr_pack__", (PyCFunction)py_FfcDhParameters_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
    2748             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_FfcDhParameters_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
    2749             :         { "__ndr_print__", (PyCFunction)py_FfcDhParameters_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
    2750             :         { NULL, NULL, 0, NULL }
    2751             : };
    2752             : 
    2753             : 
    2754             : static PyTypeObject FfcDhParameters_Type = {
    2755             :         PyVarObject_HEAD_INIT(NULL, 0)
    2756             :         .tp_name = "gkdi.FfcDhParameters",
    2757             :         .tp_getset = py_FfcDhParameters_getsetters,
    2758             :         .tp_methods = py_FfcDhParameters_methods,
    2759             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    2760             :         .tp_new = py_FfcDhParameters_new,
    2761             : };
    2762             : 
    2763             : 
    2764           0 : static PyObject *py_GkdiDerivationCtx_get_guid(PyObject *obj, void *closure)
    2765             : {
    2766           0 :         struct GkdiDerivationCtx *object = pytalloc_get_ptr(obj);
    2767           0 :         PyObject *py_guid;
    2768           0 :         py_guid = pytalloc_reference_ex(GUID_Type, pytalloc_get_mem_ctx(obj), &object->guid);
    2769           0 :         return py_guid;
    2770             : }
    2771             : 
    2772           0 : static int py_GkdiDerivationCtx_set_guid(PyObject *py_obj, PyObject *value, void *closure)
    2773             : {
    2774           0 :         struct GkdiDerivationCtx *object = pytalloc_get_ptr(py_obj);
    2775           0 :         if (value == NULL) {
    2776           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->guid");
    2777           0 :                 return -1;
    2778             :         }
    2779           0 :         PY_CHECK_TYPE(GUID_Type, value, return -1;);
    2780           0 :         if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
    2781           0 :                 PyErr_NoMemory();
    2782           0 :                 return -1;
    2783             :         }
    2784           0 :         object->guid = *(struct GUID *)pytalloc_get_ptr(value);
    2785           0 :         return 0;
    2786             : }
    2787             : 
    2788           0 : static PyObject *py_GkdiDerivationCtx_get_l0_idx(PyObject *obj, void *closure)
    2789             : {
    2790           0 :         struct GkdiDerivationCtx *object = pytalloc_get_ptr(obj);
    2791           0 :         PyObject *py_l0_idx;
    2792           0 :         py_l0_idx = PyLong_FromLong(object->l0_idx);
    2793           0 :         return py_l0_idx;
    2794             : }
    2795             : 
    2796           0 : static int py_GkdiDerivationCtx_set_l0_idx(PyObject *py_obj, PyObject *value, void *closure)
    2797             : {
    2798           0 :         struct GkdiDerivationCtx *object = pytalloc_get_ptr(py_obj);
    2799           0 :         if (value == NULL) {
    2800           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->l0_idx");
    2801           0 :                 return -1;
    2802             :         }
    2803             :         {
    2804           0 :                 const long long int_max = ndr_sizeof2intmax(sizeof(object->l0_idx));
    2805           0 :                 const long long int_min = -int_max - 1;
    2806           0 :                 if (PyLong_Check(value)) {
    2807           0 :                         long long test_var;
    2808           0 :                         test_var = PyLong_AsLongLong(value);
    2809           0 :                         if (PyErr_Occurred() != NULL) {
    2810           0 :                                 return -1;
    2811             :                         }
    2812           0 :                         if (test_var < int_min || test_var > int_max) {
    2813           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range %lld - %lld, got %lld",
    2814             :                                   PyLong_Type.tp_name, int_min, int_max, test_var);
    2815           0 :                                 return -1;
    2816             :                         }
    2817           0 :                         object->l0_idx = test_var;
    2818             :                 } else {
    2819           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    2820             :                           PyLong_Type.tp_name);
    2821           0 :                         return -1;
    2822             :                 }
    2823             :         }
    2824           0 :         return 0;
    2825             : }
    2826             : 
    2827           0 : static PyObject *py_GkdiDerivationCtx_get_l1_idx(PyObject *obj, void *closure)
    2828             : {
    2829           0 :         struct GkdiDerivationCtx *object = pytalloc_get_ptr(obj);
    2830           0 :         PyObject *py_l1_idx;
    2831           0 :         py_l1_idx = PyLong_FromLong(object->l1_idx);
    2832           0 :         return py_l1_idx;
    2833             : }
    2834             : 
    2835           0 : static int py_GkdiDerivationCtx_set_l1_idx(PyObject *py_obj, PyObject *value, void *closure)
    2836             : {
    2837           0 :         struct GkdiDerivationCtx *object = pytalloc_get_ptr(py_obj);
    2838           0 :         if (value == NULL) {
    2839           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->l1_idx");
    2840           0 :                 return -1;
    2841             :         }
    2842             :         {
    2843           0 :                 const long long int_max = ndr_sizeof2intmax(sizeof(object->l1_idx));
    2844           0 :                 const long long int_min = -int_max - 1;
    2845           0 :                 if (PyLong_Check(value)) {
    2846           0 :                         long long test_var;
    2847           0 :                         test_var = PyLong_AsLongLong(value);
    2848           0 :                         if (PyErr_Occurred() != NULL) {
    2849           0 :                                 return -1;
    2850             :                         }
    2851           0 :                         if (test_var < int_min || test_var > int_max) {
    2852           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range %lld - %lld, got %lld",
    2853             :                                   PyLong_Type.tp_name, int_min, int_max, test_var);
    2854           0 :                                 return -1;
    2855             :                         }
    2856           0 :                         object->l1_idx = test_var;
    2857             :                 } else {
    2858           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    2859             :                           PyLong_Type.tp_name);
    2860           0 :                         return -1;
    2861             :                 }
    2862             :         }
    2863           0 :         return 0;
    2864             : }
    2865             : 
    2866           0 : static PyObject *py_GkdiDerivationCtx_get_l2_idx(PyObject *obj, void *closure)
    2867             : {
    2868           0 :         struct GkdiDerivationCtx *object = pytalloc_get_ptr(obj);
    2869           0 :         PyObject *py_l2_idx;
    2870           0 :         py_l2_idx = PyLong_FromLong(object->l2_idx);
    2871           0 :         return py_l2_idx;
    2872             : }
    2873             : 
    2874           0 : static int py_GkdiDerivationCtx_set_l2_idx(PyObject *py_obj, PyObject *value, void *closure)
    2875             : {
    2876           0 :         struct GkdiDerivationCtx *object = pytalloc_get_ptr(py_obj);
    2877           0 :         if (value == NULL) {
    2878           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->l2_idx");
    2879           0 :                 return -1;
    2880             :         }
    2881             :         {
    2882           0 :                 const long long int_max = ndr_sizeof2intmax(sizeof(object->l2_idx));
    2883           0 :                 const long long int_min = -int_max - 1;
    2884           0 :                 if (PyLong_Check(value)) {
    2885           0 :                         long long test_var;
    2886           0 :                         test_var = PyLong_AsLongLong(value);
    2887           0 :                         if (PyErr_Occurred() != NULL) {
    2888           0 :                                 return -1;
    2889             :                         }
    2890           0 :                         if (test_var < int_min || test_var > int_max) {
    2891           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range %lld - %lld, got %lld",
    2892             :                                   PyLong_Type.tp_name, int_min, int_max, test_var);
    2893           0 :                                 return -1;
    2894             :                         }
    2895           0 :                         object->l2_idx = test_var;
    2896             :                 } else {
    2897           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    2898             :                           PyLong_Type.tp_name);
    2899           0 :                         return -1;
    2900             :                 }
    2901             :         }
    2902           0 :         return 0;
    2903             : }
    2904             : 
    2905           0 : static PyObject *py_GkdiDerivationCtx_get_target_security_descriptor(PyObject *obj, void *closure)
    2906             : {
    2907           0 :         struct GkdiDerivationCtx *object = pytalloc_get_ptr(obj);
    2908           0 :         PyObject *py_target_security_descriptor;
    2909           0 :         py_target_security_descriptor = PyBytes_FromStringAndSize((char *)(object->target_security_descriptor).data, (object->target_security_descriptor).length);
    2910           0 :         return py_target_security_descriptor;
    2911             : }
    2912             : 
    2913           0 : static int py_GkdiDerivationCtx_set_target_security_descriptor(PyObject *py_obj, PyObject *value, void *closure)
    2914             : {
    2915           0 :         struct GkdiDerivationCtx *object = pytalloc_get_ptr(py_obj);
    2916           0 :         if (value == NULL) {
    2917           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->target_security_descriptor");
    2918           0 :                 return -1;
    2919             :         }
    2920           0 :         object->target_security_descriptor = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
    2921           0 :         return 0;
    2922             : }
    2923             : 
    2924             : static PyGetSetDef py_GkdiDerivationCtx_getsetters[] = {
    2925             :         {
    2926             :                 .name = discard_const_p(char, "guid"),
    2927             :                 .get = py_GkdiDerivationCtx_get_guid,
    2928             :                 .set = py_GkdiDerivationCtx_set_guid,
    2929             :                 .doc = discard_const_p(char, "PIDL-generated element of base type GUID")
    2930             :         },
    2931             :         {
    2932             :                 .name = discard_const_p(char, "l0_idx"),
    2933             :                 .get = py_GkdiDerivationCtx_get_l0_idx,
    2934             :                 .set = py_GkdiDerivationCtx_set_l0_idx,
    2935             :                 .doc = discard_const_p(char, "PIDL-generated element of base type int32")
    2936             :         },
    2937             :         {
    2938             :                 .name = discard_const_p(char, "l1_idx"),
    2939             :                 .get = py_GkdiDerivationCtx_get_l1_idx,
    2940             :                 .set = py_GkdiDerivationCtx_set_l1_idx,
    2941             :                 .doc = discard_const_p(char, "PIDL-generated element of base type int32")
    2942             :         },
    2943             :         {
    2944             :                 .name = discard_const_p(char, "l2_idx"),
    2945             :                 .get = py_GkdiDerivationCtx_get_l2_idx,
    2946             :                 .set = py_GkdiDerivationCtx_set_l2_idx,
    2947             :                 .doc = discard_const_p(char, "PIDL-generated element of base type int32")
    2948             :         },
    2949             :         {
    2950             :                 .name = discard_const_p(char, "target_security_descriptor"),
    2951             :                 .get = py_GkdiDerivationCtx_get_target_security_descriptor,
    2952             :                 .set = py_GkdiDerivationCtx_set_target_security_descriptor,
    2953             :                 .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
    2954             :         },
    2955             :         { .name = NULL }
    2956             : };
    2957             : 
    2958           0 : static PyObject *py_GkdiDerivationCtx_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    2959             : {
    2960           0 :         return pytalloc_new(struct GkdiDerivationCtx, type);
    2961             : }
    2962             : 
    2963           0 : static PyObject *py_GkdiDerivationCtx_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
    2964             : {
    2965           0 :         struct GkdiDerivationCtx *object = pytalloc_get_ptr(py_obj);
    2966           0 :         PyObject *ret = NULL;
    2967           0 :         DATA_BLOB blob;
    2968           0 :         enum ndr_err_code err;
    2969           0 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
    2970           0 :         if (tmp_ctx == NULL) {
    2971           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    2972           0 :                 return NULL;
    2973             :         }
    2974           0 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_GkdiDerivationCtx);
    2975           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    2976           0 :                 TALLOC_FREE(tmp_ctx);
    2977           0 :                 PyErr_SetNdrError(err);
    2978           0 :                 return NULL;
    2979             :         }
    2980             : 
    2981           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    2982           0 :         TALLOC_FREE(tmp_ctx);
    2983           0 :         return ret;
    2984             : }
    2985             : 
    2986           0 : static PyObject *py_GkdiDerivationCtx_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    2987             : {
    2988           0 :         struct GkdiDerivationCtx *object = pytalloc_get_ptr(py_obj);
    2989           0 :         DATA_BLOB blob = {.data = NULL, .length = 0};
    2990           0 :         Py_ssize_t blob_length = 0;
    2991           0 :         enum ndr_err_code err;
    2992           0 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
    2993           0 :         PyObject *allow_remaining_obj = NULL;
    2994           0 :         bool allow_remaining = false;
    2995             : 
    2996           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
    2997             :                 discard_const_p(char *, kwnames),
    2998             :                 &blob.data, &blob_length,
    2999             :                 &allow_remaining_obj)) {
    3000           0 :                 return NULL;
    3001             :         }
    3002           0 :         blob.length = blob_length;
    3003             : 
    3004           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    3005           0 :                 allow_remaining = true;
    3006             :         }
    3007             : 
    3008           0 :         if (allow_remaining) {
    3009           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_GkdiDerivationCtx);
    3010             :         } else {
    3011           0 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_GkdiDerivationCtx);
    3012             :         }
    3013           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    3014           0 :                 PyErr_SetNdrError(err);
    3015           0 :                 return NULL;
    3016             :         }
    3017             : 
    3018           0 :         Py_RETURN_NONE;
    3019             : }
    3020             : 
    3021           0 : static PyObject *py_GkdiDerivationCtx_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    3022             : {
    3023           0 :         struct GkdiDerivationCtx *object = pytalloc_get_ptr(py_obj);
    3024           0 :         PyObject *ret;
    3025           0 :         char *retstr;
    3026             : 
    3027           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_GkdiDerivationCtx, "GkdiDerivationCtx", object);
    3028           0 :         ret = PyUnicode_FromString(retstr);
    3029           0 :         talloc_free(retstr);
    3030             : 
    3031           0 :         return ret;
    3032             : }
    3033             : 
    3034             : static PyMethodDef py_GkdiDerivationCtx_methods[] = {
    3035             :         { "__ndr_pack__", (PyCFunction)py_GkdiDerivationCtx_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
    3036             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_GkdiDerivationCtx_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
    3037             :         { "__ndr_print__", (PyCFunction)py_GkdiDerivationCtx_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
    3038             :         { NULL, NULL, 0, NULL }
    3039             : };
    3040             : 
    3041             : 
    3042             : static PyTypeObject GkdiDerivationCtx_Type = {
    3043             :         PyVarObject_HEAD_INIT(NULL, 0)
    3044             :         .tp_name = "gkdi.GkdiDerivationCtx",
    3045             :         .tp_getset = py_GkdiDerivationCtx_getsetters,
    3046             :         .tp_methods = py_GkdiDerivationCtx_methods,
    3047             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    3048             :         .tp_new = py_GkdiDerivationCtx_new,
    3049             : };
    3050             : 
    3051             : 
    3052             : 
    3053           0 : static PyObject *py_gkdi_GetKey_in_get_target_sd_len(PyObject *obj, void *closure)
    3054             : {
    3055           0 :         struct gkdi_GetKey *object = pytalloc_get_ptr(obj);
    3056           0 :         PyObject *py_target_sd_len;
    3057           0 :         py_target_sd_len = PyLong_FromUnsignedLongLong((uint32_t)(object->in.target_sd_len));
    3058           0 :         return py_target_sd_len;
    3059             : }
    3060             : 
    3061           0 : static int py_gkdi_GetKey_in_set_target_sd_len(PyObject *py_obj, PyObject *value, void *closure)
    3062             : {
    3063           0 :         struct gkdi_GetKey *object = pytalloc_get_ptr(py_obj);
    3064           0 :         if (value == NULL) {
    3065           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.target_sd_len");
    3066           0 :                 return -1;
    3067             :         }
    3068             :         {
    3069           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.target_sd_len));
    3070           0 :                 if (PyLong_Check(value)) {
    3071           0 :                         unsigned long long test_var;
    3072           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    3073           0 :                         if (PyErr_Occurred() != NULL) {
    3074           0 :                                 return -1;
    3075             :                         }
    3076           0 :                         if (test_var > uint_max) {
    3077           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    3078             :                                   PyLong_Type.tp_name, uint_max, test_var);
    3079           0 :                                 return -1;
    3080             :                         }
    3081           0 :                         object->in.target_sd_len = test_var;
    3082             :                 } else {
    3083           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    3084             :                           PyLong_Type.tp_name);
    3085           0 :                         return -1;
    3086             :                 }
    3087             :         }
    3088           0 :         return 0;
    3089             : }
    3090             : 
    3091           0 : static PyObject *py_gkdi_GetKey_in_get_target_sd(PyObject *obj, void *closure)
    3092             : {
    3093           0 :         struct gkdi_GetKey *object = pytalloc_get_ptr(obj);
    3094           0 :         PyObject *py_target_sd;
    3095           0 :         if (object->in.target_sd == NULL) {
    3096           0 :                 Py_RETURN_NONE;
    3097             :         }
    3098           0 :         py_target_sd = PyList_New(object->in.target_sd_len);
    3099           0 :         if (py_target_sd == NULL) {
    3100           0 :                 return NULL;
    3101             :         }
    3102             :         {
    3103             :                 int target_sd_cntr_1;
    3104           0 :                 for (target_sd_cntr_1 = 0; target_sd_cntr_1 < (object->in.target_sd_len); target_sd_cntr_1++) {
    3105           0 :                         PyObject *py_target_sd_1;
    3106           0 :                         py_target_sd_1 = PyLong_FromLong((uint16_t)((object->in.target_sd)[target_sd_cntr_1]));
    3107           0 :                         PyList_SetItem(py_target_sd, target_sd_cntr_1, py_target_sd_1);
    3108             :                 }
    3109             :         }
    3110           0 :         return py_target_sd;
    3111             : }
    3112             : 
    3113           0 : static int py_gkdi_GetKey_in_set_target_sd(PyObject *py_obj, PyObject *value, void *closure)
    3114             : {
    3115           0 :         struct gkdi_GetKey *object = pytalloc_get_ptr(py_obj);
    3116           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.target_sd));
    3117           0 :         if (value == NULL) {
    3118           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.target_sd");
    3119           0 :                 return -1;
    3120             :         }
    3121           0 :         object->in.target_sd = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.target_sd);
    3122           0 :         if (object->in.target_sd == NULL) {
    3123           0 :                 PyErr_NoMemory();
    3124           0 :                 return -1;
    3125             :         }
    3126           0 :         PY_CHECK_TYPE(&PyList_Type, value, return -1;);
    3127             :         {
    3128           0 :                 int target_sd_cntr_1;
    3129           0 :                 object->in.target_sd = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.target_sd, PyList_GET_SIZE(value));
    3130           0 :                 if (!object->in.target_sd) { return -1; }
    3131           0 :                 talloc_set_name_const(object->in.target_sd, "ARRAY: object->in.target_sd");
    3132           0 :                 for (target_sd_cntr_1 = 0; target_sd_cntr_1 < PyList_GET_SIZE(value); target_sd_cntr_1++) {
    3133           0 :                         if (PyList_GET_ITEM(value, target_sd_cntr_1) == NULL) {
    3134           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->in.target_sd)[target_sd_cntr_1]");
    3135           0 :                                 return -1;
    3136             :                         }
    3137             :                         {
    3138           0 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((object->in.target_sd)[target_sd_cntr_1]));
    3139           0 :                                 if (PyLong_Check(PyList_GET_ITEM(value, target_sd_cntr_1))) {
    3140           0 :                                         unsigned long long test_var;
    3141           0 :                                         test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, target_sd_cntr_1));
    3142           0 :                                         if (PyErr_Occurred() != NULL) {
    3143           0 :                                                 return -1;
    3144             :                                         }
    3145           0 :                                         if (test_var > uint_max) {
    3146           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    3147             :                                                   PyLong_Type.tp_name, uint_max, test_var);
    3148           0 :                                                 return -1;
    3149             :                                         }
    3150           0 :                                         (object->in.target_sd)[target_sd_cntr_1] = test_var;
    3151             :                                 } else {
    3152           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    3153             :                                           PyLong_Type.tp_name);
    3154           0 :                                         return -1;
    3155             :                                 }
    3156             :                         }
    3157             :                 }
    3158             :         }
    3159           0 :         return 0;
    3160             : }
    3161             : 
    3162           0 : static PyObject *py_gkdi_GetKey_in_get_root_key_id(PyObject *obj, void *closure)
    3163             : {
    3164           0 :         struct gkdi_GetKey *object = pytalloc_get_ptr(obj);
    3165           0 :         PyObject *py_root_key_id;
    3166           0 :         if (object->in.root_key_id == NULL) {
    3167           0 :                 Py_RETURN_NONE;
    3168             :         }
    3169           0 :         if (object->in.root_key_id == NULL) {
    3170           0 :                 py_root_key_id = Py_None;
    3171           0 :                 Py_INCREF(py_root_key_id);
    3172             :         } else {
    3173           0 :                 py_root_key_id = pytalloc_reference_ex(GUID_Type, object->in.root_key_id, object->in.root_key_id);
    3174             :         }
    3175           0 :         return py_root_key_id;
    3176             : }
    3177             : 
    3178           0 : static int py_gkdi_GetKey_in_set_root_key_id(PyObject *py_obj, PyObject *value, void *closure)
    3179             : {
    3180           0 :         struct gkdi_GetKey *object = pytalloc_get_ptr(py_obj);
    3181           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.root_key_id));
    3182           0 :         if (value == NULL) {
    3183           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.root_key_id");
    3184           0 :                 return -1;
    3185             :         }
    3186           0 :         if (value == Py_None) {
    3187           0 :                 object->in.root_key_id = NULL;
    3188             :         } else {
    3189           0 :                 object->in.root_key_id = NULL;
    3190           0 :                 PY_CHECK_TYPE(GUID_Type, value, return -1;);
    3191           0 :                 if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
    3192           0 :                         PyErr_NoMemory();
    3193           0 :                         return -1;
    3194             :                 }
    3195           0 :                 object->in.root_key_id = (struct GUID *)pytalloc_get_ptr(value);
    3196             :         }
    3197           0 :         return 0;
    3198             : }
    3199             : 
    3200           0 : static PyObject *py_gkdi_GetKey_in_get_l0_key_id(PyObject *obj, void *closure)
    3201             : {
    3202           0 :         struct gkdi_GetKey *object = pytalloc_get_ptr(obj);
    3203           0 :         PyObject *py_l0_key_id;
    3204           0 :         py_l0_key_id = PyLong_FromLong(object->in.l0_key_id);
    3205           0 :         return py_l0_key_id;
    3206             : }
    3207             : 
    3208           0 : static int py_gkdi_GetKey_in_set_l0_key_id(PyObject *py_obj, PyObject *value, void *closure)
    3209             : {
    3210           0 :         struct gkdi_GetKey *object = pytalloc_get_ptr(py_obj);
    3211           0 :         if (value == NULL) {
    3212           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.l0_key_id");
    3213           0 :                 return -1;
    3214             :         }
    3215             :         {
    3216           0 :                 const long long int_max = ndr_sizeof2intmax(sizeof(object->in.l0_key_id));
    3217           0 :                 const long long int_min = -int_max - 1;
    3218           0 :                 if (PyLong_Check(value)) {
    3219           0 :                         long long test_var;
    3220           0 :                         test_var = PyLong_AsLongLong(value);
    3221           0 :                         if (PyErr_Occurred() != NULL) {
    3222           0 :                                 return -1;
    3223             :                         }
    3224           0 :                         if (test_var < int_min || test_var > int_max) {
    3225           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range %lld - %lld, got %lld",
    3226             :                                   PyLong_Type.tp_name, int_min, int_max, test_var);
    3227           0 :                                 return -1;
    3228             :                         }
    3229           0 :                         object->in.l0_key_id = test_var;
    3230             :                 } else {
    3231           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    3232             :                           PyLong_Type.tp_name);
    3233           0 :                         return -1;
    3234             :                 }
    3235             :         }
    3236           0 :         return 0;
    3237             : }
    3238             : 
    3239           0 : static PyObject *py_gkdi_GetKey_in_get_l1_key_id(PyObject *obj, void *closure)
    3240             : {
    3241           0 :         struct gkdi_GetKey *object = pytalloc_get_ptr(obj);
    3242           0 :         PyObject *py_l1_key_id;
    3243           0 :         py_l1_key_id = PyLong_FromLong(object->in.l1_key_id);
    3244           0 :         return py_l1_key_id;
    3245             : }
    3246             : 
    3247           0 : static int py_gkdi_GetKey_in_set_l1_key_id(PyObject *py_obj, PyObject *value, void *closure)
    3248             : {
    3249           0 :         struct gkdi_GetKey *object = pytalloc_get_ptr(py_obj);
    3250           0 :         if (value == NULL) {
    3251           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.l1_key_id");
    3252           0 :                 return -1;
    3253             :         }
    3254             :         {
    3255           0 :                 const long long int_max = ndr_sizeof2intmax(sizeof(object->in.l1_key_id));
    3256           0 :                 const long long int_min = -int_max - 1;
    3257           0 :                 if (PyLong_Check(value)) {
    3258           0 :                         long long test_var;
    3259           0 :                         test_var = PyLong_AsLongLong(value);
    3260           0 :                         if (PyErr_Occurred() != NULL) {
    3261           0 :                                 return -1;
    3262             :                         }
    3263           0 :                         if (test_var < int_min || test_var > int_max) {
    3264           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range %lld - %lld, got %lld",
    3265             :                                   PyLong_Type.tp_name, int_min, int_max, test_var);
    3266           0 :                                 return -1;
    3267             :                         }
    3268           0 :                         object->in.l1_key_id = test_var;
    3269             :                 } else {
    3270           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    3271             :                           PyLong_Type.tp_name);
    3272           0 :                         return -1;
    3273             :                 }
    3274             :         }
    3275           0 :         return 0;
    3276             : }
    3277             : 
    3278           0 : static PyObject *py_gkdi_GetKey_in_get_l2_key_id(PyObject *obj, void *closure)
    3279             : {
    3280           0 :         struct gkdi_GetKey *object = pytalloc_get_ptr(obj);
    3281           0 :         PyObject *py_l2_key_id;
    3282           0 :         py_l2_key_id = PyLong_FromLong(object->in.l2_key_id);
    3283           0 :         return py_l2_key_id;
    3284             : }
    3285             : 
    3286           0 : static int py_gkdi_GetKey_in_set_l2_key_id(PyObject *py_obj, PyObject *value, void *closure)
    3287             : {
    3288           0 :         struct gkdi_GetKey *object = pytalloc_get_ptr(py_obj);
    3289           0 :         if (value == NULL) {
    3290           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->in.l2_key_id");
    3291           0 :                 return -1;
    3292             :         }
    3293             :         {
    3294           0 :                 const long long int_max = ndr_sizeof2intmax(sizeof(object->in.l2_key_id));
    3295           0 :                 const long long int_min = -int_max - 1;
    3296           0 :                 if (PyLong_Check(value)) {
    3297           0 :                         long long test_var;
    3298           0 :                         test_var = PyLong_AsLongLong(value);
    3299           0 :                         if (PyErr_Occurred() != NULL) {
    3300           0 :                                 return -1;
    3301             :                         }
    3302           0 :                         if (test_var < int_min || test_var > int_max) {
    3303           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range %lld - %lld, got %lld",
    3304             :                                   PyLong_Type.tp_name, int_min, int_max, test_var);
    3305           0 :                                 return -1;
    3306             :                         }
    3307           0 :                         object->in.l2_key_id = test_var;
    3308             :                 } else {
    3309           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    3310             :                           PyLong_Type.tp_name);
    3311           0 :                         return -1;
    3312             :                 }
    3313             :         }
    3314           0 :         return 0;
    3315             : }
    3316             : 
    3317           0 : static PyObject *py_gkdi_GetKey_out_get_out_len(PyObject *obj, void *closure)
    3318             : {
    3319           0 :         struct gkdi_GetKey *object = pytalloc_get_ptr(obj);
    3320           0 :         PyObject *py_out_len;
    3321           0 :         if (object->out.out_len == NULL) {
    3322           0 :                 Py_RETURN_NONE;
    3323             :         }
    3324           0 :         py_out_len = PyLong_FromUnsignedLongLong((uint32_t)(*object->out.out_len));
    3325           0 :         return py_out_len;
    3326             : }
    3327             : 
    3328           0 : static int py_gkdi_GetKey_out_set_out_len(PyObject *py_obj, PyObject *value, void *closure)
    3329             : {
    3330           0 :         struct gkdi_GetKey *object = pytalloc_get_ptr(py_obj);
    3331           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.out_len));
    3332           0 :         if (value == NULL) {
    3333           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.out_len");
    3334           0 :                 return -1;
    3335             :         }
    3336           0 :         object->out.out_len = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.out_len);
    3337           0 :         if (object->out.out_len == NULL) {
    3338           0 :                 PyErr_NoMemory();
    3339           0 :                 return -1;
    3340             :         }
    3341             :         {
    3342           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.out_len));
    3343           0 :                 if (PyLong_Check(value)) {
    3344           0 :                         unsigned long long test_var;
    3345           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    3346           0 :                         if (PyErr_Occurred() != NULL) {
    3347           0 :                                 return -1;
    3348             :                         }
    3349           0 :                         if (test_var > uint_max) {
    3350           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    3351             :                                   PyLong_Type.tp_name, uint_max, test_var);
    3352           0 :                                 return -1;
    3353             :                         }
    3354           0 :                         *object->out.out_len = test_var;
    3355             :                 } else {
    3356           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    3357             :                           PyLong_Type.tp_name);
    3358           0 :                         return -1;
    3359             :                 }
    3360             :         }
    3361           0 :         return 0;
    3362             : }
    3363             : 
    3364           0 : static PyObject *py_gkdi_GetKey_out_get_out(PyObject *obj, void *closure)
    3365             : {
    3366           0 :         struct gkdi_GetKey *object = pytalloc_get_ptr(obj);
    3367           0 :         PyObject *py_out;
    3368           0 :         if (object->out.out == NULL) {
    3369           0 :                 Py_RETURN_NONE;
    3370             :         }
    3371           0 :         if (*object->out.out == NULL) {
    3372           0 :                 py_out = Py_None;
    3373           0 :                 Py_INCREF(py_out);
    3374             :         } else {
    3375           0 :                 py_out = PyList_New(*object->out.out_len);
    3376           0 :                 if (py_out == NULL) {
    3377           0 :                         return NULL;
    3378             :                 }
    3379             :                 {
    3380             :                         int out_cntr_2;
    3381           0 :                         for (out_cntr_2 = 0; out_cntr_2 < (*object->out.out_len); out_cntr_2++) {
    3382           0 :                                 PyObject *py_out_2;
    3383           0 :                                 py_out_2 = PyLong_FromLong((uint16_t)((*object->out.out)[out_cntr_2]));
    3384           0 :                                 PyList_SetItem(py_out, out_cntr_2, py_out_2);
    3385             :                         }
    3386             :                 }
    3387             :         }
    3388           0 :         return py_out;
    3389             : }
    3390             : 
    3391           0 : static int py_gkdi_GetKey_out_set_out(PyObject *py_obj, PyObject *value, void *closure)
    3392             : {
    3393           0 :         struct gkdi_GetKey *object = pytalloc_get_ptr(py_obj);
    3394           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.out));
    3395           0 :         if (value == NULL) {
    3396           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.out");
    3397           0 :                 return -1;
    3398             :         }
    3399           0 :         object->out.out = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.out);
    3400           0 :         if (object->out.out == NULL) {
    3401           0 :                 PyErr_NoMemory();
    3402           0 :                 return -1;
    3403             :         }
    3404           0 :         if (value == Py_None) {
    3405           0 :                 *object->out.out = NULL;
    3406             :         } else {
    3407           0 :                 *object->out.out = NULL;
    3408           0 :                 PY_CHECK_TYPE(&PyList_Type, value, return -1;);
    3409             :                 {
    3410           0 :                         int out_cntr_2;
    3411           0 :                         *object->out.out = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), *object->out.out, PyList_GET_SIZE(value));
    3412           0 :                         if (!*object->out.out) { return -1; }
    3413           0 :                         talloc_set_name_const(*object->out.out, "ARRAY: *object->out.out");
    3414           0 :                         for (out_cntr_2 = 0; out_cntr_2 < PyList_GET_SIZE(value); out_cntr_2++) {
    3415           0 :                                 if (PyList_GET_ITEM(value, out_cntr_2) == NULL) {
    3416           0 :                                         PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (*object->out.out)[out_cntr_2]");
    3417           0 :                                         return -1;
    3418             :                                 }
    3419             :                                 {
    3420           0 :                                         const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((*object->out.out)[out_cntr_2]));
    3421           0 :                                         if (PyLong_Check(PyList_GET_ITEM(value, out_cntr_2))) {
    3422           0 :                                                 unsigned long long test_var;
    3423           0 :                                                 test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, out_cntr_2));
    3424           0 :                                                 if (PyErr_Occurred() != NULL) {
    3425           0 :                                                         return -1;
    3426             :                                                 }
    3427           0 :                                                 if (test_var > uint_max) {
    3428           0 :                                                         PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    3429             :                                                           PyLong_Type.tp_name, uint_max, test_var);
    3430           0 :                                                         return -1;
    3431             :                                                 }
    3432           0 :                                                 (*object->out.out)[out_cntr_2] = test_var;
    3433             :                                         } else {
    3434           0 :                                                 PyErr_Format(PyExc_TypeError, "Expected type %s",
    3435             :                                                   PyLong_Type.tp_name);
    3436           0 :                                                 return -1;
    3437             :                                         }
    3438             :                                 }
    3439             :                         }
    3440             :                 }
    3441             :         }
    3442           0 :         return 0;
    3443             : }
    3444             : 
    3445           0 : static PyObject *py_gkdi_GetKey_get_result(PyObject *obj, void *closure)
    3446             : {
    3447           0 :         struct gkdi_GetKey *object = pytalloc_get_ptr(obj);
    3448           0 :         PyObject *py_result;
    3449           0 :         py_result = PyErr_FromHRESULT(object->out.result);
    3450           0 :         return py_result;
    3451             : }
    3452             : 
    3453           0 : static int py_gkdi_GetKey_set_result(PyObject *py_obj, PyObject *value, void *closure)
    3454             : {
    3455           0 :         struct gkdi_GetKey *object = pytalloc_get_ptr(py_obj);
    3456           0 :         if (value == NULL) {
    3457           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->out.result");
    3458           0 :                 return -1;
    3459             :         }
    3460           0 :         object->out.result = HRES_ERROR(PyLong_AsLong(value));
    3461           0 :         return 0;
    3462             : }
    3463             : 
    3464             : static PyGetSetDef py_gkdi_GetKey_getsetters[] = {
    3465             :         {
    3466             :                 .name = discard_const_p(char, "in_target_sd_len"),
    3467             :                 .get = py_gkdi_GetKey_in_get_target_sd_len,
    3468             :                 .set = py_gkdi_GetKey_in_set_target_sd_len,
    3469             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    3470             :         },
    3471             :         {
    3472             :                 .name = discard_const_p(char, "in_target_sd"),
    3473             :                 .get = py_gkdi_GetKey_in_get_target_sd,
    3474             :                 .set = py_gkdi_GetKey_in_set_target_sd,
    3475             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
    3476             :         },
    3477             :         {
    3478             :                 .name = discard_const_p(char, "in_root_key_id"),
    3479             :                 .get = py_gkdi_GetKey_in_get_root_key_id,
    3480             :                 .set = py_gkdi_GetKey_in_set_root_key_id,
    3481             :                 .doc = discard_const_p(char, "PIDL-generated element of base type GUID")
    3482             :         },
    3483             :         {
    3484             :                 .name = discard_const_p(char, "in_l0_key_id"),
    3485             :                 .get = py_gkdi_GetKey_in_get_l0_key_id,
    3486             :                 .set = py_gkdi_GetKey_in_set_l0_key_id,
    3487             :                 .doc = discard_const_p(char, "PIDL-generated element of base type int32")
    3488             :         },
    3489             :         {
    3490             :                 .name = discard_const_p(char, "in_l1_key_id"),
    3491             :                 .get = py_gkdi_GetKey_in_get_l1_key_id,
    3492             :                 .set = py_gkdi_GetKey_in_set_l1_key_id,
    3493             :                 .doc = discard_const_p(char, "PIDL-generated element of base type int32")
    3494             :         },
    3495             :         {
    3496             :                 .name = discard_const_p(char, "in_l2_key_id"),
    3497             :                 .get = py_gkdi_GetKey_in_get_l2_key_id,
    3498             :                 .set = py_gkdi_GetKey_in_set_l2_key_id,
    3499             :                 .doc = discard_const_p(char, "PIDL-generated element of base type int32")
    3500             :         },
    3501             :         {
    3502             :                 .name = discard_const_p(char, "out_out_len"),
    3503             :                 .get = py_gkdi_GetKey_out_get_out_len,
    3504             :                 .set = py_gkdi_GetKey_out_set_out_len,
    3505             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    3506             :         },
    3507             :         {
    3508             :                 .name = discard_const_p(char, "out_out"),
    3509             :                 .get = py_gkdi_GetKey_out_get_out,
    3510             :                 .set = py_gkdi_GetKey_out_set_out,
    3511             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
    3512             :         },
    3513             :         {
    3514             :                 .name = discard_const_p(char, "result"),
    3515             :                 .get = py_gkdi_GetKey_get_result,
    3516             :                 .set = py_gkdi_GetKey_set_result,
    3517             :                 .doc = discard_const_p(char, "PIDL-generated element of type HRESULT")
    3518             :         },
    3519             :         { .name = NULL }
    3520             : };
    3521             : 
    3522           0 : static PyObject *py_gkdi_GetKey_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    3523             : {
    3524           0 :         PyObject *self = pytalloc_new(struct gkdi_GetKey, type);
    3525           0 :         struct gkdi_GetKey *_self = (struct gkdi_GetKey *)pytalloc_get_ptr(self);
    3526           0 :         TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
    3527           0 :         _self->in.target_sd = talloc_zero(mem_ctx, uint8_t);
    3528           0 :         _self->out.out_len = talloc_zero(mem_ctx, uint32_t);
    3529             :         /* a pointer to a NULL pointer */
    3530           0 :         _self->out.out = talloc_zero(mem_ctx, uint8_t *);
    3531           0 :         return self;
    3532             : }
    3533             : 
    3534           0 : static PyObject *py_gkdi_GetKey_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
    3535             : {
    3536             : 
    3537             : 
    3538           0 :         return PyLong_FromLong(0);
    3539             : }
    3540             : 
    3541           0 : static PyObject *py_gkdi_GetKey_ndr_pack(PyObject *py_obj, ndr_flags_type ndr_inout_flags, libndr_flags ndr_push_flags)
    3542             : {
    3543           0 :         const struct ndr_interface_call *call = NULL;
    3544           0 :         struct gkdi_GetKey *object = pytalloc_get_ptr(py_obj);
    3545           0 :         PyObject *ret = NULL;
    3546           0 :         struct ndr_push *push = NULL;
    3547           0 :         DATA_BLOB blob;
    3548           0 :         enum ndr_err_code err;
    3549             : 
    3550           0 :         if (ndr_table_gkdi.num_calls < 1) {
    3551           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_gkdi_GetKey_ndr_pack");
    3552           0 :                 return NULL;
    3553             :         }
    3554           0 :         call = &ndr_table_gkdi.calls[0];
    3555             : 
    3556           0 :         push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
    3557           0 :         if (push == NULL) {
    3558           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    3559           0 :                 return NULL;
    3560             :         }
    3561             : 
    3562           0 :         push->flags |= ndr_push_flags;
    3563             : 
    3564           0 :         err = call->ndr_push(push, ndr_inout_flags, object);
    3565           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    3566           0 :                 TALLOC_FREE(push);
    3567           0 :                 PyErr_SetNdrError(err);
    3568           0 :                 return NULL;
    3569             :         }
    3570           0 :         blob = ndr_push_blob(push);
    3571           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    3572           0 :         TALLOC_FREE(push);
    3573           0 :         return ret;
    3574             : }
    3575             : 
    3576           0 : static PyObject *py_gkdi_GetKey_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    3577             : {
    3578           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
    3579           0 :         PyObject *bigendian_obj = NULL;
    3580           0 :         PyObject *ndr64_obj = NULL;
    3581           0 :         libndr_flags ndr_push_flags = 0;
    3582             : 
    3583           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
    3584             :                 discard_const_p(char *, kwnames),
    3585             :                 &bigendian_obj,
    3586             :                 &ndr64_obj)) {
    3587           0 :                 return NULL;
    3588             :         }
    3589             : 
    3590           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    3591           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
    3592             :         }
    3593           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    3594           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
    3595             :         }
    3596             : 
    3597           0 :         return py_gkdi_GetKey_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
    3598             : }
    3599             : 
    3600           0 : static PyObject *py_gkdi_GetKey_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    3601             : {
    3602           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
    3603           0 :         PyObject *bigendian_obj = NULL;
    3604           0 :         PyObject *ndr64_obj = NULL;
    3605           0 :         libndr_flags ndr_push_flags = 0;
    3606             : 
    3607           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
    3608             :                 discard_const_p(char *, kwnames),
    3609             :                 &bigendian_obj,
    3610             :                 &ndr64_obj)) {
    3611           0 :                 return NULL;
    3612             :         }
    3613             : 
    3614           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    3615           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
    3616             :         }
    3617           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    3618           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
    3619             :         }
    3620             : 
    3621           0 :         return py_gkdi_GetKey_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
    3622             : }
    3623             : 
    3624           0 : static PyObject *py_gkdi_GetKey_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, ndr_flags_type ndr_inout_flags, libndr_flags ndr_pull_flags, bool allow_remaining)
    3625             : {
    3626           0 :         const struct ndr_interface_call *call = NULL;
    3627           0 :         struct gkdi_GetKey *object = pytalloc_get_ptr(py_obj);
    3628           0 :         struct ndr_pull *pull = NULL;
    3629           0 :         enum ndr_err_code err;
    3630             : 
    3631           0 :         if (ndr_table_gkdi.num_calls < 1) {
    3632           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_gkdi_GetKey_ndr_unpack");
    3633           0 :                 return NULL;
    3634             :         }
    3635           0 :         call = &ndr_table_gkdi.calls[0];
    3636             : 
    3637           0 :         pull = ndr_pull_init_blob(blob, object);
    3638           0 :         if (pull == NULL) {
    3639           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    3640           0 :                 return NULL;
    3641             :         }
    3642             : 
    3643           0 :         pull->flags |= ndr_pull_flags;
    3644             : 
    3645           0 :         err = call->ndr_pull(pull, ndr_inout_flags, object);
    3646           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    3647           0 :                 TALLOC_FREE(pull);
    3648           0 :                 PyErr_SetNdrError(err);
    3649           0 :                 return NULL;
    3650             :         }
    3651           0 :         if (!allow_remaining) {
    3652           0 :                 uint32_t highest_ofs;
    3653             : 
    3654           0 :                 if (pull->offset > pull->relative_highest_offset) {
    3655           0 :                         highest_ofs = pull->offset;
    3656             :                 } else {
    3657           0 :                         highest_ofs = pull->relative_highest_offset;
    3658             :                 }
    3659           0 :                 if (highest_ofs < pull->data_size) {
    3660           0 :                         err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
    3661             :                                 "not all bytes consumed ofs[%u] size[%u]",
    3662             :                                 highest_ofs, pull->data_size);
    3663           0 :                         TALLOC_FREE(pull);
    3664           0 :                         PyErr_SetNdrError(err);
    3665           0 :                         return NULL;
    3666             :                 }
    3667             :         }
    3668             : 
    3669           0 :         TALLOC_FREE(pull);
    3670           0 :         Py_RETURN_NONE;
    3671             : }
    3672             : 
    3673           0 : static PyObject *py_gkdi_GetKey_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    3674             : {
    3675           0 :         DATA_BLOB blob;
    3676           0 :         Py_ssize_t blob_length = 0;
    3677           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
    3678           0 :         PyObject *bigendian_obj = NULL;
    3679           0 :         PyObject *ndr64_obj = NULL;
    3680           0 :         libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
    3681           0 :         PyObject *allow_remaining_obj = NULL;
    3682           0 :         bool allow_remaining = false;
    3683             : 
    3684           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
    3685             :                 discard_const_p(char *, kwnames),
    3686             :                 &blob.data, &blob_length,
    3687             :                 &bigendian_obj,
    3688             :                 &ndr64_obj,
    3689             :                 &allow_remaining_obj)) {
    3690           0 :                 return NULL;
    3691             :         }
    3692           0 :         blob.length = blob_length;
    3693             : 
    3694           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    3695           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
    3696             :         }
    3697           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    3698           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
    3699             :         }
    3700             : 
    3701           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    3702           0 :                 allow_remaining = true;
    3703             :         }
    3704             : 
    3705           0 :         return py_gkdi_GetKey_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
    3706             : }
    3707             : 
    3708           0 : static PyObject *py_gkdi_GetKey_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    3709             : {
    3710           0 :         DATA_BLOB blob;
    3711           0 :         Py_ssize_t blob_length = 0;
    3712           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
    3713           0 :         PyObject *bigendian_obj = NULL;
    3714           0 :         PyObject *ndr64_obj = NULL;
    3715           0 :         libndr_flags ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
    3716           0 :         PyObject *allow_remaining_obj = NULL;
    3717           0 :         bool allow_remaining = false;
    3718             : 
    3719           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
    3720             :                 discard_const_p(char *, kwnames),
    3721             :                 &blob.data, &blob_length,
    3722             :                 &bigendian_obj,
    3723             :                 &ndr64_obj,
    3724             :                 &allow_remaining_obj)) {
    3725           0 :                 return NULL;
    3726             :         }
    3727           0 :         blob.length = blob_length;
    3728             : 
    3729           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    3730           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
    3731             :         }
    3732           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    3733           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
    3734             :         }
    3735             : 
    3736           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    3737           0 :                 allow_remaining = true;
    3738             :         }
    3739             : 
    3740           0 :         return py_gkdi_GetKey_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
    3741             : }
    3742             : 
    3743           0 : static PyObject *py_gkdi_GetKey_ndr_print(PyObject *py_obj, const char *name, ndr_flags_type ndr_inout_flags)
    3744             : {
    3745           0 :         const struct ndr_interface_call *call = NULL;
    3746           0 :         struct gkdi_GetKey *object = pytalloc_get_ptr(py_obj);
    3747           0 :         PyObject *ret;
    3748           0 :         char *retstr;
    3749             : 
    3750           0 :         if (ndr_table_gkdi.num_calls < 1) {
    3751           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_gkdi_GetKey_ndr_print");
    3752           0 :                 return NULL;
    3753             :         }
    3754           0 :         call = &ndr_table_gkdi.calls[0];
    3755             : 
    3756           0 :         retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
    3757           0 :         ret = PyUnicode_FromString(retstr);
    3758           0 :         TALLOC_FREE(retstr);
    3759             : 
    3760           0 :         return ret;
    3761             : }
    3762             : 
    3763           0 : static PyObject *py_gkdi_GetKey_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    3764             : {
    3765           0 :         return py_gkdi_GetKey_ndr_print(py_obj, "gkdi_GetKey_in", NDR_IN);
    3766             : }
    3767             : 
    3768           0 : static PyObject *py_gkdi_GetKey_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    3769             : {
    3770           0 :         return py_gkdi_GetKey_ndr_print(py_obj, "gkdi_GetKey_out", NDR_OUT);
    3771             : }
    3772             : 
    3773             : static PyMethodDef py_gkdi_GetKey_methods[] = {
    3774             :         { "opnum", (PyCFunction)py_gkdi_GetKey_ndr_opnum, METH_NOARGS|METH_CLASS,
    3775             :                 "gkdi.GetKey.opnum() -> 0 (0x00) " },
    3776             :         { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_gkdi_GetKey_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
    3777             :                 "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
    3778             :         { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_gkdi_GetKey_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
    3779             :                 "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
    3780             :         { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_gkdi_GetKey_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
    3781             :                 "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
    3782             :         { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_gkdi_GetKey_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
    3783             :                 "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
    3784             :         { "__ndr_print_in__", (PyCFunction)py_gkdi_GetKey_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
    3785             :         { "__ndr_print_out__", (PyCFunction)py_gkdi_GetKey_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
    3786             :         { NULL, NULL, 0, NULL }
    3787             : };
    3788             : 
    3789             : 
    3790             : static PyTypeObject gkdi_GetKey_Type = {
    3791             :         PyVarObject_HEAD_INIT(NULL, 0)
    3792             :         .tp_name = "gkdi.GetKey",
    3793             :         .tp_getset = py_gkdi_GetKey_getsetters,
    3794             :         .tp_methods = py_gkdi_GetKey_methods,
    3795             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    3796             :         .tp_new = py_gkdi_GetKey_new,
    3797             : };
    3798             : 
    3799           0 : static bool pack_py_gkdi_GetKey_args_in(PyObject *args, PyObject *kwargs, struct gkdi_GetKey *r)
    3800             : {
    3801           0 :         PyObject *py_target_sd;
    3802           0 :         PyObject *py_root_key_id;
    3803           0 :         PyObject *py_l0_key_id;
    3804           0 :         PyObject *py_l1_key_id;
    3805           0 :         PyObject *py_l2_key_id;
    3806           0 :         const char *kwnames[] = {
    3807             :                 "target_sd", "root_key_id", "l0_key_id", "l1_key_id", "l2_key_id", NULL
    3808             :         };
    3809             : 
    3810           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOO:gkdi_GetKey", discard_const_p(char *, kwnames), &py_target_sd, &py_root_key_id, &py_l0_key_id, &py_l1_key_id, &py_l2_key_id)) {
    3811           0 :                 return false;
    3812             :         }
    3813             : 
    3814           0 :         PY_CHECK_TYPE(&PyList_Type, py_target_sd, return false;);
    3815           0 :         r->in.target_sd_len = PyList_GET_SIZE(py_target_sd);
    3816           0 :         if (py_target_sd == NULL) {
    3817           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.target_sd");
    3818           0 :                 return false;
    3819             :         }
    3820           0 :         r->in.target_sd = talloc_ptrtype(r, r->in.target_sd);
    3821           0 :         if (r->in.target_sd == NULL) {
    3822           0 :                 PyErr_NoMemory();
    3823           0 :                 return false;
    3824             :         }
    3825           0 :         PY_CHECK_TYPE(&PyList_Type, py_target_sd, return false;);
    3826             :         {
    3827           0 :                 int target_sd_cntr_1;
    3828           0 :                 r->in.target_sd = talloc_array_ptrtype(r, r->in.target_sd, PyList_GET_SIZE(py_target_sd));
    3829           0 :                 if (!r->in.target_sd) { return false; }
    3830           0 :                 talloc_set_name_const(r->in.target_sd, "ARRAY: r->in.target_sd");
    3831           0 :                 for (target_sd_cntr_1 = 0; target_sd_cntr_1 < PyList_GET_SIZE(py_target_sd); target_sd_cntr_1++) {
    3832           0 :                         if (PyList_GET_ITEM(py_target_sd, target_sd_cntr_1) == NULL) {
    3833           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (r->in.target_sd)[target_sd_cntr_1]");
    3834           0 :                                 return false;
    3835             :                         }
    3836             :                         {
    3837           0 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((r->in.target_sd)[target_sd_cntr_1]));
    3838           0 :                                 if (PyLong_Check(PyList_GET_ITEM(py_target_sd, target_sd_cntr_1))) {
    3839           0 :                                         unsigned long long test_var;
    3840           0 :                                         test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_target_sd, target_sd_cntr_1));
    3841           0 :                                         if (PyErr_Occurred() != NULL) {
    3842           0 :                                                 return false;
    3843             :                                         }
    3844           0 :                                         if (test_var > uint_max) {
    3845           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    3846             :                                                   PyLong_Type.tp_name, uint_max, test_var);
    3847           0 :                                                 return false;
    3848             :                                         }
    3849           0 :                                         (r->in.target_sd)[target_sd_cntr_1] = test_var;
    3850             :                                 } else {
    3851           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    3852             :                                           PyLong_Type.tp_name);
    3853           0 :                                         return false;
    3854             :                                 }
    3855             :                         }
    3856             :                 }
    3857             :         }
    3858           0 :         if (py_root_key_id == NULL) {
    3859           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.root_key_id");
    3860           0 :                 return false;
    3861             :         }
    3862           0 :         if (py_root_key_id == Py_None) {
    3863           0 :                 r->in.root_key_id = NULL;
    3864             :         } else {
    3865           0 :                 r->in.root_key_id = NULL;
    3866           0 :                 PY_CHECK_TYPE(GUID_Type, py_root_key_id, return false;);
    3867           0 :                 if (talloc_reference(r, pytalloc_get_mem_ctx(py_root_key_id)) == NULL) {
    3868           0 :                         PyErr_NoMemory();
    3869           0 :                         return false;
    3870             :                 }
    3871           0 :                 r->in.root_key_id = (struct GUID *)pytalloc_get_ptr(py_root_key_id);
    3872             :         }
    3873           0 :         if (py_l0_key_id == NULL) {
    3874           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.l0_key_id");
    3875           0 :                 return false;
    3876             :         }
    3877             :         {
    3878           0 :                 const long long int_max = ndr_sizeof2intmax(sizeof(r->in.l0_key_id));
    3879           0 :                 const long long int_min = -int_max - 1;
    3880           0 :                 if (PyLong_Check(py_l0_key_id)) {
    3881           0 :                         long long test_var;
    3882           0 :                         test_var = PyLong_AsLongLong(py_l0_key_id);
    3883           0 :                         if (PyErr_Occurred() != NULL) {
    3884           0 :                                 return false;
    3885             :                         }
    3886           0 :                         if (test_var < int_min || test_var > int_max) {
    3887           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range %lld - %lld, got %lld",
    3888             :                                   PyLong_Type.tp_name, int_min, int_max, test_var);
    3889           0 :                                 return false;
    3890             :                         }
    3891           0 :                         r->in.l0_key_id = test_var;
    3892             :                 } else {
    3893           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    3894             :                           PyLong_Type.tp_name);
    3895           0 :                         return false;
    3896             :                 }
    3897             :         }
    3898           0 :         if (py_l1_key_id == NULL) {
    3899           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.l1_key_id");
    3900           0 :                 return false;
    3901             :         }
    3902             :         {
    3903           0 :                 const long long int_max = ndr_sizeof2intmax(sizeof(r->in.l1_key_id));
    3904           0 :                 const long long int_min = -int_max - 1;
    3905           0 :                 if (PyLong_Check(py_l1_key_id)) {
    3906           0 :                         long long test_var;
    3907           0 :                         test_var = PyLong_AsLongLong(py_l1_key_id);
    3908           0 :                         if (PyErr_Occurred() != NULL) {
    3909           0 :                                 return false;
    3910             :                         }
    3911           0 :                         if (test_var < int_min || test_var > int_max) {
    3912           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range %lld - %lld, got %lld",
    3913             :                                   PyLong_Type.tp_name, int_min, int_max, test_var);
    3914           0 :                                 return false;
    3915             :                         }
    3916           0 :                         r->in.l1_key_id = test_var;
    3917             :                 } else {
    3918           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    3919             :                           PyLong_Type.tp_name);
    3920           0 :                         return false;
    3921             :                 }
    3922             :         }
    3923           0 :         if (py_l2_key_id == NULL) {
    3924           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: r->in.l2_key_id");
    3925           0 :                 return false;
    3926             :         }
    3927             :         {
    3928           0 :                 const long long int_max = ndr_sizeof2intmax(sizeof(r->in.l2_key_id));
    3929           0 :                 const long long int_min = -int_max - 1;
    3930           0 :                 if (PyLong_Check(py_l2_key_id)) {
    3931           0 :                         long long test_var;
    3932           0 :                         test_var = PyLong_AsLongLong(py_l2_key_id);
    3933           0 :                         if (PyErr_Occurred() != NULL) {
    3934           0 :                                 return false;
    3935             :                         }
    3936           0 :                         if (test_var < int_min || test_var > int_max) {
    3937           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range %lld - %lld, got %lld",
    3938             :                                   PyLong_Type.tp_name, int_min, int_max, test_var);
    3939           0 :                                 return false;
    3940             :                         }
    3941           0 :                         r->in.l2_key_id = test_var;
    3942             :                 } else {
    3943           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    3944             :                           PyLong_Type.tp_name);
    3945           0 :                         return false;
    3946             :                 }
    3947             :         }
    3948           0 :         return true;
    3949             : }
    3950             : 
    3951           0 : static PyObject *unpack_py_gkdi_GetKey_args_out(struct gkdi_GetKey *r)
    3952             : {
    3953           0 :         PyObject *result;
    3954           0 :         PyObject *py_out_len;
    3955           0 :         PyObject *py_out;
    3956           0 :         result = PyTuple_New(3);
    3957           0 :         py_out_len = PyLong_FromUnsignedLongLong((uint32_t)(*r->out.out_len));
    3958           0 :         PyTuple_SetItem(result, 0, py_out_len);
    3959           0 :         if (*r->out.out == NULL) {
    3960           0 :                 py_out = Py_None;
    3961           0 :                 Py_INCREF(py_out);
    3962             :         } else {
    3963           0 :                 py_out = PyList_New(*r->out.out_len);
    3964           0 :                 if (py_out == NULL) {
    3965           0 :                         return NULL;
    3966             :                 }
    3967             :                 {
    3968             :                         int out_cntr_2;
    3969           0 :                         for (out_cntr_2 = 0; out_cntr_2 < (*r->out.out_len); out_cntr_2++) {
    3970           0 :                                 PyObject *py_out_2;
    3971           0 :                                 py_out_2 = PyLong_FromLong((uint16_t)((*r->out.out)[out_cntr_2]));
    3972           0 :                                 PyList_SetItem(py_out, out_cntr_2, py_out_2);
    3973             :                         }
    3974             :                 }
    3975             :         }
    3976           0 :         PyTuple_SetItem(result, 1, py_out);
    3977           0 :         PyTuple_SetItem(result, 2, PyErr_FromHRESULT(r->out.result));
    3978           0 :         return result;
    3979             : }
    3980             : 
    3981             : const struct PyNdrRpcMethodDef py_ndr_gkdi_methods[] = {
    3982             :         { "GetKey", "S.GetKey(target_sd, root_key_id, l0_key_id, l1_key_id, l2_key_id) -> (out_len, out, result)", (py_dcerpc_call_fn)dcerpc_gkdi_GetKey_r, (py_data_pack_fn)pack_py_gkdi_GetKey_args_in, (py_data_unpack_fn)unpack_py_gkdi_GetKey_args_out, 0, &ndr_table_gkdi },
    3983             :         {0}
    3984             : };
    3985             : 
    3986          38 : static PyObject *interface_gkdi_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    3987             : {
    3988          38 :         return py_dcerpc_interface_init_helper(type, args, kwargs, &ndr_table_gkdi);
    3989             : }
    3990             : 
    3991             : #define PY_DOC_GKDI "Active Directory Group Key Distribution Service"
    3992             : static PyTypeObject gkdi_InterfaceType = {
    3993             :         PyVarObject_HEAD_INIT(NULL, 0)
    3994             :         .tp_name = "gkdi.gkdi",
    3995             :         .tp_basicsize = sizeof(dcerpc_InterfaceObject),
    3996             :         .tp_doc = "gkdi(binding, lp_ctx=None, credentials=None) -> connection\n"
    3997             : "\n"
    3998             : "binding should be a DCE/RPC binding string (for example: ncacn_ip_tcp:127.0.0.1)\n"
    3999             : "lp_ctx should be a path to a smb.conf file or a param.LoadParm object\n"
    4000             : "credentials should be a credentials.Credentials object.\n\n"PY_DOC_GKDI,
    4001             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    4002             :         .tp_new = interface_gkdi_new,
    4003             : };
    4004             : 
    4005           0 : static PyObject *syntax_gkdi_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    4006             : {
    4007           0 :         return py_dcerpc_syntax_init_helper(type, args, kwargs, &ndr_table_gkdi.syntax_id);
    4008             : }
    4009             : 
    4010             : #define PY_DOC_GKDI_SYNTAX "Active Directory Group Key Distribution Service"
    4011             : static PyTypeObject gkdi_SyntaxType = {
    4012             :         PyVarObject_HEAD_INIT(NULL, 0)
    4013             :         .tp_name = "gkdi.gkdi_abstract_syntax",
    4014             :         .tp_doc = "gkdi_abstract_syntax()\n"PY_DOC_GKDI_SYNTAX,
    4015             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    4016             :         .tp_new = syntax_gkdi_new,
    4017             : };
    4018             : 
    4019             : static PyMethodDef gkdi_methods[] = {
    4020             :         { NULL, NULL, 0, NULL }
    4021             : };
    4022             : 
    4023             : static struct PyModuleDef moduledef = {
    4024             :         PyModuleDef_HEAD_INIT,
    4025             :         .m_name = "gkdi",
    4026             :         .m_doc = "gkdi DCE/RPC",
    4027             :         .m_size = -1,
    4028             :         .m_methods = gkdi_methods,
    4029             : };
    4030        2550 : MODULE_INIT_FUNC(gkdi)
    4031             : {
    4032        2550 :         PyObject *m = NULL;
    4033        2550 :         PyObject *dep_samba_dcerpc_misc = NULL;
    4034        2550 :         PyObject *dep_talloc = NULL;
    4035        2550 :         PyObject *dep_samba_dcerpc_base = NULL;
    4036             : 
    4037        2550 :         dep_samba_dcerpc_misc = PyImport_ImportModule("samba.dcerpc.misc");
    4038        2550 :         if (dep_samba_dcerpc_misc == NULL)
    4039           0 :                 goto out;
    4040             : 
    4041        2550 :         dep_talloc = PyImport_ImportModule("talloc");
    4042        2550 :         if (dep_talloc == NULL)
    4043           0 :                 goto out;
    4044             : 
    4045        2550 :         dep_samba_dcerpc_base = PyImport_ImportModule("samba.dcerpc.base");
    4046        2550 :         if (dep_samba_dcerpc_base == NULL)
    4047           0 :                 goto out;
    4048             : 
    4049        2550 :         GUID_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_misc, "GUID");
    4050        2550 :         if (GUID_Type == NULL)
    4051           0 :                 goto out;
    4052             : 
    4053        2550 :         BaseObject_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "BaseObject");
    4054        2550 :         if (BaseObject_Type == NULL)
    4055           0 :                 goto out;
    4056             : 
    4057        2550 :         ClientConnection_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_base, "ClientConnection");
    4058        2550 :         if (ClientConnection_Type == NULL)
    4059           0 :                 goto out;
    4060             : 
    4061        2550 :         ndr_syntax_id_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_misc, "ndr_syntax_id");
    4062        2550 :         if (ndr_syntax_id_Type == NULL)
    4063           0 :                 goto out;
    4064             : 
    4065        2550 :         KeyEnvelope_Type.tp_base = BaseObject_Type;
    4066        2550 :         KeyEnvelope_Type.tp_basicsize = pytalloc_BaseObject_size();
    4067             : 
    4068        2550 :         GroupKeyEnvelope_Type.tp_base = BaseObject_Type;
    4069        2550 :         GroupKeyEnvelope_Type.tp_basicsize = pytalloc_BaseObject_size();
    4070             : 
    4071        2550 :         KdfParameters_Type.tp_base = BaseObject_Type;
    4072        2550 :         KdfParameters_Type.tp_basicsize = pytalloc_BaseObject_size();
    4073             : 
    4074        2550 :         FfcDhParameters_Type.tp_base = BaseObject_Type;
    4075        2550 :         FfcDhParameters_Type.tp_basicsize = pytalloc_BaseObject_size();
    4076             : 
    4077        2550 :         GkdiDerivationCtx_Type.tp_base = BaseObject_Type;
    4078        2550 :         GkdiDerivationCtx_Type.tp_basicsize = pytalloc_BaseObject_size();
    4079             : 
    4080        2550 :         gkdi_GetKey_Type.tp_base = BaseObject_Type;
    4081        2550 :         gkdi_GetKey_Type.tp_basicsize = pytalloc_BaseObject_size();
    4082             : 
    4083        2550 :         gkdi_InterfaceType.tp_base = ClientConnection_Type;
    4084             : 
    4085        2550 :         gkdi_SyntaxType.tp_base = ndr_syntax_id_Type;
    4086        2550 :         gkdi_SyntaxType.tp_basicsize = pytalloc_BaseObject_size();
    4087             : 
    4088        2550 :         if (PyType_Ready(&KeyEnvelope_Type) < 0)
    4089           0 :                 goto out;
    4090        2550 :         if (PyType_Ready(&GroupKeyEnvelope_Type) < 0)
    4091           0 :                 goto out;
    4092        2550 :         if (PyType_Ready(&KdfParameters_Type) < 0)
    4093           0 :                 goto out;
    4094        2550 :         if (PyType_Ready(&FfcDhParameters_Type) < 0)
    4095           0 :                 goto out;
    4096        2550 :         if (PyType_Ready(&GkdiDerivationCtx_Type) < 0)
    4097           0 :                 goto out;
    4098        2550 :         if (PyType_Ready(&gkdi_GetKey_Type) < 0)
    4099           0 :                 goto out;
    4100        2550 :         if (PyType_Ready(&gkdi_InterfaceType) < 0)
    4101           0 :                 goto out;
    4102        2550 :         if (PyType_Ready(&gkdi_SyntaxType) < 0)
    4103           0 :                 goto out;
    4104        2550 :         if (!PyInterface_AddNdrRpcMethods(&gkdi_InterfaceType, py_ndr_gkdi_methods))
    4105           0 :                 return NULL;
    4106             : 
    4107             : #ifdef PY_KEYENVELOPE_PATCH
    4108             :         PY_KEYENVELOPE_PATCH(&KeyEnvelope_Type);
    4109             : #endif
    4110             : #ifdef PY_GROUPKEYENVELOPE_PATCH
    4111             :         PY_GROUPKEYENVELOPE_PATCH(&GroupKeyEnvelope_Type);
    4112             : #endif
    4113             : #ifdef PY_KDFPARAMETERS_PATCH
    4114             :         PY_KDFPARAMETERS_PATCH(&KdfParameters_Type);
    4115             : #endif
    4116             : #ifdef PY_FFCDHPARAMETERS_PATCH
    4117             :         PY_FFCDHPARAMETERS_PATCH(&FfcDhParameters_Type);
    4118             : #endif
    4119             : #ifdef PY_GKDIDERIVATIONCTX_PATCH
    4120             :         PY_GKDIDERIVATIONCTX_PATCH(&GkdiDerivationCtx_Type);
    4121             : #endif
    4122             : #ifdef PY_GETKEY_PATCH
    4123             :         PY_GETKEY_PATCH(&gkdi_GetKey_Type);
    4124             : #endif
    4125             : #ifdef PY_GKDI_PATCH
    4126             :         PY_GKDI_PATCH(&gkdi_InterfaceType);
    4127             : #endif
    4128             : #ifdef PY_GKDI_ABSTRACT_SYNTAX_PATCH
    4129             :         PY_GKDI_ABSTRACT_SYNTAX_PATCH(&gkdi_SyntaxType);
    4130             : #endif
    4131             : #ifdef PY_ABSTRACT_SYNTAX_PATCH
    4132             :         PY_ABSTRACT_SYNTAX_PATCH(&gkdi_SyntaxType);
    4133             : #endif
    4134             : 
    4135        2550 :         m = PyModule_Create(&moduledef);
    4136        2550 :         if (m == NULL)
    4137           0 :                 goto out;
    4138             : 
    4139        2550 :         PyModule_AddObject(m, "ENVELOPE_FLAG_TRANSPORTING_PUBLIC_KEY", PyLong_FromUnsignedLongLong((uint32_t)(ENVELOPE_FLAG_TRANSPORTING_PUBLIC_KEY)));
    4140        2550 :         PyModule_AddObject(m, "ENVELOPE_FLAG_KEY_MAY_ENCRYPT_NEW_DATA", PyLong_FromUnsignedLongLong((uint32_t)(ENVELOPE_FLAG_KEY_MAY_ENCRYPT_NEW_DATA)));
    4141        1955 :         Py_INCREF((PyObject *)(void *)&KeyEnvelope_Type);
    4142        2550 :         PyModule_AddObject(m, "KeyEnvelope", (PyObject *)(void *)&KeyEnvelope_Type);
    4143        1955 :         Py_INCREF((PyObject *)(void *)&GroupKeyEnvelope_Type);
    4144        2550 :         PyModule_AddObject(m, "GroupKeyEnvelope", (PyObject *)(void *)&GroupKeyEnvelope_Type);
    4145        1955 :         Py_INCREF((PyObject *)(void *)&KdfParameters_Type);
    4146        2550 :         PyModule_AddObject(m, "KdfParameters", (PyObject *)(void *)&KdfParameters_Type);
    4147        1955 :         Py_INCREF((PyObject *)(void *)&FfcDhParameters_Type);
    4148        2550 :         PyModule_AddObject(m, "FfcDhParameters", (PyObject *)(void *)&FfcDhParameters_Type);
    4149        1955 :         Py_INCREF((PyObject *)(void *)&GkdiDerivationCtx_Type);
    4150        2550 :         PyModule_AddObject(m, "GkdiDerivationCtx", (PyObject *)(void *)&GkdiDerivationCtx_Type);
    4151        1955 :         Py_INCREF((PyObject *)(void *)&gkdi_GetKey_Type);
    4152        2550 :         PyModule_AddObject(m, "GetKey", (PyObject *)(void *)&gkdi_GetKey_Type);
    4153        1955 :         Py_INCREF((PyObject *)(void *)&gkdi_InterfaceType);
    4154        2550 :         PyModule_AddObject(m, "gkdi", (PyObject *)(void *)&gkdi_InterfaceType);
    4155        1955 :         Py_INCREF((PyObject *)(void *)&gkdi_SyntaxType);
    4156        2550 :         PyModule_AddObject(m, "gkdi_abstract_syntax", (PyObject *)(void *)&gkdi_SyntaxType);
    4157        1955 :         Py_INCREF((PyObject *)(void *)&gkdi_SyntaxType);
    4158        2550 :         PyModule_AddObject(m, "abstract_syntax", (PyObject *)(void *)&gkdi_SyntaxType);
    4159             : #ifdef PY_MOD_GKDI_PATCH
    4160             :         PY_MOD_GKDI_PATCH(m);
    4161             : #endif
    4162        2550 :         out:
    4163        2550 :         Py_XDECREF(dep_samba_dcerpc_misc);
    4164        2550 :         Py_XDECREF(dep_talloc);
    4165        2550 :         Py_XDECREF(dep_samba_dcerpc_base);
    4166        2473 :         return m;
    4167             : 
    4168             : }

Generated by: LCOV version 1.14