LCOV - code coverage report
Current view: top level - bin/default/librpc/gen_ndr - py_krb5pac.c (source / functions) Hit Total Coverage
Test: coverage report for v4-17-test 1498b464 Lines: 624 2554 24.4 %
Date: 2024-06-13 04:01:37 Functions: 53 210 25.2 %

          Line data    Source code
       1             : 
       2             : /* Python wrapper functions auto-generated by pidl */
       3             : #define PY_SSIZE_T_CLEAN 1 /* We use Py_ssize_t for PyArg_ParseTupleAndKeywords */
       4             : #include <Python.h>
       5             : #include "python/py3compat.h"
       6             : #include "includes.h"
       7             : #include "python/modules.h"
       8             : #include <pytalloc.h>
       9             : #include "librpc/rpc/pyrpc.h"
      10             : #include "librpc/rpc/pyrpc_util.h"
      11             : #include "bin/default/librpc/gen_ndr/ndr_krb5pac.h"
      12             : 
      13             : 
      14             : /*
      15             :  * Suppress compiler warnings if the generated code does not call these
      16             :  * functions
      17             :  */
      18             : #ifndef _MAYBE_UNUSED_
      19             : #ifdef __has_attribute
      20             : #if __has_attribute(unused)
      21             : #define _MAYBE_UNUSED_ __attribute__ ((unused))
      22             : #else
      23             : #define _MAYBE_UNUSED_
      24             : #endif
      25             : #endif
      26             : #endif
      27             : /*
      28             :  * These functions are here to ensure they can be optimized out by
      29             :  * the compiler based on the constant input values
      30             :  */
      31             : 
      32         456 : static inline unsigned long long ndr_sizeof2uintmax(size_t var_size)
      33             : {
      34         456 :         switch (var_size) {
      35           0 :         case 8:
      36           0 :                 return UINT64_MAX;
      37         456 :         case 4:
      38         456 :                 return UINT32_MAX;
      39           0 :         case 2:
      40           0 :                 return UINT16_MAX;
      41           0 :         case 1:
      42           0 :                 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/security.h"
      65             : #include "librpc/gen_ndr/lsa.h"
      66             : #include "librpc/gen_ndr/netlogon.h"
      67             : #include "librpc/gen_ndr/samr.h"
      68             : static PyTypeObject PAC_LOGON_NAME_Type;
      69             : static PyTypeObject PAC_SIGNATURE_DATA_Type;
      70             : static PyTypeObject PAC_DOMAIN_GROUP_MEMBERSHIP_Type;
      71             : static PyTypeObject PAC_LOGON_INFO_Type;
      72             : static PyTypeObject PAC_CREDENTIAL_NTLM_SECPKG_Type;
      73             : static PyTypeObject PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_Type;
      74             : static PyTypeObject PAC_CREDENTIAL_DATA_Type;
      75             : static PyTypeObject PAC_CREDENTIAL_DATA_CTR_Type;
      76             : static PyTypeObject PAC_CREDENTIAL_DATA_NDR_Type;
      77             : static PyTypeObject PAC_CREDENTIAL_INFO_Type;
      78             : static PyTypeObject PAC_CONSTRAINED_DELEGATION_Type;
      79             : static PyTypeObject PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_Type;
      80             : static PyTypeObject PAC_UPN_DNS_INFO_EX_Type;
      81             : static PyTypeObject PAC_UPN_DNS_INFO_Type;
      82             : static PyTypeObject PAC_ATTRIBUTES_INFO_Type;
      83             : static PyTypeObject PAC_REQUESTER_SID_Type;
      84             : static PyTypeObject PAC_LOGON_INFO_CTR_Type;
      85             : static PyTypeObject PAC_CONSTRAINED_DELEGATION_CTR_Type;
      86             : static PyTypeObject DATA_BLOB_REM_Type;
      87             : static PyTypeObject PAC_INFO_Type;
      88             : static PyTypeObject PAC_BUFFER_Type;
      89             : static PyTypeObject PAC_DATA_Type;
      90             : static PyTypeObject PAC_BUFFER_RAW_Type;
      91             : static PyTypeObject PAC_DATA_RAW_Type;
      92             : static PyTypeObject PAC_Validate_Type;
      93             : static PyTypeObject netsamlogoncache_entry_Type;
      94             : static PyTypeObject krb5pac_InterfaceType;
      95             : 
      96             : static PyTypeObject *BaseObject_Type;
      97             : static PyTypeObject *dom_sid_Type;
      98             : static PyTypeObject *samr_RidWithAttributeArray_Type;
      99             : static PyTypeObject *netr_SamInfo3_Type;
     100             : static PyTypeObject *samr_Password_Type;
     101             : static PyTypeObject *lsa_String_Type;
     102             : static PyTypeObject *ClientConnection_Type;
     103             : static PyTypeObject *ndr_syntax_id_Type;
     104             : 
     105           0 : static PyObject *py_PAC_LOGON_NAME_get_logon_time(PyObject *obj, void *closure)
     106             : {
     107           0 :         struct PAC_LOGON_NAME *object = (struct PAC_LOGON_NAME *)pytalloc_get_ptr(obj);
     108             :         PyObject *py_logon_time;
     109           0 :         py_logon_time = PyLong_FromUnsignedLongLong(object->logon_time);
     110           0 :         return py_logon_time;
     111             : }
     112             : 
     113           0 : static int py_PAC_LOGON_NAME_set_logon_time(PyObject *py_obj, PyObject *value, void *closure)
     114             : {
     115           0 :         struct PAC_LOGON_NAME *object = (struct PAC_LOGON_NAME *)pytalloc_get_ptr(py_obj);
     116           0 :         if (value == NULL) {
     117           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->logon_time");
     118           0 :                 return -1;
     119             :         }
     120             :         {
     121           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->logon_time));
     122           0 :                 if (PyLong_Check(value)) {
     123             :                         unsigned long long test_var;
     124           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     125           0 :                         if (PyErr_Occurred() != NULL) {
     126           0 :                                 return -1;
     127             :                         }
     128           0 :                         if (test_var > uint_max) {
     129           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
     130             :                                   PyLong_Type.tp_name, uint_max, test_var);
     131           0 :                                 return -1;
     132             :                         }
     133           0 :                         object->logon_time = test_var;
     134             :                 } else {
     135           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
     136             :                           PyLong_Type.tp_name);
     137           0 :                         return -1;
     138             :                 }
     139             :         }
     140           0 :         return 0;
     141             : }
     142             : 
     143           0 : static PyObject *py_PAC_LOGON_NAME_get_size(PyObject *obj, void *closure)
     144             : {
     145           0 :         struct PAC_LOGON_NAME *object = (struct PAC_LOGON_NAME *)pytalloc_get_ptr(obj);
     146             :         PyObject *py_size;
     147           0 :         py_size = PyLong_FromLong((uint16_t)object->size);
     148           0 :         return py_size;
     149             : }
     150             : 
     151           0 : static int py_PAC_LOGON_NAME_set_size(PyObject *py_obj, PyObject *value, void *closure)
     152             : {
     153           0 :         struct PAC_LOGON_NAME *object = (struct PAC_LOGON_NAME *)pytalloc_get_ptr(py_obj);
     154           0 :         if (value == NULL) {
     155           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->size");
     156           0 :                 return -1;
     157             :         }
     158             :         {
     159           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->size));
     160           0 :                 if (PyLong_Check(value)) {
     161             :                         unsigned long long test_var;
     162           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     163           0 :                         if (PyErr_Occurred() != NULL) {
     164           0 :                                 return -1;
     165             :                         }
     166           0 :                         if (test_var > uint_max) {
     167           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
     168             :                                   PyLong_Type.tp_name, uint_max, test_var);
     169           0 :                                 return -1;
     170             :                         }
     171           0 :                         object->size = test_var;
     172             :                 } else {
     173           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
     174             :                           PyLong_Type.tp_name);
     175           0 :                         return -1;
     176             :                 }
     177             :         }
     178           0 :         return 0;
     179             : }
     180             : 
     181        2602 : static PyObject *py_PAC_LOGON_NAME_get_account_name(PyObject *obj, void *closure)
     182             : {
     183        2602 :         struct PAC_LOGON_NAME *object = (struct PAC_LOGON_NAME *)pytalloc_get_ptr(obj);
     184             :         PyObject *py_account_name;
     185        2602 :         if (object->account_name == NULL) {
     186           0 :                 py_account_name = Py_None;
     187           0 :                 Py_INCREF(py_account_name);
     188             :         } else {
     189        2602 :                 py_account_name = PyUnicode_Decode(object->account_name, strlen(object->account_name), "utf-8", "ignore");
     190             :         }
     191        2602 :         return py_account_name;
     192             : }
     193             : 
     194           0 : static int py_PAC_LOGON_NAME_set_account_name(PyObject *py_obj, PyObject *value, void *closure)
     195             : {
     196           0 :         struct PAC_LOGON_NAME *object = (struct PAC_LOGON_NAME *)pytalloc_get_ptr(py_obj);
     197           0 :         if (value == NULL) {
     198           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->account_name");
     199           0 :                 return -1;
     200             :         }
     201             :         {
     202             :                 const char *test_str;
     203             :                 const char *talloc_str;
     204           0 :                 PyObject *unicode = NULL;
     205           0 :                 if (PyUnicode_Check(value)) {
     206           0 :                         unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
     207           0 :                         if (unicode == NULL) {
     208           0 :                                 PyErr_NoMemory();
     209           0 :                                 return -1;
     210             :                         }
     211           0 :                         test_str = PyBytes_AS_STRING(unicode);
     212           0 :                 } else if (PyBytes_Check(value)) {
     213           0 :                         test_str = PyBytes_AS_STRING(value);
     214             :                 } else {
     215           0 :                         PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
     216           0 :                         return -1;
     217             :                 }
     218           0 :                 talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
     219           0 :                 if (unicode != NULL) {
     220           0 :                         Py_DECREF(unicode);
     221             :                 }
     222           0 :                 if (talloc_str == NULL) {
     223           0 :                         PyErr_NoMemory();
     224           0 :                         return -1;
     225             :                 }
     226           0 :                 object->account_name = talloc_str;
     227             :         }
     228           0 :         return 0;
     229             : }
     230             : 
     231             : static PyGetSetDef py_PAC_LOGON_NAME_getsetters[] = {
     232             :         {
     233             :                 .name = discard_const_p(char, "logon_time"),
     234             :                 .get = py_PAC_LOGON_NAME_get_logon_time,
     235             :                 .set = py_PAC_LOGON_NAME_set_logon_time,
     236             :                 .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
     237             :         },
     238             :         {
     239             :                 .name = discard_const_p(char, "size"),
     240             :                 .get = py_PAC_LOGON_NAME_get_size,
     241             :                 .set = py_PAC_LOGON_NAME_set_size,
     242             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
     243             :         },
     244             :         {
     245             :                 .name = discard_const_p(char, "account_name"),
     246             :                 .get = py_PAC_LOGON_NAME_get_account_name,
     247             :                 .set = py_PAC_LOGON_NAME_set_account_name,
     248             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
     249             :         },
     250             :         { .name = NULL }
     251             : };
     252             : 
     253           0 : static PyObject *py_PAC_LOGON_NAME_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     254             : {
     255           0 :         return pytalloc_new(struct PAC_LOGON_NAME, type);
     256             : }
     257             : 
     258             : 
     259             : static PyTypeObject PAC_LOGON_NAME_Type = {
     260             :         PyVarObject_HEAD_INIT(NULL, 0)
     261             :         .tp_name = "krb5pac.PAC_LOGON_NAME",
     262             :         .tp_getset = py_PAC_LOGON_NAME_getsetters,
     263             :         .tp_methods = NULL,
     264             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
     265             :         .tp_new = py_PAC_LOGON_NAME_new,
     266             : };
     267             : 
     268             : 
     269        7832 : static PyObject *py_PAC_SIGNATURE_DATA_get_type(PyObject *obj, void *closure)
     270             : {
     271        7832 :         struct PAC_SIGNATURE_DATA *object = (struct PAC_SIGNATURE_DATA *)pytalloc_get_ptr(obj);
     272             :         PyObject *py_type;
     273        7832 :         py_type = PyLong_FromUnsignedLongLong((uint32_t)object->type);
     274        7832 :         return py_type;
     275             : }
     276             : 
     277         380 : static int py_PAC_SIGNATURE_DATA_set_type(PyObject *py_obj, PyObject *value, void *closure)
     278             : {
     279         380 :         struct PAC_SIGNATURE_DATA *object = (struct PAC_SIGNATURE_DATA *)pytalloc_get_ptr(py_obj);
     280         380 :         if (value == NULL) {
     281           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->type");
     282           0 :                 return -1;
     283             :         }
     284             :         {
     285         380 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->type));
     286         380 :                 if (PyLong_Check(value)) {
     287             :                         unsigned long long test_var;
     288         380 :                         test_var = PyLong_AsUnsignedLongLong(value);
     289         380 :                         if (PyErr_Occurred() != NULL) {
     290           0 :                                 return -1;
     291             :                         }
     292         380 :                         if (test_var > uint_max) {
     293           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
     294             :                                   PyLong_Type.tp_name, uint_max, test_var);
     295           0 :                                 return -1;
     296             :                         }
     297         380 :                         object->type = test_var;
     298             :                 } else {
     299           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
     300             :                           PyLong_Type.tp_name);
     301           0 :                         return -1;
     302             :                 }
     303             :         }
     304         380 :         return 0;
     305             : }
     306             : 
     307        7832 : static PyObject *py_PAC_SIGNATURE_DATA_get_signature(PyObject *obj, void *closure)
     308             : {
     309        7832 :         struct PAC_SIGNATURE_DATA *object = (struct PAC_SIGNATURE_DATA *)pytalloc_get_ptr(obj);
     310             :         PyObject *py_signature;
     311        7832 :         py_signature = PyBytes_FromStringAndSize((char *)(object->signature).data, (object->signature).length);
     312        7832 :         return py_signature;
     313             : }
     314             : 
     315        7266 : static int py_PAC_SIGNATURE_DATA_set_signature(PyObject *py_obj, PyObject *value, void *closure)
     316             : {
     317        7266 :         struct PAC_SIGNATURE_DATA *object = (struct PAC_SIGNATURE_DATA *)pytalloc_get_ptr(py_obj);
     318        7266 :         if (value == NULL) {
     319           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->signature");
     320           0 :                 return -1;
     321             :         }
     322        7266 :         object->signature = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
     323        7266 :         return 0;
     324             : }
     325             : 
     326             : static PyGetSetDef py_PAC_SIGNATURE_DATA_getsetters[] = {
     327             :         {
     328             :                 .name = discard_const_p(char, "type"),
     329             :                 .get = py_PAC_SIGNATURE_DATA_get_type,
     330             :                 .set = py_PAC_SIGNATURE_DATA_set_type,
     331             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
     332             :         },
     333             :         {
     334             :                 .name = discard_const_p(char, "signature"),
     335             :                 .get = py_PAC_SIGNATURE_DATA_get_signature,
     336             :                 .set = py_PAC_SIGNATURE_DATA_set_signature,
     337             :                 .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
     338             :         },
     339             :         { .name = NULL }
     340             : };
     341             : 
     342        6594 : static PyObject *py_PAC_SIGNATURE_DATA_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     343             : {
     344        6594 :         return pytalloc_new(struct PAC_SIGNATURE_DATA, type);
     345             : }
     346             : 
     347        6570 : static PyObject *py_PAC_SIGNATURE_DATA_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
     348             : {
     349        6570 :         struct PAC_SIGNATURE_DATA *object = (struct PAC_SIGNATURE_DATA *)pytalloc_get_ptr(py_obj);
     350        6570 :         PyObject *ret = NULL;
     351             :         DATA_BLOB blob;
     352             :         enum ndr_err_code err;
     353        6570 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
     354        6570 :         if (tmp_ctx == NULL) {
     355           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
     356           0 :                 return NULL;
     357             :         }
     358        6570 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_PAC_SIGNATURE_DATA);
     359        6570 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
     360           0 :                 TALLOC_FREE(tmp_ctx);
     361           0 :                 PyErr_SetNdrError(err);
     362           0 :                 return NULL;
     363             :         }
     364             : 
     365        6570 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
     366        6570 :         TALLOC_FREE(tmp_ctx);
     367        6570 :         return ret;
     368             : }
     369             : 
     370        6570 : static PyObject *py_PAC_SIGNATURE_DATA_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
     371             : {
     372        6570 :         struct PAC_SIGNATURE_DATA *object = (struct PAC_SIGNATURE_DATA *)pytalloc_get_ptr(py_obj);
     373        6570 :         DATA_BLOB blob = {.data = NULL, .length = 0};
     374        6570 :         Py_ssize_t blob_length = 0;
     375             :         enum ndr_err_code err;
     376        6570 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
     377        6570 :         PyObject *allow_remaining_obj = NULL;
     378        6570 :         bool allow_remaining = false;
     379             : 
     380        6570 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
     381             :                 discard_const_p(char *, kwnames),
     382             :                 &blob.data, &blob_length,
     383             :                 &allow_remaining_obj)) {
     384           0 :                 return NULL;
     385             :         }
     386        6570 :         blob.length = blob_length;
     387             : 
     388        6570 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
     389           0 :                 allow_remaining = true;
     390             :         }
     391             : 
     392        6570 :         if (allow_remaining) {
     393           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_SIGNATURE_DATA);
     394             :         } else {
     395        6570 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_SIGNATURE_DATA);
     396             :         }
     397        6570 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
     398           0 :                 PyErr_SetNdrError(err);
     399           0 :                 return NULL;
     400             :         }
     401             : 
     402        6570 :         Py_RETURN_NONE;
     403             : }
     404             : 
     405           0 : static PyObject *py_PAC_SIGNATURE_DATA_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
     406             : {
     407           0 :         struct PAC_SIGNATURE_DATA *object = (struct PAC_SIGNATURE_DATA *)pytalloc_get_ptr(py_obj);
     408             :         PyObject *ret;
     409             :         char *retstr;
     410             : 
     411           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_PAC_SIGNATURE_DATA, "PAC_SIGNATURE_DATA", object);
     412           0 :         ret = PyUnicode_FromString(retstr);
     413           0 :         talloc_free(retstr);
     414             : 
     415           0 :         return ret;
     416             : }
     417             : 
     418             : static PyMethodDef py_PAC_SIGNATURE_DATA_methods[] = {
     419             :         { "__ndr_pack__", (PyCFunction)py_PAC_SIGNATURE_DATA_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
     420             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PAC_SIGNATURE_DATA_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
     421             :         { "__ndr_print__", (PyCFunction)py_PAC_SIGNATURE_DATA_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
     422             :         { NULL, NULL, 0, NULL }
     423             : };
     424             : 
     425             : 
     426             : static PyTypeObject PAC_SIGNATURE_DATA_Type = {
     427             :         PyVarObject_HEAD_INIT(NULL, 0)
     428             :         .tp_name = "krb5pac.PAC_SIGNATURE_DATA",
     429             :         .tp_getset = py_PAC_SIGNATURE_DATA_getsetters,
     430             :         .tp_methods = py_PAC_SIGNATURE_DATA_methods,
     431             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
     432             :         .tp_new = py_PAC_SIGNATURE_DATA_new,
     433             : };
     434             : 
     435             : 
     436           0 : static PyObject *py_PAC_DOMAIN_GROUP_MEMBERSHIP_get_domain_sid(PyObject *obj, void *closure)
     437             : {
     438           0 :         struct PAC_DOMAIN_GROUP_MEMBERSHIP *object = (struct PAC_DOMAIN_GROUP_MEMBERSHIP *)pytalloc_get_ptr(obj);
     439             :         PyObject *py_domain_sid;
     440           0 :         if (object->domain_sid == NULL) {
     441           0 :                 Py_RETURN_NONE;
     442             :         }
     443           0 :         if (object->domain_sid == NULL) {
     444           0 :                 py_domain_sid = Py_None;
     445           0 :                 Py_INCREF(py_domain_sid);
     446             :         } else {
     447           0 :                 py_domain_sid = pytalloc_reference_ex(dom_sid_Type, object->domain_sid, object->domain_sid);
     448             :         }
     449           0 :         return py_domain_sid;
     450             : }
     451             : 
     452           0 : static int py_PAC_DOMAIN_GROUP_MEMBERSHIP_set_domain_sid(PyObject *py_obj, PyObject *value, void *closure)
     453             : {
     454           0 :         struct PAC_DOMAIN_GROUP_MEMBERSHIP *object = (struct PAC_DOMAIN_GROUP_MEMBERSHIP *)pytalloc_get_ptr(py_obj);
     455           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->domain_sid));
     456           0 :         if (value == NULL) {
     457           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->domain_sid");
     458           0 :                 return -1;
     459             :         }
     460           0 :         if (value == Py_None) {
     461           0 :                 object->domain_sid = NULL;
     462             :         } else {
     463           0 :                 object->domain_sid = NULL;
     464           0 :                 PY_CHECK_TYPE(dom_sid_Type, value, return -1;);
     465           0 :                 if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
     466           0 :                         PyErr_NoMemory();
     467           0 :                         return -1;
     468             :                 }
     469           0 :                 object->domain_sid = (struct dom_sid *)pytalloc_get_ptr(value);
     470             :         }
     471           0 :         return 0;
     472             : }
     473             : 
     474           0 : static PyObject *py_PAC_DOMAIN_GROUP_MEMBERSHIP_get_groups(PyObject *obj, void *closure)
     475             : {
     476           0 :         struct PAC_DOMAIN_GROUP_MEMBERSHIP *object = (struct PAC_DOMAIN_GROUP_MEMBERSHIP *)pytalloc_get_ptr(obj);
     477             :         PyObject *py_groups;
     478           0 :         py_groups = pytalloc_reference_ex(samr_RidWithAttributeArray_Type, pytalloc_get_mem_ctx(obj), &object->groups);
     479           0 :         return py_groups;
     480             : }
     481             : 
     482           0 : static int py_PAC_DOMAIN_GROUP_MEMBERSHIP_set_groups(PyObject *py_obj, PyObject *value, void *closure)
     483             : {
     484           0 :         struct PAC_DOMAIN_GROUP_MEMBERSHIP *object = (struct PAC_DOMAIN_GROUP_MEMBERSHIP *)pytalloc_get_ptr(py_obj);
     485           0 :         if (value == NULL) {
     486           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->groups");
     487           0 :                 return -1;
     488             :         }
     489           0 :         PY_CHECK_TYPE(samr_RidWithAttributeArray_Type, value, return -1;);
     490           0 :         if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
     491           0 :                 PyErr_NoMemory();
     492           0 :                 return -1;
     493             :         }
     494           0 :         object->groups = *(struct samr_RidWithAttributeArray *)pytalloc_get_ptr(value);
     495           0 :         return 0;
     496             : }
     497             : 
     498             : static PyGetSetDef py_PAC_DOMAIN_GROUP_MEMBERSHIP_getsetters[] = {
     499             :         {
     500             :                 .name = discard_const_p(char, "domain_sid"),
     501             :                 .get = py_PAC_DOMAIN_GROUP_MEMBERSHIP_get_domain_sid,
     502             :                 .set = py_PAC_DOMAIN_GROUP_MEMBERSHIP_set_domain_sid,
     503             :                 .doc = discard_const_p(char, "PIDL-generated element of base type dom_sid2")
     504             :         },
     505             :         {
     506             :                 .name = discard_const_p(char, "groups"),
     507             :                 .get = py_PAC_DOMAIN_GROUP_MEMBERSHIP_get_groups,
     508             :                 .set = py_PAC_DOMAIN_GROUP_MEMBERSHIP_set_groups,
     509             :                 .doc = discard_const_p(char, "PIDL-generated element of base type samr_RidWithAttributeArray")
     510             :         },
     511             :         { .name = NULL }
     512             : };
     513             : 
     514           0 : static PyObject *py_PAC_DOMAIN_GROUP_MEMBERSHIP_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     515             : {
     516           0 :         return pytalloc_new(struct PAC_DOMAIN_GROUP_MEMBERSHIP, type);
     517             : }
     518             : 
     519             : 
     520             : static PyTypeObject PAC_DOMAIN_GROUP_MEMBERSHIP_Type = {
     521             :         PyVarObject_HEAD_INIT(NULL, 0)
     522             :         .tp_name = "krb5pac.PAC_DOMAIN_GROUP_MEMBERSHIP",
     523             :         .tp_getset = py_PAC_DOMAIN_GROUP_MEMBERSHIP_getsetters,
     524             :         .tp_methods = NULL,
     525             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
     526             :         .tp_new = py_PAC_DOMAIN_GROUP_MEMBERSHIP_new,
     527             : };
     528             : 
     529             : 
     530        2602 : static PyObject *py_PAC_LOGON_INFO_get_info3(PyObject *obj, void *closure)
     531             : {
     532        2602 :         struct PAC_LOGON_INFO *object = (struct PAC_LOGON_INFO *)pytalloc_get_ptr(obj);
     533             :         PyObject *py_info3;
     534        2602 :         py_info3 = pytalloc_reference_ex(netr_SamInfo3_Type, pytalloc_get_mem_ctx(obj), &object->info3);
     535        2602 :         return py_info3;
     536             : }
     537             : 
     538           0 : static int py_PAC_LOGON_INFO_set_info3(PyObject *py_obj, PyObject *value, void *closure)
     539             : {
     540           0 :         struct PAC_LOGON_INFO *object = (struct PAC_LOGON_INFO *)pytalloc_get_ptr(py_obj);
     541           0 :         if (value == NULL) {
     542           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->info3");
     543           0 :                 return -1;
     544             :         }
     545           0 :         PY_CHECK_TYPE(netr_SamInfo3_Type, value, return -1;);
     546           0 :         if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
     547           0 :                 PyErr_NoMemory();
     548           0 :                 return -1;
     549             :         }
     550           0 :         object->info3 = *(struct netr_SamInfo3 *)pytalloc_get_ptr(value);
     551           0 :         return 0;
     552             : }
     553             : 
     554           0 : static PyObject *py_PAC_LOGON_INFO_get_resource_groups(PyObject *obj, void *closure)
     555             : {
     556           0 :         struct PAC_LOGON_INFO *object = (struct PAC_LOGON_INFO *)pytalloc_get_ptr(obj);
     557             :         PyObject *py_resource_groups;
     558           0 :         py_resource_groups = pytalloc_reference_ex(&PAC_DOMAIN_GROUP_MEMBERSHIP_Type, pytalloc_get_mem_ctx(obj), &object->resource_groups);
     559           0 :         return py_resource_groups;
     560             : }
     561             : 
     562           0 : static int py_PAC_LOGON_INFO_set_resource_groups(PyObject *py_obj, PyObject *value, void *closure)
     563             : {
     564           0 :         struct PAC_LOGON_INFO *object = (struct PAC_LOGON_INFO *)pytalloc_get_ptr(py_obj);
     565           0 :         if (value == NULL) {
     566           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->resource_groups");
     567           0 :                 return -1;
     568             :         }
     569           0 :         PY_CHECK_TYPE(&PAC_DOMAIN_GROUP_MEMBERSHIP_Type, value, return -1;);
     570           0 :         if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
     571           0 :                 PyErr_NoMemory();
     572           0 :                 return -1;
     573             :         }
     574           0 :         object->resource_groups = *(struct PAC_DOMAIN_GROUP_MEMBERSHIP *)pytalloc_get_ptr(value);
     575           0 :         return 0;
     576             : }
     577             : 
     578             : static PyGetSetDef py_PAC_LOGON_INFO_getsetters[] = {
     579             :         {
     580             :                 .name = discard_const_p(char, "info3"),
     581             :                 .get = py_PAC_LOGON_INFO_get_info3,
     582             :                 .set = py_PAC_LOGON_INFO_set_info3,
     583             :                 .doc = discard_const_p(char, "PIDL-generated element of base type netr_SamInfo3")
     584             :         },
     585             :         {
     586             :                 .name = discard_const_p(char, "resource_groups"),
     587             :                 .get = py_PAC_LOGON_INFO_get_resource_groups,
     588             :                 .set = py_PAC_LOGON_INFO_set_resource_groups,
     589             :                 .doc = discard_const_p(char, "PIDL-generated element of base type PAC_DOMAIN_GROUP_MEMBERSHIP")
     590             :         },
     591             :         { .name = NULL }
     592             : };
     593             : 
     594           0 : static PyObject *py_PAC_LOGON_INFO_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     595             : {
     596           0 :         return pytalloc_new(struct PAC_LOGON_INFO, type);
     597             : }
     598             : 
     599             : 
     600             : static PyTypeObject PAC_LOGON_INFO_Type = {
     601             :         PyVarObject_HEAD_INIT(NULL, 0)
     602             :         .tp_name = "krb5pac.PAC_LOGON_INFO",
     603             :         .tp_getset = py_PAC_LOGON_INFO_getsetters,
     604             :         .tp_methods = NULL,
     605             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
     606             :         .tp_new = py_PAC_LOGON_INFO_new,
     607             : };
     608             : 
     609             : 
     610           0 : static PyObject *py_PAC_CREDENTIAL_NTLM_SECPKG_get_version(PyObject *obj, void *closure)
     611             : {
     612           0 :         struct PAC_CREDENTIAL_NTLM_SECPKG *object = (struct PAC_CREDENTIAL_NTLM_SECPKG *)pytalloc_get_ptr(obj);
     613             :         PyObject *py_version;
     614           0 :         py_version = PyLong_FromUnsignedLongLong((uint32_t)object->version);
     615           0 :         return py_version;
     616             : }
     617             : 
     618           0 : static int py_PAC_CREDENTIAL_NTLM_SECPKG_set_version(PyObject *py_obj, PyObject *value, void *closure)
     619             : {
     620           0 :         struct PAC_CREDENTIAL_NTLM_SECPKG *object = (struct PAC_CREDENTIAL_NTLM_SECPKG *)pytalloc_get_ptr(py_obj);
     621           0 :         if (value == NULL) {
     622           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->version");
     623           0 :                 return -1;
     624             :         }
     625             :         {
     626           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->version));
     627           0 :                 if (PyLong_Check(value)) {
     628             :                         unsigned long long test_var;
     629           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     630           0 :                         if (PyErr_Occurred() != NULL) {
     631           0 :                                 return -1;
     632             :                         }
     633           0 :                         if (test_var > uint_max) {
     634           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
     635             :                                   PyLong_Type.tp_name, uint_max, test_var);
     636           0 :                                 return -1;
     637             :                         }
     638           0 :                         object->version = test_var;
     639             :                 } else {
     640           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
     641             :                           PyLong_Type.tp_name);
     642           0 :                         return -1;
     643             :                 }
     644             :         }
     645           0 :         return 0;
     646             : }
     647             : 
     648           0 : static PyObject *py_PAC_CREDENTIAL_NTLM_SECPKG_get_flags(PyObject *obj, void *closure)
     649             : {
     650           0 :         struct PAC_CREDENTIAL_NTLM_SECPKG *object = (struct PAC_CREDENTIAL_NTLM_SECPKG *)pytalloc_get_ptr(obj);
     651             :         PyObject *py_flags;
     652           0 :         py_flags = PyLong_FromUnsignedLongLong((uint32_t)object->flags);
     653           0 :         return py_flags;
     654             : }
     655             : 
     656           0 : static int py_PAC_CREDENTIAL_NTLM_SECPKG_set_flags(PyObject *py_obj, PyObject *value, void *closure)
     657             : {
     658           0 :         struct PAC_CREDENTIAL_NTLM_SECPKG *object = (struct PAC_CREDENTIAL_NTLM_SECPKG *)pytalloc_get_ptr(py_obj);
     659           0 :         if (value == NULL) {
     660           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->flags");
     661           0 :                 return -1;
     662             :         }
     663             :         {
     664           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->flags));
     665           0 :                 if (PyLong_Check(value)) {
     666             :                         unsigned long long test_var;
     667           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     668           0 :                         if (PyErr_Occurred() != NULL) {
     669           0 :                                 return -1;
     670             :                         }
     671           0 :                         if (test_var > uint_max) {
     672           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
     673             :                                   PyLong_Type.tp_name, uint_max, test_var);
     674           0 :                                 return -1;
     675             :                         }
     676           0 :                         object->flags = test_var;
     677             :                 } else {
     678           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
     679             :                           PyLong_Type.tp_name);
     680           0 :                         return -1;
     681             :                 }
     682             :         }
     683           0 :         return 0;
     684             : }
     685             : 
     686           0 : static PyObject *py_PAC_CREDENTIAL_NTLM_SECPKG_get_lm_password(PyObject *obj, void *closure)
     687             : {
     688           0 :         struct PAC_CREDENTIAL_NTLM_SECPKG *object = (struct PAC_CREDENTIAL_NTLM_SECPKG *)pytalloc_get_ptr(obj);
     689             :         PyObject *py_lm_password;
     690           0 :         py_lm_password = pytalloc_reference_ex(samr_Password_Type, pytalloc_get_mem_ctx(obj), &object->lm_password);
     691           0 :         return py_lm_password;
     692             : }
     693             : 
     694           0 : static int py_PAC_CREDENTIAL_NTLM_SECPKG_set_lm_password(PyObject *py_obj, PyObject *value, void *closure)
     695             : {
     696           0 :         struct PAC_CREDENTIAL_NTLM_SECPKG *object = (struct PAC_CREDENTIAL_NTLM_SECPKG *)pytalloc_get_ptr(py_obj);
     697           0 :         if (value == NULL) {
     698           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->lm_password");
     699           0 :                 return -1;
     700             :         }
     701           0 :         PY_CHECK_TYPE(samr_Password_Type, value, return -1;);
     702           0 :         if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
     703           0 :                 PyErr_NoMemory();
     704           0 :                 return -1;
     705             :         }
     706           0 :         object->lm_password = *(struct samr_Password *)pytalloc_get_ptr(value);
     707           0 :         return 0;
     708             : }
     709             : 
     710           0 : static PyObject *py_PAC_CREDENTIAL_NTLM_SECPKG_get_nt_password(PyObject *obj, void *closure)
     711             : {
     712           0 :         struct PAC_CREDENTIAL_NTLM_SECPKG *object = (struct PAC_CREDENTIAL_NTLM_SECPKG *)pytalloc_get_ptr(obj);
     713             :         PyObject *py_nt_password;
     714           0 :         py_nt_password = pytalloc_reference_ex(samr_Password_Type, pytalloc_get_mem_ctx(obj), &object->nt_password);
     715           0 :         return py_nt_password;
     716             : }
     717             : 
     718           0 : static int py_PAC_CREDENTIAL_NTLM_SECPKG_set_nt_password(PyObject *py_obj, PyObject *value, void *closure)
     719             : {
     720           0 :         struct PAC_CREDENTIAL_NTLM_SECPKG *object = (struct PAC_CREDENTIAL_NTLM_SECPKG *)pytalloc_get_ptr(py_obj);
     721           0 :         if (value == NULL) {
     722           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->nt_password");
     723           0 :                 return -1;
     724             :         }
     725           0 :         PY_CHECK_TYPE(samr_Password_Type, value, return -1;);
     726           0 :         if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
     727           0 :                 PyErr_NoMemory();
     728           0 :                 return -1;
     729             :         }
     730           0 :         object->nt_password = *(struct samr_Password *)pytalloc_get_ptr(value);
     731           0 :         return 0;
     732             : }
     733             : 
     734             : static PyGetSetDef py_PAC_CREDENTIAL_NTLM_SECPKG_getsetters[] = {
     735             :         {
     736             :                 .name = discard_const_p(char, "version"),
     737             :                 .get = py_PAC_CREDENTIAL_NTLM_SECPKG_get_version,
     738             :                 .set = py_PAC_CREDENTIAL_NTLM_SECPKG_set_version,
     739             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
     740             :         },
     741             :         {
     742             :                 .name = discard_const_p(char, "flags"),
     743             :                 .get = py_PAC_CREDENTIAL_NTLM_SECPKG_get_flags,
     744             :                 .set = py_PAC_CREDENTIAL_NTLM_SECPKG_set_flags,
     745             :                 .doc = discard_const_p(char, "PIDL-generated element of base type PAC_CREDENTIAL_NTLM_FLAGS")
     746             :         },
     747             :         {
     748             :                 .name = discard_const_p(char, "lm_password"),
     749             :                 .get = py_PAC_CREDENTIAL_NTLM_SECPKG_get_lm_password,
     750             :                 .set = py_PAC_CREDENTIAL_NTLM_SECPKG_set_lm_password,
     751             :                 .doc = discard_const_p(char, "PIDL-generated element of base type samr_Password")
     752             :         },
     753             :         {
     754             :                 .name = discard_const_p(char, "nt_password"),
     755             :                 .get = py_PAC_CREDENTIAL_NTLM_SECPKG_get_nt_password,
     756             :                 .set = py_PAC_CREDENTIAL_NTLM_SECPKG_set_nt_password,
     757             :                 .doc = discard_const_p(char, "PIDL-generated element of base type samr_Password")
     758             :         },
     759             :         { .name = NULL }
     760             : };
     761             : 
     762           0 : static PyObject *py_PAC_CREDENTIAL_NTLM_SECPKG_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     763             : {
     764           0 :         return pytalloc_new(struct PAC_CREDENTIAL_NTLM_SECPKG, type);
     765             : }
     766             : 
     767           0 : static PyObject *py_PAC_CREDENTIAL_NTLM_SECPKG_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
     768             : {
     769           0 :         struct PAC_CREDENTIAL_NTLM_SECPKG *object = (struct PAC_CREDENTIAL_NTLM_SECPKG *)pytalloc_get_ptr(py_obj);
     770           0 :         PyObject *ret = NULL;
     771             :         DATA_BLOB blob;
     772             :         enum ndr_err_code err;
     773           0 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
     774           0 :         if (tmp_ctx == NULL) {
     775           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
     776           0 :                 return NULL;
     777             :         }
     778           0 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_PAC_CREDENTIAL_NTLM_SECPKG);
     779           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
     780           0 :                 TALLOC_FREE(tmp_ctx);
     781           0 :                 PyErr_SetNdrError(err);
     782           0 :                 return NULL;
     783             :         }
     784             : 
     785           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
     786           0 :         TALLOC_FREE(tmp_ctx);
     787           0 :         return ret;
     788             : }
     789             : 
     790           0 : static PyObject *py_PAC_CREDENTIAL_NTLM_SECPKG_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
     791             : {
     792           0 :         struct PAC_CREDENTIAL_NTLM_SECPKG *object = (struct PAC_CREDENTIAL_NTLM_SECPKG *)pytalloc_get_ptr(py_obj);
     793           0 :         DATA_BLOB blob = {.data = NULL, .length = 0};
     794           0 :         Py_ssize_t blob_length = 0;
     795             :         enum ndr_err_code err;
     796           0 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
     797           0 :         PyObject *allow_remaining_obj = NULL;
     798           0 :         bool allow_remaining = false;
     799             : 
     800           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
     801             :                 discard_const_p(char *, kwnames),
     802             :                 &blob.data, &blob_length,
     803             :                 &allow_remaining_obj)) {
     804           0 :                 return NULL;
     805             :         }
     806           0 :         blob.length = blob_length;
     807             : 
     808           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
     809           0 :                 allow_remaining = true;
     810             :         }
     811             : 
     812           0 :         if (allow_remaining) {
     813           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_CREDENTIAL_NTLM_SECPKG);
     814             :         } else {
     815           0 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_CREDENTIAL_NTLM_SECPKG);
     816             :         }
     817           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
     818           0 :                 PyErr_SetNdrError(err);
     819           0 :                 return NULL;
     820             :         }
     821             : 
     822           0 :         Py_RETURN_NONE;
     823             : }
     824             : 
     825           0 : static PyObject *py_PAC_CREDENTIAL_NTLM_SECPKG_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
     826             : {
     827           0 :         struct PAC_CREDENTIAL_NTLM_SECPKG *object = (struct PAC_CREDENTIAL_NTLM_SECPKG *)pytalloc_get_ptr(py_obj);
     828             :         PyObject *ret;
     829             :         char *retstr;
     830             : 
     831           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_PAC_CREDENTIAL_NTLM_SECPKG, "PAC_CREDENTIAL_NTLM_SECPKG", object);
     832           0 :         ret = PyUnicode_FromString(retstr);
     833           0 :         talloc_free(retstr);
     834             : 
     835           0 :         return ret;
     836             : }
     837             : 
     838             : static PyMethodDef py_PAC_CREDENTIAL_NTLM_SECPKG_methods[] = {
     839             :         { "__ndr_pack__", (PyCFunction)py_PAC_CREDENTIAL_NTLM_SECPKG_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
     840             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PAC_CREDENTIAL_NTLM_SECPKG_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
     841             :         { "__ndr_print__", (PyCFunction)py_PAC_CREDENTIAL_NTLM_SECPKG_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
     842             :         { NULL, NULL, 0, NULL }
     843             : };
     844             : 
     845             : 
     846             : static PyTypeObject PAC_CREDENTIAL_NTLM_SECPKG_Type = {
     847             :         PyVarObject_HEAD_INIT(NULL, 0)
     848             :         .tp_name = "krb5pac.PAC_CREDENTIAL_NTLM_SECPKG",
     849             :         .tp_getset = py_PAC_CREDENTIAL_NTLM_SECPKG_getsetters,
     850             :         .tp_methods = py_PAC_CREDENTIAL_NTLM_SECPKG_methods,
     851             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
     852             :         .tp_new = py_PAC_CREDENTIAL_NTLM_SECPKG_new,
     853             : };
     854             : 
     855             : 
     856           0 : static PyObject *py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_get_package_name(PyObject *obj, void *closure)
     857             : {
     858           0 :         struct PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG *object = (struct PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG *)pytalloc_get_ptr(obj);
     859             :         PyObject *py_package_name;
     860           0 :         py_package_name = pytalloc_reference_ex(lsa_String_Type, pytalloc_get_mem_ctx(obj), &object->package_name);
     861           0 :         return py_package_name;
     862             : }
     863             : 
     864           0 : static int py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_set_package_name(PyObject *py_obj, PyObject *value, void *closure)
     865             : {
     866           0 :         struct PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG *object = (struct PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG *)pytalloc_get_ptr(py_obj);
     867           0 :         if (value == NULL) {
     868           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->package_name");
     869           0 :                 return -1;
     870             :         }
     871           0 :         PY_CHECK_TYPE(lsa_String_Type, value, return -1;);
     872           0 :         if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
     873           0 :                 PyErr_NoMemory();
     874           0 :                 return -1;
     875             :         }
     876           0 :         object->package_name = *(struct lsa_String *)pytalloc_get_ptr(value);
     877           0 :         return 0;
     878             : }
     879             : 
     880           0 : static PyObject *py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_get_credential_size(PyObject *obj, void *closure)
     881             : {
     882           0 :         struct PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG *object = (struct PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG *)pytalloc_get_ptr(obj);
     883             :         PyObject *py_credential_size;
     884           0 :         py_credential_size = PyLong_FromUnsignedLongLong((uint32_t)object->credential_size);
     885           0 :         return py_credential_size;
     886             : }
     887             : 
     888           0 : static int py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_set_credential_size(PyObject *py_obj, PyObject *value, void *closure)
     889             : {
     890           0 :         struct PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG *object = (struct PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG *)pytalloc_get_ptr(py_obj);
     891           0 :         if (value == NULL) {
     892           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->credential_size");
     893           0 :                 return -1;
     894             :         }
     895             :         {
     896           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->credential_size));
     897           0 :                 if (PyLong_Check(value)) {
     898             :                         unsigned long long test_var;
     899           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     900           0 :                         if (PyErr_Occurred() != NULL) {
     901           0 :                                 return -1;
     902             :                         }
     903           0 :                         if (test_var > uint_max) {
     904           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
     905             :                                   PyLong_Type.tp_name, uint_max, test_var);
     906           0 :                                 return -1;
     907             :                         }
     908           0 :                         object->credential_size = test_var;
     909             :                 } else {
     910           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
     911             :                           PyLong_Type.tp_name);
     912           0 :                         return -1;
     913             :                 }
     914             :         }
     915           0 :         return 0;
     916             : }
     917             : 
     918           0 : static PyObject *py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_get_credential(PyObject *obj, void *closure)
     919             : {
     920           0 :         struct PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG *object = (struct PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG *)pytalloc_get_ptr(obj);
     921             :         PyObject *py_credential;
     922           0 :         if (object->credential == NULL) {
     923           0 :                 Py_RETURN_NONE;
     924             :         }
     925           0 :         if (object->credential == NULL) {
     926           0 :                 py_credential = Py_None;
     927           0 :                 Py_INCREF(py_credential);
     928             :         } else {
     929           0 :                 py_credential = PyList_New(object->credential_size);
     930           0 :                 if (py_credential == NULL) {
     931           0 :                         return NULL;
     932             :                 }
     933             :                 {
     934             :                         int credential_cntr_1;
     935           0 :                         for (credential_cntr_1 = 0; credential_cntr_1 < (object->credential_size); credential_cntr_1++) {
     936             :                                 PyObject *py_credential_1;
     937           0 :                                 py_credential_1 = PyLong_FromLong((uint16_t)object->credential[credential_cntr_1]);
     938           0 :                                 PyList_SetItem(py_credential, credential_cntr_1, py_credential_1);
     939             :                         }
     940             :                 }
     941             :         }
     942           0 :         return py_credential;
     943             : }
     944             : 
     945           0 : static int py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_set_credential(PyObject *py_obj, PyObject *value, void *closure)
     946             : {
     947           0 :         struct PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG *object = (struct PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG *)pytalloc_get_ptr(py_obj);
     948           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->credential));
     949           0 :         if (value == NULL) {
     950           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->credential");
     951           0 :                 return -1;
     952             :         }
     953           0 :         if (value == Py_None) {
     954           0 :                 object->credential = NULL;
     955             :         } else {
     956           0 :                 object->credential = NULL;
     957           0 :                 PY_CHECK_TYPE(&PyList_Type, value, return -1;);
     958             :                 {
     959             :                         int credential_cntr_1;
     960           0 :                         object->credential = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->credential, PyList_GET_SIZE(value));
     961           0 :                         if (!object->credential) { return -1;; }
     962           0 :                         talloc_set_name_const(object->credential, "ARRAY: object->credential");
     963           0 :                         for (credential_cntr_1 = 0; credential_cntr_1 < PyList_GET_SIZE(value); credential_cntr_1++) {
     964           0 :                                 if (PyList_GET_ITEM(value, credential_cntr_1) == NULL) {
     965           0 :                                         PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->credential[credential_cntr_1]");
     966           0 :                                         return -1;
     967             :                                 }
     968             :                                 {
     969           0 :                                         const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->credential[credential_cntr_1]));
     970           0 :                                         if (PyLong_Check(PyList_GET_ITEM(value, credential_cntr_1))) {
     971             :                                                 unsigned long long test_var;
     972           0 :                                                 test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, credential_cntr_1));
     973           0 :                                                 if (PyErr_Occurred() != NULL) {
     974           0 :                                                         return -1;
     975             :                                                 }
     976           0 :                                                 if (test_var > uint_max) {
     977           0 :                                                         PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
     978             :                                                           PyLong_Type.tp_name, uint_max, test_var);
     979           0 :                                                         return -1;
     980             :                                                 }
     981           0 :                                                 object->credential[credential_cntr_1] = test_var;
     982             :                                         } else {
     983           0 :                                                 PyErr_Format(PyExc_TypeError, "Expected type %s",
     984             :                                                   PyLong_Type.tp_name);
     985           0 :                                                 return -1;
     986             :                                         }
     987             :                                 }
     988             :                         }
     989             :                 }
     990             :         }
     991           0 :         return 0;
     992             : }
     993             : 
     994             : static PyGetSetDef py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_getsetters[] = {
     995             :         {
     996             :                 .name = discard_const_p(char, "package_name"),
     997             :                 .get = py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_get_package_name,
     998             :                 .set = py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_set_package_name,
     999             :                 .doc = discard_const_p(char, "PIDL-generated element of base type lsa_String")
    1000             :         },
    1001             :         {
    1002             :                 .name = discard_const_p(char, "credential_size"),
    1003             :                 .get = py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_get_credential_size,
    1004             :                 .set = py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_set_credential_size,
    1005             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    1006             :         },
    1007             :         {
    1008             :                 .name = discard_const_p(char, "credential"),
    1009             :                 .get = py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_get_credential,
    1010             :                 .set = py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_set_credential,
    1011             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
    1012             :         },
    1013             :         { .name = NULL }
    1014             : };
    1015             : 
    1016           0 : static PyObject *py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1017             : {
    1018           0 :         return pytalloc_new(struct PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG, type);
    1019             : }
    1020             : 
    1021           0 : static PyObject *py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
    1022             : {
    1023           0 :         struct PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG *object = (struct PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG *)pytalloc_get_ptr(py_obj);
    1024           0 :         PyObject *ret = NULL;
    1025             :         DATA_BLOB blob;
    1026             :         enum ndr_err_code err;
    1027           0 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
    1028           0 :         if (tmp_ctx == NULL) {
    1029           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    1030           0 :                 return NULL;
    1031             :         }
    1032           0 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG);
    1033           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    1034           0 :                 TALLOC_FREE(tmp_ctx);
    1035           0 :                 PyErr_SetNdrError(err);
    1036           0 :                 return NULL;
    1037             :         }
    1038             : 
    1039           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    1040           0 :         TALLOC_FREE(tmp_ctx);
    1041           0 :         return ret;
    1042             : }
    1043             : 
    1044           0 : static PyObject *py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    1045             : {
    1046           0 :         struct PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG *object = (struct PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG *)pytalloc_get_ptr(py_obj);
    1047           0 :         DATA_BLOB blob = {.data = NULL, .length = 0};
    1048           0 :         Py_ssize_t blob_length = 0;
    1049             :         enum ndr_err_code err;
    1050           0 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
    1051           0 :         PyObject *allow_remaining_obj = NULL;
    1052           0 :         bool allow_remaining = false;
    1053             : 
    1054           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
    1055             :                 discard_const_p(char *, kwnames),
    1056             :                 &blob.data, &blob_length,
    1057             :                 &allow_remaining_obj)) {
    1058           0 :                 return NULL;
    1059             :         }
    1060           0 :         blob.length = blob_length;
    1061             : 
    1062           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    1063           0 :                 allow_remaining = true;
    1064             :         }
    1065             : 
    1066           0 :         if (allow_remaining) {
    1067           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG);
    1068             :         } else {
    1069           0 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG);
    1070             :         }
    1071           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    1072           0 :                 PyErr_SetNdrError(err);
    1073           0 :                 return NULL;
    1074             :         }
    1075             : 
    1076           0 :         Py_RETURN_NONE;
    1077             : }
    1078             : 
    1079           0 : static PyObject *py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    1080             : {
    1081           0 :         struct PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG *object = (struct PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG *)pytalloc_get_ptr(py_obj);
    1082             :         PyObject *ret;
    1083             :         char *retstr;
    1084             : 
    1085           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG, "PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG", object);
    1086           0 :         ret = PyUnicode_FromString(retstr);
    1087           0 :         talloc_free(retstr);
    1088             : 
    1089           0 :         return ret;
    1090             : }
    1091             : 
    1092             : static PyMethodDef py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_methods[] = {
    1093             :         { "__ndr_pack__", (PyCFunction)py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
    1094             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
    1095             :         { "__ndr_print__", (PyCFunction)py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
    1096             :         { NULL, NULL, 0, NULL }
    1097             : };
    1098             : 
    1099             : 
    1100             : static PyTypeObject PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_Type = {
    1101             :         PyVarObject_HEAD_INIT(NULL, 0)
    1102             :         .tp_name = "krb5pac.PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG",
    1103             :         .tp_getset = py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_getsetters,
    1104             :         .tp_methods = py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_methods,
    1105             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    1106             :         .tp_new = py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_new,
    1107             : };
    1108             : 
    1109             : 
    1110           0 : static PyObject *py_PAC_CREDENTIAL_DATA_get_credential_count(PyObject *obj, void *closure)
    1111             : {
    1112           0 :         struct PAC_CREDENTIAL_DATA *object = (struct PAC_CREDENTIAL_DATA *)pytalloc_get_ptr(obj);
    1113             :         PyObject *py_credential_count;
    1114           0 :         py_credential_count = PyLong_FromUnsignedLongLong((uint32_t)object->credential_count);
    1115           0 :         return py_credential_count;
    1116             : }
    1117             : 
    1118           0 : static int py_PAC_CREDENTIAL_DATA_set_credential_count(PyObject *py_obj, PyObject *value, void *closure)
    1119             : {
    1120           0 :         struct PAC_CREDENTIAL_DATA *object = (struct PAC_CREDENTIAL_DATA *)pytalloc_get_ptr(py_obj);
    1121           0 :         if (value == NULL) {
    1122           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->credential_count");
    1123           0 :                 return -1;
    1124             :         }
    1125             :         {
    1126           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->credential_count));
    1127           0 :                 if (PyLong_Check(value)) {
    1128             :                         unsigned long long test_var;
    1129           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1130           0 :                         if (PyErr_Occurred() != NULL) {
    1131           0 :                                 return -1;
    1132             :                         }
    1133           0 :                         if (test_var > uint_max) {
    1134           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    1135             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1136           0 :                                 return -1;
    1137             :                         }
    1138           0 :                         object->credential_count = test_var;
    1139             :                 } else {
    1140           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    1141             :                           PyLong_Type.tp_name);
    1142           0 :                         return -1;
    1143             :                 }
    1144             :         }
    1145           0 :         return 0;
    1146             : }
    1147             : 
    1148           0 : static PyObject *py_PAC_CREDENTIAL_DATA_get_credentials(PyObject *obj, void *closure)
    1149             : {
    1150           0 :         struct PAC_CREDENTIAL_DATA *object = (struct PAC_CREDENTIAL_DATA *)pytalloc_get_ptr(obj);
    1151             :         PyObject *py_credentials;
    1152           0 :         py_credentials = PyList_New(object->credential_count);
    1153           0 :         if (py_credentials == NULL) {
    1154           0 :                 return NULL;
    1155             :         }
    1156             :         {
    1157             :                 int credentials_cntr_0;
    1158           0 :                 for (credentials_cntr_0 = 0; credentials_cntr_0 < (object->credential_count); credentials_cntr_0++) {
    1159             :                         PyObject *py_credentials_0;
    1160           0 :                         py_credentials_0 = pytalloc_reference_ex(&PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_Type, object->credentials, &object->credentials[credentials_cntr_0]);
    1161           0 :                         PyList_SetItem(py_credentials, credentials_cntr_0, py_credentials_0);
    1162             :                 }
    1163             :         }
    1164           0 :         return py_credentials;
    1165             : }
    1166             : 
    1167           0 : static int py_PAC_CREDENTIAL_DATA_set_credentials(PyObject *py_obj, PyObject *value, void *closure)
    1168             : {
    1169           0 :         struct PAC_CREDENTIAL_DATA *object = (struct PAC_CREDENTIAL_DATA *)pytalloc_get_ptr(py_obj);
    1170           0 :         if (value == NULL) {
    1171           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->credentials");
    1172           0 :                 return -1;
    1173             :         }
    1174           0 :         PY_CHECK_TYPE(&PyList_Type, value, return -1;);
    1175             :         {
    1176             :                 int credentials_cntr_0;
    1177           0 :                 object->credentials = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->credentials, PyList_GET_SIZE(value));
    1178           0 :                 if (!object->credentials) { return -1;; }
    1179           0 :                 talloc_set_name_const(object->credentials, "ARRAY: object->credentials");
    1180           0 :                 for (credentials_cntr_0 = 0; credentials_cntr_0 < PyList_GET_SIZE(value); credentials_cntr_0++) {
    1181           0 :                         if (PyList_GET_ITEM(value, credentials_cntr_0) == NULL) {
    1182           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->credentials[credentials_cntr_0]");
    1183           0 :                                 return -1;
    1184             :                         }
    1185           0 :                         PY_CHECK_TYPE(&PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_Type, PyList_GET_ITEM(value, credentials_cntr_0), return -1;);
    1186           0 :                         if (talloc_reference(object->credentials, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, credentials_cntr_0))) == NULL) {
    1187           0 :                                 PyErr_NoMemory();
    1188           0 :                                 return -1;
    1189             :                         }
    1190           0 :                         object->credentials[credentials_cntr_0] = *(struct PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG *)pytalloc_get_ptr(PyList_GET_ITEM(value, credentials_cntr_0));
    1191             :                 }
    1192             :         }
    1193           0 :         return 0;
    1194             : }
    1195             : 
    1196             : static PyGetSetDef py_PAC_CREDENTIAL_DATA_getsetters[] = {
    1197             :         {
    1198             :                 .name = discard_const_p(char, "credential_count"),
    1199             :                 .get = py_PAC_CREDENTIAL_DATA_get_credential_count,
    1200             :                 .set = py_PAC_CREDENTIAL_DATA_set_credential_count,
    1201             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    1202             :         },
    1203             :         {
    1204             :                 .name = discard_const_p(char, "credentials"),
    1205             :                 .get = py_PAC_CREDENTIAL_DATA_get_credentials,
    1206             :                 .set = py_PAC_CREDENTIAL_DATA_set_credentials,
    1207             :                 .doc = discard_const_p(char, "PIDL-generated element of base type PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG")
    1208             :         },
    1209             :         { .name = NULL }
    1210             : };
    1211             : 
    1212           0 : static PyObject *py_PAC_CREDENTIAL_DATA_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1213             : {
    1214           0 :         return pytalloc_new(struct PAC_CREDENTIAL_DATA, type);
    1215             : }
    1216             : 
    1217           0 : static PyObject *py_PAC_CREDENTIAL_DATA_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
    1218             : {
    1219           0 :         struct PAC_CREDENTIAL_DATA *object = (struct PAC_CREDENTIAL_DATA *)pytalloc_get_ptr(py_obj);
    1220           0 :         PyObject *ret = NULL;
    1221             :         DATA_BLOB blob;
    1222             :         enum ndr_err_code err;
    1223           0 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
    1224           0 :         if (tmp_ctx == NULL) {
    1225           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    1226           0 :                 return NULL;
    1227             :         }
    1228           0 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_PAC_CREDENTIAL_DATA);
    1229           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    1230           0 :                 TALLOC_FREE(tmp_ctx);
    1231           0 :                 PyErr_SetNdrError(err);
    1232           0 :                 return NULL;
    1233             :         }
    1234             : 
    1235           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    1236           0 :         TALLOC_FREE(tmp_ctx);
    1237           0 :         return ret;
    1238             : }
    1239             : 
    1240           0 : static PyObject *py_PAC_CREDENTIAL_DATA_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    1241             : {
    1242           0 :         struct PAC_CREDENTIAL_DATA *object = (struct PAC_CREDENTIAL_DATA *)pytalloc_get_ptr(py_obj);
    1243           0 :         DATA_BLOB blob = {.data = NULL, .length = 0};
    1244           0 :         Py_ssize_t blob_length = 0;
    1245             :         enum ndr_err_code err;
    1246           0 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
    1247           0 :         PyObject *allow_remaining_obj = NULL;
    1248           0 :         bool allow_remaining = false;
    1249             : 
    1250           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
    1251             :                 discard_const_p(char *, kwnames),
    1252             :                 &blob.data, &blob_length,
    1253             :                 &allow_remaining_obj)) {
    1254           0 :                 return NULL;
    1255             :         }
    1256           0 :         blob.length = blob_length;
    1257             : 
    1258           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    1259           0 :                 allow_remaining = true;
    1260             :         }
    1261             : 
    1262           0 :         if (allow_remaining) {
    1263           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_CREDENTIAL_DATA);
    1264             :         } else {
    1265           0 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_CREDENTIAL_DATA);
    1266             :         }
    1267           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    1268           0 :                 PyErr_SetNdrError(err);
    1269           0 :                 return NULL;
    1270             :         }
    1271             : 
    1272           0 :         Py_RETURN_NONE;
    1273             : }
    1274             : 
    1275           0 : static PyObject *py_PAC_CREDENTIAL_DATA_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    1276             : {
    1277           0 :         struct PAC_CREDENTIAL_DATA *object = (struct PAC_CREDENTIAL_DATA *)pytalloc_get_ptr(py_obj);
    1278             :         PyObject *ret;
    1279             :         char *retstr;
    1280             : 
    1281           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_PAC_CREDENTIAL_DATA, "PAC_CREDENTIAL_DATA", object);
    1282           0 :         ret = PyUnicode_FromString(retstr);
    1283           0 :         talloc_free(retstr);
    1284             : 
    1285           0 :         return ret;
    1286             : }
    1287             : 
    1288             : static PyMethodDef py_PAC_CREDENTIAL_DATA_methods[] = {
    1289             :         { "__ndr_pack__", (PyCFunction)py_PAC_CREDENTIAL_DATA_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
    1290             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PAC_CREDENTIAL_DATA_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
    1291             :         { "__ndr_print__", (PyCFunction)py_PAC_CREDENTIAL_DATA_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
    1292             :         { NULL, NULL, 0, NULL }
    1293             : };
    1294             : 
    1295             : 
    1296             : static PyTypeObject PAC_CREDENTIAL_DATA_Type = {
    1297             :         PyVarObject_HEAD_INIT(NULL, 0)
    1298             :         .tp_name = "krb5pac.PAC_CREDENTIAL_DATA",
    1299             :         .tp_getset = py_PAC_CREDENTIAL_DATA_getsetters,
    1300             :         .tp_methods = py_PAC_CREDENTIAL_DATA_methods,
    1301             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    1302             :         .tp_new = py_PAC_CREDENTIAL_DATA_new,
    1303             : };
    1304             : 
    1305             : 
    1306           0 : static PyObject *py_PAC_CREDENTIAL_DATA_CTR_get_data(PyObject *obj, void *closure)
    1307             : {
    1308           0 :         struct PAC_CREDENTIAL_DATA_CTR *object = (struct PAC_CREDENTIAL_DATA_CTR *)pytalloc_get_ptr(obj);
    1309             :         PyObject *py_data;
    1310           0 :         if (object->data == NULL) {
    1311           0 :                 Py_RETURN_NONE;
    1312             :         }
    1313           0 :         if (object->data == NULL) {
    1314           0 :                 py_data = Py_None;
    1315           0 :                 Py_INCREF(py_data);
    1316             :         } else {
    1317           0 :                 py_data = pytalloc_reference_ex(&PAC_CREDENTIAL_DATA_Type, object->data, object->data);
    1318             :         }
    1319           0 :         return py_data;
    1320             : }
    1321             : 
    1322           0 : static int py_PAC_CREDENTIAL_DATA_CTR_set_data(PyObject *py_obj, PyObject *value, void *closure)
    1323             : {
    1324           0 :         struct PAC_CREDENTIAL_DATA_CTR *object = (struct PAC_CREDENTIAL_DATA_CTR *)pytalloc_get_ptr(py_obj);
    1325           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->data));
    1326           0 :         if (value == NULL) {
    1327           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->data");
    1328           0 :                 return -1;
    1329             :         }
    1330           0 :         if (value == Py_None) {
    1331           0 :                 object->data = NULL;
    1332             :         } else {
    1333           0 :                 object->data = NULL;
    1334           0 :                 PY_CHECK_TYPE(&PAC_CREDENTIAL_DATA_Type, value, return -1;);
    1335           0 :                 if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
    1336           0 :                         PyErr_NoMemory();
    1337           0 :                         return -1;
    1338             :                 }
    1339           0 :                 object->data = (struct PAC_CREDENTIAL_DATA *)pytalloc_get_ptr(value);
    1340             :         }
    1341           0 :         return 0;
    1342             : }
    1343             : 
    1344             : static PyGetSetDef py_PAC_CREDENTIAL_DATA_CTR_getsetters[] = {
    1345             :         {
    1346             :                 .name = discard_const_p(char, "data"),
    1347             :                 .get = py_PAC_CREDENTIAL_DATA_CTR_get_data,
    1348             :                 .set = py_PAC_CREDENTIAL_DATA_CTR_set_data,
    1349             :                 .doc = discard_const_p(char, "PIDL-generated element of base type PAC_CREDENTIAL_DATA")
    1350             :         },
    1351             :         { .name = NULL }
    1352             : };
    1353             : 
    1354           0 : static PyObject *py_PAC_CREDENTIAL_DATA_CTR_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1355             : {
    1356           0 :         return pytalloc_new(struct PAC_CREDENTIAL_DATA_CTR, type);
    1357             : }
    1358             : 
    1359           0 : static PyObject *py_PAC_CREDENTIAL_DATA_CTR_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
    1360             : {
    1361           0 :         struct PAC_CREDENTIAL_DATA_CTR *object = (struct PAC_CREDENTIAL_DATA_CTR *)pytalloc_get_ptr(py_obj);
    1362           0 :         PyObject *ret = NULL;
    1363             :         DATA_BLOB blob;
    1364             :         enum ndr_err_code err;
    1365           0 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
    1366           0 :         if (tmp_ctx == NULL) {
    1367           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    1368           0 :                 return NULL;
    1369             :         }
    1370           0 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_PAC_CREDENTIAL_DATA_CTR);
    1371           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    1372           0 :                 TALLOC_FREE(tmp_ctx);
    1373           0 :                 PyErr_SetNdrError(err);
    1374           0 :                 return NULL;
    1375             :         }
    1376             : 
    1377           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    1378           0 :         TALLOC_FREE(tmp_ctx);
    1379           0 :         return ret;
    1380             : }
    1381             : 
    1382           0 : static PyObject *py_PAC_CREDENTIAL_DATA_CTR_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    1383             : {
    1384           0 :         struct PAC_CREDENTIAL_DATA_CTR *object = (struct PAC_CREDENTIAL_DATA_CTR *)pytalloc_get_ptr(py_obj);
    1385           0 :         DATA_BLOB blob = {.data = NULL, .length = 0};
    1386           0 :         Py_ssize_t blob_length = 0;
    1387             :         enum ndr_err_code err;
    1388           0 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
    1389           0 :         PyObject *allow_remaining_obj = NULL;
    1390           0 :         bool allow_remaining = false;
    1391             : 
    1392           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
    1393             :                 discard_const_p(char *, kwnames),
    1394             :                 &blob.data, &blob_length,
    1395             :                 &allow_remaining_obj)) {
    1396           0 :                 return NULL;
    1397             :         }
    1398           0 :         blob.length = blob_length;
    1399             : 
    1400           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    1401           0 :                 allow_remaining = true;
    1402             :         }
    1403             : 
    1404           0 :         if (allow_remaining) {
    1405           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_CREDENTIAL_DATA_CTR);
    1406             :         } else {
    1407           0 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_CREDENTIAL_DATA_CTR);
    1408             :         }
    1409           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    1410           0 :                 PyErr_SetNdrError(err);
    1411           0 :                 return NULL;
    1412             :         }
    1413             : 
    1414           0 :         Py_RETURN_NONE;
    1415             : }
    1416             : 
    1417           0 : static PyObject *py_PAC_CREDENTIAL_DATA_CTR_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    1418             : {
    1419           0 :         struct PAC_CREDENTIAL_DATA_CTR *object = (struct PAC_CREDENTIAL_DATA_CTR *)pytalloc_get_ptr(py_obj);
    1420             :         PyObject *ret;
    1421             :         char *retstr;
    1422             : 
    1423           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_PAC_CREDENTIAL_DATA_CTR, "PAC_CREDENTIAL_DATA_CTR", object);
    1424           0 :         ret = PyUnicode_FromString(retstr);
    1425           0 :         talloc_free(retstr);
    1426             : 
    1427           0 :         return ret;
    1428             : }
    1429             : 
    1430             : static PyMethodDef py_PAC_CREDENTIAL_DATA_CTR_methods[] = {
    1431             :         { "__ndr_pack__", (PyCFunction)py_PAC_CREDENTIAL_DATA_CTR_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
    1432             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PAC_CREDENTIAL_DATA_CTR_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
    1433             :         { "__ndr_print__", (PyCFunction)py_PAC_CREDENTIAL_DATA_CTR_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
    1434             :         { NULL, NULL, 0, NULL }
    1435             : };
    1436             : 
    1437             : 
    1438             : static PyTypeObject PAC_CREDENTIAL_DATA_CTR_Type = {
    1439             :         PyVarObject_HEAD_INIT(NULL, 0)
    1440             :         .tp_name = "krb5pac.PAC_CREDENTIAL_DATA_CTR",
    1441             :         .tp_getset = py_PAC_CREDENTIAL_DATA_CTR_getsetters,
    1442             :         .tp_methods = py_PAC_CREDENTIAL_DATA_CTR_methods,
    1443             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    1444             :         .tp_new = py_PAC_CREDENTIAL_DATA_CTR_new,
    1445             : };
    1446             : 
    1447             : 
    1448           0 : static PyObject *py_PAC_CREDENTIAL_DATA_NDR_get_ctr(PyObject *obj, void *closure)
    1449             : {
    1450           0 :         struct PAC_CREDENTIAL_DATA_NDR *object = (struct PAC_CREDENTIAL_DATA_NDR *)pytalloc_get_ptr(obj);
    1451             :         PyObject *py_ctr;
    1452           0 :         py_ctr = pytalloc_reference_ex(&PAC_CREDENTIAL_DATA_CTR_Type, pytalloc_get_mem_ctx(obj), &object->ctr);
    1453           0 :         return py_ctr;
    1454             : }
    1455             : 
    1456           0 : static int py_PAC_CREDENTIAL_DATA_NDR_set_ctr(PyObject *py_obj, PyObject *value, void *closure)
    1457             : {
    1458           0 :         struct PAC_CREDENTIAL_DATA_NDR *object = (struct PAC_CREDENTIAL_DATA_NDR *)pytalloc_get_ptr(py_obj);
    1459           0 :         if (value == NULL) {
    1460           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->ctr");
    1461           0 :                 return -1;
    1462             :         }
    1463           0 :         PY_CHECK_TYPE(&PAC_CREDENTIAL_DATA_CTR_Type, value, return -1;);
    1464           0 :         if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
    1465           0 :                 PyErr_NoMemory();
    1466           0 :                 return -1;
    1467             :         }
    1468           0 :         object->ctr = *(struct PAC_CREDENTIAL_DATA_CTR *)pytalloc_get_ptr(value);
    1469           0 :         return 0;
    1470             : }
    1471             : 
    1472             : static PyGetSetDef py_PAC_CREDENTIAL_DATA_NDR_getsetters[] = {
    1473             :         {
    1474             :                 .name = discard_const_p(char, "ctr"),
    1475             :                 .get = py_PAC_CREDENTIAL_DATA_NDR_get_ctr,
    1476             :                 .set = py_PAC_CREDENTIAL_DATA_NDR_set_ctr,
    1477             :                 .doc = discard_const_p(char, "PIDL-generated element of base type PAC_CREDENTIAL_DATA_CTR")
    1478             :         },
    1479             :         { .name = NULL }
    1480             : };
    1481             : 
    1482           0 : static PyObject *py_PAC_CREDENTIAL_DATA_NDR_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1483             : {
    1484           0 :         return pytalloc_new(struct PAC_CREDENTIAL_DATA_NDR, type);
    1485             : }
    1486             : 
    1487           0 : static PyObject *py_PAC_CREDENTIAL_DATA_NDR_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
    1488             : {
    1489           0 :         struct PAC_CREDENTIAL_DATA_NDR *object = (struct PAC_CREDENTIAL_DATA_NDR *)pytalloc_get_ptr(py_obj);
    1490           0 :         PyObject *ret = NULL;
    1491             :         DATA_BLOB blob;
    1492             :         enum ndr_err_code err;
    1493           0 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
    1494           0 :         if (tmp_ctx == NULL) {
    1495           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    1496           0 :                 return NULL;
    1497             :         }
    1498           0 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_PAC_CREDENTIAL_DATA_NDR);
    1499           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    1500           0 :                 TALLOC_FREE(tmp_ctx);
    1501           0 :                 PyErr_SetNdrError(err);
    1502           0 :                 return NULL;
    1503             :         }
    1504             : 
    1505           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    1506           0 :         TALLOC_FREE(tmp_ctx);
    1507           0 :         return ret;
    1508             : }
    1509             : 
    1510           0 : static PyObject *py_PAC_CREDENTIAL_DATA_NDR_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    1511             : {
    1512           0 :         struct PAC_CREDENTIAL_DATA_NDR *object = (struct PAC_CREDENTIAL_DATA_NDR *)pytalloc_get_ptr(py_obj);
    1513           0 :         DATA_BLOB blob = {.data = NULL, .length = 0};
    1514           0 :         Py_ssize_t blob_length = 0;
    1515             :         enum ndr_err_code err;
    1516           0 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
    1517           0 :         PyObject *allow_remaining_obj = NULL;
    1518           0 :         bool allow_remaining = false;
    1519             : 
    1520           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
    1521             :                 discard_const_p(char *, kwnames),
    1522             :                 &blob.data, &blob_length,
    1523             :                 &allow_remaining_obj)) {
    1524           0 :                 return NULL;
    1525             :         }
    1526           0 :         blob.length = blob_length;
    1527             : 
    1528           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    1529           0 :                 allow_remaining = true;
    1530             :         }
    1531             : 
    1532           0 :         if (allow_remaining) {
    1533           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_CREDENTIAL_DATA_NDR);
    1534             :         } else {
    1535           0 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_CREDENTIAL_DATA_NDR);
    1536             :         }
    1537           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    1538           0 :                 PyErr_SetNdrError(err);
    1539           0 :                 return NULL;
    1540             :         }
    1541             : 
    1542           0 :         Py_RETURN_NONE;
    1543             : }
    1544             : 
    1545           0 : static PyObject *py_PAC_CREDENTIAL_DATA_NDR_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    1546             : {
    1547           0 :         struct PAC_CREDENTIAL_DATA_NDR *object = (struct PAC_CREDENTIAL_DATA_NDR *)pytalloc_get_ptr(py_obj);
    1548             :         PyObject *ret;
    1549             :         char *retstr;
    1550             : 
    1551           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_PAC_CREDENTIAL_DATA_NDR, "PAC_CREDENTIAL_DATA_NDR", object);
    1552           0 :         ret = PyUnicode_FromString(retstr);
    1553           0 :         talloc_free(retstr);
    1554             : 
    1555           0 :         return ret;
    1556             : }
    1557             : 
    1558             : static PyMethodDef py_PAC_CREDENTIAL_DATA_NDR_methods[] = {
    1559             :         { "__ndr_pack__", (PyCFunction)py_PAC_CREDENTIAL_DATA_NDR_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
    1560             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PAC_CREDENTIAL_DATA_NDR_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
    1561             :         { "__ndr_print__", (PyCFunction)py_PAC_CREDENTIAL_DATA_NDR_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
    1562             :         { NULL, NULL, 0, NULL }
    1563             : };
    1564             : 
    1565             : 
    1566             : static PyTypeObject PAC_CREDENTIAL_DATA_NDR_Type = {
    1567             :         PyVarObject_HEAD_INIT(NULL, 0)
    1568             :         .tp_name = "krb5pac.PAC_CREDENTIAL_DATA_NDR",
    1569             :         .tp_getset = py_PAC_CREDENTIAL_DATA_NDR_getsetters,
    1570             :         .tp_methods = py_PAC_CREDENTIAL_DATA_NDR_methods,
    1571             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    1572             :         .tp_new = py_PAC_CREDENTIAL_DATA_NDR_new,
    1573             : };
    1574             : 
    1575             : 
    1576           0 : static PyObject *py_PAC_CREDENTIAL_INFO_get_version(PyObject *obj, void *closure)
    1577             : {
    1578           0 :         struct PAC_CREDENTIAL_INFO *object = (struct PAC_CREDENTIAL_INFO *)pytalloc_get_ptr(obj);
    1579             :         PyObject *py_version;
    1580           0 :         py_version = PyLong_FromUnsignedLongLong((uint32_t)object->version);
    1581           0 :         return py_version;
    1582             : }
    1583             : 
    1584           0 : static int py_PAC_CREDENTIAL_INFO_set_version(PyObject *py_obj, PyObject *value, void *closure)
    1585             : {
    1586           0 :         struct PAC_CREDENTIAL_INFO *object = (struct PAC_CREDENTIAL_INFO *)pytalloc_get_ptr(py_obj);
    1587           0 :         if (value == NULL) {
    1588           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->version");
    1589           0 :                 return -1;
    1590             :         }
    1591             :         {
    1592           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->version));
    1593           0 :                 if (PyLong_Check(value)) {
    1594             :                         unsigned long long test_var;
    1595           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1596           0 :                         if (PyErr_Occurred() != NULL) {
    1597           0 :                                 return -1;
    1598             :                         }
    1599           0 :                         if (test_var > uint_max) {
    1600           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    1601             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1602           0 :                                 return -1;
    1603             :                         }
    1604           0 :                         object->version = test_var;
    1605             :                 } else {
    1606           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    1607             :                           PyLong_Type.tp_name);
    1608           0 :                         return -1;
    1609             :                 }
    1610             :         }
    1611           0 :         return 0;
    1612             : }
    1613             : 
    1614           0 : static PyObject *py_PAC_CREDENTIAL_INFO_get_encryption_type(PyObject *obj, void *closure)
    1615             : {
    1616           0 :         struct PAC_CREDENTIAL_INFO *object = (struct PAC_CREDENTIAL_INFO *)pytalloc_get_ptr(obj);
    1617             :         PyObject *py_encryption_type;
    1618           0 :         py_encryption_type = PyLong_FromUnsignedLongLong((uint32_t)object->encryption_type);
    1619           0 :         return py_encryption_type;
    1620             : }
    1621             : 
    1622           0 : static int py_PAC_CREDENTIAL_INFO_set_encryption_type(PyObject *py_obj, PyObject *value, void *closure)
    1623             : {
    1624           0 :         struct PAC_CREDENTIAL_INFO *object = (struct PAC_CREDENTIAL_INFO *)pytalloc_get_ptr(py_obj);
    1625           0 :         if (value == NULL) {
    1626           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->encryption_type");
    1627           0 :                 return -1;
    1628             :         }
    1629             :         {
    1630           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->encryption_type));
    1631           0 :                 if (PyLong_Check(value)) {
    1632             :                         unsigned long long test_var;
    1633           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1634           0 :                         if (PyErr_Occurred() != NULL) {
    1635           0 :                                 return -1;
    1636             :                         }
    1637           0 :                         if (test_var > uint_max) {
    1638           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    1639             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1640           0 :                                 return -1;
    1641             :                         }
    1642           0 :                         object->encryption_type = test_var;
    1643             :                 } else {
    1644           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    1645             :                           PyLong_Type.tp_name);
    1646           0 :                         return -1;
    1647             :                 }
    1648             :         }
    1649           0 :         return 0;
    1650             : }
    1651             : 
    1652           0 : static PyObject *py_PAC_CREDENTIAL_INFO_get_encrypted_data(PyObject *obj, void *closure)
    1653             : {
    1654           0 :         struct PAC_CREDENTIAL_INFO *object = (struct PAC_CREDENTIAL_INFO *)pytalloc_get_ptr(obj);
    1655             :         PyObject *py_encrypted_data;
    1656           0 :         py_encrypted_data = PyBytes_FromStringAndSize((char *)(object->encrypted_data).data, (object->encrypted_data).length);
    1657           0 :         return py_encrypted_data;
    1658             : }
    1659             : 
    1660           0 : static int py_PAC_CREDENTIAL_INFO_set_encrypted_data(PyObject *py_obj, PyObject *value, void *closure)
    1661             : {
    1662           0 :         struct PAC_CREDENTIAL_INFO *object = (struct PAC_CREDENTIAL_INFO *)pytalloc_get_ptr(py_obj);
    1663           0 :         if (value == NULL) {
    1664           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->encrypted_data");
    1665           0 :                 return -1;
    1666             :         }
    1667           0 :         object->encrypted_data = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
    1668           0 :         return 0;
    1669             : }
    1670             : 
    1671             : static PyGetSetDef py_PAC_CREDENTIAL_INFO_getsetters[] = {
    1672             :         {
    1673             :                 .name = discard_const_p(char, "version"),
    1674             :                 .get = py_PAC_CREDENTIAL_INFO_get_version,
    1675             :                 .set = py_PAC_CREDENTIAL_INFO_set_version,
    1676             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    1677             :         },
    1678             :         {
    1679             :                 .name = discard_const_p(char, "encryption_type"),
    1680             :                 .get = py_PAC_CREDENTIAL_INFO_get_encryption_type,
    1681             :                 .set = py_PAC_CREDENTIAL_INFO_set_encryption_type,
    1682             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    1683             :         },
    1684             :         {
    1685             :                 .name = discard_const_p(char, "encrypted_data"),
    1686             :                 .get = py_PAC_CREDENTIAL_INFO_get_encrypted_data,
    1687             :                 .set = py_PAC_CREDENTIAL_INFO_set_encrypted_data,
    1688             :                 .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
    1689             :         },
    1690             :         { .name = NULL }
    1691             : };
    1692             : 
    1693           0 : static PyObject *py_PAC_CREDENTIAL_INFO_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1694             : {
    1695           0 :         return pytalloc_new(struct PAC_CREDENTIAL_INFO, type);
    1696             : }
    1697             : 
    1698           0 : static PyObject *py_PAC_CREDENTIAL_INFO_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
    1699             : {
    1700           0 :         struct PAC_CREDENTIAL_INFO *object = (struct PAC_CREDENTIAL_INFO *)pytalloc_get_ptr(py_obj);
    1701           0 :         PyObject *ret = NULL;
    1702             :         DATA_BLOB blob;
    1703             :         enum ndr_err_code err;
    1704           0 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
    1705           0 :         if (tmp_ctx == NULL) {
    1706           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    1707           0 :                 return NULL;
    1708             :         }
    1709           0 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_PAC_CREDENTIAL_INFO);
    1710           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    1711           0 :                 TALLOC_FREE(tmp_ctx);
    1712           0 :                 PyErr_SetNdrError(err);
    1713           0 :                 return NULL;
    1714             :         }
    1715             : 
    1716           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    1717           0 :         TALLOC_FREE(tmp_ctx);
    1718           0 :         return ret;
    1719             : }
    1720             : 
    1721           0 : static PyObject *py_PAC_CREDENTIAL_INFO_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    1722             : {
    1723           0 :         struct PAC_CREDENTIAL_INFO *object = (struct PAC_CREDENTIAL_INFO *)pytalloc_get_ptr(py_obj);
    1724           0 :         DATA_BLOB blob = {.data = NULL, .length = 0};
    1725           0 :         Py_ssize_t blob_length = 0;
    1726             :         enum ndr_err_code err;
    1727           0 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
    1728           0 :         PyObject *allow_remaining_obj = NULL;
    1729           0 :         bool allow_remaining = false;
    1730             : 
    1731           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
    1732             :                 discard_const_p(char *, kwnames),
    1733             :                 &blob.data, &blob_length,
    1734             :                 &allow_remaining_obj)) {
    1735           0 :                 return NULL;
    1736             :         }
    1737           0 :         blob.length = blob_length;
    1738             : 
    1739           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    1740           0 :                 allow_remaining = true;
    1741             :         }
    1742             : 
    1743           0 :         if (allow_remaining) {
    1744           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_CREDENTIAL_INFO);
    1745             :         } else {
    1746           0 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_CREDENTIAL_INFO);
    1747             :         }
    1748           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    1749           0 :                 PyErr_SetNdrError(err);
    1750           0 :                 return NULL;
    1751             :         }
    1752             : 
    1753           0 :         Py_RETURN_NONE;
    1754             : }
    1755             : 
    1756           0 : static PyObject *py_PAC_CREDENTIAL_INFO_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    1757             : {
    1758           0 :         struct PAC_CREDENTIAL_INFO *object = (struct PAC_CREDENTIAL_INFO *)pytalloc_get_ptr(py_obj);
    1759             :         PyObject *ret;
    1760             :         char *retstr;
    1761             : 
    1762           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_PAC_CREDENTIAL_INFO, "PAC_CREDENTIAL_INFO", object);
    1763           0 :         ret = PyUnicode_FromString(retstr);
    1764           0 :         talloc_free(retstr);
    1765             : 
    1766           0 :         return ret;
    1767             : }
    1768             : 
    1769             : static PyMethodDef py_PAC_CREDENTIAL_INFO_methods[] = {
    1770             :         { "__ndr_pack__", (PyCFunction)py_PAC_CREDENTIAL_INFO_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
    1771             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PAC_CREDENTIAL_INFO_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
    1772             :         { "__ndr_print__", (PyCFunction)py_PAC_CREDENTIAL_INFO_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
    1773             :         { NULL, NULL, 0, NULL }
    1774             : };
    1775             : 
    1776             : 
    1777             : static PyTypeObject PAC_CREDENTIAL_INFO_Type = {
    1778             :         PyVarObject_HEAD_INIT(NULL, 0)
    1779             :         .tp_name = "krb5pac.PAC_CREDENTIAL_INFO",
    1780             :         .tp_getset = py_PAC_CREDENTIAL_INFO_getsetters,
    1781             :         .tp_methods = py_PAC_CREDENTIAL_INFO_methods,
    1782             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    1783             :         .tp_new = py_PAC_CREDENTIAL_INFO_new,
    1784             : };
    1785             : 
    1786             : 
    1787          35 : static PyObject *py_PAC_CONSTRAINED_DELEGATION_get_proxy_target(PyObject *obj, void *closure)
    1788             : {
    1789          35 :         struct PAC_CONSTRAINED_DELEGATION *object = (struct PAC_CONSTRAINED_DELEGATION *)pytalloc_get_ptr(obj);
    1790             :         PyObject *py_proxy_target;
    1791          35 :         py_proxy_target = pytalloc_reference_ex(lsa_String_Type, pytalloc_get_mem_ctx(obj), &object->proxy_target);
    1792          35 :         return py_proxy_target;
    1793             : }
    1794             : 
    1795           4 : static int py_PAC_CONSTRAINED_DELEGATION_set_proxy_target(PyObject *py_obj, PyObject *value, void *closure)
    1796             : {
    1797           4 :         struct PAC_CONSTRAINED_DELEGATION *object = (struct PAC_CONSTRAINED_DELEGATION *)pytalloc_get_ptr(py_obj);
    1798           4 :         if (value == NULL) {
    1799           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->proxy_target");
    1800           0 :                 return -1;
    1801             :         }
    1802           4 :         PY_CHECK_TYPE(lsa_String_Type, value, return -1;);
    1803           4 :         if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
    1804           0 :                 PyErr_NoMemory();
    1805           0 :                 return -1;
    1806             :         }
    1807           4 :         object->proxy_target = *(struct lsa_String *)pytalloc_get_ptr(value);
    1808           4 :         return 0;
    1809             : }
    1810             : 
    1811           0 : static PyObject *py_PAC_CONSTRAINED_DELEGATION_get_num_transited_services(PyObject *obj, void *closure)
    1812             : {
    1813           0 :         struct PAC_CONSTRAINED_DELEGATION *object = (struct PAC_CONSTRAINED_DELEGATION *)pytalloc_get_ptr(obj);
    1814             :         PyObject *py_num_transited_services;
    1815           0 :         py_num_transited_services = PyLong_FromUnsignedLongLong((uint32_t)object->num_transited_services);
    1816           0 :         return py_num_transited_services;
    1817             : }
    1818             : 
    1819           4 : static int py_PAC_CONSTRAINED_DELEGATION_set_num_transited_services(PyObject *py_obj, PyObject *value, void *closure)
    1820             : {
    1821           4 :         struct PAC_CONSTRAINED_DELEGATION *object = (struct PAC_CONSTRAINED_DELEGATION *)pytalloc_get_ptr(py_obj);
    1822           4 :         if (value == NULL) {
    1823           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->num_transited_services");
    1824           0 :                 return -1;
    1825             :         }
    1826             :         {
    1827           4 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->num_transited_services));
    1828           4 :                 if (PyLong_Check(value)) {
    1829             :                         unsigned long long test_var;
    1830           4 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1831           4 :                         if (PyErr_Occurred() != NULL) {
    1832           0 :                                 return -1;
    1833             :                         }
    1834           4 :                         if (test_var > uint_max) {
    1835           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    1836             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1837           0 :                                 return -1;
    1838             :                         }
    1839           4 :                         object->num_transited_services = test_var;
    1840             :                 } else {
    1841           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    1842             :                           PyLong_Type.tp_name);
    1843           0 :                         return -1;
    1844             :                 }
    1845             :         }
    1846           4 :         return 0;
    1847             : }
    1848             : 
    1849          35 : static PyObject *py_PAC_CONSTRAINED_DELEGATION_get_transited_services(PyObject *obj, void *closure)
    1850             : {
    1851          35 :         struct PAC_CONSTRAINED_DELEGATION *object = (struct PAC_CONSTRAINED_DELEGATION *)pytalloc_get_ptr(obj);
    1852             :         PyObject *py_transited_services;
    1853          35 :         if (object->transited_services == NULL) {
    1854           0 :                 Py_RETURN_NONE;
    1855             :         }
    1856          35 :         if (object->transited_services == NULL) {
    1857           0 :                 py_transited_services = Py_None;
    1858           0 :                 Py_INCREF(py_transited_services);
    1859             :         } else {
    1860          35 :                 py_transited_services = PyList_New(object->num_transited_services);
    1861          35 :                 if (py_transited_services == NULL) {
    1862           0 :                         return NULL;
    1863             :                 }
    1864             :                 {
    1865             :                         int transited_services_cntr_1;
    1866          76 :                         for (transited_services_cntr_1 = 0; transited_services_cntr_1 < (object->num_transited_services); transited_services_cntr_1++) {
    1867             :                                 PyObject *py_transited_services_1;
    1868          41 :                                 py_transited_services_1 = pytalloc_reference_ex(lsa_String_Type, object->transited_services, &object->transited_services[transited_services_cntr_1]);
    1869          41 :                                 PyList_SetItem(py_transited_services, transited_services_cntr_1, py_transited_services_1);
    1870             :                         }
    1871             :                 }
    1872             :         }
    1873          35 :         return py_transited_services;
    1874             : }
    1875             : 
    1876           4 : static int py_PAC_CONSTRAINED_DELEGATION_set_transited_services(PyObject *py_obj, PyObject *value, void *closure)
    1877             : {
    1878           4 :         struct PAC_CONSTRAINED_DELEGATION *object = (struct PAC_CONSTRAINED_DELEGATION *)pytalloc_get_ptr(py_obj);
    1879           4 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->transited_services));
    1880           4 :         if (value == NULL) {
    1881           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->transited_services");
    1882           0 :                 return -1;
    1883             :         }
    1884           4 :         if (value == Py_None) {
    1885           0 :                 object->transited_services = NULL;
    1886             :         } else {
    1887           4 :                 object->transited_services = NULL;
    1888           4 :                 PY_CHECK_TYPE(&PyList_Type, value, return -1;);
    1889             :                 {
    1890             :                         int transited_services_cntr_1;
    1891           4 :                         object->transited_services = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->transited_services, PyList_GET_SIZE(value));
    1892           4 :                         if (!object->transited_services) { return -1;; }
    1893           4 :                         talloc_set_name_const(object->transited_services, "ARRAY: object->transited_services");
    1894          16 :                         for (transited_services_cntr_1 = 0; transited_services_cntr_1 < PyList_GET_SIZE(value); transited_services_cntr_1++) {
    1895          12 :                                 if (PyList_GET_ITEM(value, transited_services_cntr_1) == NULL) {
    1896           0 :                                         PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->transited_services[transited_services_cntr_1]");
    1897           0 :                                         return -1;
    1898             :                                 }
    1899          12 :                                 PY_CHECK_TYPE(lsa_String_Type, PyList_GET_ITEM(value, transited_services_cntr_1), return -1;);
    1900          12 :                                 if (talloc_reference(object->transited_services, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, transited_services_cntr_1))) == NULL) {
    1901           0 :                                         PyErr_NoMemory();
    1902           0 :                                         return -1;
    1903             :                                 }
    1904          12 :                                 object->transited_services[transited_services_cntr_1] = *(struct lsa_String *)pytalloc_get_ptr(PyList_GET_ITEM(value, transited_services_cntr_1));
    1905             :                         }
    1906             :                 }
    1907             :         }
    1908           4 :         return 0;
    1909             : }
    1910             : 
    1911             : static PyGetSetDef py_PAC_CONSTRAINED_DELEGATION_getsetters[] = {
    1912             :         {
    1913             :                 .name = discard_const_p(char, "proxy_target"),
    1914             :                 .get = py_PAC_CONSTRAINED_DELEGATION_get_proxy_target,
    1915             :                 .set = py_PAC_CONSTRAINED_DELEGATION_set_proxy_target,
    1916             :                 .doc = discard_const_p(char, "PIDL-generated element of base type lsa_String")
    1917             :         },
    1918             :         {
    1919             :                 .name = discard_const_p(char, "num_transited_services"),
    1920             :                 .get = py_PAC_CONSTRAINED_DELEGATION_get_num_transited_services,
    1921             :                 .set = py_PAC_CONSTRAINED_DELEGATION_set_num_transited_services,
    1922             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    1923             :         },
    1924             :         {
    1925             :                 .name = discard_const_p(char, "transited_services"),
    1926             :                 .get = py_PAC_CONSTRAINED_DELEGATION_get_transited_services,
    1927             :                 .set = py_PAC_CONSTRAINED_DELEGATION_set_transited_services,
    1928             :                 .doc = discard_const_p(char, "PIDL-generated element of base type lsa_String")
    1929             :         },
    1930             :         { .name = NULL }
    1931             : };
    1932             : 
    1933           4 : static PyObject *py_PAC_CONSTRAINED_DELEGATION_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1934             : {
    1935           4 :         return pytalloc_new(struct PAC_CONSTRAINED_DELEGATION, type);
    1936             : }
    1937             : 
    1938             : 
    1939             : static PyTypeObject PAC_CONSTRAINED_DELEGATION_Type = {
    1940             :         PyVarObject_HEAD_INIT(NULL, 0)
    1941             :         .tp_name = "krb5pac.PAC_CONSTRAINED_DELEGATION",
    1942             :         .tp_getset = py_PAC_CONSTRAINED_DELEGATION_getsetters,
    1943             :         .tp_methods = NULL,
    1944             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    1945             :         .tp_new = py_PAC_CONSTRAINED_DELEGATION_new,
    1946             : };
    1947             : 
    1948             : 
    1949           0 : static PyObject *py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_get_samaccountname_size(PyObject *obj, void *closure)
    1950             : {
    1951           0 :         struct PAC_UPN_DNS_INFO_SAM_NAME_AND_SID *object = (struct PAC_UPN_DNS_INFO_SAM_NAME_AND_SID *)pytalloc_get_ptr(obj);
    1952             :         PyObject *py_samaccountname_size;
    1953           0 :         py_samaccountname_size = PyLong_FromLong((uint16_t)object->samaccountname_size);
    1954           0 :         return py_samaccountname_size;
    1955             : }
    1956             : 
    1957           0 : static int py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_set_samaccountname_size(PyObject *py_obj, PyObject *value, void *closure)
    1958             : {
    1959           0 :         struct PAC_UPN_DNS_INFO_SAM_NAME_AND_SID *object = (struct PAC_UPN_DNS_INFO_SAM_NAME_AND_SID *)pytalloc_get_ptr(py_obj);
    1960           0 :         if (value == NULL) {
    1961           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->samaccountname_size");
    1962           0 :                 return -1;
    1963             :         }
    1964             :         {
    1965           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->samaccountname_size));
    1966           0 :                 if (PyLong_Check(value)) {
    1967             :                         unsigned long long test_var;
    1968           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1969           0 :                         if (PyErr_Occurred() != NULL) {
    1970           0 :                                 return -1;
    1971             :                         }
    1972           0 :                         if (test_var > uint_max) {
    1973           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    1974             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1975           0 :                                 return -1;
    1976             :                         }
    1977           0 :                         object->samaccountname_size = test_var;
    1978             :                 } else {
    1979           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    1980             :                           PyLong_Type.tp_name);
    1981           0 :                         return -1;
    1982             :                 }
    1983             :         }
    1984           0 :         return 0;
    1985             : }
    1986             : 
    1987         201 : static PyObject *py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_get_samaccountname(PyObject *obj, void *closure)
    1988             : {
    1989         201 :         struct PAC_UPN_DNS_INFO_SAM_NAME_AND_SID *object = (struct PAC_UPN_DNS_INFO_SAM_NAME_AND_SID *)pytalloc_get_ptr(obj);
    1990             :         PyObject *py_samaccountname;
    1991         201 :         if (object->samaccountname == NULL) {
    1992           0 :                 Py_RETURN_NONE;
    1993             :         }
    1994         201 :         if (object->samaccountname == NULL) {
    1995           0 :                 py_samaccountname = Py_None;
    1996           0 :                 Py_INCREF(py_samaccountname);
    1997             :         } else {
    1998         201 :                 py_samaccountname = PyString_FromStringOrNULL(object->samaccountname);
    1999             :         }
    2000         201 :         return py_samaccountname;
    2001             : }
    2002             : 
    2003           0 : static int py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_set_samaccountname(PyObject *py_obj, PyObject *value, void *closure)
    2004             : {
    2005           0 :         struct PAC_UPN_DNS_INFO_SAM_NAME_AND_SID *object = (struct PAC_UPN_DNS_INFO_SAM_NAME_AND_SID *)pytalloc_get_ptr(py_obj);
    2006           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->samaccountname));
    2007           0 :         if (value == NULL) {
    2008           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->samaccountname");
    2009           0 :                 return -1;
    2010             :         }
    2011           0 :         if (value == Py_None) {
    2012           0 :                 object->samaccountname = NULL;
    2013             :         } else {
    2014           0 :                 object->samaccountname = NULL;
    2015             :                 {
    2016             :                         const char *test_str;
    2017             :                         const char *talloc_str;
    2018           0 :                         PyObject *unicode = NULL;
    2019           0 :                         if (PyUnicode_Check(value)) {
    2020           0 :                                 unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
    2021           0 :                                 if (unicode == NULL) {
    2022           0 :                                         PyErr_NoMemory();
    2023           0 :                                         return -1;
    2024             :                                 }
    2025           0 :                                 test_str = PyBytes_AS_STRING(unicode);
    2026           0 :                         } else if (PyBytes_Check(value)) {
    2027           0 :                                 test_str = PyBytes_AS_STRING(value);
    2028             :                         } else {
    2029           0 :                                 PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
    2030           0 :                                 return -1;
    2031             :                         }
    2032           0 :                         talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
    2033           0 :                         if (unicode != NULL) {
    2034           0 :                                 Py_DECREF(unicode);
    2035             :                         }
    2036           0 :                         if (talloc_str == NULL) {
    2037           0 :                                 PyErr_NoMemory();
    2038           0 :                                 return -1;
    2039             :                         }
    2040           0 :                         object->samaccountname = talloc_str;
    2041             :                 }
    2042             :         }
    2043           0 :         return 0;
    2044             : }
    2045             : 
    2046           0 : static PyObject *py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_get_objectsid_size(PyObject *obj, void *closure)
    2047             : {
    2048           0 :         struct PAC_UPN_DNS_INFO_SAM_NAME_AND_SID *object = (struct PAC_UPN_DNS_INFO_SAM_NAME_AND_SID *)pytalloc_get_ptr(obj);
    2049             :         PyObject *py_objectsid_size;
    2050           0 :         py_objectsid_size = PyLong_FromLong((uint16_t)object->objectsid_size);
    2051           0 :         return py_objectsid_size;
    2052             : }
    2053             : 
    2054           0 : static int py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_set_objectsid_size(PyObject *py_obj, PyObject *value, void *closure)
    2055             : {
    2056           0 :         struct PAC_UPN_DNS_INFO_SAM_NAME_AND_SID *object = (struct PAC_UPN_DNS_INFO_SAM_NAME_AND_SID *)pytalloc_get_ptr(py_obj);
    2057           0 :         if (value == NULL) {
    2058           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->objectsid_size");
    2059           0 :                 return -1;
    2060             :         }
    2061             :         {
    2062           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->objectsid_size));
    2063           0 :                 if (PyLong_Check(value)) {
    2064             :                         unsigned long long test_var;
    2065           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    2066           0 :                         if (PyErr_Occurred() != NULL) {
    2067           0 :                                 return -1;
    2068             :                         }
    2069           0 :                         if (test_var > uint_max) {
    2070           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    2071             :                                   PyLong_Type.tp_name, uint_max, test_var);
    2072           0 :                                 return -1;
    2073             :                         }
    2074           0 :                         object->objectsid_size = test_var;
    2075             :                 } else {
    2076           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    2077             :                           PyLong_Type.tp_name);
    2078           0 :                         return -1;
    2079             :                 }
    2080             :         }
    2081           0 :         return 0;
    2082             : }
    2083             : 
    2084          53 : static PyObject *py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_get_objectsid(PyObject *obj, void *closure)
    2085             : {
    2086          53 :         struct PAC_UPN_DNS_INFO_SAM_NAME_AND_SID *object = (struct PAC_UPN_DNS_INFO_SAM_NAME_AND_SID *)pytalloc_get_ptr(obj);
    2087             :         PyObject *py_objectsid;
    2088          53 :         if (object->objectsid == NULL) {
    2089           0 :                 Py_RETURN_NONE;
    2090             :         }
    2091          53 :         if (object->objectsid == NULL) {
    2092           0 :                 py_objectsid = Py_None;
    2093           0 :                 Py_INCREF(py_objectsid);
    2094             :         } else {
    2095          53 :                 py_objectsid = pytalloc_reference_ex(dom_sid_Type, object->objectsid, object->objectsid);
    2096             :         }
    2097          53 :         return py_objectsid;
    2098             : }
    2099             : 
    2100           0 : static int py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_set_objectsid(PyObject *py_obj, PyObject *value, void *closure)
    2101             : {
    2102           0 :         struct PAC_UPN_DNS_INFO_SAM_NAME_AND_SID *object = (struct PAC_UPN_DNS_INFO_SAM_NAME_AND_SID *)pytalloc_get_ptr(py_obj);
    2103           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->objectsid));
    2104           0 :         if (value == NULL) {
    2105           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->objectsid");
    2106           0 :                 return -1;
    2107             :         }
    2108           0 :         if (value == Py_None) {
    2109           0 :                 object->objectsid = NULL;
    2110             :         } else {
    2111           0 :                 object->objectsid = NULL;
    2112           0 :                 PY_CHECK_TYPE(dom_sid_Type, value, return -1;);
    2113           0 :                 if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
    2114           0 :                         PyErr_NoMemory();
    2115           0 :                         return -1;
    2116             :                 }
    2117           0 :                 object->objectsid = (struct dom_sid *)pytalloc_get_ptr(value);
    2118             :         }
    2119           0 :         return 0;
    2120             : }
    2121             : 
    2122             : static PyGetSetDef py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_getsetters[] = {
    2123             :         {
    2124             :                 .name = discard_const_p(char, "samaccountname_size"),
    2125             :                 .get = py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_get_samaccountname_size,
    2126             :                 .set = py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_set_samaccountname_size,
    2127             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
    2128             :         },
    2129             :         {
    2130             :                 .name = discard_const_p(char, "samaccountname"),
    2131             :                 .get = py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_get_samaccountname,
    2132             :                 .set = py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_set_samaccountname,
    2133             :                 .doc = discard_const_p(char, "PIDL-generated element of base type string")
    2134             :         },
    2135             :         {
    2136             :                 .name = discard_const_p(char, "objectsid_size"),
    2137             :                 .get = py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_get_objectsid_size,
    2138             :                 .set = py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_set_objectsid_size,
    2139             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
    2140             :         },
    2141             :         {
    2142             :                 .name = discard_const_p(char, "objectsid"),
    2143             :                 .get = py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_get_objectsid,
    2144             :                 .set = py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_set_objectsid,
    2145             :                 .doc = discard_const_p(char, "PIDL-generated element of base type dom_sid")
    2146             :         },
    2147             :         { .name = NULL }
    2148             : };
    2149             : 
    2150           0 : static PyObject *py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    2151             : {
    2152           0 :         return pytalloc_new(struct PAC_UPN_DNS_INFO_SAM_NAME_AND_SID, type);
    2153             : }
    2154             : 
    2155             : 
    2156             : static PyTypeObject PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_Type = {
    2157             :         PyVarObject_HEAD_INIT(NULL, 0)
    2158             :         .tp_name = "krb5pac.PAC_UPN_DNS_INFO_SAM_NAME_AND_SID",
    2159             :         .tp_getset = py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_getsetters,
    2160             :         .tp_methods = NULL,
    2161             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    2162             :         .tp_new = py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_new,
    2163             : };
    2164             : 
    2165        2602 : static PyObject *py_import_PAC_UPN_DNS_INFO_EX(TALLOC_CTX *mem_ctx, int level, union PAC_UPN_DNS_INFO_EX *in)
    2166             : {
    2167             :         PyObject *ret;
    2168             : 
    2169        2602 :         switch (level) {
    2170        2602 :                 case PAC_UPN_DNS_FLAG_HAS_SAM_NAME_AND_SID:
    2171        2602 :                         ret = pytalloc_reference_ex(&PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_Type, mem_ctx, &in->sam_name_and_sid);
    2172        2602 :                         return ret;
    2173             : 
    2174           0 :                 default:
    2175           0 :                         ret = Py_None;
    2176           0 :                         Py_INCREF(ret);
    2177           0 :                         return ret;
    2178             : 
    2179             :         }
    2180             :         PyErr_SetString(PyExc_TypeError, "unknown union level");
    2181             :         return NULL;
    2182             : }
    2183             : 
    2184           0 : static union PAC_UPN_DNS_INFO_EX *py_export_PAC_UPN_DNS_INFO_EX(TALLOC_CTX *mem_ctx, int level, PyObject *in)
    2185             : {
    2186           0 :         union PAC_UPN_DNS_INFO_EX *ret = talloc_zero(mem_ctx, union PAC_UPN_DNS_INFO_EX);
    2187           0 :         switch (level) {
    2188           0 :                 case PAC_UPN_DNS_FLAG_HAS_SAM_NAME_AND_SID:
    2189           0 :                         if (in == NULL) {
    2190           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->sam_name_and_sid");
    2191           0 :                                 talloc_free(ret); return NULL;
    2192             :                         }
    2193           0 :                         PY_CHECK_TYPE(&PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_Type, in, talloc_free(ret); return NULL;);
    2194           0 :                         if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
    2195           0 :                                 PyErr_NoMemory();
    2196           0 :                                 talloc_free(ret); return NULL;
    2197             :                         }
    2198           0 :                         ret->sam_name_and_sid = *(struct PAC_UPN_DNS_INFO_SAM_NAME_AND_SID *)pytalloc_get_ptr(in);
    2199           0 :                         break;
    2200             : 
    2201           0 :                 default:
    2202           0 :                         break;
    2203             : 
    2204             :         }
    2205             : 
    2206           0 :         return ret;
    2207             : }
    2208             : 
    2209        2602 : static PyObject *py_PAC_UPN_DNS_INFO_EX_import(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    2210             : {
    2211        2602 :         const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
    2212        2602 :         PyObject *mem_ctx_obj = NULL;
    2213        2602 :         TALLOC_CTX *mem_ctx = NULL;
    2214        2602 :         int level = 0;
    2215        2602 :         PyObject *in_obj = NULL;
    2216        2602 :         union PAC_UPN_DNS_INFO_EX *in = NULL;
    2217             : 
    2218        2602 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:import",
    2219             :                 discard_const_p(char *, kwnames),
    2220             :                 &mem_ctx_obj,
    2221             :                 &level,
    2222             :                 &in_obj)) {
    2223           0 :                 return NULL;
    2224             :         }
    2225        2602 :         mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
    2226        2602 :         if (mem_ctx == NULL) {
    2227           0 :                 PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
    2228           0 :                 return NULL;
    2229             :         }
    2230        2602 :         in = (union PAC_UPN_DNS_INFO_EX *)pytalloc_get_ptr(in_obj);
    2231        2602 :         if (in == NULL) {
    2232           0 :                 PyErr_Format(PyExc_TypeError, "in needs to be a pointer to union PAC_UPN_DNS_INFO_EX!");
    2233           0 :                 return NULL;
    2234             :         }
    2235             : 
    2236        2602 :         return py_import_PAC_UPN_DNS_INFO_EX(mem_ctx, level, in);
    2237             : }
    2238             : 
    2239           0 : static PyObject *py_PAC_UPN_DNS_INFO_EX_export(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    2240             : {
    2241           0 :         const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
    2242           0 :         PyObject *mem_ctx_obj = NULL;
    2243           0 :         TALLOC_CTX *mem_ctx = NULL;
    2244           0 :         int level = 0;
    2245           0 :         PyObject *in = NULL;
    2246           0 :         union PAC_UPN_DNS_INFO_EX *out = NULL;
    2247             : 
    2248           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:export",
    2249             :                 discard_const_p(char *, kwnames),
    2250             :                 &mem_ctx_obj,
    2251             :                 &level,
    2252             :                 &in)) {
    2253           0 :                 return NULL;
    2254             :         }
    2255           0 :         mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
    2256           0 :         if (mem_ctx == NULL) {
    2257           0 :                 PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
    2258           0 :                 return NULL;
    2259             :         }
    2260             : 
    2261           0 :         out = py_export_PAC_UPN_DNS_INFO_EX(mem_ctx, level, in);
    2262           0 :         if (out == NULL) {
    2263           0 :                 return NULL;
    2264             :         }
    2265             : 
    2266           0 :         return pytalloc_GenericObject_reference(out);
    2267             : }
    2268             : 
    2269             : static PyMethodDef py_PAC_UPN_DNS_INFO_EX_methods[] = {
    2270             :         { "__import__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PAC_UPN_DNS_INFO_EX_import),
    2271             :                 METH_VARARGS|METH_KEYWORDS|METH_CLASS,
    2272             :                 "T.__import__(mem_ctx, level, in) => ret." },
    2273             :         { "__export__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PAC_UPN_DNS_INFO_EX_export),
    2274             :                 METH_VARARGS|METH_KEYWORDS|METH_CLASS,
    2275             :                 "T.__export__(mem_ctx, level, in) => ret." },
    2276             :         { NULL, NULL, 0, NULL }
    2277             : };
    2278             : 
    2279           0 : static PyObject *py_PAC_UPN_DNS_INFO_EX_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    2280             : {
    2281           0 :         PyErr_Format(PyExc_TypeError, "New %s Objects are not supported", type->tp_name);
    2282           0 :         return NULL;
    2283             : }
    2284             : 
    2285             : 
    2286             : static PyTypeObject PAC_UPN_DNS_INFO_EX_Type = {
    2287             :         PyVarObject_HEAD_INIT(NULL, 0)
    2288             :         .tp_name = "krb5pac.PAC_UPN_DNS_INFO_EX",
    2289             :         .tp_getset = NULL,
    2290             :         .tp_methods = py_PAC_UPN_DNS_INFO_EX_methods,
    2291             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    2292             :         .tp_new = py_PAC_UPN_DNS_INFO_EX_new,
    2293             : };
    2294             : 
    2295             : 
    2296           0 : static PyObject *py_PAC_UPN_DNS_INFO_get_upn_name_size(PyObject *obj, void *closure)
    2297             : {
    2298           0 :         struct PAC_UPN_DNS_INFO *object = (struct PAC_UPN_DNS_INFO *)pytalloc_get_ptr(obj);
    2299             :         PyObject *py_upn_name_size;
    2300           0 :         py_upn_name_size = PyLong_FromLong((uint16_t)object->upn_name_size);
    2301           0 :         return py_upn_name_size;
    2302             : }
    2303             : 
    2304           0 : static int py_PAC_UPN_DNS_INFO_set_upn_name_size(PyObject *py_obj, PyObject *value, void *closure)
    2305             : {
    2306           0 :         struct PAC_UPN_DNS_INFO *object = (struct PAC_UPN_DNS_INFO *)pytalloc_get_ptr(py_obj);
    2307           0 :         if (value == NULL) {
    2308           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->upn_name_size");
    2309           0 :                 return -1;
    2310             :         }
    2311             :         {
    2312           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->upn_name_size));
    2313           0 :                 if (PyLong_Check(value)) {
    2314             :                         unsigned long long test_var;
    2315           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    2316           0 :                         if (PyErr_Occurred() != NULL) {
    2317           0 :                                 return -1;
    2318             :                         }
    2319           0 :                         if (test_var > uint_max) {
    2320           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    2321             :                                   PyLong_Type.tp_name, uint_max, test_var);
    2322           0 :                                 return -1;
    2323             :                         }
    2324           0 :                         object->upn_name_size = test_var;
    2325             :                 } else {
    2326           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    2327             :                           PyLong_Type.tp_name);
    2328           0 :                         return -1;
    2329             :                 }
    2330             :         }
    2331           0 :         return 0;
    2332             : }
    2333             : 
    2334           0 : static PyObject *py_PAC_UPN_DNS_INFO_get_upn_name(PyObject *obj, void *closure)
    2335             : {
    2336           0 :         struct PAC_UPN_DNS_INFO *object = (struct PAC_UPN_DNS_INFO *)pytalloc_get_ptr(obj);
    2337             :         PyObject *py_upn_name;
    2338           0 :         if (object->upn_name == NULL) {
    2339           0 :                 Py_RETURN_NONE;
    2340             :         }
    2341           0 :         if (object->upn_name == NULL) {
    2342           0 :                 py_upn_name = Py_None;
    2343           0 :                 Py_INCREF(py_upn_name);
    2344             :         } else {
    2345           0 :                 py_upn_name = PyString_FromStringOrNULL(object->upn_name);
    2346             :         }
    2347           0 :         return py_upn_name;
    2348             : }
    2349             : 
    2350           0 : static int py_PAC_UPN_DNS_INFO_set_upn_name(PyObject *py_obj, PyObject *value, void *closure)
    2351             : {
    2352           0 :         struct PAC_UPN_DNS_INFO *object = (struct PAC_UPN_DNS_INFO *)pytalloc_get_ptr(py_obj);
    2353           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->upn_name));
    2354           0 :         if (value == NULL) {
    2355           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->upn_name");
    2356           0 :                 return -1;
    2357             :         }
    2358           0 :         if (value == Py_None) {
    2359           0 :                 object->upn_name = NULL;
    2360             :         } else {
    2361           0 :                 object->upn_name = NULL;
    2362             :                 {
    2363             :                         const char *test_str;
    2364             :                         const char *talloc_str;
    2365           0 :                         PyObject *unicode = NULL;
    2366           0 :                         if (PyUnicode_Check(value)) {
    2367           0 :                                 unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
    2368           0 :                                 if (unicode == NULL) {
    2369           0 :                                         PyErr_NoMemory();
    2370           0 :                                         return -1;
    2371             :                                 }
    2372           0 :                                 test_str = PyBytes_AS_STRING(unicode);
    2373           0 :                         } else if (PyBytes_Check(value)) {
    2374           0 :                                 test_str = PyBytes_AS_STRING(value);
    2375             :                         } else {
    2376           0 :                                 PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
    2377           0 :                                 return -1;
    2378             :                         }
    2379           0 :                         talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
    2380           0 :                         if (unicode != NULL) {
    2381           0 :                                 Py_DECREF(unicode);
    2382             :                         }
    2383           0 :                         if (talloc_str == NULL) {
    2384           0 :                                 PyErr_NoMemory();
    2385           0 :                                 return -1;
    2386             :                         }
    2387           0 :                         object->upn_name = talloc_str;
    2388             :                 }
    2389             :         }
    2390           0 :         return 0;
    2391             : }
    2392             : 
    2393           0 : static PyObject *py_PAC_UPN_DNS_INFO_get_dns_domain_name_size(PyObject *obj, void *closure)
    2394             : {
    2395           0 :         struct PAC_UPN_DNS_INFO *object = (struct PAC_UPN_DNS_INFO *)pytalloc_get_ptr(obj);
    2396             :         PyObject *py_dns_domain_name_size;
    2397           0 :         py_dns_domain_name_size = PyLong_FromLong((uint16_t)object->dns_domain_name_size);
    2398           0 :         return py_dns_domain_name_size;
    2399             : }
    2400             : 
    2401           0 : static int py_PAC_UPN_DNS_INFO_set_dns_domain_name_size(PyObject *py_obj, PyObject *value, void *closure)
    2402             : {
    2403           0 :         struct PAC_UPN_DNS_INFO *object = (struct PAC_UPN_DNS_INFO *)pytalloc_get_ptr(py_obj);
    2404           0 :         if (value == NULL) {
    2405           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->dns_domain_name_size");
    2406           0 :                 return -1;
    2407             :         }
    2408             :         {
    2409           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->dns_domain_name_size));
    2410           0 :                 if (PyLong_Check(value)) {
    2411             :                         unsigned long long test_var;
    2412           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    2413           0 :                         if (PyErr_Occurred() != NULL) {
    2414           0 :                                 return -1;
    2415             :                         }
    2416           0 :                         if (test_var > uint_max) {
    2417           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    2418             :                                   PyLong_Type.tp_name, uint_max, test_var);
    2419           0 :                                 return -1;
    2420             :                         }
    2421           0 :                         object->dns_domain_name_size = test_var;
    2422             :                 } else {
    2423           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    2424             :                           PyLong_Type.tp_name);
    2425           0 :                         return -1;
    2426             :                 }
    2427             :         }
    2428           0 :         return 0;
    2429             : }
    2430             : 
    2431        2602 : static PyObject *py_PAC_UPN_DNS_INFO_get_dns_domain_name(PyObject *obj, void *closure)
    2432             : {
    2433        2602 :         struct PAC_UPN_DNS_INFO *object = (struct PAC_UPN_DNS_INFO *)pytalloc_get_ptr(obj);
    2434             :         PyObject *py_dns_domain_name;
    2435        2602 :         if (object->dns_domain_name == NULL) {
    2436           0 :                 Py_RETURN_NONE;
    2437             :         }
    2438        2602 :         if (object->dns_domain_name == NULL) {
    2439           0 :                 py_dns_domain_name = Py_None;
    2440           0 :                 Py_INCREF(py_dns_domain_name);
    2441             :         } else {
    2442        2602 :                 py_dns_domain_name = PyString_FromStringOrNULL(object->dns_domain_name);
    2443             :         }
    2444        2602 :         return py_dns_domain_name;
    2445             : }
    2446             : 
    2447           0 : static int py_PAC_UPN_DNS_INFO_set_dns_domain_name(PyObject *py_obj, PyObject *value, void *closure)
    2448             : {
    2449           0 :         struct PAC_UPN_DNS_INFO *object = (struct PAC_UPN_DNS_INFO *)pytalloc_get_ptr(py_obj);
    2450           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->dns_domain_name));
    2451           0 :         if (value == NULL) {
    2452           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->dns_domain_name");
    2453           0 :                 return -1;
    2454             :         }
    2455           0 :         if (value == Py_None) {
    2456           0 :                 object->dns_domain_name = NULL;
    2457             :         } else {
    2458           0 :                 object->dns_domain_name = NULL;
    2459             :                 {
    2460             :                         const char *test_str;
    2461             :                         const char *talloc_str;
    2462           0 :                         PyObject *unicode = NULL;
    2463           0 :                         if (PyUnicode_Check(value)) {
    2464           0 :                                 unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
    2465           0 :                                 if (unicode == NULL) {
    2466           0 :                                         PyErr_NoMemory();
    2467           0 :                                         return -1;
    2468             :                                 }
    2469           0 :                                 test_str = PyBytes_AS_STRING(unicode);
    2470           0 :                         } else if (PyBytes_Check(value)) {
    2471           0 :                                 test_str = PyBytes_AS_STRING(value);
    2472             :                         } else {
    2473           0 :                                 PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
    2474           0 :                                 return -1;
    2475             :                         }
    2476           0 :                         talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
    2477           0 :                         if (unicode != NULL) {
    2478           0 :                                 Py_DECREF(unicode);
    2479             :                         }
    2480           0 :                         if (talloc_str == NULL) {
    2481           0 :                                 PyErr_NoMemory();
    2482           0 :                                 return -1;
    2483             :                         }
    2484           0 :                         object->dns_domain_name = talloc_str;
    2485             :                 }
    2486             :         }
    2487           0 :         return 0;
    2488             : }
    2489             : 
    2490           0 : static PyObject *py_PAC_UPN_DNS_INFO_get_flags(PyObject *obj, void *closure)
    2491             : {
    2492           0 :         struct PAC_UPN_DNS_INFO *object = (struct PAC_UPN_DNS_INFO *)pytalloc_get_ptr(obj);
    2493             :         PyObject *py_flags;
    2494           0 :         py_flags = PyLong_FromUnsignedLongLong((uint32_t)object->flags);
    2495           0 :         return py_flags;
    2496             : }
    2497             : 
    2498           0 : static int py_PAC_UPN_DNS_INFO_set_flags(PyObject *py_obj, PyObject *value, void *closure)
    2499             : {
    2500           0 :         struct PAC_UPN_DNS_INFO *object = (struct PAC_UPN_DNS_INFO *)pytalloc_get_ptr(py_obj);
    2501           0 :         if (value == NULL) {
    2502           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->flags");
    2503           0 :                 return -1;
    2504             :         }
    2505             :         {
    2506           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->flags));
    2507           0 :                 if (PyLong_Check(value)) {
    2508             :                         unsigned long long test_var;
    2509           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    2510           0 :                         if (PyErr_Occurred() != NULL) {
    2511           0 :                                 return -1;
    2512             :                         }
    2513           0 :                         if (test_var > uint_max) {
    2514           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    2515             :                                   PyLong_Type.tp_name, uint_max, test_var);
    2516           0 :                                 return -1;
    2517             :                         }
    2518           0 :                         object->flags = test_var;
    2519             :                 } else {
    2520           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    2521             :                           PyLong_Type.tp_name);
    2522           0 :                         return -1;
    2523             :                 }
    2524             :         }
    2525           0 :         return 0;
    2526             : }
    2527             : 
    2528        2602 : static PyObject *py_PAC_UPN_DNS_INFO_get_ex(PyObject *obj, void *closure)
    2529             : {
    2530        2602 :         struct PAC_UPN_DNS_INFO *object = (struct PAC_UPN_DNS_INFO *)pytalloc_get_ptr(obj);
    2531             :         PyObject *py_ex;
    2532        2602 :         py_ex = pyrpc_import_union(&PAC_UPN_DNS_INFO_EX_Type, pytalloc_get_mem_ctx(obj), object->flags & PAC_UPN_DNS_FLAG_HAS_SAM_NAME_AND_SID, &object->ex, "union PAC_UPN_DNS_INFO_EX");
    2533        2602 :         if (py_ex == NULL) {
    2534           0 :                 return NULL;
    2535             :         }
    2536        2602 :         return py_ex;
    2537             : }
    2538             : 
    2539           0 : static int py_PAC_UPN_DNS_INFO_set_ex(PyObject *py_obj, PyObject *value, void *closure)
    2540             : {
    2541           0 :         struct PAC_UPN_DNS_INFO *object = (struct PAC_UPN_DNS_INFO *)pytalloc_get_ptr(py_obj);
    2542           0 :         if (value == NULL) {
    2543           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->ex");
    2544           0 :                 return -1;
    2545             :         }
    2546             :         {
    2547             :                 union PAC_UPN_DNS_INFO_EX *ex_switch_0;
    2548           0 :                 ex_switch_0 = (union PAC_UPN_DNS_INFO_EX *)pyrpc_export_union(&PAC_UPN_DNS_INFO_EX_Type, pytalloc_get_mem_ctx(py_obj), object->flags & PAC_UPN_DNS_FLAG_HAS_SAM_NAME_AND_SID, value, "union PAC_UPN_DNS_INFO_EX");
    2549           0 :                 if (ex_switch_0 == NULL) {
    2550           0 :                         return -1;
    2551             :                 }
    2552           0 :                 object->ex = *ex_switch_0;
    2553             :         }
    2554           0 :         return 0;
    2555             : }
    2556             : 
    2557             : static PyGetSetDef py_PAC_UPN_DNS_INFO_getsetters[] = {
    2558             :         {
    2559             :                 .name = discard_const_p(char, "upn_name_size"),
    2560             :                 .get = py_PAC_UPN_DNS_INFO_get_upn_name_size,
    2561             :                 .set = py_PAC_UPN_DNS_INFO_set_upn_name_size,
    2562             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
    2563             :         },
    2564             :         {
    2565             :                 .name = discard_const_p(char, "upn_name"),
    2566             :                 .get = py_PAC_UPN_DNS_INFO_get_upn_name,
    2567             :                 .set = py_PAC_UPN_DNS_INFO_set_upn_name,
    2568             :                 .doc = discard_const_p(char, "PIDL-generated element of base type string")
    2569             :         },
    2570             :         {
    2571             :                 .name = discard_const_p(char, "dns_domain_name_size"),
    2572             :                 .get = py_PAC_UPN_DNS_INFO_get_dns_domain_name_size,
    2573             :                 .set = py_PAC_UPN_DNS_INFO_set_dns_domain_name_size,
    2574             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
    2575             :         },
    2576             :         {
    2577             :                 .name = discard_const_p(char, "dns_domain_name"),
    2578             :                 .get = py_PAC_UPN_DNS_INFO_get_dns_domain_name,
    2579             :                 .set = py_PAC_UPN_DNS_INFO_set_dns_domain_name,
    2580             :                 .doc = discard_const_p(char, "PIDL-generated element of base type string")
    2581             :         },
    2582             :         {
    2583             :                 .name = discard_const_p(char, "flags"),
    2584             :                 .get = py_PAC_UPN_DNS_INFO_get_flags,
    2585             :                 .set = py_PAC_UPN_DNS_INFO_set_flags,
    2586             :                 .doc = discard_const_p(char, "PIDL-generated element of base type PAC_UPN_DNS_FLAGS")
    2587             :         },
    2588             :         {
    2589             :                 .name = discard_const_p(char, "ex"),
    2590             :                 .get = py_PAC_UPN_DNS_INFO_get_ex,
    2591             :                 .set = py_PAC_UPN_DNS_INFO_set_ex,
    2592             :                 .doc = discard_const_p(char, "PIDL-generated element of base type PAC_UPN_DNS_INFO_EX")
    2593             :         },
    2594             :         { .name = NULL }
    2595             : };
    2596             : 
    2597           0 : static PyObject *py_PAC_UPN_DNS_INFO_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    2598             : {
    2599           0 :         return pytalloc_new(struct PAC_UPN_DNS_INFO, type);
    2600             : }
    2601             : 
    2602             : 
    2603             : static PyTypeObject PAC_UPN_DNS_INFO_Type = {
    2604             :         PyVarObject_HEAD_INIT(NULL, 0)
    2605             :         .tp_name = "krb5pac.PAC_UPN_DNS_INFO",
    2606             :         .tp_getset = py_PAC_UPN_DNS_INFO_getsetters,
    2607             :         .tp_methods = NULL,
    2608             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    2609             :         .tp_new = py_PAC_UPN_DNS_INFO_new,
    2610             : };
    2611             : 
    2612             : 
    2613         117 : static PyObject *py_PAC_ATTRIBUTES_INFO_get_flags_length(PyObject *obj, void *closure)
    2614             : {
    2615         117 :         struct PAC_ATTRIBUTES_INFO *object = (struct PAC_ATTRIBUTES_INFO *)pytalloc_get_ptr(obj);
    2616             :         PyObject *py_flags_length;
    2617         117 :         py_flags_length = PyLong_FromUnsignedLongLong((uint32_t)object->flags_length);
    2618         117 :         return py_flags_length;
    2619             : }
    2620             : 
    2621           0 : static int py_PAC_ATTRIBUTES_INFO_set_flags_length(PyObject *py_obj, PyObject *value, void *closure)
    2622             : {
    2623           0 :         struct PAC_ATTRIBUTES_INFO *object = (struct PAC_ATTRIBUTES_INFO *)pytalloc_get_ptr(py_obj);
    2624           0 :         if (value == NULL) {
    2625           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->flags_length");
    2626           0 :                 return -1;
    2627             :         }
    2628             :         {
    2629           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->flags_length));
    2630           0 :                 if (PyLong_Check(value)) {
    2631             :                         unsigned long long test_var;
    2632           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    2633           0 :                         if (PyErr_Occurred() != NULL) {
    2634           0 :                                 return -1;
    2635             :                         }
    2636           0 :                         if (test_var > uint_max) {
    2637           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    2638             :                                   PyLong_Type.tp_name, uint_max, test_var);
    2639           0 :                                 return -1;
    2640             :                         }
    2641           0 :                         object->flags_length = test_var;
    2642             :                 } else {
    2643           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    2644             :                           PyLong_Type.tp_name);
    2645           0 :                         return -1;
    2646             :                 }
    2647             :         }
    2648           0 :         return 0;
    2649             : }
    2650             : 
    2651         117 : static PyObject *py_PAC_ATTRIBUTES_INFO_get_flags(PyObject *obj, void *closure)
    2652             : {
    2653         117 :         struct PAC_ATTRIBUTES_INFO *object = (struct PAC_ATTRIBUTES_INFO *)pytalloc_get_ptr(obj);
    2654             :         PyObject *py_flags;
    2655         117 :         py_flags = PyLong_FromUnsignedLongLong((uint32_t)object->flags);
    2656         117 :         return py_flags;
    2657             : }
    2658             : 
    2659           0 : static int py_PAC_ATTRIBUTES_INFO_set_flags(PyObject *py_obj, PyObject *value, void *closure)
    2660             : {
    2661           0 :         struct PAC_ATTRIBUTES_INFO *object = (struct PAC_ATTRIBUTES_INFO *)pytalloc_get_ptr(py_obj);
    2662           0 :         if (value == NULL) {
    2663           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->flags");
    2664           0 :                 return -1;
    2665             :         }
    2666             :         {
    2667           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->flags));
    2668           0 :                 if (PyLong_Check(value)) {
    2669             :                         unsigned long long test_var;
    2670           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    2671           0 :                         if (PyErr_Occurred() != NULL) {
    2672           0 :                                 return -1;
    2673             :                         }
    2674           0 :                         if (test_var > uint_max) {
    2675           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    2676             :                                   PyLong_Type.tp_name, uint_max, test_var);
    2677           0 :                                 return -1;
    2678             :                         }
    2679           0 :                         object->flags = test_var;
    2680             :                 } else {
    2681           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    2682             :                           PyLong_Type.tp_name);
    2683           0 :                         return -1;
    2684             :                 }
    2685             :         }
    2686           0 :         return 0;
    2687             : }
    2688             : 
    2689             : static PyGetSetDef py_PAC_ATTRIBUTES_INFO_getsetters[] = {
    2690             :         {
    2691             :                 .name = discard_const_p(char, "flags_length"),
    2692             :                 .get = py_PAC_ATTRIBUTES_INFO_get_flags_length,
    2693             :                 .set = py_PAC_ATTRIBUTES_INFO_set_flags_length,
    2694             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    2695             :         },
    2696             :         {
    2697             :                 .name = discard_const_p(char, "flags"),
    2698             :                 .get = py_PAC_ATTRIBUTES_INFO_get_flags,
    2699             :                 .set = py_PAC_ATTRIBUTES_INFO_set_flags,
    2700             :                 .doc = discard_const_p(char, "PIDL-generated element of base type PAC_ATTRIBUTE_INFO_FLAGS")
    2701             :         },
    2702             :         { .name = NULL }
    2703             : };
    2704             : 
    2705           0 : static PyObject *py_PAC_ATTRIBUTES_INFO_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    2706             : {
    2707           0 :         return pytalloc_new(struct PAC_ATTRIBUTES_INFO, type);
    2708             : }
    2709             : 
    2710             : 
    2711             : static PyTypeObject PAC_ATTRIBUTES_INFO_Type = {
    2712             :         PyVarObject_HEAD_INIT(NULL, 0)
    2713             :         .tp_name = "krb5pac.PAC_ATTRIBUTES_INFO",
    2714             :         .tp_getset = py_PAC_ATTRIBUTES_INFO_getsetters,
    2715             :         .tp_methods = NULL,
    2716             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    2717             :         .tp_new = py_PAC_ATTRIBUTES_INFO_new,
    2718             : };
    2719             : 
    2720             : 
    2721         117 : static PyObject *py_PAC_REQUESTER_SID_get_sid(PyObject *obj, void *closure)
    2722             : {
    2723         117 :         struct PAC_REQUESTER_SID *object = (struct PAC_REQUESTER_SID *)pytalloc_get_ptr(obj);
    2724             :         PyObject *py_sid;
    2725         117 :         py_sid = pytalloc_reference_ex(dom_sid_Type, pytalloc_get_mem_ctx(obj), &object->sid);
    2726         117 :         return py_sid;
    2727             : }
    2728             : 
    2729           0 : static int py_PAC_REQUESTER_SID_set_sid(PyObject *py_obj, PyObject *value, void *closure)
    2730             : {
    2731           0 :         struct PAC_REQUESTER_SID *object = (struct PAC_REQUESTER_SID *)pytalloc_get_ptr(py_obj);
    2732           0 :         if (value == NULL) {
    2733           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->sid");
    2734           0 :                 return -1;
    2735             :         }
    2736           0 :         PY_CHECK_TYPE(dom_sid_Type, value, return -1;);
    2737           0 :         if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
    2738           0 :                 PyErr_NoMemory();
    2739           0 :                 return -1;
    2740             :         }
    2741           0 :         object->sid = *(struct dom_sid *)pytalloc_get_ptr(value);
    2742           0 :         return 0;
    2743             : }
    2744             : 
    2745             : static PyGetSetDef py_PAC_REQUESTER_SID_getsetters[] = {
    2746             :         {
    2747             :                 .name = discard_const_p(char, "sid"),
    2748             :                 .get = py_PAC_REQUESTER_SID_get_sid,
    2749             :                 .set = py_PAC_REQUESTER_SID_set_sid,
    2750             :                 .doc = discard_const_p(char, "PIDL-generated element of base type dom_sid")
    2751             :         },
    2752             :         { .name = NULL }
    2753             : };
    2754             : 
    2755           0 : static PyObject *py_PAC_REQUESTER_SID_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    2756             : {
    2757           0 :         return pytalloc_new(struct PAC_REQUESTER_SID, type);
    2758             : }
    2759             : 
    2760             : 
    2761             : static PyTypeObject PAC_REQUESTER_SID_Type = {
    2762             :         PyVarObject_HEAD_INIT(NULL, 0)
    2763             :         .tp_name = "krb5pac.PAC_REQUESTER_SID",
    2764             :         .tp_getset = py_PAC_REQUESTER_SID_getsetters,
    2765             :         .tp_methods = NULL,
    2766             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    2767             :         .tp_new = py_PAC_REQUESTER_SID_new,
    2768             : };
    2769             : 
    2770             : 
    2771        2602 : static PyObject *py_PAC_LOGON_INFO_CTR_get_info(PyObject *obj, void *closure)
    2772             : {
    2773        2602 :         struct PAC_LOGON_INFO_CTR *object = (struct PAC_LOGON_INFO_CTR *)pytalloc_get_ptr(obj);
    2774             :         PyObject *py_info;
    2775        2602 :         if (object->info == NULL) {
    2776           0 :                 Py_RETURN_NONE;
    2777             :         }
    2778        2602 :         if (object->info == NULL) {
    2779           0 :                 py_info = Py_None;
    2780           0 :                 Py_INCREF(py_info);
    2781             :         } else {
    2782        2602 :                 py_info = pytalloc_reference_ex(&PAC_LOGON_INFO_Type, object->info, object->info);
    2783             :         }
    2784        2602 :         return py_info;
    2785             : }
    2786             : 
    2787           0 : static int py_PAC_LOGON_INFO_CTR_set_info(PyObject *py_obj, PyObject *value, void *closure)
    2788             : {
    2789           0 :         struct PAC_LOGON_INFO_CTR *object = (struct PAC_LOGON_INFO_CTR *)pytalloc_get_ptr(py_obj);
    2790           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->info));
    2791           0 :         if (value == NULL) {
    2792           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->info");
    2793           0 :                 return -1;
    2794             :         }
    2795           0 :         if (value == Py_None) {
    2796           0 :                 object->info = NULL;
    2797             :         } else {
    2798           0 :                 object->info = NULL;
    2799           0 :                 PY_CHECK_TYPE(&PAC_LOGON_INFO_Type, value, return -1;);
    2800           0 :                 if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
    2801           0 :                         PyErr_NoMemory();
    2802           0 :                         return -1;
    2803             :                 }
    2804           0 :                 object->info = (struct PAC_LOGON_INFO *)pytalloc_get_ptr(value);
    2805             :         }
    2806           0 :         return 0;
    2807             : }
    2808             : 
    2809             : static PyGetSetDef py_PAC_LOGON_INFO_CTR_getsetters[] = {
    2810             :         {
    2811             :                 .name = discard_const_p(char, "info"),
    2812             :                 .get = py_PAC_LOGON_INFO_CTR_get_info,
    2813             :                 .set = py_PAC_LOGON_INFO_CTR_set_info,
    2814             :                 .doc = discard_const_p(char, "PIDL-generated element of base type PAC_LOGON_INFO")
    2815             :         },
    2816             :         { .name = NULL }
    2817             : };
    2818             : 
    2819           0 : static PyObject *py_PAC_LOGON_INFO_CTR_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    2820             : {
    2821           0 :         return pytalloc_new(struct PAC_LOGON_INFO_CTR, type);
    2822             : }
    2823             : 
    2824           0 : static PyObject *py_PAC_LOGON_INFO_CTR_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
    2825             : {
    2826           0 :         struct PAC_LOGON_INFO_CTR *object = (struct PAC_LOGON_INFO_CTR *)pytalloc_get_ptr(py_obj);
    2827           0 :         PyObject *ret = NULL;
    2828             :         DATA_BLOB blob;
    2829             :         enum ndr_err_code err;
    2830           0 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
    2831           0 :         if (tmp_ctx == NULL) {
    2832           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    2833           0 :                 return NULL;
    2834             :         }
    2835           0 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_PAC_LOGON_INFO_CTR);
    2836           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    2837           0 :                 TALLOC_FREE(tmp_ctx);
    2838           0 :                 PyErr_SetNdrError(err);
    2839           0 :                 return NULL;
    2840             :         }
    2841             : 
    2842           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    2843           0 :         TALLOC_FREE(tmp_ctx);
    2844           0 :         return ret;
    2845             : }
    2846             : 
    2847           0 : static PyObject *py_PAC_LOGON_INFO_CTR_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    2848             : {
    2849           0 :         struct PAC_LOGON_INFO_CTR *object = (struct PAC_LOGON_INFO_CTR *)pytalloc_get_ptr(py_obj);
    2850           0 :         DATA_BLOB blob = {.data = NULL, .length = 0};
    2851           0 :         Py_ssize_t blob_length = 0;
    2852             :         enum ndr_err_code err;
    2853           0 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
    2854           0 :         PyObject *allow_remaining_obj = NULL;
    2855           0 :         bool allow_remaining = false;
    2856             : 
    2857           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
    2858             :                 discard_const_p(char *, kwnames),
    2859             :                 &blob.data, &blob_length,
    2860             :                 &allow_remaining_obj)) {
    2861           0 :                 return NULL;
    2862             :         }
    2863           0 :         blob.length = blob_length;
    2864             : 
    2865           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    2866           0 :                 allow_remaining = true;
    2867             :         }
    2868             : 
    2869           0 :         if (allow_remaining) {
    2870           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_LOGON_INFO_CTR);
    2871             :         } else {
    2872           0 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_LOGON_INFO_CTR);
    2873             :         }
    2874           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    2875           0 :                 PyErr_SetNdrError(err);
    2876           0 :                 return NULL;
    2877             :         }
    2878             : 
    2879           0 :         Py_RETURN_NONE;
    2880             : }
    2881             : 
    2882           0 : static PyObject *py_PAC_LOGON_INFO_CTR_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    2883             : {
    2884           0 :         struct PAC_LOGON_INFO_CTR *object = (struct PAC_LOGON_INFO_CTR *)pytalloc_get_ptr(py_obj);
    2885             :         PyObject *ret;
    2886             :         char *retstr;
    2887             : 
    2888           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_PAC_LOGON_INFO_CTR, "PAC_LOGON_INFO_CTR", object);
    2889           0 :         ret = PyUnicode_FromString(retstr);
    2890           0 :         talloc_free(retstr);
    2891             : 
    2892           0 :         return ret;
    2893             : }
    2894             : 
    2895             : static PyMethodDef py_PAC_LOGON_INFO_CTR_methods[] = {
    2896             :         { "__ndr_pack__", (PyCFunction)py_PAC_LOGON_INFO_CTR_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
    2897             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PAC_LOGON_INFO_CTR_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
    2898             :         { "__ndr_print__", (PyCFunction)py_PAC_LOGON_INFO_CTR_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
    2899             :         { NULL, NULL, 0, NULL }
    2900             : };
    2901             : 
    2902             : 
    2903             : static PyTypeObject PAC_LOGON_INFO_CTR_Type = {
    2904             :         PyVarObject_HEAD_INIT(NULL, 0)
    2905             :         .tp_name = "krb5pac.PAC_LOGON_INFO_CTR",
    2906             :         .tp_getset = py_PAC_LOGON_INFO_CTR_getsetters,
    2907             :         .tp_methods = py_PAC_LOGON_INFO_CTR_methods,
    2908             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    2909             :         .tp_new = py_PAC_LOGON_INFO_CTR_new,
    2910             : };
    2911             : 
    2912             : 
    2913          35 : static PyObject *py_PAC_CONSTRAINED_DELEGATION_CTR_get_info(PyObject *obj, void *closure)
    2914             : {
    2915          35 :         struct PAC_CONSTRAINED_DELEGATION_CTR *object = (struct PAC_CONSTRAINED_DELEGATION_CTR *)pytalloc_get_ptr(obj);
    2916             :         PyObject *py_info;
    2917          35 :         if (object->info == NULL) {
    2918           0 :                 Py_RETURN_NONE;
    2919             :         }
    2920          35 :         if (object->info == NULL) {
    2921           0 :                 py_info = Py_None;
    2922           0 :                 Py_INCREF(py_info);
    2923             :         } else {
    2924          35 :                 py_info = pytalloc_reference_ex(&PAC_CONSTRAINED_DELEGATION_Type, object->info, object->info);
    2925             :         }
    2926          35 :         return py_info;
    2927             : }
    2928             : 
    2929           4 : static int py_PAC_CONSTRAINED_DELEGATION_CTR_set_info(PyObject *py_obj, PyObject *value, void *closure)
    2930             : {
    2931           4 :         struct PAC_CONSTRAINED_DELEGATION_CTR *object = (struct PAC_CONSTRAINED_DELEGATION_CTR *)pytalloc_get_ptr(py_obj);
    2932           4 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->info));
    2933           4 :         if (value == NULL) {
    2934           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->info");
    2935           0 :                 return -1;
    2936             :         }
    2937           4 :         if (value == Py_None) {
    2938           0 :                 object->info = NULL;
    2939             :         } else {
    2940           4 :                 object->info = NULL;
    2941           4 :                 PY_CHECK_TYPE(&PAC_CONSTRAINED_DELEGATION_Type, value, return -1;);
    2942           4 :                 if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
    2943           0 :                         PyErr_NoMemory();
    2944           0 :                         return -1;
    2945             :                 }
    2946           4 :                 object->info = (struct PAC_CONSTRAINED_DELEGATION *)pytalloc_get_ptr(value);
    2947             :         }
    2948           4 :         return 0;
    2949             : }
    2950             : 
    2951             : static PyGetSetDef py_PAC_CONSTRAINED_DELEGATION_CTR_getsetters[] = {
    2952             :         {
    2953             :                 .name = discard_const_p(char, "info"),
    2954             :                 .get = py_PAC_CONSTRAINED_DELEGATION_CTR_get_info,
    2955             :                 .set = py_PAC_CONSTRAINED_DELEGATION_CTR_set_info,
    2956             :                 .doc = discard_const_p(char, "PIDL-generated element of base type PAC_CONSTRAINED_DELEGATION")
    2957             :         },
    2958             :         { .name = NULL }
    2959             : };
    2960             : 
    2961           4 : static PyObject *py_PAC_CONSTRAINED_DELEGATION_CTR_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    2962             : {
    2963           4 :         return pytalloc_new(struct PAC_CONSTRAINED_DELEGATION_CTR, type);
    2964             : }
    2965             : 
    2966           0 : static PyObject *py_PAC_CONSTRAINED_DELEGATION_CTR_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
    2967             : {
    2968           0 :         struct PAC_CONSTRAINED_DELEGATION_CTR *object = (struct PAC_CONSTRAINED_DELEGATION_CTR *)pytalloc_get_ptr(py_obj);
    2969           0 :         PyObject *ret = NULL;
    2970             :         DATA_BLOB blob;
    2971             :         enum ndr_err_code err;
    2972           0 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
    2973           0 :         if (tmp_ctx == NULL) {
    2974           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    2975           0 :                 return NULL;
    2976             :         }
    2977           0 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_PAC_CONSTRAINED_DELEGATION_CTR);
    2978           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    2979           0 :                 TALLOC_FREE(tmp_ctx);
    2980           0 :                 PyErr_SetNdrError(err);
    2981           0 :                 return NULL;
    2982             :         }
    2983             : 
    2984           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    2985           0 :         TALLOC_FREE(tmp_ctx);
    2986           0 :         return ret;
    2987             : }
    2988             : 
    2989           0 : static PyObject *py_PAC_CONSTRAINED_DELEGATION_CTR_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    2990             : {
    2991           0 :         struct PAC_CONSTRAINED_DELEGATION_CTR *object = (struct PAC_CONSTRAINED_DELEGATION_CTR *)pytalloc_get_ptr(py_obj);
    2992           0 :         DATA_BLOB blob = {.data = NULL, .length = 0};
    2993           0 :         Py_ssize_t blob_length = 0;
    2994             :         enum ndr_err_code err;
    2995           0 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
    2996           0 :         PyObject *allow_remaining_obj = NULL;
    2997           0 :         bool allow_remaining = false;
    2998             : 
    2999           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
    3000             :                 discard_const_p(char *, kwnames),
    3001             :                 &blob.data, &blob_length,
    3002             :                 &allow_remaining_obj)) {
    3003           0 :                 return NULL;
    3004             :         }
    3005           0 :         blob.length = blob_length;
    3006             : 
    3007           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    3008           0 :                 allow_remaining = true;
    3009             :         }
    3010             : 
    3011           0 :         if (allow_remaining) {
    3012           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_CONSTRAINED_DELEGATION_CTR);
    3013             :         } else {
    3014           0 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_CONSTRAINED_DELEGATION_CTR);
    3015             :         }
    3016           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    3017           0 :                 PyErr_SetNdrError(err);
    3018           0 :                 return NULL;
    3019             :         }
    3020             : 
    3021           0 :         Py_RETURN_NONE;
    3022             : }
    3023             : 
    3024           0 : static PyObject *py_PAC_CONSTRAINED_DELEGATION_CTR_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    3025             : {
    3026           0 :         struct PAC_CONSTRAINED_DELEGATION_CTR *object = (struct PAC_CONSTRAINED_DELEGATION_CTR *)pytalloc_get_ptr(py_obj);
    3027             :         PyObject *ret;
    3028             :         char *retstr;
    3029             : 
    3030           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_PAC_CONSTRAINED_DELEGATION_CTR, "PAC_CONSTRAINED_DELEGATION_CTR", object);
    3031           0 :         ret = PyUnicode_FromString(retstr);
    3032           0 :         talloc_free(retstr);
    3033             : 
    3034           0 :         return ret;
    3035             : }
    3036             : 
    3037             : static PyMethodDef py_PAC_CONSTRAINED_DELEGATION_CTR_methods[] = {
    3038             :         { "__ndr_pack__", (PyCFunction)py_PAC_CONSTRAINED_DELEGATION_CTR_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
    3039             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PAC_CONSTRAINED_DELEGATION_CTR_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
    3040             :         { "__ndr_print__", (PyCFunction)py_PAC_CONSTRAINED_DELEGATION_CTR_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
    3041             :         { NULL, NULL, 0, NULL }
    3042             : };
    3043             : 
    3044             : 
    3045             : static PyTypeObject PAC_CONSTRAINED_DELEGATION_CTR_Type = {
    3046             :         PyVarObject_HEAD_INIT(NULL, 0)
    3047             :         .tp_name = "krb5pac.PAC_CONSTRAINED_DELEGATION_CTR",
    3048             :         .tp_getset = py_PAC_CONSTRAINED_DELEGATION_CTR_getsetters,
    3049             :         .tp_methods = py_PAC_CONSTRAINED_DELEGATION_CTR_methods,
    3050             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    3051             :         .tp_new = py_PAC_CONSTRAINED_DELEGATION_CTR_new,
    3052             : };
    3053             : 
    3054             : 
    3055        6570 : static PyObject *py_DATA_BLOB_REM_get_remaining(PyObject *obj, void *closure)
    3056             : {
    3057        6570 :         struct DATA_BLOB_REM *object = (struct DATA_BLOB_REM *)pytalloc_get_ptr(obj);
    3058             :         PyObject *py_remaining;
    3059        6570 :         py_remaining = PyBytes_FromStringAndSize((char *)(object->remaining).data, (object->remaining).length);
    3060        6570 :         return py_remaining;
    3061             : }
    3062             : 
    3063        6570 : static int py_DATA_BLOB_REM_set_remaining(PyObject *py_obj, PyObject *value, void *closure)
    3064             : {
    3065        6570 :         struct DATA_BLOB_REM *object = (struct DATA_BLOB_REM *)pytalloc_get_ptr(py_obj);
    3066        6570 :         if (value == NULL) {
    3067           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->remaining");
    3068           0 :                 return -1;
    3069             :         }
    3070        6570 :         object->remaining = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
    3071        6570 :         return 0;
    3072             : }
    3073             : 
    3074             : static PyGetSetDef py_DATA_BLOB_REM_getsetters[] = {
    3075             :         {
    3076             :                 .name = discard_const_p(char, "remaining"),
    3077             :                 .get = py_DATA_BLOB_REM_get_remaining,
    3078             :                 .set = py_DATA_BLOB_REM_set_remaining,
    3079             :                 .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
    3080             :         },
    3081             :         { .name = NULL }
    3082             : };
    3083             : 
    3084           0 : static PyObject *py_DATA_BLOB_REM_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    3085             : {
    3086           0 :         return pytalloc_new(struct DATA_BLOB_REM, type);
    3087             : }
    3088             : 
    3089             : 
    3090             : static PyTypeObject DATA_BLOB_REM_Type = {
    3091             :         PyVarObject_HEAD_INIT(NULL, 0)
    3092             :         .tp_name = "krb5pac.DATA_BLOB_REM",
    3093             :         .tp_getset = py_DATA_BLOB_REM_getsetters,
    3094             :         .tp_methods = NULL,
    3095             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    3096             :         .tp_new = py_DATA_BLOB_REM_new,
    3097             : };
    3098             : 
    3099       24815 : static PyObject *py_import_PAC_INFO(TALLOC_CTX *mem_ctx, int level, union PAC_INFO *in)
    3100             : {
    3101             :         PyObject *ret;
    3102             : 
    3103       24815 :         switch (level) {
    3104        2602 :                 case PAC_TYPE_LOGON_INFO:
    3105        2602 :                         ret = pytalloc_reference_ex(&PAC_LOGON_INFO_CTR_Type, mem_ctx, &in->logon_info);
    3106        2602 :                         return ret;
    3107             : 
    3108           0 :                 case PAC_TYPE_CREDENTIAL_INFO:
    3109           0 :                         ret = pytalloc_reference_ex(&PAC_CREDENTIAL_INFO_Type, mem_ctx, &in->credential_info);
    3110           0 :                         return ret;
    3111             : 
    3112        5692 :                 case PAC_TYPE_SRV_CHECKSUM:
    3113        5692 :                         ret = pytalloc_reference_ex(&PAC_SIGNATURE_DATA_Type, mem_ctx, &in->srv_cksum);
    3114        5692 :                         return ret;
    3115             : 
    3116        5695 :                 case PAC_TYPE_KDC_CHECKSUM:
    3117        5695 :                         ret = pytalloc_reference_ex(&PAC_SIGNATURE_DATA_Type, mem_ctx, &in->kdc_cksum);
    3118        5695 :                         return ret;
    3119             : 
    3120        2602 :                 case PAC_TYPE_LOGON_NAME:
    3121        2602 :                         ret = pytalloc_reference_ex(&PAC_LOGON_NAME_Type, mem_ctx, &in->logon_name);
    3122        2602 :                         return ret;
    3123             : 
    3124          35 :                 case PAC_TYPE_CONSTRAINED_DELEGATION:
    3125          35 :                         ret = pytalloc_reference_ex(&PAC_CONSTRAINED_DELEGATION_CTR_Type, mem_ctx, &in->constrained_delegation);
    3126          35 :                         return ret;
    3127             : 
    3128        2602 :                 case PAC_TYPE_UPN_DNS_INFO:
    3129        2602 :                         ret = pytalloc_reference_ex(&PAC_UPN_DNS_INFO_Type, mem_ctx, &in->upn_dns_info);
    3130        2602 :                         return ret;
    3131             : 
    3132        2652 :                 case PAC_TYPE_TICKET_CHECKSUM:
    3133        2652 :                         ret = pytalloc_reference_ex(&PAC_SIGNATURE_DATA_Type, mem_ctx, &in->ticket_checksum);
    3134        2652 :                         return ret;
    3135             : 
    3136         117 :                 case PAC_TYPE_ATTRIBUTES_INFO:
    3137         117 :                         ret = pytalloc_reference_ex(&PAC_ATTRIBUTES_INFO_Type, mem_ctx, &in->attributes_info);
    3138         117 :                         return ret;
    3139             : 
    3140         117 :                 case PAC_TYPE_REQUESTER_SID:
    3141         117 :                         ret = pytalloc_reference_ex(&PAC_REQUESTER_SID_Type, mem_ctx, &in->requester_sid);
    3142         117 :                         return ret;
    3143             : 
    3144        2701 :                 case PAC_TYPE_FULL_CHECKSUM:
    3145        2701 :                         ret = pytalloc_reference_ex(&PAC_SIGNATURE_DATA_Type, mem_ctx, &in->full_checksum);
    3146        2701 :                         return ret;
    3147             : 
    3148           0 :                 default:
    3149           0 :                         ret = pytalloc_reference_ex(&DATA_BLOB_REM_Type, mem_ctx, &in->unknown);
    3150           0 :                         return ret;
    3151             : 
    3152             :         }
    3153             :         PyErr_SetString(PyExc_TypeError, "unknown union level");
    3154             :         return NULL;
    3155             : }
    3156             : 
    3157          28 : static union PAC_INFO *py_export_PAC_INFO(TALLOC_CTX *mem_ctx, int level, PyObject *in)
    3158             : {
    3159          28 :         union PAC_INFO *ret = talloc_zero(mem_ctx, union PAC_INFO);
    3160          28 :         switch (level) {
    3161           0 :                 case PAC_TYPE_LOGON_INFO:
    3162           0 :                         if (in == NULL) {
    3163           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->logon_info");
    3164           0 :                                 talloc_free(ret); return NULL;
    3165             :                         }
    3166           0 :                         PY_CHECK_TYPE(&PAC_LOGON_INFO_CTR_Type, in, talloc_free(ret); return NULL;);
    3167           0 :                         if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
    3168           0 :                                 PyErr_NoMemory();
    3169           0 :                                 talloc_free(ret); return NULL;
    3170             :                         }
    3171           0 :                         ret->logon_info = *(struct PAC_LOGON_INFO_CTR *)pytalloc_get_ptr(in);
    3172           0 :                         break;
    3173             : 
    3174           0 :                 case PAC_TYPE_CREDENTIAL_INFO:
    3175           0 :                         if (in == NULL) {
    3176           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->credential_info");
    3177           0 :                                 talloc_free(ret); return NULL;
    3178             :                         }
    3179           0 :                         PY_CHECK_TYPE(&PAC_CREDENTIAL_INFO_Type, in, talloc_free(ret); return NULL;);
    3180           0 :                         if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
    3181           0 :                                 PyErr_NoMemory();
    3182           0 :                                 talloc_free(ret); return NULL;
    3183             :                         }
    3184           0 :                         ret->credential_info = *(struct PAC_CREDENTIAL_INFO *)pytalloc_get_ptr(in);
    3185           0 :                         break;
    3186             : 
    3187           0 :                 case PAC_TYPE_SRV_CHECKSUM:
    3188           0 :                         if (in == NULL) {
    3189           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->srv_cksum");
    3190           0 :                                 talloc_free(ret); return NULL;
    3191             :                         }
    3192           0 :                         PY_CHECK_TYPE(&PAC_SIGNATURE_DATA_Type, in, talloc_free(ret); return NULL;);
    3193           0 :                         if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
    3194           0 :                                 PyErr_NoMemory();
    3195           0 :                                 talloc_free(ret); return NULL;
    3196             :                         }
    3197           0 :                         ret->srv_cksum = *(struct PAC_SIGNATURE_DATA *)pytalloc_get_ptr(in);
    3198           0 :                         break;
    3199             : 
    3200           0 :                 case PAC_TYPE_KDC_CHECKSUM:
    3201           0 :                         if (in == NULL) {
    3202           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->kdc_cksum");
    3203           0 :                                 talloc_free(ret); return NULL;
    3204             :                         }
    3205           0 :                         PY_CHECK_TYPE(&PAC_SIGNATURE_DATA_Type, in, talloc_free(ret); return NULL;);
    3206           0 :                         if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
    3207           0 :                                 PyErr_NoMemory();
    3208           0 :                                 talloc_free(ret); return NULL;
    3209             :                         }
    3210           0 :                         ret->kdc_cksum = *(struct PAC_SIGNATURE_DATA *)pytalloc_get_ptr(in);
    3211           0 :                         break;
    3212             : 
    3213           0 :                 case PAC_TYPE_LOGON_NAME:
    3214           0 :                         if (in == NULL) {
    3215           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->logon_name");
    3216           0 :                                 talloc_free(ret); return NULL;
    3217             :                         }
    3218           0 :                         PY_CHECK_TYPE(&PAC_LOGON_NAME_Type, in, talloc_free(ret); return NULL;);
    3219           0 :                         if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
    3220           0 :                                 PyErr_NoMemory();
    3221           0 :                                 talloc_free(ret); return NULL;
    3222             :                         }
    3223           0 :                         ret->logon_name = *(struct PAC_LOGON_NAME *)pytalloc_get_ptr(in);
    3224           0 :                         break;
    3225             : 
    3226           4 :                 case PAC_TYPE_CONSTRAINED_DELEGATION:
    3227           4 :                         if (in == NULL) {
    3228           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->constrained_delegation");
    3229           0 :                                 talloc_free(ret); return NULL;
    3230             :                         }
    3231           4 :                         PY_CHECK_TYPE(&PAC_CONSTRAINED_DELEGATION_CTR_Type, in, talloc_free(ret); return NULL;);
    3232           4 :                         if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
    3233           0 :                                 PyErr_NoMemory();
    3234           0 :                                 talloc_free(ret); return NULL;
    3235             :                         }
    3236           4 :                         ret->constrained_delegation = *(struct PAC_CONSTRAINED_DELEGATION_CTR *)pytalloc_get_ptr(in);
    3237           4 :                         break;
    3238             : 
    3239           0 :                 case PAC_TYPE_UPN_DNS_INFO:
    3240           0 :                         if (in == NULL) {
    3241           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->upn_dns_info");
    3242           0 :                                 talloc_free(ret); return NULL;
    3243             :                         }
    3244           0 :                         PY_CHECK_TYPE(&PAC_UPN_DNS_INFO_Type, in, talloc_free(ret); return NULL;);
    3245           0 :                         if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
    3246           0 :                                 PyErr_NoMemory();
    3247           0 :                                 talloc_free(ret); return NULL;
    3248             :                         }
    3249           0 :                         ret->upn_dns_info = *(struct PAC_UPN_DNS_INFO *)pytalloc_get_ptr(in);
    3250           0 :                         break;
    3251             : 
    3252          15 :                 case PAC_TYPE_TICKET_CHECKSUM:
    3253          15 :                         if (in == NULL) {
    3254           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->ticket_checksum");
    3255           0 :                                 talloc_free(ret); return NULL;
    3256             :                         }
    3257          15 :                         PY_CHECK_TYPE(&PAC_SIGNATURE_DATA_Type, in, talloc_free(ret); return NULL;);
    3258          15 :                         if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
    3259           0 :                                 PyErr_NoMemory();
    3260           0 :                                 talloc_free(ret); return NULL;
    3261             :                         }
    3262          15 :                         ret->ticket_checksum = *(struct PAC_SIGNATURE_DATA *)pytalloc_get_ptr(in);
    3263          15 :                         break;
    3264             : 
    3265           0 :                 case PAC_TYPE_ATTRIBUTES_INFO:
    3266           0 :                         if (in == NULL) {
    3267           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->attributes_info");
    3268           0 :                                 talloc_free(ret); return NULL;
    3269             :                         }
    3270           0 :                         PY_CHECK_TYPE(&PAC_ATTRIBUTES_INFO_Type, in, talloc_free(ret); return NULL;);
    3271           0 :                         if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
    3272           0 :                                 PyErr_NoMemory();
    3273           0 :                                 talloc_free(ret); return NULL;
    3274             :                         }
    3275           0 :                         ret->attributes_info = *(struct PAC_ATTRIBUTES_INFO *)pytalloc_get_ptr(in);
    3276           0 :                         break;
    3277             : 
    3278           0 :                 case PAC_TYPE_REQUESTER_SID:
    3279           0 :                         if (in == NULL) {
    3280           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->requester_sid");
    3281           0 :                                 talloc_free(ret); return NULL;
    3282             :                         }
    3283           0 :                         PY_CHECK_TYPE(&PAC_REQUESTER_SID_Type, in, talloc_free(ret); return NULL;);
    3284           0 :                         if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
    3285           0 :                                 PyErr_NoMemory();
    3286           0 :                                 talloc_free(ret); return NULL;
    3287             :                         }
    3288           0 :                         ret->requester_sid = *(struct PAC_REQUESTER_SID *)pytalloc_get_ptr(in);
    3289           0 :                         break;
    3290             : 
    3291           9 :                 case PAC_TYPE_FULL_CHECKSUM:
    3292           9 :                         if (in == NULL) {
    3293           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->full_checksum");
    3294           0 :                                 talloc_free(ret); return NULL;
    3295             :                         }
    3296           9 :                         PY_CHECK_TYPE(&PAC_SIGNATURE_DATA_Type, in, talloc_free(ret); return NULL;);
    3297           9 :                         if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
    3298           0 :                                 PyErr_NoMemory();
    3299           0 :                                 talloc_free(ret); return NULL;
    3300             :                         }
    3301           9 :                         ret->full_checksum = *(struct PAC_SIGNATURE_DATA *)pytalloc_get_ptr(in);
    3302           9 :                         break;
    3303             : 
    3304           0 :                 default:
    3305           0 :                         if (in == NULL) {
    3306           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->unknown");
    3307           0 :                                 talloc_free(ret); return NULL;
    3308             :                         }
    3309           0 :                         PY_CHECK_TYPE(&DATA_BLOB_REM_Type, in, talloc_free(ret); return NULL;);
    3310           0 :                         if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
    3311           0 :                                 PyErr_NoMemory();
    3312           0 :                                 talloc_free(ret); return NULL;
    3313             :                         }
    3314           0 :                         ret->unknown = *(struct DATA_BLOB_REM *)pytalloc_get_ptr(in);
    3315           0 :                         break;
    3316             : 
    3317             :         }
    3318             : 
    3319          28 :         return ret;
    3320             : }
    3321             : 
    3322       24815 : static PyObject *py_PAC_INFO_import(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    3323             : {
    3324       24815 :         const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
    3325       24815 :         PyObject *mem_ctx_obj = NULL;
    3326       24815 :         TALLOC_CTX *mem_ctx = NULL;
    3327       24815 :         int level = 0;
    3328       24815 :         PyObject *in_obj = NULL;
    3329       24815 :         union PAC_INFO *in = NULL;
    3330             : 
    3331       24815 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:import",
    3332             :                 discard_const_p(char *, kwnames),
    3333             :                 &mem_ctx_obj,
    3334             :                 &level,
    3335             :                 &in_obj)) {
    3336           0 :                 return NULL;
    3337             :         }
    3338       24815 :         mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
    3339       24815 :         if (mem_ctx == NULL) {
    3340           0 :                 PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
    3341           0 :                 return NULL;
    3342             :         }
    3343       24815 :         in = (union PAC_INFO *)pytalloc_get_ptr(in_obj);
    3344       24815 :         if (in == NULL) {
    3345           0 :                 PyErr_Format(PyExc_TypeError, "in needs to be a pointer to union PAC_INFO!");
    3346           0 :                 return NULL;
    3347             :         }
    3348             : 
    3349       24815 :         return py_import_PAC_INFO(mem_ctx, level, in);
    3350             : }
    3351             : 
    3352          28 : static PyObject *py_PAC_INFO_export(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    3353             : {
    3354          28 :         const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
    3355          28 :         PyObject *mem_ctx_obj = NULL;
    3356          28 :         TALLOC_CTX *mem_ctx = NULL;
    3357          28 :         int level = 0;
    3358          28 :         PyObject *in = NULL;
    3359          28 :         union PAC_INFO *out = NULL;
    3360             : 
    3361          28 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:export",
    3362             :                 discard_const_p(char *, kwnames),
    3363             :                 &mem_ctx_obj,
    3364             :                 &level,
    3365             :                 &in)) {
    3366           0 :                 return NULL;
    3367             :         }
    3368          28 :         mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
    3369          28 :         if (mem_ctx == NULL) {
    3370           0 :                 PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
    3371           0 :                 return NULL;
    3372             :         }
    3373             : 
    3374          28 :         out = py_export_PAC_INFO(mem_ctx, level, in);
    3375          28 :         if (out == NULL) {
    3376           0 :                 return NULL;
    3377             :         }
    3378             : 
    3379          28 :         return pytalloc_GenericObject_reference(out);
    3380             : }
    3381             : 
    3382             : static PyMethodDef py_PAC_INFO_methods[] = {
    3383             :         { "__import__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PAC_INFO_import),
    3384             :                 METH_VARARGS|METH_KEYWORDS|METH_CLASS,
    3385             :                 "T.__import__(mem_ctx, level, in) => ret." },
    3386             :         { "__export__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PAC_INFO_export),
    3387             :                 METH_VARARGS|METH_KEYWORDS|METH_CLASS,
    3388             :                 "T.__export__(mem_ctx, level, in) => ret." },
    3389             :         { NULL, NULL, 0, NULL }
    3390             : };
    3391             : 
    3392           0 : static PyObject *py_PAC_INFO_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    3393             : {
    3394           0 :         PyErr_Format(PyExc_TypeError, "New %s Objects are not supported", type->tp_name);
    3395           0 :         return NULL;
    3396             : }
    3397             : 
    3398             : 
    3399             : static PyTypeObject PAC_INFO_Type = {
    3400             :         PyVarObject_HEAD_INIT(NULL, 0)
    3401             :         .tp_name = "krb5pac.PAC_INFO",
    3402             :         .tp_getset = NULL,
    3403             :         .tp_methods = py_PAC_INFO_methods,
    3404             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    3405             :         .tp_new = py_PAC_INFO_new,
    3406             : };
    3407             : 
    3408             : 
    3409      104980 : static PyObject *py_PAC_BUFFER_get_type(PyObject *obj, void *closure)
    3410             : {
    3411      104980 :         struct PAC_BUFFER *object = (struct PAC_BUFFER *)pytalloc_get_ptr(obj);
    3412             :         PyObject *py_type;
    3413      104980 :         py_type = PyLong_FromUnsignedLongLong((uint32_t)object->type);
    3414      104980 :         return py_type;
    3415             : }
    3416             : 
    3417          28 : static int py_PAC_BUFFER_set_type(PyObject *py_obj, PyObject *value, void *closure)
    3418             : {
    3419          28 :         struct PAC_BUFFER *object = (struct PAC_BUFFER *)pytalloc_get_ptr(py_obj);
    3420          28 :         if (value == NULL) {
    3421           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->type");
    3422           0 :                 return -1;
    3423             :         }
    3424             :         {
    3425          28 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->type));
    3426          28 :                 if (PyLong_Check(value)) {
    3427             :                         unsigned long long test_var;
    3428          28 :                         test_var = PyLong_AsUnsignedLongLong(value);
    3429          28 :                         if (PyErr_Occurred() != NULL) {
    3430           0 :                                 return -1;
    3431             :                         }
    3432          28 :                         if (test_var > uint_max) {
    3433           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    3434             :                                   PyLong_Type.tp_name, uint_max, test_var);
    3435           0 :                                 return -1;
    3436             :                         }
    3437          28 :                         object->type = test_var;
    3438             :                 } else {
    3439           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    3440             :                           PyLong_Type.tp_name);
    3441           0 :                         return -1;
    3442             :                 }
    3443             :         }
    3444          28 :         return 0;
    3445             : }
    3446             : 
    3447           0 : static PyObject *py_PAC_BUFFER_get__ndr_size(PyObject *obj, void *closure)
    3448             : {
    3449           0 :         struct PAC_BUFFER *object = (struct PAC_BUFFER *)pytalloc_get_ptr(obj);
    3450             :         PyObject *py__ndr_size;
    3451           0 :         py__ndr_size = PyLong_FromUnsignedLongLong((uint32_t)object->_ndr_size);
    3452           0 :         return py__ndr_size;
    3453             : }
    3454             : 
    3455           0 : static int py_PAC_BUFFER_set__ndr_size(PyObject *py_obj, PyObject *value, void *closure)
    3456             : {
    3457           0 :         struct PAC_BUFFER *object = (struct PAC_BUFFER *)pytalloc_get_ptr(py_obj);
    3458           0 :         if (value == NULL) {
    3459           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->_ndr_size");
    3460           0 :                 return -1;
    3461             :         }
    3462             :         {
    3463           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->_ndr_size));
    3464           0 :                 if (PyLong_Check(value)) {
    3465             :                         unsigned long long test_var;
    3466           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    3467           0 :                         if (PyErr_Occurred() != NULL) {
    3468           0 :                                 return -1;
    3469             :                         }
    3470           0 :                         if (test_var > uint_max) {
    3471           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    3472             :                                   PyLong_Type.tp_name, uint_max, test_var);
    3473           0 :                                 return -1;
    3474             :                         }
    3475           0 :                         object->_ndr_size = test_var;
    3476             :                 } else {
    3477           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    3478             :                           PyLong_Type.tp_name);
    3479           0 :                         return -1;
    3480             :                 }
    3481             :         }
    3482           0 :         return 0;
    3483             : }
    3484             : 
    3485       24815 : static PyObject *py_PAC_BUFFER_get_info(PyObject *obj, void *closure)
    3486             : {
    3487       24815 :         struct PAC_BUFFER *object = (struct PAC_BUFFER *)pytalloc_get_ptr(obj);
    3488             :         PyObject *py_info;
    3489       24815 :         if (object->info == NULL) {
    3490           0 :                 Py_RETURN_NONE;
    3491             :         }
    3492       24815 :         if (object->info == NULL) {
    3493           0 :                 py_info = Py_None;
    3494           0 :                 Py_INCREF(py_info);
    3495             :         } else {
    3496       24815 :                 py_info = pyrpc_import_union(&PAC_INFO_Type, object->info, object->type, object->info, "union PAC_INFO");
    3497       24815 :                 if (py_info == NULL) {
    3498           0 :                         return NULL;
    3499             :                 }
    3500             :         }
    3501       24815 :         return py_info;
    3502             : }
    3503             : 
    3504          28 : static int py_PAC_BUFFER_set_info(PyObject *py_obj, PyObject *value, void *closure)
    3505             : {
    3506          28 :         struct PAC_BUFFER *object = (struct PAC_BUFFER *)pytalloc_get_ptr(py_obj);
    3507          28 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->info));
    3508          28 :         if (value == NULL) {
    3509           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->info");
    3510           0 :                 return -1;
    3511             :         }
    3512          28 :         if (value == Py_None) {
    3513           0 :                 object->info = NULL;
    3514             :         } else {
    3515          28 :                 object->info = NULL;
    3516             :                 {
    3517             :                         union PAC_INFO *info_switch_2;
    3518          28 :                         info_switch_2 = (union PAC_INFO *)pyrpc_export_union(&PAC_INFO_Type, pytalloc_get_mem_ctx(py_obj), object->type, value, "union PAC_INFO");
    3519          28 :                         if (info_switch_2 == NULL) {
    3520           0 :                                 return -1;
    3521             :                         }
    3522          28 :                         object->info = info_switch_2;
    3523             :                 }
    3524             :         }
    3525          28 :         return 0;
    3526             : }
    3527             : 
    3528           0 : static PyObject *py_PAC_BUFFER_get__pad(PyObject *obj, void *closure)
    3529             : {
    3530           0 :         struct PAC_BUFFER *object = (struct PAC_BUFFER *)pytalloc_get_ptr(obj);
    3531             :         PyObject *py__pad;
    3532           0 :         py__pad = PyLong_FromUnsignedLongLong((uint32_t)object->_pad);
    3533           0 :         return py__pad;
    3534             : }
    3535             : 
    3536           0 : static int py_PAC_BUFFER_set__pad(PyObject *py_obj, PyObject *value, void *closure)
    3537             : {
    3538           0 :         struct PAC_BUFFER *object = (struct PAC_BUFFER *)pytalloc_get_ptr(py_obj);
    3539           0 :         if (value == NULL) {
    3540           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->_pad");
    3541           0 :                 return -1;
    3542             :         }
    3543             :         {
    3544           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->_pad));
    3545           0 :                 if (PyLong_Check(value)) {
    3546             :                         unsigned long long test_var;
    3547           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    3548           0 :                         if (PyErr_Occurred() != NULL) {
    3549           0 :                                 return -1;
    3550             :                         }
    3551           0 :                         if (test_var > uint_max) {
    3552           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    3553             :                                   PyLong_Type.tp_name, uint_max, test_var);
    3554           0 :                                 return -1;
    3555             :                         }
    3556           0 :                         object->_pad = test_var;
    3557             :                 } else {
    3558           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    3559             :                           PyLong_Type.tp_name);
    3560           0 :                         return -1;
    3561             :                 }
    3562             :         }
    3563           0 :         return 0;
    3564             : }
    3565             : 
    3566             : static PyGetSetDef py_PAC_BUFFER_getsetters[] = {
    3567             :         {
    3568             :                 .name = discard_const_p(char, "type"),
    3569             :                 .get = py_PAC_BUFFER_get_type,
    3570             :                 .set = py_PAC_BUFFER_set_type,
    3571             :                 .doc = discard_const_p(char, "PIDL-generated element of base type PAC_TYPE")
    3572             :         },
    3573             :         {
    3574             :                 .name = discard_const_p(char, "_ndr_size"),
    3575             :                 .get = py_PAC_BUFFER_get__ndr_size,
    3576             :                 .set = py_PAC_BUFFER_set__ndr_size,
    3577             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    3578             :         },
    3579             :         {
    3580             :                 .name = discard_const_p(char, "info"),
    3581             :                 .get = py_PAC_BUFFER_get_info,
    3582             :                 .set = py_PAC_BUFFER_set_info,
    3583             :                 .doc = discard_const_p(char, "PIDL-generated element of base type PAC_INFO")
    3584             :         },
    3585             :         {
    3586             :                 .name = discard_const_p(char, "_pad"),
    3587             :                 .get = py_PAC_BUFFER_get__pad,
    3588             :                 .set = py_PAC_BUFFER_set__pad,
    3589             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    3590             :         },
    3591             :         { .name = NULL }
    3592             : };
    3593             : 
    3594          28 : static PyObject *py_PAC_BUFFER_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    3595             : {
    3596          28 :         return pytalloc_new(struct PAC_BUFFER, type);
    3597             : }
    3598             : 
    3599           0 : static PyObject *py_PAC_BUFFER_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
    3600             : {
    3601           0 :         struct PAC_BUFFER *object = (struct PAC_BUFFER *)pytalloc_get_ptr(py_obj);
    3602           0 :         PyObject *ret = NULL;
    3603             :         DATA_BLOB blob;
    3604             :         enum ndr_err_code err;
    3605           0 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
    3606           0 :         if (tmp_ctx == NULL) {
    3607           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    3608           0 :                 return NULL;
    3609             :         }
    3610           0 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_PAC_BUFFER);
    3611           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    3612           0 :                 TALLOC_FREE(tmp_ctx);
    3613           0 :                 PyErr_SetNdrError(err);
    3614           0 :                 return NULL;
    3615             :         }
    3616             : 
    3617           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    3618           0 :         TALLOC_FREE(tmp_ctx);
    3619           0 :         return ret;
    3620             : }
    3621             : 
    3622           0 : static PyObject *py_PAC_BUFFER_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    3623             : {
    3624           0 :         struct PAC_BUFFER *object = (struct PAC_BUFFER *)pytalloc_get_ptr(py_obj);
    3625           0 :         DATA_BLOB blob = {.data = NULL, .length = 0};
    3626           0 :         Py_ssize_t blob_length = 0;
    3627             :         enum ndr_err_code err;
    3628           0 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
    3629           0 :         PyObject *allow_remaining_obj = NULL;
    3630           0 :         bool allow_remaining = false;
    3631             : 
    3632           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
    3633             :                 discard_const_p(char *, kwnames),
    3634             :                 &blob.data, &blob_length,
    3635             :                 &allow_remaining_obj)) {
    3636           0 :                 return NULL;
    3637             :         }
    3638           0 :         blob.length = blob_length;
    3639             : 
    3640           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    3641           0 :                 allow_remaining = true;
    3642             :         }
    3643             : 
    3644           0 :         if (allow_remaining) {
    3645           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_BUFFER);
    3646             :         } else {
    3647           0 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_BUFFER);
    3648             :         }
    3649           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    3650           0 :                 PyErr_SetNdrError(err);
    3651           0 :                 return NULL;
    3652             :         }
    3653             : 
    3654           0 :         Py_RETURN_NONE;
    3655             : }
    3656             : 
    3657           0 : static PyObject *py_PAC_BUFFER_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    3658             : {
    3659           0 :         struct PAC_BUFFER *object = (struct PAC_BUFFER *)pytalloc_get_ptr(py_obj);
    3660             :         PyObject *ret;
    3661             :         char *retstr;
    3662             : 
    3663           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_PAC_BUFFER, "PAC_BUFFER", object);
    3664           0 :         ret = PyUnicode_FromString(retstr);
    3665           0 :         talloc_free(retstr);
    3666             : 
    3667           0 :         return ret;
    3668             : }
    3669             : 
    3670             : static PyMethodDef py_PAC_BUFFER_methods[] = {
    3671             :         { "__ndr_pack__", (PyCFunction)py_PAC_BUFFER_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
    3672             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PAC_BUFFER_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
    3673             :         { "__ndr_print__", (PyCFunction)py_PAC_BUFFER_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
    3674             :         { NULL, NULL, 0, NULL }
    3675             : };
    3676             : 
    3677             : 
    3678             : static PyTypeObject PAC_BUFFER_Type = {
    3679             :         PyVarObject_HEAD_INIT(NULL, 0)
    3680             :         .tp_name = "krb5pac.PAC_BUFFER",
    3681             :         .tp_getset = py_PAC_BUFFER_getsetters,
    3682             :         .tp_methods = py_PAC_BUFFER_methods,
    3683             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    3684             :         .tp_new = py_PAC_BUFFER_new,
    3685             : };
    3686             : 
    3687             : 
    3688          44 : static PyObject *py_PAC_DATA_get_num_buffers(PyObject *obj, void *closure)
    3689             : {
    3690          44 :         struct PAC_DATA *object = (struct PAC_DATA *)pytalloc_get_ptr(obj);
    3691             :         PyObject *py_num_buffers;
    3692          44 :         py_num_buffers = PyLong_FromUnsignedLongLong((uint32_t)object->num_buffers);
    3693          44 :         return py_num_buffers;
    3694             : }
    3695             : 
    3696          44 : static int py_PAC_DATA_set_num_buffers(PyObject *py_obj, PyObject *value, void *closure)
    3697             : {
    3698          44 :         struct PAC_DATA *object = (struct PAC_DATA *)pytalloc_get_ptr(py_obj);
    3699          44 :         if (value == NULL) {
    3700           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->num_buffers");
    3701           0 :                 return -1;
    3702             :         }
    3703             :         {
    3704          44 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->num_buffers));
    3705          44 :                 if (PyLong_Check(value)) {
    3706             :                         unsigned long long test_var;
    3707          44 :                         test_var = PyLong_AsUnsignedLongLong(value);
    3708          44 :                         if (PyErr_Occurred() != NULL) {
    3709           0 :                                 return -1;
    3710             :                         }
    3711          44 :                         if (test_var > uint_max) {
    3712           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    3713             :                                   PyLong_Type.tp_name, uint_max, test_var);
    3714           0 :                                 return -1;
    3715             :                         }
    3716          44 :                         object->num_buffers = test_var;
    3717             :                 } else {
    3718           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    3719             :                           PyLong_Type.tp_name);
    3720           0 :                         return -1;
    3721             :                 }
    3722             :         }
    3723          44 :         return 0;
    3724             : }
    3725             : 
    3726           0 : static PyObject *py_PAC_DATA_get_version(PyObject *obj, void *closure)
    3727             : {
    3728           0 :         struct PAC_DATA *object = (struct PAC_DATA *)pytalloc_get_ptr(obj);
    3729             :         PyObject *py_version;
    3730           0 :         py_version = PyLong_FromUnsignedLongLong((uint32_t)object->version);
    3731           0 :         return py_version;
    3732             : }
    3733             : 
    3734           0 : static int py_PAC_DATA_set_version(PyObject *py_obj, PyObject *value, void *closure)
    3735             : {
    3736           0 :         struct PAC_DATA *object = (struct PAC_DATA *)pytalloc_get_ptr(py_obj);
    3737           0 :         if (value == NULL) {
    3738           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->version");
    3739           0 :                 return -1;
    3740             :         }
    3741             :         {
    3742           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->version));
    3743           0 :                 if (PyLong_Check(value)) {
    3744             :                         unsigned long long test_var;
    3745           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    3746           0 :                         if (PyErr_Occurred() != NULL) {
    3747           0 :                                 return -1;
    3748             :                         }
    3749           0 :                         if (test_var > uint_max) {
    3750           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    3751             :                                   PyLong_Type.tp_name, uint_max, test_var);
    3752           0 :                                 return -1;
    3753             :                         }
    3754           0 :                         object->version = test_var;
    3755             :                 } else {
    3756           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    3757             :                           PyLong_Type.tp_name);
    3758           0 :                         return -1;
    3759             :                 }
    3760             :         }
    3761           0 :         return 0;
    3762             : }
    3763             : 
    3764        7996 : static PyObject *py_PAC_DATA_get_buffers(PyObject *obj, void *closure)
    3765             : {
    3766        7996 :         struct PAC_DATA *object = (struct PAC_DATA *)pytalloc_get_ptr(obj);
    3767             :         PyObject *py_buffers;
    3768        7996 :         py_buffers = PyList_New(object->num_buffers);
    3769        7996 :         if (py_buffers == NULL) {
    3770           0 :                 return NULL;
    3771             :         }
    3772             :         {
    3773             :                 int buffers_cntr_0;
    3774       57061 :                 for (buffers_cntr_0 = 0; buffers_cntr_0 < (object->num_buffers); buffers_cntr_0++) {
    3775             :                         PyObject *py_buffers_0;
    3776       49065 :                         py_buffers_0 = pytalloc_reference_ex(&PAC_BUFFER_Type, object->buffers, &object->buffers[buffers_cntr_0]);
    3777       49065 :                         PyList_SetItem(py_buffers, buffers_cntr_0, py_buffers_0);
    3778             :                 }
    3779             :         }
    3780        7996 :         return py_buffers;
    3781             : }
    3782             : 
    3783         138 : static int py_PAC_DATA_set_buffers(PyObject *py_obj, PyObject *value, void *closure)
    3784             : {
    3785         138 :         struct PAC_DATA *object = (struct PAC_DATA *)pytalloc_get_ptr(py_obj);
    3786         138 :         if (value == NULL) {
    3787           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->buffers");
    3788           0 :                 return -1;
    3789             :         }
    3790         138 :         PY_CHECK_TYPE(&PyList_Type, value, return -1;);
    3791             :         {
    3792             :                 int buffers_cntr_0;
    3793         138 :                 object->buffers = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->buffers, PyList_GET_SIZE(value));
    3794         138 :                 if (!object->buffers) { return -1;; }
    3795         138 :                 talloc_set_name_const(object->buffers, "ARRAY: object->buffers");
    3796        1104 :                 for (buffers_cntr_0 = 0; buffers_cntr_0 < PyList_GET_SIZE(value); buffers_cntr_0++) {
    3797         966 :                         if (PyList_GET_ITEM(value, buffers_cntr_0) == NULL) {
    3798           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->buffers[buffers_cntr_0]");
    3799           0 :                                 return -1;
    3800             :                         }
    3801         966 :                         PY_CHECK_TYPE(&PAC_BUFFER_Type, PyList_GET_ITEM(value, buffers_cntr_0), return -1;);
    3802         966 :                         if (talloc_reference(object->buffers, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, buffers_cntr_0))) == NULL) {
    3803           0 :                                 PyErr_NoMemory();
    3804           0 :                                 return -1;
    3805             :                         }
    3806         966 :                         object->buffers[buffers_cntr_0] = *(struct PAC_BUFFER *)pytalloc_get_ptr(PyList_GET_ITEM(value, buffers_cntr_0));
    3807             :                 }
    3808             :         }
    3809         138 :         return 0;
    3810             : }
    3811             : 
    3812             : static PyGetSetDef py_PAC_DATA_getsetters[] = {
    3813             :         {
    3814             :                 .name = discard_const_p(char, "num_buffers"),
    3815             :                 .get = py_PAC_DATA_get_num_buffers,
    3816             :                 .set = py_PAC_DATA_set_num_buffers,
    3817             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    3818             :         },
    3819             :         {
    3820             :                 .name = discard_const_p(char, "version"),
    3821             :                 .get = py_PAC_DATA_get_version,
    3822             :                 .set = py_PAC_DATA_set_version,
    3823             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    3824             :         },
    3825             :         {
    3826             :                 .name = discard_const_p(char, "buffers"),
    3827             :                 .get = py_PAC_DATA_get_buffers,
    3828             :                 .set = py_PAC_DATA_set_buffers,
    3829             :                 .doc = discard_const_p(char, "PIDL-generated element of base type PAC_BUFFER")
    3830             :         },
    3831             :         { .name = NULL }
    3832             : };
    3833             : 
    3834        5394 : static PyObject *py_PAC_DATA_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    3835             : {
    3836        5394 :         return pytalloc_new(struct PAC_DATA, type);
    3837             : }
    3838             : 
    3839         325 : static PyObject *py_PAC_DATA_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
    3840             : {
    3841         325 :         struct PAC_DATA *object = (struct PAC_DATA *)pytalloc_get_ptr(py_obj);
    3842         325 :         PyObject *ret = NULL;
    3843             :         DATA_BLOB blob;
    3844             :         enum ndr_err_code err;
    3845         325 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
    3846         325 :         if (tmp_ctx == NULL) {
    3847           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    3848           0 :                 return NULL;
    3849             :         }
    3850         325 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_PAC_DATA);
    3851         325 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    3852           0 :                 TALLOC_FREE(tmp_ctx);
    3853           0 :                 PyErr_SetNdrError(err);
    3854           0 :                 return NULL;
    3855             :         }
    3856             : 
    3857         325 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    3858         325 :         TALLOC_FREE(tmp_ctx);
    3859         325 :         return ret;
    3860             : }
    3861             : 
    3862        5394 : static PyObject *py_PAC_DATA_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    3863             : {
    3864        5394 :         struct PAC_DATA *object = (struct PAC_DATA *)pytalloc_get_ptr(py_obj);
    3865        5394 :         DATA_BLOB blob = {.data = NULL, .length = 0};
    3866        5394 :         Py_ssize_t blob_length = 0;
    3867             :         enum ndr_err_code err;
    3868        5394 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
    3869        5394 :         PyObject *allow_remaining_obj = NULL;
    3870        5394 :         bool allow_remaining = false;
    3871             : 
    3872        5394 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
    3873             :                 discard_const_p(char *, kwnames),
    3874             :                 &blob.data, &blob_length,
    3875             :                 &allow_remaining_obj)) {
    3876           0 :                 return NULL;
    3877             :         }
    3878        5394 :         blob.length = blob_length;
    3879             : 
    3880        5394 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    3881           0 :                 allow_remaining = true;
    3882             :         }
    3883             : 
    3884        5394 :         if (allow_remaining) {
    3885           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_DATA);
    3886             :         } else {
    3887        5394 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_DATA);
    3888             :         }
    3889        5394 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    3890           0 :                 PyErr_SetNdrError(err);
    3891           0 :                 return NULL;
    3892             :         }
    3893             : 
    3894        5394 :         Py_RETURN_NONE;
    3895             : }
    3896             : 
    3897           0 : static PyObject *py_PAC_DATA_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    3898             : {
    3899           0 :         struct PAC_DATA *object = (struct PAC_DATA *)pytalloc_get_ptr(py_obj);
    3900             :         PyObject *ret;
    3901             :         char *retstr;
    3902             : 
    3903           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_PAC_DATA, "PAC_DATA", object);
    3904           0 :         ret = PyUnicode_FromString(retstr);
    3905           0 :         talloc_free(retstr);
    3906             : 
    3907           0 :         return ret;
    3908             : }
    3909             : 
    3910             : static PyMethodDef py_PAC_DATA_methods[] = {
    3911             :         { "__ndr_pack__", (PyCFunction)py_PAC_DATA_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
    3912             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PAC_DATA_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
    3913             :         { "__ndr_print__", (PyCFunction)py_PAC_DATA_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
    3914             :         { NULL, NULL, 0, NULL }
    3915             : };
    3916             : 
    3917             : 
    3918             : static PyTypeObject PAC_DATA_Type = {
    3919             :         PyVarObject_HEAD_INIT(NULL, 0)
    3920             :         .tp_name = "krb5pac.PAC_DATA",
    3921             :         .tp_getset = py_PAC_DATA_getsetters,
    3922             :         .tp_methods = py_PAC_DATA_methods,
    3923             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    3924             :         .tp_new = py_PAC_DATA_new,
    3925             : };
    3926             : 
    3927             : 
    3928           0 : static PyObject *py_PAC_BUFFER_RAW_get_type(PyObject *obj, void *closure)
    3929             : {
    3930           0 :         struct PAC_BUFFER_RAW *object = (struct PAC_BUFFER_RAW *)pytalloc_get_ptr(obj);
    3931             :         PyObject *py_type;
    3932           0 :         py_type = PyLong_FromUnsignedLongLong((uint32_t)object->type);
    3933           0 :         return py_type;
    3934             : }
    3935             : 
    3936           0 : static int py_PAC_BUFFER_RAW_set_type(PyObject *py_obj, PyObject *value, void *closure)
    3937             : {
    3938           0 :         struct PAC_BUFFER_RAW *object = (struct PAC_BUFFER_RAW *)pytalloc_get_ptr(py_obj);
    3939           0 :         if (value == NULL) {
    3940           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->type");
    3941           0 :                 return -1;
    3942             :         }
    3943             :         {
    3944           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->type));
    3945           0 :                 if (PyLong_Check(value)) {
    3946             :                         unsigned long long test_var;
    3947           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    3948           0 :                         if (PyErr_Occurred() != NULL) {
    3949           0 :                                 return -1;
    3950             :                         }
    3951           0 :                         if (test_var > uint_max) {
    3952           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    3953             :                                   PyLong_Type.tp_name, uint_max, test_var);
    3954           0 :                                 return -1;
    3955             :                         }
    3956           0 :                         object->type = test_var;
    3957             :                 } else {
    3958           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    3959             :                           PyLong_Type.tp_name);
    3960           0 :                         return -1;
    3961             :                 }
    3962             :         }
    3963           0 :         return 0;
    3964             : }
    3965             : 
    3966           0 : static PyObject *py_PAC_BUFFER_RAW_get_ndr_size(PyObject *obj, void *closure)
    3967             : {
    3968           0 :         struct PAC_BUFFER_RAW *object = (struct PAC_BUFFER_RAW *)pytalloc_get_ptr(obj);
    3969             :         PyObject *py_ndr_size;
    3970           0 :         py_ndr_size = PyLong_FromUnsignedLongLong((uint32_t)object->ndr_size);
    3971           0 :         return py_ndr_size;
    3972             : }
    3973             : 
    3974           0 : static int py_PAC_BUFFER_RAW_set_ndr_size(PyObject *py_obj, PyObject *value, void *closure)
    3975             : {
    3976           0 :         struct PAC_BUFFER_RAW *object = (struct PAC_BUFFER_RAW *)pytalloc_get_ptr(py_obj);
    3977           0 :         if (value == NULL) {
    3978           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->ndr_size");
    3979           0 :                 return -1;
    3980             :         }
    3981             :         {
    3982           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->ndr_size));
    3983           0 :                 if (PyLong_Check(value)) {
    3984             :                         unsigned long long test_var;
    3985           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    3986           0 :                         if (PyErr_Occurred() != NULL) {
    3987           0 :                                 return -1;
    3988             :                         }
    3989           0 :                         if (test_var > uint_max) {
    3990           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    3991             :                                   PyLong_Type.tp_name, uint_max, test_var);
    3992           0 :                                 return -1;
    3993             :                         }
    3994           0 :                         object->ndr_size = test_var;
    3995             :                 } else {
    3996           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    3997             :                           PyLong_Type.tp_name);
    3998           0 :                         return -1;
    3999             :                 }
    4000             :         }
    4001           0 :         return 0;
    4002             : }
    4003             : 
    4004       13140 : static PyObject *py_PAC_BUFFER_RAW_get_info(PyObject *obj, void *closure)
    4005             : {
    4006       13140 :         struct PAC_BUFFER_RAW *object = (struct PAC_BUFFER_RAW *)pytalloc_get_ptr(obj);
    4007             :         PyObject *py_info;
    4008       13140 :         if (object->info == NULL) {
    4009           0 :                 Py_RETURN_NONE;
    4010             :         }
    4011       13140 :         if (object->info == NULL) {
    4012           0 :                 py_info = Py_None;
    4013           0 :                 Py_INCREF(py_info);
    4014             :         } else {
    4015       13140 :                 py_info = pytalloc_reference_ex(&DATA_BLOB_REM_Type, object->info, object->info);
    4016             :         }
    4017       13140 :         return py_info;
    4018             : }
    4019             : 
    4020           0 : static int py_PAC_BUFFER_RAW_set_info(PyObject *py_obj, PyObject *value, void *closure)
    4021             : {
    4022           0 :         struct PAC_BUFFER_RAW *object = (struct PAC_BUFFER_RAW *)pytalloc_get_ptr(py_obj);
    4023           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->info));
    4024           0 :         if (value == NULL) {
    4025           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->info");
    4026           0 :                 return -1;
    4027             :         }
    4028           0 :         if (value == Py_None) {
    4029           0 :                 object->info = NULL;
    4030             :         } else {
    4031           0 :                 object->info = NULL;
    4032           0 :                 PY_CHECK_TYPE(&DATA_BLOB_REM_Type, value, return -1;);
    4033           0 :                 if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
    4034           0 :                         PyErr_NoMemory();
    4035           0 :                         return -1;
    4036             :                 }
    4037           0 :                 object->info = (struct DATA_BLOB_REM *)pytalloc_get_ptr(value);
    4038             :         }
    4039           0 :         return 0;
    4040             : }
    4041             : 
    4042           0 : static PyObject *py_PAC_BUFFER_RAW_get__pad(PyObject *obj, void *closure)
    4043             : {
    4044           0 :         struct PAC_BUFFER_RAW *object = (struct PAC_BUFFER_RAW *)pytalloc_get_ptr(obj);
    4045             :         PyObject *py__pad;
    4046           0 :         py__pad = PyLong_FromUnsignedLongLong((uint32_t)object->_pad);
    4047           0 :         return py__pad;
    4048             : }
    4049             : 
    4050           0 : static int py_PAC_BUFFER_RAW_set__pad(PyObject *py_obj, PyObject *value, void *closure)
    4051             : {
    4052           0 :         struct PAC_BUFFER_RAW *object = (struct PAC_BUFFER_RAW *)pytalloc_get_ptr(py_obj);
    4053           0 :         if (value == NULL) {
    4054           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->_pad");
    4055           0 :                 return -1;
    4056             :         }
    4057             :         {
    4058           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->_pad));
    4059           0 :                 if (PyLong_Check(value)) {
    4060             :                         unsigned long long test_var;
    4061           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    4062           0 :                         if (PyErr_Occurred() != NULL) {
    4063           0 :                                 return -1;
    4064             :                         }
    4065           0 :                         if (test_var > uint_max) {
    4066           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    4067             :                                   PyLong_Type.tp_name, uint_max, test_var);
    4068           0 :                                 return -1;
    4069             :                         }
    4070           0 :                         object->_pad = test_var;
    4071             :                 } else {
    4072           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    4073             :                           PyLong_Type.tp_name);
    4074           0 :                         return -1;
    4075             :                 }
    4076             :         }
    4077           0 :         return 0;
    4078             : }
    4079             : 
    4080             : static PyGetSetDef py_PAC_BUFFER_RAW_getsetters[] = {
    4081             :         {
    4082             :                 .name = discard_const_p(char, "type"),
    4083             :                 .get = py_PAC_BUFFER_RAW_get_type,
    4084             :                 .set = py_PAC_BUFFER_RAW_set_type,
    4085             :                 .doc = discard_const_p(char, "PIDL-generated element of base type PAC_TYPE")
    4086             :         },
    4087             :         {
    4088             :                 .name = discard_const_p(char, "ndr_size"),
    4089             :                 .get = py_PAC_BUFFER_RAW_get_ndr_size,
    4090             :                 .set = py_PAC_BUFFER_RAW_set_ndr_size,
    4091             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    4092             :         },
    4093             :         {
    4094             :                 .name = discard_const_p(char, "info"),
    4095             :                 .get = py_PAC_BUFFER_RAW_get_info,
    4096             :                 .set = py_PAC_BUFFER_RAW_set_info,
    4097             :                 .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB_REM")
    4098             :         },
    4099             :         {
    4100             :                 .name = discard_const_p(char, "_pad"),
    4101             :                 .get = py_PAC_BUFFER_RAW_get__pad,
    4102             :                 .set = py_PAC_BUFFER_RAW_set__pad,
    4103             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    4104             :         },
    4105             :         { .name = NULL }
    4106             : };
    4107             : 
    4108           0 : static PyObject *py_PAC_BUFFER_RAW_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    4109             : {
    4110           0 :         return pytalloc_new(struct PAC_BUFFER_RAW, type);
    4111             : }
    4112             : 
    4113           0 : static PyObject *py_PAC_BUFFER_RAW_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
    4114             : {
    4115           0 :         struct PAC_BUFFER_RAW *object = (struct PAC_BUFFER_RAW *)pytalloc_get_ptr(py_obj);
    4116           0 :         PyObject *ret = NULL;
    4117             :         DATA_BLOB blob;
    4118             :         enum ndr_err_code err;
    4119           0 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
    4120           0 :         if (tmp_ctx == NULL) {
    4121           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    4122           0 :                 return NULL;
    4123             :         }
    4124           0 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_PAC_BUFFER_RAW);
    4125           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    4126           0 :                 TALLOC_FREE(tmp_ctx);
    4127           0 :                 PyErr_SetNdrError(err);
    4128           0 :                 return NULL;
    4129             :         }
    4130             : 
    4131           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    4132           0 :         TALLOC_FREE(tmp_ctx);
    4133           0 :         return ret;
    4134             : }
    4135             : 
    4136           0 : static PyObject *py_PAC_BUFFER_RAW_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    4137             : {
    4138           0 :         struct PAC_BUFFER_RAW *object = (struct PAC_BUFFER_RAW *)pytalloc_get_ptr(py_obj);
    4139           0 :         DATA_BLOB blob = {.data = NULL, .length = 0};
    4140           0 :         Py_ssize_t blob_length = 0;
    4141             :         enum ndr_err_code err;
    4142           0 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
    4143           0 :         PyObject *allow_remaining_obj = NULL;
    4144           0 :         bool allow_remaining = false;
    4145             : 
    4146           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
    4147             :                 discard_const_p(char *, kwnames),
    4148             :                 &blob.data, &blob_length,
    4149             :                 &allow_remaining_obj)) {
    4150           0 :                 return NULL;
    4151             :         }
    4152           0 :         blob.length = blob_length;
    4153             : 
    4154           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    4155           0 :                 allow_remaining = true;
    4156             :         }
    4157             : 
    4158           0 :         if (allow_remaining) {
    4159           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_BUFFER_RAW);
    4160             :         } else {
    4161           0 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_BUFFER_RAW);
    4162             :         }
    4163           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    4164           0 :                 PyErr_SetNdrError(err);
    4165           0 :                 return NULL;
    4166             :         }
    4167             : 
    4168           0 :         Py_RETURN_NONE;
    4169             : }
    4170             : 
    4171           0 : static PyObject *py_PAC_BUFFER_RAW_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    4172             : {
    4173           0 :         struct PAC_BUFFER_RAW *object = (struct PAC_BUFFER_RAW *)pytalloc_get_ptr(py_obj);
    4174             :         PyObject *ret;
    4175             :         char *retstr;
    4176             : 
    4177           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_PAC_BUFFER_RAW, "PAC_BUFFER_RAW", object);
    4178           0 :         ret = PyUnicode_FromString(retstr);
    4179           0 :         talloc_free(retstr);
    4180             : 
    4181           0 :         return ret;
    4182             : }
    4183             : 
    4184             : static PyMethodDef py_PAC_BUFFER_RAW_methods[] = {
    4185             :         { "__ndr_pack__", (PyCFunction)py_PAC_BUFFER_RAW_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
    4186             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PAC_BUFFER_RAW_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
    4187             :         { "__ndr_print__", (PyCFunction)py_PAC_BUFFER_RAW_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
    4188             :         { NULL, NULL, 0, NULL }
    4189             : };
    4190             : 
    4191             : 
    4192             : static PyTypeObject PAC_BUFFER_RAW_Type = {
    4193             :         PyVarObject_HEAD_INIT(NULL, 0)
    4194             :         .tp_name = "krb5pac.PAC_BUFFER_RAW",
    4195             :         .tp_getset = py_PAC_BUFFER_RAW_getsetters,
    4196             :         .tp_methods = py_PAC_BUFFER_RAW_methods,
    4197             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    4198             :         .tp_new = py_PAC_BUFFER_RAW_new,
    4199             : };
    4200             : 
    4201             : 
    4202           0 : static PyObject *py_PAC_DATA_RAW_get_num_buffers(PyObject *obj, void *closure)
    4203             : {
    4204           0 :         struct PAC_DATA_RAW *object = (struct PAC_DATA_RAW *)pytalloc_get_ptr(obj);
    4205             :         PyObject *py_num_buffers;
    4206           0 :         py_num_buffers = PyLong_FromUnsignedLongLong((uint32_t)object->num_buffers);
    4207           0 :         return py_num_buffers;
    4208             : }
    4209             : 
    4210           0 : static int py_PAC_DATA_RAW_set_num_buffers(PyObject *py_obj, PyObject *value, void *closure)
    4211             : {
    4212           0 :         struct PAC_DATA_RAW *object = (struct PAC_DATA_RAW *)pytalloc_get_ptr(py_obj);
    4213           0 :         if (value == NULL) {
    4214           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->num_buffers");
    4215           0 :                 return -1;
    4216             :         }
    4217             :         {
    4218           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->num_buffers));
    4219           0 :                 if (PyLong_Check(value)) {
    4220             :                         unsigned long long test_var;
    4221           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    4222           0 :                         if (PyErr_Occurred() != NULL) {
    4223           0 :                                 return -1;
    4224             :                         }
    4225           0 :                         if (test_var > uint_max) {
    4226           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    4227             :                                   PyLong_Type.tp_name, uint_max, test_var);
    4228           0 :                                 return -1;
    4229             :                         }
    4230           0 :                         object->num_buffers = test_var;
    4231             :                 } else {
    4232           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    4233             :                           PyLong_Type.tp_name);
    4234           0 :                         return -1;
    4235             :                 }
    4236             :         }
    4237           0 :         return 0;
    4238             : }
    4239             : 
    4240           0 : static PyObject *py_PAC_DATA_RAW_get_version(PyObject *obj, void *closure)
    4241             : {
    4242           0 :         struct PAC_DATA_RAW *object = (struct PAC_DATA_RAW *)pytalloc_get_ptr(obj);
    4243             :         PyObject *py_version;
    4244           0 :         py_version = PyLong_FromUnsignedLongLong((uint32_t)object->version);
    4245           0 :         return py_version;
    4246             : }
    4247             : 
    4248           0 : static int py_PAC_DATA_RAW_set_version(PyObject *py_obj, PyObject *value, void *closure)
    4249             : {
    4250           0 :         struct PAC_DATA_RAW *object = (struct PAC_DATA_RAW *)pytalloc_get_ptr(py_obj);
    4251           0 :         if (value == NULL) {
    4252           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->version");
    4253           0 :                 return -1;
    4254             :         }
    4255             :         {
    4256           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->version));
    4257           0 :                 if (PyLong_Check(value)) {
    4258             :                         unsigned long long test_var;
    4259           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    4260           0 :                         if (PyErr_Occurred() != NULL) {
    4261           0 :                                 return -1;
    4262             :                         }
    4263           0 :                         if (test_var > uint_max) {
    4264           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    4265             :                                   PyLong_Type.tp_name, uint_max, test_var);
    4266           0 :                                 return -1;
    4267             :                         }
    4268           0 :                         object->version = test_var;
    4269             :                 } else {
    4270           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    4271             :                           PyLong_Type.tp_name);
    4272           0 :                         return -1;
    4273             :                 }
    4274             :         }
    4275           0 :         return 0;
    4276             : }
    4277             : 
    4278        2654 : static PyObject *py_PAC_DATA_RAW_get_buffers(PyObject *obj, void *closure)
    4279             : {
    4280        2654 :         struct PAC_DATA_RAW *object = (struct PAC_DATA_RAW *)pytalloc_get_ptr(obj);
    4281             :         PyObject *py_buffers;
    4282        2654 :         py_buffers = PyList_New(object->num_buffers);
    4283        2654 :         if (py_buffers == NULL) {
    4284           0 :                 return NULL;
    4285             :         }
    4286             :         {
    4287             :                 int buffers_cntr_0;
    4288       18915 :                 for (buffers_cntr_0 = 0; buffers_cntr_0 < (object->num_buffers); buffers_cntr_0++) {
    4289             :                         PyObject *py_buffers_0;
    4290       16261 :                         py_buffers_0 = pytalloc_reference_ex(&PAC_BUFFER_RAW_Type, object->buffers, &object->buffers[buffers_cntr_0]);
    4291       16261 :                         PyList_SetItem(py_buffers, buffers_cntr_0, py_buffers_0);
    4292             :                 }
    4293             :         }
    4294        2654 :         return py_buffers;
    4295             : }
    4296             : 
    4297           0 : static int py_PAC_DATA_RAW_set_buffers(PyObject *py_obj, PyObject *value, void *closure)
    4298             : {
    4299           0 :         struct PAC_DATA_RAW *object = (struct PAC_DATA_RAW *)pytalloc_get_ptr(py_obj);
    4300           0 :         if (value == NULL) {
    4301           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->buffers");
    4302           0 :                 return -1;
    4303             :         }
    4304           0 :         PY_CHECK_TYPE(&PyList_Type, value, return -1;);
    4305             :         {
    4306             :                 int buffers_cntr_0;
    4307           0 :                 object->buffers = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->buffers, PyList_GET_SIZE(value));
    4308           0 :                 if (!object->buffers) { return -1;; }
    4309           0 :                 talloc_set_name_const(object->buffers, "ARRAY: object->buffers");
    4310           0 :                 for (buffers_cntr_0 = 0; buffers_cntr_0 < PyList_GET_SIZE(value); buffers_cntr_0++) {
    4311           0 :                         if (PyList_GET_ITEM(value, buffers_cntr_0) == NULL) {
    4312           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->buffers[buffers_cntr_0]");
    4313           0 :                                 return -1;
    4314             :                         }
    4315           0 :                         PY_CHECK_TYPE(&PAC_BUFFER_RAW_Type, PyList_GET_ITEM(value, buffers_cntr_0), return -1;);
    4316           0 :                         if (talloc_reference(object->buffers, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, buffers_cntr_0))) == NULL) {
    4317           0 :                                 PyErr_NoMemory();
    4318           0 :                                 return -1;
    4319             :                         }
    4320           0 :                         object->buffers[buffers_cntr_0] = *(struct PAC_BUFFER_RAW *)pytalloc_get_ptr(PyList_GET_ITEM(value, buffers_cntr_0));
    4321             :                 }
    4322             :         }
    4323           0 :         return 0;
    4324             : }
    4325             : 
    4326             : static PyGetSetDef py_PAC_DATA_RAW_getsetters[] = {
    4327             :         {
    4328             :                 .name = discard_const_p(char, "num_buffers"),
    4329             :                 .get = py_PAC_DATA_RAW_get_num_buffers,
    4330             :                 .set = py_PAC_DATA_RAW_set_num_buffers,
    4331             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    4332             :         },
    4333             :         {
    4334             :                 .name = discard_const_p(char, "version"),
    4335             :                 .get = py_PAC_DATA_RAW_get_version,
    4336             :                 .set = py_PAC_DATA_RAW_set_version,
    4337             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    4338             :         },
    4339             :         {
    4340             :                 .name = discard_const_p(char, "buffers"),
    4341             :                 .get = py_PAC_DATA_RAW_get_buffers,
    4342             :                 .set = py_PAC_DATA_RAW_set_buffers,
    4343             :                 .doc = discard_const_p(char, "PIDL-generated element of base type PAC_BUFFER_RAW")
    4344             :         },
    4345             :         { .name = NULL }
    4346             : };
    4347             : 
    4348        2654 : static PyObject *py_PAC_DATA_RAW_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    4349             : {
    4350        2654 :         return pytalloc_new(struct PAC_DATA_RAW, type);
    4351             : }
    4352             : 
    4353        3916 : static PyObject *py_PAC_DATA_RAW_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
    4354             : {
    4355        3916 :         struct PAC_DATA_RAW *object = (struct PAC_DATA_RAW *)pytalloc_get_ptr(py_obj);
    4356        3916 :         PyObject *ret = NULL;
    4357             :         DATA_BLOB blob;
    4358             :         enum ndr_err_code err;
    4359        3916 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
    4360        3916 :         if (tmp_ctx == NULL) {
    4361           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    4362           0 :                 return NULL;
    4363             :         }
    4364        3916 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_PAC_DATA_RAW);
    4365        3916 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    4366           0 :                 TALLOC_FREE(tmp_ctx);
    4367           0 :                 PyErr_SetNdrError(err);
    4368           0 :                 return NULL;
    4369             :         }
    4370             : 
    4371        3916 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    4372        3916 :         TALLOC_FREE(tmp_ctx);
    4373        3916 :         return ret;
    4374             : }
    4375             : 
    4376        2654 : static PyObject *py_PAC_DATA_RAW_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    4377             : {
    4378        2654 :         struct PAC_DATA_RAW *object = (struct PAC_DATA_RAW *)pytalloc_get_ptr(py_obj);
    4379        2654 :         DATA_BLOB blob = {.data = NULL, .length = 0};
    4380        2654 :         Py_ssize_t blob_length = 0;
    4381             :         enum ndr_err_code err;
    4382        2654 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
    4383        2654 :         PyObject *allow_remaining_obj = NULL;
    4384        2654 :         bool allow_remaining = false;
    4385             : 
    4386        2654 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
    4387             :                 discard_const_p(char *, kwnames),
    4388             :                 &blob.data, &blob_length,
    4389             :                 &allow_remaining_obj)) {
    4390           0 :                 return NULL;
    4391             :         }
    4392        2654 :         blob.length = blob_length;
    4393             : 
    4394        2654 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    4395           0 :                 allow_remaining = true;
    4396             :         }
    4397             : 
    4398        2654 :         if (allow_remaining) {
    4399           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_DATA_RAW);
    4400             :         } else {
    4401        2654 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_DATA_RAW);
    4402             :         }
    4403        2654 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    4404           0 :                 PyErr_SetNdrError(err);
    4405           0 :                 return NULL;
    4406             :         }
    4407             : 
    4408        2654 :         Py_RETURN_NONE;
    4409             : }
    4410             : 
    4411           0 : static PyObject *py_PAC_DATA_RAW_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    4412             : {
    4413           0 :         struct PAC_DATA_RAW *object = (struct PAC_DATA_RAW *)pytalloc_get_ptr(py_obj);
    4414             :         PyObject *ret;
    4415             :         char *retstr;
    4416             : 
    4417           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_PAC_DATA_RAW, "PAC_DATA_RAW", object);
    4418           0 :         ret = PyUnicode_FromString(retstr);
    4419           0 :         talloc_free(retstr);
    4420             : 
    4421           0 :         return ret;
    4422             : }
    4423             : 
    4424             : static PyMethodDef py_PAC_DATA_RAW_methods[] = {
    4425             :         { "__ndr_pack__", (PyCFunction)py_PAC_DATA_RAW_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
    4426             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PAC_DATA_RAW_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
    4427             :         { "__ndr_print__", (PyCFunction)py_PAC_DATA_RAW_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
    4428             :         { NULL, NULL, 0, NULL }
    4429             : };
    4430             : 
    4431             : 
    4432             : static PyTypeObject PAC_DATA_RAW_Type = {
    4433             :         PyVarObject_HEAD_INIT(NULL, 0)
    4434             :         .tp_name = "krb5pac.PAC_DATA_RAW",
    4435             :         .tp_getset = py_PAC_DATA_RAW_getsetters,
    4436             :         .tp_methods = py_PAC_DATA_RAW_methods,
    4437             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    4438             :         .tp_new = py_PAC_DATA_RAW_new,
    4439             : };
    4440             : 
    4441             : 
    4442           0 : static PyObject *py_PAC_Validate_get_MessageType(PyObject *obj, void *closure)
    4443             : {
    4444           0 :         struct PAC_Validate *object = (struct PAC_Validate *)pytalloc_get_ptr(obj);
    4445             :         PyObject *py_MessageType;
    4446           0 :         py_MessageType = PyLong_FromUnsignedLongLong((uint32_t)object->MessageType);
    4447           0 :         return py_MessageType;
    4448             : }
    4449             : 
    4450           0 : static int py_PAC_Validate_set_MessageType(PyObject *py_obj, PyObject *value, void *closure)
    4451             : {
    4452           0 :         struct PAC_Validate *object = (struct PAC_Validate *)pytalloc_get_ptr(py_obj);
    4453           0 :         if (value == NULL) {
    4454           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->MessageType");
    4455           0 :                 return -1;
    4456             :         }
    4457             :         {
    4458           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->MessageType));
    4459           0 :                 if (PyLong_Check(value)) {
    4460             :                         unsigned long long test_var;
    4461           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    4462           0 :                         if (PyErr_Occurred() != NULL) {
    4463           0 :                                 return -1;
    4464             :                         }
    4465           0 :                         if (test_var > uint_max) {
    4466           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    4467             :                                   PyLong_Type.tp_name, uint_max, test_var);
    4468           0 :                                 return -1;
    4469             :                         }
    4470           0 :                         object->MessageType = test_var;
    4471             :                 } else {
    4472           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    4473             :                           PyLong_Type.tp_name);
    4474           0 :                         return -1;
    4475             :                 }
    4476             :         }
    4477           0 :         return 0;
    4478             : }
    4479             : 
    4480           0 : static PyObject *py_PAC_Validate_get_ChecksumLength(PyObject *obj, void *closure)
    4481             : {
    4482           0 :         struct PAC_Validate *object = (struct PAC_Validate *)pytalloc_get_ptr(obj);
    4483             :         PyObject *py_ChecksumLength;
    4484           0 :         py_ChecksumLength = PyLong_FromUnsignedLongLong((uint32_t)object->ChecksumLength);
    4485           0 :         return py_ChecksumLength;
    4486             : }
    4487             : 
    4488           0 : static int py_PAC_Validate_set_ChecksumLength(PyObject *py_obj, PyObject *value, void *closure)
    4489             : {
    4490           0 :         struct PAC_Validate *object = (struct PAC_Validate *)pytalloc_get_ptr(py_obj);
    4491           0 :         if (value == NULL) {
    4492           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->ChecksumLength");
    4493           0 :                 return -1;
    4494             :         }
    4495             :         {
    4496           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->ChecksumLength));
    4497           0 :                 if (PyLong_Check(value)) {
    4498             :                         unsigned long long test_var;
    4499           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    4500           0 :                         if (PyErr_Occurred() != NULL) {
    4501           0 :                                 return -1;
    4502             :                         }
    4503           0 :                         if (test_var > uint_max) {
    4504           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    4505             :                                   PyLong_Type.tp_name, uint_max, test_var);
    4506           0 :                                 return -1;
    4507             :                         }
    4508           0 :                         object->ChecksumLength = test_var;
    4509             :                 } else {
    4510           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    4511             :                           PyLong_Type.tp_name);
    4512           0 :                         return -1;
    4513             :                 }
    4514             :         }
    4515           0 :         return 0;
    4516             : }
    4517             : 
    4518           0 : static PyObject *py_PAC_Validate_get_SignatureType(PyObject *obj, void *closure)
    4519             : {
    4520           0 :         struct PAC_Validate *object = (struct PAC_Validate *)pytalloc_get_ptr(obj);
    4521             :         PyObject *py_SignatureType;
    4522           0 :         py_SignatureType = PyLong_FromLong(object->SignatureType);
    4523           0 :         return py_SignatureType;
    4524             : }
    4525             : 
    4526           0 : static int py_PAC_Validate_set_SignatureType(PyObject *py_obj, PyObject *value, void *closure)
    4527             : {
    4528           0 :         struct PAC_Validate *object = (struct PAC_Validate *)pytalloc_get_ptr(py_obj);
    4529           0 :         if (value == NULL) {
    4530           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->SignatureType");
    4531           0 :                 return -1;
    4532             :         }
    4533             :         {
    4534           0 :                 const long long int_max = ndr_sizeof2intmax(sizeof(object->SignatureType));
    4535           0 :                 const long long int_min = -int_max - 1;
    4536           0 :                 if (PyLong_Check(value)) {
    4537             :                         long long test_var;
    4538           0 :                         test_var = PyLong_AsLongLong(value);
    4539           0 :                         if (PyErr_Occurred() != NULL) {
    4540           0 :                                 return -1;
    4541             :                         }
    4542           0 :                         if (test_var < int_min || test_var > int_max) {
    4543           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range %lld - %lld, got %lld",
    4544             :                                   PyLong_Type.tp_name, int_min, int_max, test_var);
    4545           0 :                                 return -1;
    4546             :                         }
    4547           0 :                         object->SignatureType = test_var;
    4548             :                 } else {
    4549           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    4550             :                           PyLong_Type.tp_name);
    4551           0 :                         return -1;
    4552             :                 }
    4553             :         }
    4554           0 :         return 0;
    4555             : }
    4556             : 
    4557           0 : static PyObject *py_PAC_Validate_get_SignatureLength(PyObject *obj, void *closure)
    4558             : {
    4559           0 :         struct PAC_Validate *object = (struct PAC_Validate *)pytalloc_get_ptr(obj);
    4560             :         PyObject *py_SignatureLength;
    4561           0 :         py_SignatureLength = PyLong_FromUnsignedLongLong((uint32_t)object->SignatureLength);
    4562           0 :         return py_SignatureLength;
    4563             : }
    4564             : 
    4565           0 : static int py_PAC_Validate_set_SignatureLength(PyObject *py_obj, PyObject *value, void *closure)
    4566             : {
    4567           0 :         struct PAC_Validate *object = (struct PAC_Validate *)pytalloc_get_ptr(py_obj);
    4568           0 :         if (value == NULL) {
    4569           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->SignatureLength");
    4570           0 :                 return -1;
    4571             :         }
    4572             :         {
    4573           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->SignatureLength));
    4574           0 :                 if (PyLong_Check(value)) {
    4575             :                         unsigned long long test_var;
    4576           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    4577           0 :                         if (PyErr_Occurred() != NULL) {
    4578           0 :                                 return -1;
    4579             :                         }
    4580           0 :                         if (test_var > uint_max) {
    4581           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    4582             :                                   PyLong_Type.tp_name, uint_max, test_var);
    4583           0 :                                 return -1;
    4584             :                         }
    4585           0 :                         object->SignatureLength = test_var;
    4586             :                 } else {
    4587           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    4588             :                           PyLong_Type.tp_name);
    4589           0 :                         return -1;
    4590             :                 }
    4591             :         }
    4592           0 :         return 0;
    4593             : }
    4594             : 
    4595           0 : static PyObject *py_PAC_Validate_get_ChecksumAndSignature(PyObject *obj, void *closure)
    4596             : {
    4597           0 :         struct PAC_Validate *object = (struct PAC_Validate *)pytalloc_get_ptr(obj);
    4598             :         PyObject *py_ChecksumAndSignature;
    4599           0 :         py_ChecksumAndSignature = PyBytes_FromStringAndSize((char *)(object->ChecksumAndSignature).data, (object->ChecksumAndSignature).length);
    4600           0 :         return py_ChecksumAndSignature;
    4601             : }
    4602             : 
    4603           0 : static int py_PAC_Validate_set_ChecksumAndSignature(PyObject *py_obj, PyObject *value, void *closure)
    4604             : {
    4605           0 :         struct PAC_Validate *object = (struct PAC_Validate *)pytalloc_get_ptr(py_obj);
    4606           0 :         if (value == NULL) {
    4607           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->ChecksumAndSignature");
    4608           0 :                 return -1;
    4609             :         }
    4610           0 :         object->ChecksumAndSignature = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
    4611           0 :         return 0;
    4612             : }
    4613             : 
    4614             : static PyGetSetDef py_PAC_Validate_getsetters[] = {
    4615             :         {
    4616             :                 .name = discard_const_p(char, "MessageType"),
    4617             :                 .get = py_PAC_Validate_get_MessageType,
    4618             :                 .set = py_PAC_Validate_set_MessageType,
    4619             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    4620             :         },
    4621             :         {
    4622             :                 .name = discard_const_p(char, "ChecksumLength"),
    4623             :                 .get = py_PAC_Validate_get_ChecksumLength,
    4624             :                 .set = py_PAC_Validate_set_ChecksumLength,
    4625             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    4626             :         },
    4627             :         {
    4628             :                 .name = discard_const_p(char, "SignatureType"),
    4629             :                 .get = py_PAC_Validate_get_SignatureType,
    4630             :                 .set = py_PAC_Validate_set_SignatureType,
    4631             :                 .doc = discard_const_p(char, "PIDL-generated element of base type int32")
    4632             :         },
    4633             :         {
    4634             :                 .name = discard_const_p(char, "SignatureLength"),
    4635             :                 .get = py_PAC_Validate_get_SignatureLength,
    4636             :                 .set = py_PAC_Validate_set_SignatureLength,
    4637             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    4638             :         },
    4639             :         {
    4640             :                 .name = discard_const_p(char, "ChecksumAndSignature"),
    4641             :                 .get = py_PAC_Validate_get_ChecksumAndSignature,
    4642             :                 .set = py_PAC_Validate_set_ChecksumAndSignature,
    4643             :                 .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
    4644             :         },
    4645             :         { .name = NULL }
    4646             : };
    4647             : 
    4648           0 : static PyObject *py_PAC_Validate_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    4649             : {
    4650           0 :         return pytalloc_new(struct PAC_Validate, type);
    4651             : }
    4652             : 
    4653           0 : static PyObject *py_PAC_Validate_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
    4654             : {
    4655           0 :         struct PAC_Validate *object = (struct PAC_Validate *)pytalloc_get_ptr(py_obj);
    4656           0 :         PyObject *ret = NULL;
    4657             :         DATA_BLOB blob;
    4658             :         enum ndr_err_code err;
    4659           0 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
    4660           0 :         if (tmp_ctx == NULL) {
    4661           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    4662           0 :                 return NULL;
    4663             :         }
    4664           0 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_PAC_Validate);
    4665           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    4666           0 :                 TALLOC_FREE(tmp_ctx);
    4667           0 :                 PyErr_SetNdrError(err);
    4668           0 :                 return NULL;
    4669             :         }
    4670             : 
    4671           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    4672           0 :         TALLOC_FREE(tmp_ctx);
    4673           0 :         return ret;
    4674             : }
    4675             : 
    4676           0 : static PyObject *py_PAC_Validate_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    4677             : {
    4678           0 :         struct PAC_Validate *object = (struct PAC_Validate *)pytalloc_get_ptr(py_obj);
    4679           0 :         DATA_BLOB blob = {.data = NULL, .length = 0};
    4680           0 :         Py_ssize_t blob_length = 0;
    4681             :         enum ndr_err_code err;
    4682           0 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
    4683           0 :         PyObject *allow_remaining_obj = NULL;
    4684           0 :         bool allow_remaining = false;
    4685             : 
    4686           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
    4687             :                 discard_const_p(char *, kwnames),
    4688             :                 &blob.data, &blob_length,
    4689             :                 &allow_remaining_obj)) {
    4690           0 :                 return NULL;
    4691             :         }
    4692           0 :         blob.length = blob_length;
    4693             : 
    4694           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    4695           0 :                 allow_remaining = true;
    4696             :         }
    4697             : 
    4698           0 :         if (allow_remaining) {
    4699           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_Validate);
    4700             :         } else {
    4701           0 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_Validate);
    4702             :         }
    4703           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    4704           0 :                 PyErr_SetNdrError(err);
    4705           0 :                 return NULL;
    4706             :         }
    4707             : 
    4708           0 :         Py_RETURN_NONE;
    4709             : }
    4710             : 
    4711           0 : static PyObject *py_PAC_Validate_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    4712             : {
    4713           0 :         struct PAC_Validate *object = (struct PAC_Validate *)pytalloc_get_ptr(py_obj);
    4714             :         PyObject *ret;
    4715             :         char *retstr;
    4716             : 
    4717           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_PAC_Validate, "PAC_Validate", object);
    4718           0 :         ret = PyUnicode_FromString(retstr);
    4719           0 :         talloc_free(retstr);
    4720             : 
    4721           0 :         return ret;
    4722             : }
    4723             : 
    4724             : static PyMethodDef py_PAC_Validate_methods[] = {
    4725             :         { "__ndr_pack__", (PyCFunction)py_PAC_Validate_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
    4726             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PAC_Validate_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
    4727             :         { "__ndr_print__", (PyCFunction)py_PAC_Validate_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
    4728             :         { NULL, NULL, 0, NULL }
    4729             : };
    4730             : 
    4731             : 
    4732             : static PyTypeObject PAC_Validate_Type = {
    4733             :         PyVarObject_HEAD_INIT(NULL, 0)
    4734             :         .tp_name = "krb5pac.PAC_Validate",
    4735             :         .tp_getset = py_PAC_Validate_getsetters,
    4736             :         .tp_methods = py_PAC_Validate_methods,
    4737             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    4738             :         .tp_new = py_PAC_Validate_new,
    4739             : };
    4740             : 
    4741             : 
    4742           0 : static PyObject *py_netsamlogoncache_entry_get_timestamp(PyObject *obj, void *closure)
    4743             : {
    4744           0 :         struct netsamlogoncache_entry *object = (struct netsamlogoncache_entry *)pytalloc_get_ptr(obj);
    4745             :         PyObject *py_timestamp;
    4746           0 :         py_timestamp = PyLong_FromLong(object->timestamp);
    4747           0 :         return py_timestamp;
    4748             : }
    4749             : 
    4750           0 : static int py_netsamlogoncache_entry_set_timestamp(PyObject *py_obj, PyObject *value, void *closure)
    4751             : {
    4752           0 :         struct netsamlogoncache_entry *object = (struct netsamlogoncache_entry *)pytalloc_get_ptr(py_obj);
    4753           0 :         if (value == NULL) {
    4754           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->timestamp");
    4755           0 :                 return -1;
    4756             :         }
    4757             :         {
    4758           0 :                 const long long int_max = ndr_sizeof2intmax(sizeof(object->timestamp));
    4759           0 :                 const long long int_min = -int_max - 1;
    4760           0 :                 if (PyLong_Check(value)) {
    4761             :                         long long test_var;
    4762           0 :                         test_var = PyLong_AsLongLong(value);
    4763           0 :                         if (PyErr_Occurred() != NULL) {
    4764           0 :                                 return -1;
    4765             :                         }
    4766           0 :                         if (test_var < int_min || test_var > int_max) {
    4767           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range %lld - %lld, got %lld",
    4768             :                                   PyLong_Type.tp_name, int_min, int_max, test_var);
    4769           0 :                                 return -1;
    4770             :                         }
    4771           0 :                         object->timestamp = test_var;
    4772             :                 } else {
    4773           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    4774             :                           PyLong_Type.tp_name);
    4775           0 :                         return -1;
    4776             :                 }
    4777             :         }
    4778           0 :         return 0;
    4779             : }
    4780             : 
    4781           0 : static PyObject *py_netsamlogoncache_entry_get_info3(PyObject *obj, void *closure)
    4782             : {
    4783           0 :         struct netsamlogoncache_entry *object = (struct netsamlogoncache_entry *)pytalloc_get_ptr(obj);
    4784             :         PyObject *py_info3;
    4785           0 :         py_info3 = pytalloc_reference_ex(netr_SamInfo3_Type, pytalloc_get_mem_ctx(obj), &object->info3);
    4786           0 :         return py_info3;
    4787             : }
    4788             : 
    4789           0 : static int py_netsamlogoncache_entry_set_info3(PyObject *py_obj, PyObject *value, void *closure)
    4790             : {
    4791           0 :         struct netsamlogoncache_entry *object = (struct netsamlogoncache_entry *)pytalloc_get_ptr(py_obj);
    4792           0 :         if (value == NULL) {
    4793           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->info3");
    4794           0 :                 return -1;
    4795             :         }
    4796           0 :         PY_CHECK_TYPE(netr_SamInfo3_Type, value, return -1;);
    4797           0 :         if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
    4798           0 :                 PyErr_NoMemory();
    4799           0 :                 return -1;
    4800             :         }
    4801           0 :         object->info3 = *(struct netr_SamInfo3 *)pytalloc_get_ptr(value);
    4802           0 :         return 0;
    4803             : }
    4804             : 
    4805             : static PyGetSetDef py_netsamlogoncache_entry_getsetters[] = {
    4806             :         {
    4807             :                 .name = discard_const_p(char, "timestamp"),
    4808             :                 .get = py_netsamlogoncache_entry_get_timestamp,
    4809             :                 .set = py_netsamlogoncache_entry_set_timestamp,
    4810             :                 .doc = discard_const_p(char, "PIDL-generated element of base type time_t")
    4811             :         },
    4812             :         {
    4813             :                 .name = discard_const_p(char, "info3"),
    4814             :                 .get = py_netsamlogoncache_entry_get_info3,
    4815             :                 .set = py_netsamlogoncache_entry_set_info3,
    4816             :                 .doc = discard_const_p(char, "PIDL-generated element of base type netr_SamInfo3")
    4817             :         },
    4818             :         { .name = NULL }
    4819             : };
    4820             : 
    4821           0 : static PyObject *py_netsamlogoncache_entry_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    4822             : {
    4823           0 :         return pytalloc_new(struct netsamlogoncache_entry, type);
    4824             : }
    4825             : 
    4826           0 : static PyObject *py_netsamlogoncache_entry_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
    4827             : {
    4828           0 :         struct netsamlogoncache_entry *object = (struct netsamlogoncache_entry *)pytalloc_get_ptr(py_obj);
    4829           0 :         PyObject *ret = NULL;
    4830             :         DATA_BLOB blob;
    4831             :         enum ndr_err_code err;
    4832           0 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
    4833           0 :         if (tmp_ctx == NULL) {
    4834           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    4835           0 :                 return NULL;
    4836             :         }
    4837           0 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_netsamlogoncache_entry);
    4838           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    4839           0 :                 TALLOC_FREE(tmp_ctx);
    4840           0 :                 PyErr_SetNdrError(err);
    4841           0 :                 return NULL;
    4842             :         }
    4843             : 
    4844           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    4845           0 :         TALLOC_FREE(tmp_ctx);
    4846           0 :         return ret;
    4847             : }
    4848             : 
    4849           0 : static PyObject *py_netsamlogoncache_entry_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    4850             : {
    4851           0 :         struct netsamlogoncache_entry *object = (struct netsamlogoncache_entry *)pytalloc_get_ptr(py_obj);
    4852           0 :         DATA_BLOB blob = {.data = NULL, .length = 0};
    4853           0 :         Py_ssize_t blob_length = 0;
    4854             :         enum ndr_err_code err;
    4855           0 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
    4856           0 :         PyObject *allow_remaining_obj = NULL;
    4857           0 :         bool allow_remaining = false;
    4858             : 
    4859           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
    4860             :                 discard_const_p(char *, kwnames),
    4861             :                 &blob.data, &blob_length,
    4862             :                 &allow_remaining_obj)) {
    4863           0 :                 return NULL;
    4864             :         }
    4865           0 :         blob.length = blob_length;
    4866             : 
    4867           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    4868           0 :                 allow_remaining = true;
    4869             :         }
    4870             : 
    4871           0 :         if (allow_remaining) {
    4872           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_netsamlogoncache_entry);
    4873             :         } else {
    4874           0 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_netsamlogoncache_entry);
    4875             :         }
    4876           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    4877           0 :                 PyErr_SetNdrError(err);
    4878           0 :                 return NULL;
    4879             :         }
    4880             : 
    4881           0 :         Py_RETURN_NONE;
    4882             : }
    4883             : 
    4884           0 : static PyObject *py_netsamlogoncache_entry_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    4885             : {
    4886           0 :         struct netsamlogoncache_entry *object = (struct netsamlogoncache_entry *)pytalloc_get_ptr(py_obj);
    4887             :         PyObject *ret;
    4888             :         char *retstr;
    4889             : 
    4890           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_netsamlogoncache_entry, "netsamlogoncache_entry", object);
    4891           0 :         ret = PyUnicode_FromString(retstr);
    4892           0 :         talloc_free(retstr);
    4893             : 
    4894           0 :         return ret;
    4895             : }
    4896             : 
    4897             : static PyMethodDef py_netsamlogoncache_entry_methods[] = {
    4898             :         { "__ndr_pack__", (PyCFunction)py_netsamlogoncache_entry_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
    4899             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_netsamlogoncache_entry_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
    4900             :         { "__ndr_print__", (PyCFunction)py_netsamlogoncache_entry_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
    4901             :         { NULL, NULL, 0, NULL }
    4902             : };
    4903             : 
    4904             : 
    4905             : static PyTypeObject netsamlogoncache_entry_Type = {
    4906             :         PyVarObject_HEAD_INIT(NULL, 0)
    4907             :         .tp_name = "krb5pac.netsamlogoncache_entry",
    4908             :         .tp_getset = py_netsamlogoncache_entry_getsetters,
    4909             :         .tp_methods = py_netsamlogoncache_entry_methods,
    4910             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    4911             :         .tp_new = py_netsamlogoncache_entry_new,
    4912             : };
    4913             : 
    4914             : 
    4915             : const struct PyNdrRpcMethodDef py_ndr_krb5pac_methods[] = {
    4916             :         {0}
    4917             : };
    4918             : 
    4919           0 : static PyObject *interface_krb5pac_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    4920             : {
    4921           0 :         return py_dcerpc_interface_init_helper(type, args, kwargs, &ndr_table_krb5pac);
    4922             : }
    4923             : 
    4924             : #define PY_DOC_KRB5PAC "Active Directory KRB5 PAC"
    4925             : static PyTypeObject krb5pac_InterfaceType = {
    4926             :         PyVarObject_HEAD_INIT(NULL, 0)
    4927             :         .tp_name = "krb5pac.krb5pac",
    4928             :         .tp_basicsize = sizeof(dcerpc_InterfaceObject),
    4929             :         .tp_doc = "krb5pac(binding, lp_ctx=None, credentials=None) -> connection\n"
    4930             : "\n"
    4931             : "binding should be a DCE/RPC binding string (for example: ncacn_ip_tcp:127.0.0.1)\n"
    4932             : "lp_ctx should be a path to a smb.conf file or a param.LoadParm object\n"
    4933             : "credentials should be a credentials.Credentials object.\n\n"PY_DOC_KRB5PAC,
    4934             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    4935             :         .tp_new = interface_krb5pac_new,
    4936             : };
    4937             : 
    4938           0 : static PyObject *syntax_krb5pac_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    4939             : {
    4940           0 :         return py_dcerpc_syntax_init_helper(type, args, kwargs, &ndr_table_krb5pac.syntax_id);
    4941             : }
    4942             : 
    4943             : #define PY_DOC_KRB5PAC_SYNTAX "Active Directory KRB5 PAC"
    4944             : static PyTypeObject krb5pac_SyntaxType = {
    4945             :         PyVarObject_HEAD_INIT(NULL, 0)
    4946             :         .tp_name = "krb5pac.krb5pac_abstract_syntax",
    4947             :         .tp_doc = "krb5pac_abstract_syntax()\n"PY_DOC_KRB5PAC_SYNTAX,
    4948             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    4949             :         .tp_new = syntax_krb5pac_new,
    4950             : };
    4951             : 
    4952             : static PyMethodDef krb5pac_methods[] = {
    4953             :         { NULL, NULL, 0, NULL }
    4954             : };
    4955             : 
    4956             : static struct PyModuleDef moduledef = {
    4957             :         PyModuleDef_HEAD_INIT,
    4958             :         .m_name = "krb5pac",
    4959             :         .m_doc = "krb5pac DCE/RPC",
    4960             :         .m_size = -1,
    4961             :         .m_methods = krb5pac_methods,
    4962             : };
    4963        2653 : MODULE_INIT_FUNC(krb5pac)
    4964             : {
    4965        2653 :         PyObject *m = NULL;
    4966        2653 :         PyObject *dep_samba_dcerpc_security = NULL;
    4967        2653 :         PyObject *dep_samba_dcerpc_lsa = NULL;
    4968        2653 :         PyObject *dep_samba_dcerpc_netlogon = NULL;
    4969        2653 :         PyObject *dep_samba_dcerpc_samr = NULL;
    4970        2653 :         PyObject *dep_talloc = NULL;
    4971        2653 :         PyObject *dep_samba_dcerpc_base = NULL;
    4972        2653 :         PyObject *dep_samba_dcerpc_misc = NULL;
    4973             : 
    4974        2653 :         dep_samba_dcerpc_security = PyImport_ImportModule("samba.dcerpc.security");
    4975        2653 :         if (dep_samba_dcerpc_security == NULL)
    4976           0 :                 goto out;
    4977             : 
    4978        2653 :         dep_samba_dcerpc_lsa = PyImport_ImportModule("samba.dcerpc.lsa");
    4979        2653 :         if (dep_samba_dcerpc_lsa == NULL)
    4980           0 :                 goto out;
    4981             : 
    4982        2653 :         dep_samba_dcerpc_netlogon = PyImport_ImportModule("samba.dcerpc.netlogon");
    4983        2653 :         if (dep_samba_dcerpc_netlogon == NULL)
    4984           0 :                 goto out;
    4985             : 
    4986        2653 :         dep_samba_dcerpc_samr = PyImport_ImportModule("samba.dcerpc.samr");
    4987        2653 :         if (dep_samba_dcerpc_samr == NULL)
    4988           0 :                 goto out;
    4989             : 
    4990        2653 :         dep_talloc = PyImport_ImportModule("talloc");
    4991        2653 :         if (dep_talloc == NULL)
    4992           0 :                 goto out;
    4993             : 
    4994        2653 :         dep_samba_dcerpc_base = PyImport_ImportModule("samba.dcerpc.base");
    4995        2653 :         if (dep_samba_dcerpc_base == NULL)
    4996           0 :                 goto out;
    4997             : 
    4998        2653 :         dep_samba_dcerpc_misc = PyImport_ImportModule("samba.dcerpc.misc");
    4999        2653 :         if (dep_samba_dcerpc_misc == NULL)
    5000           0 :                 goto out;
    5001             : 
    5002        2653 :         BaseObject_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "BaseObject");
    5003        2653 :         if (BaseObject_Type == NULL)
    5004           0 :                 goto out;
    5005             : 
    5006        2653 :         dom_sid_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_security, "dom_sid");
    5007        2653 :         if (dom_sid_Type == NULL)
    5008           0 :                 goto out;
    5009             : 
    5010        2653 :         samr_RidWithAttributeArray_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_samr, "RidWithAttributeArray");
    5011        2653 :         if (samr_RidWithAttributeArray_Type == NULL)
    5012           0 :                 goto out;
    5013             : 
    5014        2653 :         netr_SamInfo3_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_netlogon, "netr_SamInfo3");
    5015        2653 :         if (netr_SamInfo3_Type == NULL)
    5016           0 :                 goto out;
    5017             : 
    5018        2653 :         samr_Password_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_samr, "Password");
    5019        2653 :         if (samr_Password_Type == NULL)
    5020           0 :                 goto out;
    5021             : 
    5022        2653 :         lsa_String_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_lsa, "String");
    5023        2653 :         if (lsa_String_Type == NULL)
    5024           0 :                 goto out;
    5025             : 
    5026        2653 :         ClientConnection_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_base, "ClientConnection");
    5027        2653 :         if (ClientConnection_Type == NULL)
    5028           0 :                 goto out;
    5029             : 
    5030        2653 :         ndr_syntax_id_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_misc, "ndr_syntax_id");
    5031        2653 :         if (ndr_syntax_id_Type == NULL)
    5032           0 :                 goto out;
    5033             : 
    5034        2653 :         PAC_LOGON_NAME_Type.tp_base = BaseObject_Type;
    5035        2653 :         PAC_LOGON_NAME_Type.tp_basicsize = pytalloc_BaseObject_size();
    5036             : 
    5037        2653 :         PAC_SIGNATURE_DATA_Type.tp_base = BaseObject_Type;
    5038        2653 :         PAC_SIGNATURE_DATA_Type.tp_basicsize = pytalloc_BaseObject_size();
    5039             : 
    5040        2653 :         PAC_DOMAIN_GROUP_MEMBERSHIP_Type.tp_base = BaseObject_Type;
    5041        2653 :         PAC_DOMAIN_GROUP_MEMBERSHIP_Type.tp_basicsize = pytalloc_BaseObject_size();
    5042             : 
    5043        2653 :         PAC_LOGON_INFO_Type.tp_base = BaseObject_Type;
    5044        2653 :         PAC_LOGON_INFO_Type.tp_basicsize = pytalloc_BaseObject_size();
    5045             : 
    5046        2653 :         PAC_CREDENTIAL_NTLM_SECPKG_Type.tp_base = BaseObject_Type;
    5047        2653 :         PAC_CREDENTIAL_NTLM_SECPKG_Type.tp_basicsize = pytalloc_BaseObject_size();
    5048             : 
    5049        2653 :         PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_Type.tp_base = BaseObject_Type;
    5050        2653 :         PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_Type.tp_basicsize = pytalloc_BaseObject_size();
    5051             : 
    5052        2653 :         PAC_CREDENTIAL_DATA_Type.tp_base = BaseObject_Type;
    5053        2653 :         PAC_CREDENTIAL_DATA_Type.tp_basicsize = pytalloc_BaseObject_size();
    5054             : 
    5055        2653 :         PAC_CREDENTIAL_DATA_CTR_Type.tp_base = BaseObject_Type;
    5056        2653 :         PAC_CREDENTIAL_DATA_CTR_Type.tp_basicsize = pytalloc_BaseObject_size();
    5057             : 
    5058        2653 :         PAC_CREDENTIAL_DATA_NDR_Type.tp_base = BaseObject_Type;
    5059        2653 :         PAC_CREDENTIAL_DATA_NDR_Type.tp_basicsize = pytalloc_BaseObject_size();
    5060             : 
    5061        2653 :         PAC_CREDENTIAL_INFO_Type.tp_base = BaseObject_Type;
    5062        2653 :         PAC_CREDENTIAL_INFO_Type.tp_basicsize = pytalloc_BaseObject_size();
    5063             : 
    5064        2653 :         PAC_CONSTRAINED_DELEGATION_Type.tp_base = BaseObject_Type;
    5065        2653 :         PAC_CONSTRAINED_DELEGATION_Type.tp_basicsize = pytalloc_BaseObject_size();
    5066             : 
    5067        2653 :         PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_Type.tp_base = BaseObject_Type;
    5068        2653 :         PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_Type.tp_basicsize = pytalloc_BaseObject_size();
    5069             : 
    5070        2653 :         PAC_UPN_DNS_INFO_EX_Type.tp_base = BaseObject_Type;
    5071        2653 :         PAC_UPN_DNS_INFO_EX_Type.tp_basicsize = pytalloc_BaseObject_size();
    5072             : 
    5073        2653 :         PAC_UPN_DNS_INFO_Type.tp_base = BaseObject_Type;
    5074        2653 :         PAC_UPN_DNS_INFO_Type.tp_basicsize = pytalloc_BaseObject_size();
    5075             : 
    5076        2653 :         PAC_ATTRIBUTES_INFO_Type.tp_base = BaseObject_Type;
    5077        2653 :         PAC_ATTRIBUTES_INFO_Type.tp_basicsize = pytalloc_BaseObject_size();
    5078             : 
    5079        2653 :         PAC_REQUESTER_SID_Type.tp_base = BaseObject_Type;
    5080        2653 :         PAC_REQUESTER_SID_Type.tp_basicsize = pytalloc_BaseObject_size();
    5081             : 
    5082        2653 :         PAC_LOGON_INFO_CTR_Type.tp_base = BaseObject_Type;
    5083        2653 :         PAC_LOGON_INFO_CTR_Type.tp_basicsize = pytalloc_BaseObject_size();
    5084             : 
    5085        2653 :         PAC_CONSTRAINED_DELEGATION_CTR_Type.tp_base = BaseObject_Type;
    5086        2653 :         PAC_CONSTRAINED_DELEGATION_CTR_Type.tp_basicsize = pytalloc_BaseObject_size();
    5087             : 
    5088        2653 :         DATA_BLOB_REM_Type.tp_base = BaseObject_Type;
    5089        2653 :         DATA_BLOB_REM_Type.tp_basicsize = pytalloc_BaseObject_size();
    5090             : 
    5091        2653 :         PAC_INFO_Type.tp_base = BaseObject_Type;
    5092        2653 :         PAC_INFO_Type.tp_basicsize = pytalloc_BaseObject_size();
    5093             : 
    5094        2653 :         PAC_BUFFER_Type.tp_base = BaseObject_Type;
    5095        2653 :         PAC_BUFFER_Type.tp_basicsize = pytalloc_BaseObject_size();
    5096             : 
    5097        2653 :         PAC_DATA_Type.tp_base = BaseObject_Type;
    5098        2653 :         PAC_DATA_Type.tp_basicsize = pytalloc_BaseObject_size();
    5099             : 
    5100        2653 :         PAC_BUFFER_RAW_Type.tp_base = BaseObject_Type;
    5101        2653 :         PAC_BUFFER_RAW_Type.tp_basicsize = pytalloc_BaseObject_size();
    5102             : 
    5103        2653 :         PAC_DATA_RAW_Type.tp_base = BaseObject_Type;
    5104        2653 :         PAC_DATA_RAW_Type.tp_basicsize = pytalloc_BaseObject_size();
    5105             : 
    5106        2653 :         PAC_Validate_Type.tp_base = BaseObject_Type;
    5107        2653 :         PAC_Validate_Type.tp_basicsize = pytalloc_BaseObject_size();
    5108             : 
    5109        2653 :         netsamlogoncache_entry_Type.tp_base = BaseObject_Type;
    5110        2653 :         netsamlogoncache_entry_Type.tp_basicsize = pytalloc_BaseObject_size();
    5111             : 
    5112        2653 :         krb5pac_InterfaceType.tp_base = ClientConnection_Type;
    5113             : 
    5114        2653 :         krb5pac_SyntaxType.tp_base = ndr_syntax_id_Type;
    5115        2653 :         krb5pac_SyntaxType.tp_basicsize = pytalloc_BaseObject_size();
    5116             : 
    5117        2653 :         if (PyType_Ready(&PAC_LOGON_NAME_Type) < 0)
    5118           0 :                 goto out;
    5119        2653 :         if (PyType_Ready(&PAC_SIGNATURE_DATA_Type) < 0)
    5120           0 :                 goto out;
    5121        2653 :         if (PyType_Ready(&PAC_DOMAIN_GROUP_MEMBERSHIP_Type) < 0)
    5122           0 :                 goto out;
    5123        2653 :         if (PyType_Ready(&PAC_LOGON_INFO_Type) < 0)
    5124           0 :                 goto out;
    5125        2653 :         if (PyType_Ready(&PAC_CREDENTIAL_NTLM_SECPKG_Type) < 0)
    5126           0 :                 goto out;
    5127        2653 :         if (PyType_Ready(&PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_Type) < 0)
    5128           0 :                 goto out;
    5129        2653 :         if (PyType_Ready(&PAC_CREDENTIAL_DATA_Type) < 0)
    5130           0 :                 goto out;
    5131        2653 :         if (PyType_Ready(&PAC_CREDENTIAL_DATA_CTR_Type) < 0)
    5132           0 :                 goto out;
    5133        2653 :         if (PyType_Ready(&PAC_CREDENTIAL_DATA_NDR_Type) < 0)
    5134           0 :                 goto out;
    5135        2653 :         if (PyType_Ready(&PAC_CREDENTIAL_INFO_Type) < 0)
    5136           0 :                 goto out;
    5137        2653 :         if (PyType_Ready(&PAC_CONSTRAINED_DELEGATION_Type) < 0)
    5138           0 :                 goto out;
    5139        2653 :         if (PyType_Ready(&PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_Type) < 0)
    5140           0 :                 goto out;
    5141        2653 :         if (PyType_Ready(&PAC_UPN_DNS_INFO_EX_Type) < 0)
    5142           0 :                 goto out;
    5143        2653 :         if (PyType_Ready(&PAC_UPN_DNS_INFO_Type) < 0)
    5144           0 :                 goto out;
    5145        2653 :         if (PyType_Ready(&PAC_ATTRIBUTES_INFO_Type) < 0)
    5146           0 :                 goto out;
    5147        2653 :         if (PyType_Ready(&PAC_REQUESTER_SID_Type) < 0)
    5148           0 :                 goto out;
    5149        2653 :         if (PyType_Ready(&PAC_LOGON_INFO_CTR_Type) < 0)
    5150           0 :                 goto out;
    5151        2653 :         if (PyType_Ready(&PAC_CONSTRAINED_DELEGATION_CTR_Type) < 0)
    5152           0 :                 goto out;
    5153        2653 :         if (PyType_Ready(&DATA_BLOB_REM_Type) < 0)
    5154           0 :                 goto out;
    5155        2653 :         if (PyType_Ready(&PAC_INFO_Type) < 0)
    5156           0 :                 goto out;
    5157        2653 :         if (PyType_Ready(&PAC_BUFFER_Type) < 0)
    5158           0 :                 goto out;
    5159        2653 :         if (PyType_Ready(&PAC_DATA_Type) < 0)
    5160           0 :                 goto out;
    5161        2653 :         if (PyType_Ready(&PAC_BUFFER_RAW_Type) < 0)
    5162           0 :                 goto out;
    5163        2653 :         if (PyType_Ready(&PAC_DATA_RAW_Type) < 0)
    5164           0 :                 goto out;
    5165        2653 :         if (PyType_Ready(&PAC_Validate_Type) < 0)
    5166           0 :                 goto out;
    5167        2653 :         if (PyType_Ready(&netsamlogoncache_entry_Type) < 0)
    5168           0 :                 goto out;
    5169        2653 :         if (PyType_Ready(&krb5pac_InterfaceType) < 0)
    5170           0 :                 goto out;
    5171        2653 :         if (PyType_Ready(&krb5pac_SyntaxType) < 0)
    5172           0 :                 goto out;
    5173        2653 :         if (!PyInterface_AddNdrRpcMethods(&krb5pac_InterfaceType, py_ndr_krb5pac_methods))
    5174           0 :                 return NULL;
    5175             : 
    5176             : #ifdef PY_PAC_LOGON_NAME_PATCH
    5177             :         PY_PAC_LOGON_NAME_PATCH(&PAC_LOGON_NAME_Type);
    5178             : #endif
    5179             : #ifdef PY_PAC_SIGNATURE_DATA_PATCH
    5180             :         PY_PAC_SIGNATURE_DATA_PATCH(&PAC_SIGNATURE_DATA_Type);
    5181             : #endif
    5182             : #ifdef PY_PAC_DOMAIN_GROUP_MEMBERSHIP_PATCH
    5183             :         PY_PAC_DOMAIN_GROUP_MEMBERSHIP_PATCH(&PAC_DOMAIN_GROUP_MEMBERSHIP_Type);
    5184             : #endif
    5185             : #ifdef PY_PAC_LOGON_INFO_PATCH
    5186             :         PY_PAC_LOGON_INFO_PATCH(&PAC_LOGON_INFO_Type);
    5187             : #endif
    5188             : #ifdef PY_PAC_CREDENTIAL_NTLM_SECPKG_PATCH
    5189             :         PY_PAC_CREDENTIAL_NTLM_SECPKG_PATCH(&PAC_CREDENTIAL_NTLM_SECPKG_Type);
    5190             : #endif
    5191             : #ifdef PY_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_PATCH
    5192             :         PY_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_PATCH(&PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_Type);
    5193             : #endif
    5194             : #ifdef PY_PAC_CREDENTIAL_DATA_PATCH
    5195             :         PY_PAC_CREDENTIAL_DATA_PATCH(&PAC_CREDENTIAL_DATA_Type);
    5196             : #endif
    5197             : #ifdef PY_PAC_CREDENTIAL_DATA_CTR_PATCH
    5198             :         PY_PAC_CREDENTIAL_DATA_CTR_PATCH(&PAC_CREDENTIAL_DATA_CTR_Type);
    5199             : #endif
    5200             : #ifdef PY_PAC_CREDENTIAL_DATA_NDR_PATCH
    5201             :         PY_PAC_CREDENTIAL_DATA_NDR_PATCH(&PAC_CREDENTIAL_DATA_NDR_Type);
    5202             : #endif
    5203             : #ifdef PY_PAC_CREDENTIAL_INFO_PATCH
    5204             :         PY_PAC_CREDENTIAL_INFO_PATCH(&PAC_CREDENTIAL_INFO_Type);
    5205             : #endif
    5206             : #ifdef PY_PAC_CONSTRAINED_DELEGATION_PATCH
    5207             :         PY_PAC_CONSTRAINED_DELEGATION_PATCH(&PAC_CONSTRAINED_DELEGATION_Type);
    5208             : #endif
    5209             : #ifdef PY_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_PATCH
    5210             :         PY_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_PATCH(&PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_Type);
    5211             : #endif
    5212             : #ifdef PY_PAC_UPN_DNS_INFO_EX_PATCH
    5213             :         PY_PAC_UPN_DNS_INFO_EX_PATCH(&PAC_UPN_DNS_INFO_EX_Type);
    5214             : #endif
    5215             : #ifdef PY_PAC_UPN_DNS_INFO_PATCH
    5216             :         PY_PAC_UPN_DNS_INFO_PATCH(&PAC_UPN_DNS_INFO_Type);
    5217             : #endif
    5218             : #ifdef PY_PAC_ATTRIBUTES_INFO_PATCH
    5219             :         PY_PAC_ATTRIBUTES_INFO_PATCH(&PAC_ATTRIBUTES_INFO_Type);
    5220             : #endif
    5221             : #ifdef PY_PAC_REQUESTER_SID_PATCH
    5222             :         PY_PAC_REQUESTER_SID_PATCH(&PAC_REQUESTER_SID_Type);
    5223             : #endif
    5224             : #ifdef PY_PAC_LOGON_INFO_CTR_PATCH
    5225             :         PY_PAC_LOGON_INFO_CTR_PATCH(&PAC_LOGON_INFO_CTR_Type);
    5226             : #endif
    5227             : #ifdef PY_PAC_CONSTRAINED_DELEGATION_CTR_PATCH
    5228             :         PY_PAC_CONSTRAINED_DELEGATION_CTR_PATCH(&PAC_CONSTRAINED_DELEGATION_CTR_Type);
    5229             : #endif
    5230             : #ifdef PY_DATA_BLOB_REM_PATCH
    5231             :         PY_DATA_BLOB_REM_PATCH(&DATA_BLOB_REM_Type);
    5232             : #endif
    5233             : #ifdef PY_PAC_INFO_PATCH
    5234             :         PY_PAC_INFO_PATCH(&PAC_INFO_Type);
    5235             : #endif
    5236             : #ifdef PY_PAC_BUFFER_PATCH
    5237             :         PY_PAC_BUFFER_PATCH(&PAC_BUFFER_Type);
    5238             : #endif
    5239             : #ifdef PY_PAC_DATA_PATCH
    5240             :         PY_PAC_DATA_PATCH(&PAC_DATA_Type);
    5241             : #endif
    5242             : #ifdef PY_PAC_BUFFER_RAW_PATCH
    5243             :         PY_PAC_BUFFER_RAW_PATCH(&PAC_BUFFER_RAW_Type);
    5244             : #endif
    5245             : #ifdef PY_PAC_DATA_RAW_PATCH
    5246             :         PY_PAC_DATA_RAW_PATCH(&PAC_DATA_RAW_Type);
    5247             : #endif
    5248             : #ifdef PY_PAC_VALIDATE_PATCH
    5249             :         PY_PAC_VALIDATE_PATCH(&PAC_Validate_Type);
    5250             : #endif
    5251             : #ifdef PY_NETSAMLOGONCACHE_ENTRY_PATCH
    5252             :         PY_NETSAMLOGONCACHE_ENTRY_PATCH(&netsamlogoncache_entry_Type);
    5253             : #endif
    5254             : #ifdef PY_KRB5PAC_PATCH
    5255             :         PY_KRB5PAC_PATCH(&krb5pac_InterfaceType);
    5256             : #endif
    5257             : #ifdef PY_KRB5PAC_ABSTRACT_SYNTAX_PATCH
    5258             :         PY_KRB5PAC_ABSTRACT_SYNTAX_PATCH(&krb5pac_SyntaxType);
    5259             : #endif
    5260             : #ifdef PY_ABSTRACT_SYNTAX_PATCH
    5261             :         PY_ABSTRACT_SYNTAX_PATCH(&krb5pac_SyntaxType);
    5262             : #endif
    5263             : 
    5264        2653 :         m = PyModule_Create(&moduledef);
    5265        2653 :         if (m == NULL)
    5266           0 :                 goto out;
    5267             : 
    5268        2653 :         PyModule_AddObject(m, "NETLOGON_GENERIC_KRB5_PAC_VALIDATE", PyLong_FromUnsignedLongLong(3));
    5269        2653 :         PyModule_AddObject(m, "PAC_CREDENTIAL_NTLM_HAS_LM_HASH", PyLong_FromUnsignedLongLong((uint32_t)PAC_CREDENTIAL_NTLM_HAS_LM_HASH));
    5270        2653 :         PyModule_AddObject(m, "PAC_CREDENTIAL_NTLM_HAS_NT_HASH", PyLong_FromUnsignedLongLong((uint32_t)PAC_CREDENTIAL_NTLM_HAS_NT_HASH));
    5271        2653 :         PyModule_AddObject(m, "PAC_UPN_DNS_FLAG_CONSTRUCTED", PyLong_FromUnsignedLongLong((uint32_t)PAC_UPN_DNS_FLAG_CONSTRUCTED));
    5272        2653 :         PyModule_AddObject(m, "PAC_UPN_DNS_FLAG_HAS_SAM_NAME_AND_SID", PyLong_FromUnsignedLongLong((uint32_t)PAC_UPN_DNS_FLAG_HAS_SAM_NAME_AND_SID));
    5273        2653 :         PyModule_AddObject(m, "PAC_ATTRIBUTE_FLAG_PAC_WAS_REQUESTED", PyLong_FromUnsignedLongLong((uint32_t)PAC_ATTRIBUTE_FLAG_PAC_WAS_REQUESTED));
    5274        2653 :         PyModule_AddObject(m, "PAC_ATTRIBUTE_FLAG_PAC_WAS_GIVEN_IMPLICITLY", PyLong_FromUnsignedLongLong((uint32_t)PAC_ATTRIBUTE_FLAG_PAC_WAS_GIVEN_IMPLICITLY));
    5275        2653 :         PyModule_AddObject(m, "PAC_TYPE_LOGON_INFO", PyLong_FromUnsignedLongLong((uint32_t)PAC_TYPE_LOGON_INFO));
    5276        2653 :         PyModule_AddObject(m, "PAC_TYPE_CREDENTIAL_INFO", PyLong_FromUnsignedLongLong((uint32_t)PAC_TYPE_CREDENTIAL_INFO));
    5277        2653 :         PyModule_AddObject(m, "PAC_TYPE_SRV_CHECKSUM", PyLong_FromUnsignedLongLong((uint32_t)PAC_TYPE_SRV_CHECKSUM));
    5278        2653 :         PyModule_AddObject(m, "PAC_TYPE_KDC_CHECKSUM", PyLong_FromUnsignedLongLong((uint32_t)PAC_TYPE_KDC_CHECKSUM));
    5279        2653 :         PyModule_AddObject(m, "PAC_TYPE_LOGON_NAME", PyLong_FromUnsignedLongLong((uint32_t)PAC_TYPE_LOGON_NAME));
    5280        2653 :         PyModule_AddObject(m, "PAC_TYPE_CONSTRAINED_DELEGATION", PyLong_FromUnsignedLongLong((uint32_t)PAC_TYPE_CONSTRAINED_DELEGATION));
    5281        2653 :         PyModule_AddObject(m, "PAC_TYPE_UPN_DNS_INFO", PyLong_FromUnsignedLongLong((uint32_t)PAC_TYPE_UPN_DNS_INFO));
    5282        2653 :         PyModule_AddObject(m, "PAC_TYPE_CLIENT_CLAIMS_INFO", PyLong_FromUnsignedLongLong((uint32_t)PAC_TYPE_CLIENT_CLAIMS_INFO));
    5283        2653 :         PyModule_AddObject(m, "PAC_TYPE_DEVICE_INFO", PyLong_FromUnsignedLongLong((uint32_t)PAC_TYPE_DEVICE_INFO));
    5284        2653 :         PyModule_AddObject(m, "PAC_TYPE_DEVICE_CLAIMS_INFO", PyLong_FromUnsignedLongLong((uint32_t)PAC_TYPE_DEVICE_CLAIMS_INFO));
    5285        2653 :         PyModule_AddObject(m, "PAC_TYPE_TICKET_CHECKSUM", PyLong_FromUnsignedLongLong((uint32_t)PAC_TYPE_TICKET_CHECKSUM));
    5286        2653 :         PyModule_AddObject(m, "PAC_TYPE_ATTRIBUTES_INFO", PyLong_FromUnsignedLongLong((uint32_t)PAC_TYPE_ATTRIBUTES_INFO));
    5287        2653 :         PyModule_AddObject(m, "PAC_TYPE_REQUESTER_SID", PyLong_FromUnsignedLongLong((uint32_t)PAC_TYPE_REQUESTER_SID));
    5288        2653 :         PyModule_AddObject(m, "PAC_TYPE_FULL_CHECKSUM", PyLong_FromUnsignedLongLong((uint32_t)PAC_TYPE_FULL_CHECKSUM));
    5289        2653 :         Py_INCREF((PyObject *)(void *)&PAC_LOGON_NAME_Type);
    5290        2653 :         PyModule_AddObject(m, "PAC_LOGON_NAME", (PyObject *)(void *)&PAC_LOGON_NAME_Type);
    5291        2653 :         Py_INCREF((PyObject *)(void *)&PAC_SIGNATURE_DATA_Type);
    5292        2653 :         PyModule_AddObject(m, "PAC_SIGNATURE_DATA", (PyObject *)(void *)&PAC_SIGNATURE_DATA_Type);
    5293        2653 :         Py_INCREF((PyObject *)(void *)&PAC_DOMAIN_GROUP_MEMBERSHIP_Type);
    5294        2653 :         PyModule_AddObject(m, "PAC_DOMAIN_GROUP_MEMBERSHIP", (PyObject *)(void *)&PAC_DOMAIN_GROUP_MEMBERSHIP_Type);
    5295        2653 :         Py_INCREF((PyObject *)(void *)&PAC_LOGON_INFO_Type);
    5296        2653 :         PyModule_AddObject(m, "PAC_LOGON_INFO", (PyObject *)(void *)&PAC_LOGON_INFO_Type);
    5297        2653 :         Py_INCREF((PyObject *)(void *)&PAC_CREDENTIAL_NTLM_SECPKG_Type);
    5298        2653 :         PyModule_AddObject(m, "PAC_CREDENTIAL_NTLM_SECPKG", (PyObject *)(void *)&PAC_CREDENTIAL_NTLM_SECPKG_Type);
    5299        2653 :         Py_INCREF((PyObject *)(void *)&PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_Type);
    5300        2653 :         PyModule_AddObject(m, "PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG", (PyObject *)(void *)&PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_Type);
    5301        2653 :         Py_INCREF((PyObject *)(void *)&PAC_CREDENTIAL_DATA_Type);
    5302        2653 :         PyModule_AddObject(m, "PAC_CREDENTIAL_DATA", (PyObject *)(void *)&PAC_CREDENTIAL_DATA_Type);
    5303        2653 :         Py_INCREF((PyObject *)(void *)&PAC_CREDENTIAL_DATA_CTR_Type);
    5304        2653 :         PyModule_AddObject(m, "PAC_CREDENTIAL_DATA_CTR", (PyObject *)(void *)&PAC_CREDENTIAL_DATA_CTR_Type);
    5305        2653 :         Py_INCREF((PyObject *)(void *)&PAC_CREDENTIAL_DATA_NDR_Type);
    5306        2653 :         PyModule_AddObject(m, "PAC_CREDENTIAL_DATA_NDR", (PyObject *)(void *)&PAC_CREDENTIAL_DATA_NDR_Type);
    5307        2653 :         Py_INCREF((PyObject *)(void *)&PAC_CREDENTIAL_INFO_Type);
    5308        2653 :         PyModule_AddObject(m, "PAC_CREDENTIAL_INFO", (PyObject *)(void *)&PAC_CREDENTIAL_INFO_Type);
    5309        2653 :         Py_INCREF((PyObject *)(void *)&PAC_CONSTRAINED_DELEGATION_Type);
    5310        2653 :         PyModule_AddObject(m, "PAC_CONSTRAINED_DELEGATION", (PyObject *)(void *)&PAC_CONSTRAINED_DELEGATION_Type);
    5311        2653 :         Py_INCREF((PyObject *)(void *)&PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_Type);
    5312        2653 :         PyModule_AddObject(m, "PAC_UPN_DNS_INFO_SAM_NAME_AND_SID", (PyObject *)(void *)&PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_Type);
    5313        2653 :         Py_INCREF((PyObject *)(void *)&PAC_UPN_DNS_INFO_EX_Type);
    5314        2653 :         PyModule_AddObject(m, "PAC_UPN_DNS_INFO_EX", (PyObject *)(void *)&PAC_UPN_DNS_INFO_EX_Type);
    5315        2653 :         Py_INCREF((PyObject *)(void *)&PAC_UPN_DNS_INFO_Type);
    5316        2653 :         PyModule_AddObject(m, "PAC_UPN_DNS_INFO", (PyObject *)(void *)&PAC_UPN_DNS_INFO_Type);
    5317        2653 :         Py_INCREF((PyObject *)(void *)&PAC_ATTRIBUTES_INFO_Type);
    5318        2653 :         PyModule_AddObject(m, "PAC_ATTRIBUTES_INFO", (PyObject *)(void *)&PAC_ATTRIBUTES_INFO_Type);
    5319        2653 :         Py_INCREF((PyObject *)(void *)&PAC_REQUESTER_SID_Type);
    5320        2653 :         PyModule_AddObject(m, "PAC_REQUESTER_SID", (PyObject *)(void *)&PAC_REQUESTER_SID_Type);
    5321        2653 :         Py_INCREF((PyObject *)(void *)&PAC_LOGON_INFO_CTR_Type);
    5322        2653 :         PyModule_AddObject(m, "PAC_LOGON_INFO_CTR", (PyObject *)(void *)&PAC_LOGON_INFO_CTR_Type);
    5323        2653 :         Py_INCREF((PyObject *)(void *)&PAC_CONSTRAINED_DELEGATION_CTR_Type);
    5324        2653 :         PyModule_AddObject(m, "PAC_CONSTRAINED_DELEGATION_CTR", (PyObject *)(void *)&PAC_CONSTRAINED_DELEGATION_CTR_Type);
    5325        2653 :         Py_INCREF((PyObject *)(void *)&DATA_BLOB_REM_Type);
    5326        2653 :         PyModule_AddObject(m, "DATA_BLOB_REM", (PyObject *)(void *)&DATA_BLOB_REM_Type);
    5327        2653 :         Py_INCREF((PyObject *)(void *)&PAC_INFO_Type);
    5328        2653 :         PyModule_AddObject(m, "PAC_INFO", (PyObject *)(void *)&PAC_INFO_Type);
    5329        2653 :         Py_INCREF((PyObject *)(void *)&PAC_BUFFER_Type);
    5330        2653 :         PyModule_AddObject(m, "PAC_BUFFER", (PyObject *)(void *)&PAC_BUFFER_Type);
    5331        2653 :         Py_INCREF((PyObject *)(void *)&PAC_DATA_Type);
    5332        2653 :         PyModule_AddObject(m, "PAC_DATA", (PyObject *)(void *)&PAC_DATA_Type);
    5333        2653 :         Py_INCREF((PyObject *)(void *)&PAC_BUFFER_RAW_Type);
    5334        2653 :         PyModule_AddObject(m, "PAC_BUFFER_RAW", (PyObject *)(void *)&PAC_BUFFER_RAW_Type);
    5335        2653 :         Py_INCREF((PyObject *)(void *)&PAC_DATA_RAW_Type);
    5336        2653 :         PyModule_AddObject(m, "PAC_DATA_RAW", (PyObject *)(void *)&PAC_DATA_RAW_Type);
    5337        2653 :         Py_INCREF((PyObject *)(void *)&PAC_Validate_Type);
    5338        2653 :         PyModule_AddObject(m, "PAC_Validate", (PyObject *)(void *)&PAC_Validate_Type);
    5339        2653 :         Py_INCREF((PyObject *)(void *)&netsamlogoncache_entry_Type);
    5340        2653 :         PyModule_AddObject(m, "netsamlogoncache_entry", (PyObject *)(void *)&netsamlogoncache_entry_Type);
    5341        2653 :         Py_INCREF((PyObject *)(void *)&krb5pac_InterfaceType);
    5342        2653 :         PyModule_AddObject(m, "krb5pac", (PyObject *)(void *)&krb5pac_InterfaceType);
    5343        2653 :         Py_INCREF((PyObject *)(void *)&krb5pac_SyntaxType);
    5344        2653 :         PyModule_AddObject(m, "krb5pac_abstract_syntax", (PyObject *)(void *)&krb5pac_SyntaxType);
    5345        2653 :         Py_INCREF((PyObject *)(void *)&krb5pac_SyntaxType);
    5346        2653 :         PyModule_AddObject(m, "abstract_syntax", (PyObject *)(void *)&krb5pac_SyntaxType);
    5347             : #ifdef PY_MOD_KRB5PAC_PATCH
    5348             :         PY_MOD_KRB5PAC_PATCH(m);
    5349             : #endif
    5350        2653 :         out:
    5351        2653 :         Py_XDECREF(dep_samba_dcerpc_security);
    5352        2653 :         Py_XDECREF(dep_samba_dcerpc_lsa);
    5353        2653 :         Py_XDECREF(dep_samba_dcerpc_netlogon);
    5354        2653 :         Py_XDECREF(dep_samba_dcerpc_samr);
    5355        2653 :         Py_XDECREF(dep_talloc);
    5356        2653 :         Py_XDECREF(dep_samba_dcerpc_base);
    5357        2653 :         Py_XDECREF(dep_samba_dcerpc_misc);
    5358        2653 :         return m;
    5359             : 
    5360             : }

Generated by: LCOV version 1.13