LCOV - code coverage report
Current view: top level - bin/default/librpc/gen_ndr - py_misc.c (source / functions) Hit Total Coverage
Test: coverage report for master 2f515e9b Lines: 316 959 33.0 %
Date: 2024-04-21 15:09:00 Functions: 20 52 38.5 %

          Line data    Source code
       1             : 
       2             : /* Python wrapper functions auto-generated by pidl */
       3             : #define PY_SSIZE_T_CLEAN 1 /* We use Py_ssize_t for PyArg_ParseTupleAndKeywords */
       4             : #include "lib/replace/system/python.h"
       5             : #include "python/py3compat.h"
       6             : #include "includes.h"
       7             : #include "python/modules.h"
       8             : #include <pytalloc.h>
       9             : #include "librpc/rpc/pyrpc.h"
      10             : #include "librpc/rpc/pyrpc_util.h"
      11             : #include "bin/default/librpc/gen_ndr/ndr_misc.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        1608 : static inline unsigned long long ndr_sizeof2uintmax(size_t var_size)
      33             : {
      34        1608 :         switch (var_size) {
      35         144 :         case 8:
      36         144 :                 return UINT64_MAX;
      37        1464 :         case 4:
      38        1464 :                 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             : static inline _MAYBE_UNUSED_ long long ndr_sizeof2intmax(size_t var_size)
      49             : {
      50             :         switch (var_size) {
      51             :         case 8:
      52             :                 return INT64_MAX;
      53             :         case 4:
      54             :                 return INT32_MAX;
      55             :         case 2:
      56             :                 return INT16_MAX;
      57             :         case 1:
      58             :                 return INT8_MAX;
      59             :         }
      60             : 
      61             :         return 0;
      62             : }
      63             : 
      64             : static PyTypeObject GUID_Type;
      65             : static PyTypeObject ndr_syntax_id_Type;
      66             : static PyTypeObject policy_handle_Type;
      67             : static PyTypeObject KRB5_EDATA_NTSTATUS_Type;
      68             : static PyTypeObject winreg_Data_Type;
      69             : static PyTypeObject winreg_Data_GPO_Type;
      70             : 
      71             : static PyTypeObject *BaseObject_Type;
      72             : #include "librpc/ndr/py_misc.c"
      73             : 
      74             : 
      75           0 : static PyObject *py_GUID_get_time_low(PyObject *obj, void *closure)
      76             : {
      77           0 :         struct GUID *object = pytalloc_get_ptr(obj);
      78           0 :         PyObject *py_time_low;
      79           0 :         py_time_low = PyLong_FromUnsignedLongLong((uint32_t)(object->time_low));
      80           0 :         return py_time_low;
      81             : }
      82             : 
      83           0 : static int py_GUID_set_time_low(PyObject *py_obj, PyObject *value, void *closure)
      84             : {
      85           0 :         struct GUID *object = pytalloc_get_ptr(py_obj);
      86           0 :         if (value == NULL) {
      87           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->time_low");
      88           0 :                 return -1;
      89             :         }
      90             :         {
      91           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->time_low));
      92           0 :                 if (PyLong_Check(value)) {
      93           0 :                         unsigned long long test_var;
      94           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
      95           0 :                         if (PyErr_Occurred() != NULL) {
      96           0 :                                 return -1;
      97             :                         }
      98           0 :                         if (test_var > uint_max) {
      99           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
     100             :                                   PyLong_Type.tp_name, uint_max, test_var);
     101           0 :                                 return -1;
     102             :                         }
     103           0 :                         object->time_low = test_var;
     104             :                 } else {
     105           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
     106             :                           PyLong_Type.tp_name);
     107           0 :                         return -1;
     108             :                 }
     109             :         }
     110           0 :         return 0;
     111             : }
     112             : 
     113           2 : static PyObject *py_GUID_get_time_mid(PyObject *obj, void *closure)
     114             : {
     115           2 :         struct GUID *object = pytalloc_get_ptr(obj);
     116           2 :         PyObject *py_time_mid;
     117           2 :         py_time_mid = PyLong_FromLong((uint16_t)(object->time_mid));
     118           2 :         return py_time_mid;
     119             : }
     120             : 
     121           7 : static int py_GUID_set_time_mid(PyObject *py_obj, PyObject *value, void *closure)
     122             : {
     123           7 :         struct GUID *object = pytalloc_get_ptr(py_obj);
     124           7 :         if (value == NULL) {
     125           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->time_mid");
     126           0 :                 return -1;
     127             :         }
     128             :         {
     129           7 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->time_mid));
     130           7 :                 if (PyLong_Check(value)) {
     131           7 :                         unsigned long long test_var;
     132           7 :                         test_var = PyLong_AsUnsignedLongLong(value);
     133           7 :                         if (PyErr_Occurred() != NULL) {
     134           0 :                                 return -1;
     135             :                         }
     136           6 :                         if (test_var > uint_max) {
     137           4 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
     138             :                                   PyLong_Type.tp_name, uint_max, test_var);
     139           4 :                                 return -1;
     140             :                         }
     141           2 :                         object->time_mid = test_var;
     142             :                 } else {
     143           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
     144             :                           PyLong_Type.tp_name);
     145           0 :                         return -1;
     146             :                 }
     147             :         }
     148           2 :         return 0;
     149             : }
     150             : 
     151           0 : static PyObject *py_GUID_get_time_hi_and_version(PyObject *obj, void *closure)
     152             : {
     153           0 :         struct GUID *object = pytalloc_get_ptr(obj);
     154           0 :         PyObject *py_time_hi_and_version;
     155           0 :         py_time_hi_and_version = PyLong_FromLong((uint16_t)(object->time_hi_and_version));
     156           0 :         return py_time_hi_and_version;
     157             : }
     158             : 
     159           0 : static int py_GUID_set_time_hi_and_version(PyObject *py_obj, PyObject *value, void *closure)
     160             : {
     161           0 :         struct GUID *object = pytalloc_get_ptr(py_obj);
     162           0 :         if (value == NULL) {
     163           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->time_hi_and_version");
     164           0 :                 return -1;
     165             :         }
     166             :         {
     167           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->time_hi_and_version));
     168           0 :                 if (PyLong_Check(value)) {
     169           0 :                         unsigned long long test_var;
     170           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     171           0 :                         if (PyErr_Occurred() != NULL) {
     172           0 :                                 return -1;
     173             :                         }
     174           0 :                         if (test_var > uint_max) {
     175           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
     176             :                                   PyLong_Type.tp_name, uint_max, test_var);
     177           0 :                                 return -1;
     178             :                         }
     179           0 :                         object->time_hi_and_version = test_var;
     180             :                 } else {
     181           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
     182             :                           PyLong_Type.tp_name);
     183           0 :                         return -1;
     184             :                 }
     185             :         }
     186           0 :         return 0;
     187             : }
     188             : 
     189           0 : static PyObject *py_GUID_get_clock_seq(PyObject *obj, void *closure)
     190             : {
     191           0 :         struct GUID *object = pytalloc_get_ptr(obj);
     192           0 :         PyObject *py_clock_seq;
     193           0 :         py_clock_seq = PyList_New(2);
     194           0 :         if (py_clock_seq == NULL) {
     195           0 :                 return NULL;
     196             :         }
     197             :         {
     198             :                 int clock_seq_cntr_0;
     199           0 :                 for (clock_seq_cntr_0 = 0; clock_seq_cntr_0 < (2); clock_seq_cntr_0++) {
     200           0 :                         PyObject *py_clock_seq_0;
     201           0 :                         py_clock_seq_0 = PyLong_FromLong((uint16_t)((object->clock_seq)[clock_seq_cntr_0]));
     202           0 :                         PyList_SetItem(py_clock_seq, clock_seq_cntr_0, py_clock_seq_0);
     203             :                 }
     204             :         }
     205           0 :         return py_clock_seq;
     206             : }
     207             : 
     208           0 : static int py_GUID_set_clock_seq(PyObject *py_obj, PyObject *value, void *closure)
     209             : {
     210           0 :         struct GUID *object = pytalloc_get_ptr(py_obj);
     211           0 :         if (value == NULL) {
     212           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->clock_seq");
     213           0 :                 return -1;
     214             :         }
     215           0 :         PY_CHECK_TYPE(&PyList_Type, value, return -1;);
     216             :         {
     217           0 :                 int clock_seq_cntr_0;
     218           0 :                 if (ARRAY_SIZE(object->clock_seq) != PyList_GET_SIZE(value)) {
     219           0 :                         PyErr_Format(PyExc_TypeError, "Expected list of type %s, length %zu, got %zd", Py_TYPE(value)->tp_name, ARRAY_SIZE(object->clock_seq),  PyList_GET_SIZE(value));
     220           0 :                         return -1;
     221             :                 }
     222           0 :                 for (clock_seq_cntr_0 = 0; clock_seq_cntr_0 < PyList_GET_SIZE(value); clock_seq_cntr_0++) {
     223           0 :                         if (PyList_GET_ITEM(value, clock_seq_cntr_0) == NULL) {
     224           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->clock_seq)[clock_seq_cntr_0]");
     225           0 :                                 return -1;
     226             :                         }
     227             :                         {
     228           0 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((object->clock_seq)[clock_seq_cntr_0]));
     229           0 :                                 if (PyLong_Check(PyList_GET_ITEM(value, clock_seq_cntr_0))) {
     230           0 :                                         unsigned long long test_var;
     231           0 :                                         test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, clock_seq_cntr_0));
     232           0 :                                         if (PyErr_Occurred() != NULL) {
     233           0 :                                                 return -1;
     234             :                                         }
     235           0 :                                         if (test_var > uint_max) {
     236           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
     237             :                                                   PyLong_Type.tp_name, uint_max, test_var);
     238           0 :                                                 return -1;
     239             :                                         }
     240           0 :                                         (object->clock_seq)[clock_seq_cntr_0] = test_var;
     241             :                                 } else {
     242           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",
     243             :                                           PyLong_Type.tp_name);
     244           0 :                                         return -1;
     245             :                                 }
     246             :                         }
     247             :                 }
     248             :         }
     249           0 :         return 0;
     250             : }
     251             : 
     252           6 : static PyObject *py_GUID_get_node(PyObject *obj, void *closure)
     253             : {
     254           6 :         struct GUID *object = pytalloc_get_ptr(obj);
     255           6 :         PyObject *py_node;
     256           6 :         py_node = PyList_New(6);
     257           6 :         if (py_node == NULL) {
     258           0 :                 return NULL;
     259             :         }
     260             :         {
     261             :                 int node_cntr_0;
     262          42 :                 for (node_cntr_0 = 0; node_cntr_0 < (6); node_cntr_0++) {
     263          36 :                         PyObject *py_node_0;
     264          36 :                         py_node_0 = PyLong_FromLong((uint16_t)((object->node)[node_cntr_0]));
     265          36 :                         PyList_SetItem(py_node, node_cntr_0, py_node_0);
     266             :                 }
     267             :         }
     268           0 :         return py_node;
     269             : }
     270             : 
     271           6 : static int py_GUID_set_node(PyObject *py_obj, PyObject *value, void *closure)
     272             : {
     273           6 :         struct GUID *object = pytalloc_get_ptr(py_obj);
     274           6 :         if (value == NULL) {
     275           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->node");
     276           0 :                 return -1;
     277             :         }
     278           6 :         PY_CHECK_TYPE(&PyList_Type, value, return -1;);
     279             :         {
     280           6 :                 int node_cntr_0;
     281           6 :                 if (ARRAY_SIZE(object->node) != PyList_GET_SIZE(value)) {
     282           2 :                         PyErr_Format(PyExc_TypeError, "Expected list of type %s, length %zu, got %zd", Py_TYPE(value)->tp_name, ARRAY_SIZE(object->node),  PyList_GET_SIZE(value));
     283           2 :                         return -1;
     284             :                 }
     285          16 :                 for (node_cntr_0 = 0; node_cntr_0 < PyList_GET_SIZE(value); node_cntr_0++) {
     286          14 :                         if (PyList_GET_ITEM(value, node_cntr_0) == NULL) {
     287           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->node)[node_cntr_0]");
     288           0 :                                 return -1;
     289             :                         }
     290             :                         {
     291          14 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((object->node)[node_cntr_0]));
     292          14 :                                 if (PyLong_Check(PyList_GET_ITEM(value, node_cntr_0))) {
     293          14 :                                         unsigned long long test_var;
     294          14 :                                         test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, node_cntr_0));
     295          14 :                                         if (PyErr_Occurred() != NULL) {
     296           0 :                                                 return -1;
     297             :                                         }
     298          13 :                                         if (test_var > uint_max) {
     299           1 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
     300             :                                                   PyLong_Type.tp_name, uint_max, test_var);
     301           1 :                                                 return -1;
     302             :                                         }
     303          12 :                                         (object->node)[node_cntr_0] = test_var;
     304             :                                 } else {
     305           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",
     306             :                                           PyLong_Type.tp_name);
     307           0 :                                         return -1;
     308             :                                 }
     309             :                         }
     310             :                 }
     311             :         }
     312           0 :         return 0;
     313             : }
     314             : 
     315             : static PyGetSetDef py_GUID_getsetters[] = {
     316             :         {
     317             :                 .name = discard_const_p(char, "time_low"),
     318             :                 .get = py_GUID_get_time_low,
     319             :                 .set = py_GUID_set_time_low,
     320             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
     321             :         },
     322             :         {
     323             :                 .name = discard_const_p(char, "time_mid"),
     324             :                 .get = py_GUID_get_time_mid,
     325             :                 .set = py_GUID_set_time_mid,
     326             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
     327             :         },
     328             :         {
     329             :                 .name = discard_const_p(char, "time_hi_and_version"),
     330             :                 .get = py_GUID_get_time_hi_and_version,
     331             :                 .set = py_GUID_set_time_hi_and_version,
     332             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
     333             :         },
     334             :         {
     335             :                 .name = discard_const_p(char, "clock_seq"),
     336             :                 .get = py_GUID_get_clock_seq,
     337             :                 .set = py_GUID_set_clock_seq,
     338             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
     339             :         },
     340             :         {
     341             :                 .name = discard_const_p(char, "node"),
     342             :                 .get = py_GUID_get_node,
     343             :                 .set = py_GUID_set_node,
     344             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
     345             :         },
     346             :         { .name = NULL }
     347             : };
     348             : 
     349    14610119 : static PyObject *py_GUID_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     350             : {
     351    14610119 :         return pytalloc_new(struct GUID, type);
     352             : }
     353             : 
     354       20784 : static PyObject *py_GUID_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
     355             : {
     356       20784 :         struct GUID *object = pytalloc_get_ptr(py_obj);
     357       20784 :         PyObject *ret = NULL;
     358         224 :         DATA_BLOB blob;
     359         224 :         enum ndr_err_code err;
     360       20784 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
     361       20784 :         if (tmp_ctx == NULL) {
     362           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
     363           0 :                 return NULL;
     364             :         }
     365       20784 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_GUID);
     366       20784 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
     367           0 :                 TALLOC_FREE(tmp_ctx);
     368           0 :                 PyErr_SetNdrError(err);
     369           0 :                 return NULL;
     370             :         }
     371             : 
     372       20784 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
     373       20784 :         TALLOC_FREE(tmp_ctx);
     374       20784 :         return ret;
     375             : }
     376             : 
     377        7823 : static PyObject *py_GUID_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
     378             : {
     379        7823 :         struct GUID *object = pytalloc_get_ptr(py_obj);
     380        7823 :         DATA_BLOB blob = {.data = NULL, .length = 0};
     381        7823 :         Py_ssize_t blob_length = 0;
     382         202 :         enum ndr_err_code err;
     383        7823 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
     384        7823 :         PyObject *allow_remaining_obj = NULL;
     385        7823 :         bool allow_remaining = false;
     386             : 
     387        7823 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
     388             :                 discard_const_p(char *, kwnames),
     389             :                 &blob.data, &blob_length,
     390             :                 &allow_remaining_obj)) {
     391           0 :                 return NULL;
     392             :         }
     393        7823 :         blob.length = blob_length;
     394             : 
     395        7823 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
     396           0 :                 allow_remaining = true;
     397             :         }
     398             : 
     399        7621 :         if (allow_remaining) {
     400           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_GUID);
     401             :         } else {
     402        7823 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_GUID);
     403             :         }
     404        7823 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
     405           0 :                 PyErr_SetNdrError(err);
     406           0 :                 return NULL;
     407             :         }
     408             : 
     409        7823 :         Py_RETURN_NONE;
     410             : }
     411             : 
     412           0 : static PyObject *py_GUID_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
     413             : {
     414           0 :         struct GUID *object = pytalloc_get_ptr(py_obj);
     415           0 :         PyObject *ret;
     416           0 :         char *retstr;
     417             : 
     418           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_GUID, "GUID", object);
     419           0 :         ret = PyUnicode_FromString(retstr);
     420           0 :         talloc_free(retstr);
     421             : 
     422           0 :         return ret;
     423             : }
     424             : 
     425             : static PyMethodDef py_GUID_methods[] = {
     426             :         { "__ndr_pack__", (PyCFunction)py_GUID_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
     427             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_GUID_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
     428             :         { "__ndr_print__", (PyCFunction)py_GUID_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
     429             :         { NULL, NULL, 0, NULL }
     430             : };
     431             : 
     432             : 
     433             : static PyTypeObject GUID_Type = {
     434             :         PyVarObject_HEAD_INIT(NULL, 0)
     435             :         .tp_name = "misc.GUID",
     436             :         .tp_getset = py_GUID_getsetters,
     437             :         .tp_methods = py_GUID_methods,
     438             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
     439             :         .tp_new = py_GUID_new,
     440             : };
     441             : 
     442             : 
     443        2444 : static PyObject *py_ndr_syntax_id_get_uuid(PyObject *obj, void *closure)
     444             : {
     445        2444 :         struct ndr_syntax_id *object = pytalloc_get_ptr(obj);
     446           0 :         PyObject *py_uuid;
     447        2444 :         py_uuid = pytalloc_reference_ex(&GUID_Type, pytalloc_get_mem_ctx(obj), &object->uuid);
     448        2444 :         return py_uuid;
     449             : }
     450             : 
     451           0 : static int py_ndr_syntax_id_set_uuid(PyObject *py_obj, PyObject *value, void *closure)
     452             : {
     453           0 :         struct ndr_syntax_id *object = pytalloc_get_ptr(py_obj);
     454           0 :         if (value == NULL) {
     455           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->uuid");
     456           0 :                 return -1;
     457             :         }
     458           0 :         PY_CHECK_TYPE(&GUID_Type, value, return -1;);
     459           0 :         if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
     460           0 :                 PyErr_NoMemory();
     461           0 :                 return -1;
     462             :         }
     463           0 :         object->uuid = *(struct GUID *)pytalloc_get_ptr(value);
     464           0 :         return 0;
     465             : }
     466             : 
     467        2444 : static PyObject *py_ndr_syntax_id_get_if_version(PyObject *obj, void *closure)
     468             : {
     469        2444 :         struct ndr_syntax_id *object = pytalloc_get_ptr(obj);
     470           0 :         PyObject *py_if_version;
     471        2444 :         py_if_version = PyLong_FromUnsignedLongLong((uint32_t)(object->if_version));
     472        2444 :         return py_if_version;
     473             : }
     474             : 
     475           0 : static int py_ndr_syntax_id_set_if_version(PyObject *py_obj, PyObject *value, void *closure)
     476             : {
     477           0 :         struct ndr_syntax_id *object = pytalloc_get_ptr(py_obj);
     478           0 :         if (value == NULL) {
     479           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->if_version");
     480           0 :                 return -1;
     481             :         }
     482             :         {
     483           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->if_version));
     484           0 :                 if (PyLong_Check(value)) {
     485           0 :                         unsigned long long test_var;
     486           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     487           0 :                         if (PyErr_Occurred() != NULL) {
     488           0 :                                 return -1;
     489             :                         }
     490           0 :                         if (test_var > uint_max) {
     491           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
     492             :                                   PyLong_Type.tp_name, uint_max, test_var);
     493           0 :                                 return -1;
     494             :                         }
     495           0 :                         object->if_version = test_var;
     496             :                 } else {
     497           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
     498             :                           PyLong_Type.tp_name);
     499           0 :                         return -1;
     500             :                 }
     501             :         }
     502           0 :         return 0;
     503             : }
     504             : 
     505             : static PyGetSetDef py_ndr_syntax_id_getsetters[] = {
     506             :         {
     507             :                 .name = discard_const_p(char, "uuid"),
     508             :                 .get = py_ndr_syntax_id_get_uuid,
     509             :                 .set = py_ndr_syntax_id_set_uuid,
     510             :                 .doc = discard_const_p(char, "PIDL-generated element of base type GUID")
     511             :         },
     512             :         {
     513             :                 .name = discard_const_p(char, "if_version"),
     514             :                 .get = py_ndr_syntax_id_get_if_version,
     515             :                 .set = py_ndr_syntax_id_set_if_version,
     516             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
     517             :         },
     518             :         { .name = NULL }
     519             : };
     520             : 
     521          42 : static PyObject *py_ndr_syntax_id_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     522             : {
     523          42 :         return pytalloc_new(struct ndr_syntax_id, type);
     524             : }
     525             : 
     526          96 : static PyObject *py_ndr_syntax_id_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
     527             : {
     528          96 :         struct ndr_syntax_id *object = pytalloc_get_ptr(py_obj);
     529          96 :         PyObject *ret = NULL;
     530           0 :         DATA_BLOB blob;
     531           0 :         enum ndr_err_code err;
     532          96 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
     533          96 :         if (tmp_ctx == NULL) {
     534           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
     535           0 :                 return NULL;
     536             :         }
     537          96 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_ndr_syntax_id);
     538          96 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
     539           0 :                 TALLOC_FREE(tmp_ctx);
     540           0 :                 PyErr_SetNdrError(err);
     541           0 :                 return NULL;
     542             :         }
     543             : 
     544          96 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
     545          96 :         TALLOC_FREE(tmp_ctx);
     546          96 :         return ret;
     547             : }
     548             : 
     549           0 : static PyObject *py_ndr_syntax_id_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
     550             : {
     551           0 :         struct ndr_syntax_id *object = pytalloc_get_ptr(py_obj);
     552           0 :         DATA_BLOB blob = {.data = NULL, .length = 0};
     553           0 :         Py_ssize_t blob_length = 0;
     554           0 :         enum ndr_err_code err;
     555           0 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
     556           0 :         PyObject *allow_remaining_obj = NULL;
     557           0 :         bool allow_remaining = false;
     558             : 
     559           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
     560             :                 discard_const_p(char *, kwnames),
     561             :                 &blob.data, &blob_length,
     562             :                 &allow_remaining_obj)) {
     563           0 :                 return NULL;
     564             :         }
     565           0 :         blob.length = blob_length;
     566             : 
     567           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
     568           0 :                 allow_remaining = true;
     569             :         }
     570             : 
     571           0 :         if (allow_remaining) {
     572           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_ndr_syntax_id);
     573             :         } else {
     574           0 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_ndr_syntax_id);
     575             :         }
     576           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
     577           0 :                 PyErr_SetNdrError(err);
     578           0 :                 return NULL;
     579             :         }
     580             : 
     581           0 :         Py_RETURN_NONE;
     582             : }
     583             : 
     584           0 : static PyObject *py_ndr_syntax_id_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
     585             : {
     586           0 :         struct ndr_syntax_id *object = pytalloc_get_ptr(py_obj);
     587           0 :         PyObject *ret;
     588           0 :         char *retstr;
     589             : 
     590           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_ndr_syntax_id, "ndr_syntax_id", object);
     591           0 :         ret = PyUnicode_FromString(retstr);
     592           0 :         talloc_free(retstr);
     593             : 
     594           0 :         return ret;
     595             : }
     596             : 
     597             : static PyMethodDef py_ndr_syntax_id_methods[] = {
     598             :         { "__ndr_pack__", (PyCFunction)py_ndr_syntax_id_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
     599             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_ndr_syntax_id_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
     600             :         { "__ndr_print__", (PyCFunction)py_ndr_syntax_id_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
     601             :         { NULL, NULL, 0, NULL }
     602             : };
     603             : 
     604             : 
     605             : static PyTypeObject ndr_syntax_id_Type = {
     606             :         PyVarObject_HEAD_INIT(NULL, 0)
     607             :         .tp_name = "misc.ndr_syntax_id",
     608             :         .tp_getset = py_ndr_syntax_id_getsetters,
     609             :         .tp_methods = py_ndr_syntax_id_methods,
     610             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
     611             :         .tp_new = py_ndr_syntax_id_new,
     612             : };
     613             : 
     614             : 
     615           1 : static PyObject *py_policy_handle_get_handle_type(PyObject *obj, void *closure)
     616             : {
     617           1 :         struct policy_handle *object = pytalloc_get_ptr(obj);
     618           1 :         PyObject *py_handle_type;
     619           1 :         py_handle_type = PyLong_FromUnsignedLongLong((uint32_t)(object->handle_type));
     620           1 :         return py_handle_type;
     621             : }
     622             : 
     623           0 : static int py_policy_handle_set_handle_type(PyObject *py_obj, PyObject *value, void *closure)
     624             : {
     625           0 :         struct policy_handle *object = pytalloc_get_ptr(py_obj);
     626           0 :         if (value == NULL) {
     627           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->handle_type");
     628           0 :                 return -1;
     629             :         }
     630             :         {
     631           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->handle_type));
     632           0 :                 if (PyLong_Check(value)) {
     633           0 :                         unsigned long long test_var;
     634           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     635           0 :                         if (PyErr_Occurred() != NULL) {
     636           0 :                                 return -1;
     637             :                         }
     638           0 :                         if (test_var > uint_max) {
     639           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
     640             :                                   PyLong_Type.tp_name, uint_max, test_var);
     641           0 :                                 return -1;
     642             :                         }
     643           0 :                         object->handle_type = test_var;
     644             :                 } else {
     645           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
     646             :                           PyLong_Type.tp_name);
     647           0 :                         return -1;
     648             :                 }
     649             :         }
     650           0 :         return 0;
     651             : }
     652             : 
     653           1 : static PyObject *py_policy_handle_get_uuid(PyObject *obj, void *closure)
     654             : {
     655           1 :         struct policy_handle *object = pytalloc_get_ptr(obj);
     656           1 :         PyObject *py_uuid;
     657           1 :         py_uuid = pytalloc_reference_ex(&GUID_Type, pytalloc_get_mem_ctx(obj), &object->uuid);
     658           1 :         return py_uuid;
     659             : }
     660             : 
     661           0 : static int py_policy_handle_set_uuid(PyObject *py_obj, PyObject *value, void *closure)
     662             : {
     663           0 :         struct policy_handle *object = pytalloc_get_ptr(py_obj);
     664           0 :         if (value == NULL) {
     665           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->uuid");
     666           0 :                 return -1;
     667             :         }
     668           0 :         PY_CHECK_TYPE(&GUID_Type, value, return -1;);
     669           0 :         if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
     670           0 :                 PyErr_NoMemory();
     671           0 :                 return -1;
     672             :         }
     673           0 :         object->uuid = *(struct GUID *)pytalloc_get_ptr(value);
     674           0 :         return 0;
     675             : }
     676             : 
     677             : static PyGetSetDef py_policy_handle_getsetters[] = {
     678             :         {
     679             :                 .name = discard_const_p(char, "handle_type"),
     680             :                 .get = py_policy_handle_get_handle_type,
     681             :                 .set = py_policy_handle_set_handle_type,
     682             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
     683             :         },
     684             :         {
     685             :                 .name = discard_const_p(char, "uuid"),
     686             :                 .get = py_policy_handle_get_uuid,
     687             :                 .set = py_policy_handle_set_uuid,
     688             :                 .doc = discard_const_p(char, "PIDL-generated element of base type GUID")
     689             :         },
     690             :         { .name = NULL }
     691             : };
     692             : 
     693          53 : static PyObject *py_policy_handle_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     694             : {
     695          53 :         return pytalloc_new(struct policy_handle, type);
     696             : }
     697             : 
     698           0 : static PyObject *py_policy_handle_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
     699             : {
     700           0 :         struct policy_handle *object = pytalloc_get_ptr(py_obj);
     701           0 :         PyObject *ret = NULL;
     702           0 :         DATA_BLOB blob;
     703           0 :         enum ndr_err_code err;
     704           0 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
     705           0 :         if (tmp_ctx == NULL) {
     706           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
     707           0 :                 return NULL;
     708             :         }
     709           0 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_policy_handle);
     710           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
     711           0 :                 TALLOC_FREE(tmp_ctx);
     712           0 :                 PyErr_SetNdrError(err);
     713           0 :                 return NULL;
     714             :         }
     715             : 
     716           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
     717           0 :         TALLOC_FREE(tmp_ctx);
     718           0 :         return ret;
     719             : }
     720             : 
     721           0 : static PyObject *py_policy_handle_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
     722             : {
     723           0 :         struct policy_handle *object = pytalloc_get_ptr(py_obj);
     724           0 :         DATA_BLOB blob = {.data = NULL, .length = 0};
     725           0 :         Py_ssize_t blob_length = 0;
     726           0 :         enum ndr_err_code err;
     727           0 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
     728           0 :         PyObject *allow_remaining_obj = NULL;
     729           0 :         bool allow_remaining = false;
     730             : 
     731           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
     732             :                 discard_const_p(char *, kwnames),
     733             :                 &blob.data, &blob_length,
     734             :                 &allow_remaining_obj)) {
     735           0 :                 return NULL;
     736             :         }
     737           0 :         blob.length = blob_length;
     738             : 
     739           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
     740           0 :                 allow_remaining = true;
     741             :         }
     742             : 
     743           0 :         if (allow_remaining) {
     744           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_policy_handle);
     745             :         } else {
     746           0 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_policy_handle);
     747             :         }
     748           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
     749           0 :                 PyErr_SetNdrError(err);
     750           0 :                 return NULL;
     751             :         }
     752             : 
     753           0 :         Py_RETURN_NONE;
     754             : }
     755             : 
     756           0 : static PyObject *py_policy_handle_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
     757             : {
     758           0 :         struct policy_handle *object = pytalloc_get_ptr(py_obj);
     759           0 :         PyObject *ret;
     760           0 :         char *retstr;
     761             : 
     762           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_policy_handle, "policy_handle", object);
     763           0 :         ret = PyUnicode_FromString(retstr);
     764           0 :         talloc_free(retstr);
     765             : 
     766           0 :         return ret;
     767             : }
     768             : 
     769             : static PyMethodDef py_policy_handle_methods[] = {
     770             :         { "__ndr_pack__", (PyCFunction)py_policy_handle_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
     771             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_policy_handle_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
     772             :         { "__ndr_print__", (PyCFunction)py_policy_handle_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
     773             :         { NULL, NULL, 0, NULL }
     774             : };
     775             : 
     776             : 
     777             : static PyTypeObject policy_handle_Type = {
     778             :         PyVarObject_HEAD_INIT(NULL, 0)
     779             :         .tp_name = "misc.policy_handle",
     780             :         .tp_getset = py_policy_handle_getsetters,
     781             :         .tp_methods = py_policy_handle_methods,
     782             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
     783             :         .tp_new = py_policy_handle_new,
     784             : };
     785             : 
     786             : 
     787           0 : static PyObject *py_KRB5_EDATA_NTSTATUS_get_ntstatus(PyObject *obj, void *closure)
     788             : {
     789           0 :         struct KRB5_EDATA_NTSTATUS *object = pytalloc_get_ptr(obj);
     790           0 :         PyObject *py_ntstatus;
     791           0 :         py_ntstatus = PyErr_FromNTSTATUS(object->ntstatus);
     792           0 :         return py_ntstatus;
     793             : }
     794             : 
     795           0 : static int py_KRB5_EDATA_NTSTATUS_set_ntstatus(PyObject *py_obj, PyObject *value, void *closure)
     796             : {
     797           0 :         struct KRB5_EDATA_NTSTATUS *object = pytalloc_get_ptr(py_obj);
     798           0 :         if (value == NULL) {
     799           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->ntstatus");
     800           0 :                 return -1;
     801             :         }
     802           0 :         object->ntstatus = NT_STATUS(PyLong_AsLong(value));
     803           0 :         return 0;
     804             : }
     805             : 
     806           0 : static PyObject *py_KRB5_EDATA_NTSTATUS_get_unknown1(PyObject *obj, void *closure)
     807             : {
     808           0 :         struct KRB5_EDATA_NTSTATUS *object = pytalloc_get_ptr(obj);
     809           0 :         PyObject *py_unknown1;
     810           0 :         py_unknown1 = PyLong_FromUnsignedLongLong((uint32_t)(object->unknown1));
     811           0 :         return py_unknown1;
     812             : }
     813             : 
     814           0 : static int py_KRB5_EDATA_NTSTATUS_set_unknown1(PyObject *py_obj, PyObject *value, void *closure)
     815             : {
     816           0 :         struct KRB5_EDATA_NTSTATUS *object = pytalloc_get_ptr(py_obj);
     817           0 :         if (value == NULL) {
     818           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->unknown1");
     819           0 :                 return -1;
     820             :         }
     821             :         {
     822           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->unknown1));
     823           0 :                 if (PyLong_Check(value)) {
     824           0 :                         unsigned long long test_var;
     825           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     826           0 :                         if (PyErr_Occurred() != NULL) {
     827           0 :                                 return -1;
     828             :                         }
     829           0 :                         if (test_var > uint_max) {
     830           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
     831             :                                   PyLong_Type.tp_name, uint_max, test_var);
     832           0 :                                 return -1;
     833             :                         }
     834           0 :                         object->unknown1 = test_var;
     835             :                 } else {
     836           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
     837             :                           PyLong_Type.tp_name);
     838           0 :                         return -1;
     839             :                 }
     840             :         }
     841           0 :         return 0;
     842             : }
     843             : 
     844           0 : static PyObject *py_KRB5_EDATA_NTSTATUS_get_unknown2(PyObject *obj, void *closure)
     845             : {
     846           0 :         struct KRB5_EDATA_NTSTATUS *object = pytalloc_get_ptr(obj);
     847           0 :         PyObject *py_unknown2;
     848           0 :         py_unknown2 = PyLong_FromUnsignedLongLong((uint32_t)(object->unknown2));
     849           0 :         return py_unknown2;
     850             : }
     851             : 
     852           0 : static int py_KRB5_EDATA_NTSTATUS_set_unknown2(PyObject *py_obj, PyObject *value, void *closure)
     853             : {
     854           0 :         struct KRB5_EDATA_NTSTATUS *object = pytalloc_get_ptr(py_obj);
     855           0 :         if (value == NULL) {
     856           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->unknown2");
     857           0 :                 return -1;
     858             :         }
     859             :         {
     860           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->unknown2));
     861           0 :                 if (PyLong_Check(value)) {
     862           0 :                         unsigned long long test_var;
     863           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     864           0 :                         if (PyErr_Occurred() != NULL) {
     865           0 :                                 return -1;
     866             :                         }
     867           0 :                         if (test_var > uint_max) {
     868           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
     869             :                                   PyLong_Type.tp_name, uint_max, test_var);
     870           0 :                                 return -1;
     871             :                         }
     872           0 :                         object->unknown2 = test_var;
     873             :                 } else {
     874           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
     875             :                           PyLong_Type.tp_name);
     876           0 :                         return -1;
     877             :                 }
     878             :         }
     879           0 :         return 0;
     880             : }
     881             : 
     882             : static PyGetSetDef py_KRB5_EDATA_NTSTATUS_getsetters[] = {
     883             :         {
     884             :                 .name = discard_const_p(char, "ntstatus"),
     885             :                 .get = py_KRB5_EDATA_NTSTATUS_get_ntstatus,
     886             :                 .set = py_KRB5_EDATA_NTSTATUS_set_ntstatus,
     887             :                 .doc = discard_const_p(char, "PIDL-generated element of base type NTSTATUS")
     888             :         },
     889             :         {
     890             :                 .name = discard_const_p(char, "unknown1"),
     891             :                 .get = py_KRB5_EDATA_NTSTATUS_get_unknown1,
     892             :                 .set = py_KRB5_EDATA_NTSTATUS_set_unknown1,
     893             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
     894             :         },
     895             :         {
     896             :                 .name = discard_const_p(char, "unknown2"),
     897             :                 .get = py_KRB5_EDATA_NTSTATUS_get_unknown2,
     898             :                 .set = py_KRB5_EDATA_NTSTATUS_set_unknown2,
     899             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
     900             :         },
     901             :         { .name = NULL }
     902             : };
     903             : 
     904           0 : static PyObject *py_KRB5_EDATA_NTSTATUS_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     905             : {
     906           0 :         return pytalloc_new(struct KRB5_EDATA_NTSTATUS, type);
     907             : }
     908             : 
     909           0 : static PyObject *py_KRB5_EDATA_NTSTATUS_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
     910             : {
     911           0 :         struct KRB5_EDATA_NTSTATUS *object = pytalloc_get_ptr(py_obj);
     912           0 :         PyObject *ret = NULL;
     913           0 :         DATA_BLOB blob;
     914           0 :         enum ndr_err_code err;
     915           0 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
     916           0 :         if (tmp_ctx == NULL) {
     917           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
     918           0 :                 return NULL;
     919             :         }
     920           0 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_KRB5_EDATA_NTSTATUS);
     921           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
     922           0 :                 TALLOC_FREE(tmp_ctx);
     923           0 :                 PyErr_SetNdrError(err);
     924           0 :                 return NULL;
     925             :         }
     926             : 
     927           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
     928           0 :         TALLOC_FREE(tmp_ctx);
     929           0 :         return ret;
     930             : }
     931             : 
     932           0 : static PyObject *py_KRB5_EDATA_NTSTATUS_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
     933             : {
     934           0 :         struct KRB5_EDATA_NTSTATUS *object = pytalloc_get_ptr(py_obj);
     935           0 :         DATA_BLOB blob = {.data = NULL, .length = 0};
     936           0 :         Py_ssize_t blob_length = 0;
     937           0 :         enum ndr_err_code err;
     938           0 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
     939           0 :         PyObject *allow_remaining_obj = NULL;
     940           0 :         bool allow_remaining = false;
     941             : 
     942           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
     943             :                 discard_const_p(char *, kwnames),
     944             :                 &blob.data, &blob_length,
     945             :                 &allow_remaining_obj)) {
     946           0 :                 return NULL;
     947             :         }
     948           0 :         blob.length = blob_length;
     949             : 
     950           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
     951           0 :                 allow_remaining = true;
     952             :         }
     953             : 
     954           0 :         if (allow_remaining) {
     955           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_KRB5_EDATA_NTSTATUS);
     956             :         } else {
     957           0 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_KRB5_EDATA_NTSTATUS);
     958             :         }
     959           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
     960           0 :                 PyErr_SetNdrError(err);
     961           0 :                 return NULL;
     962             :         }
     963             : 
     964           0 :         Py_RETURN_NONE;
     965             : }
     966             : 
     967           0 : static PyObject *py_KRB5_EDATA_NTSTATUS_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
     968             : {
     969           0 :         struct KRB5_EDATA_NTSTATUS *object = pytalloc_get_ptr(py_obj);
     970           0 :         PyObject *ret;
     971           0 :         char *retstr;
     972             : 
     973           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_KRB5_EDATA_NTSTATUS, "KRB5_EDATA_NTSTATUS", object);
     974           0 :         ret = PyUnicode_FromString(retstr);
     975           0 :         talloc_free(retstr);
     976             : 
     977           0 :         return ret;
     978             : }
     979             : 
     980             : static PyMethodDef py_KRB5_EDATA_NTSTATUS_methods[] = {
     981             :         { "__ndr_pack__", (PyCFunction)py_KRB5_EDATA_NTSTATUS_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
     982             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_KRB5_EDATA_NTSTATUS_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
     983             :         { "__ndr_print__", (PyCFunction)py_KRB5_EDATA_NTSTATUS_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
     984             :         { NULL, NULL, 0, NULL }
     985             : };
     986             : 
     987             : 
     988             : static PyTypeObject KRB5_EDATA_NTSTATUS_Type = {
     989             :         PyVarObject_HEAD_INIT(NULL, 0)
     990             :         .tp_name = "misc.KRB5_EDATA_NTSTATUS",
     991             :         .tp_getset = py_KRB5_EDATA_NTSTATUS_getsetters,
     992             :         .tp_methods = py_KRB5_EDATA_NTSTATUS_methods,
     993             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
     994             :         .tp_new = py_KRB5_EDATA_NTSTATUS_new,
     995             : };
     996             : 
     997           0 : static PyObject *py_import_winreg_Data(TALLOC_CTX *mem_ctx, int level, union winreg_Data *in)
     998             : {
     999           0 :         PyObject *ret;
    1000             : 
    1001           0 :         switch (level) {
    1002           0 :                 case REG_NONE:
    1003           0 :                         ret = Py_None;
    1004           0 :                         Py_INCREF(ret);
    1005           0 :                         return ret;
    1006             : 
    1007           0 :                 case REG_SZ:
    1008           0 :                         ret = PyString_FromStringOrNULL(in->string);
    1009           0 :                         return ret;
    1010             : 
    1011           0 :                 case REG_EXPAND_SZ:
    1012           0 :                         ret = PyString_FromStringOrNULL(in->string);
    1013           0 :                         return ret;
    1014             : 
    1015           0 :                 case REG_BINARY:
    1016           0 :                         ret = PyBytes_FromStringAndSize((char *)(in->binary).data, (in->binary).length);
    1017           0 :                         return ret;
    1018             : 
    1019           0 :                 case REG_DWORD:
    1020           0 :                         ret = PyLong_FromUnsignedLongLong((uint32_t)(in->value));
    1021           0 :                         return ret;
    1022             : 
    1023           0 :                 case REG_DWORD_BIG_ENDIAN:
    1024           0 :                         ret = PyLong_FromUnsignedLongLong((uint32_t)(in->value));
    1025           0 :                         return ret;
    1026             : 
    1027           0 :                 case REG_MULTI_SZ:
    1028           0 :                         ret = pytalloc_GenericObject_reference_ex(mem_ctx, in->string_array);
    1029           0 :                         return ret;
    1030             : 
    1031           0 :                 case REG_QWORD:
    1032           0 :                         ret = PyLong_FromUnsignedLongLong(in->qword);
    1033           0 :                         return ret;
    1034             : 
    1035           0 :                 default:
    1036           0 :                         ret = PyBytes_FromStringAndSize((char *)(in->data).data, (in->data).length);
    1037           0 :                         return ret;
    1038             : 
    1039             :         }
    1040             :         PyErr_SetString(PyExc_TypeError, "unknown union level");
    1041             :         return NULL;
    1042             : }
    1043             : 
    1044           0 : static union winreg_Data *py_export_winreg_Data(TALLOC_CTX *mem_ctx, int level, PyObject *in)
    1045             : {
    1046           0 :         union winreg_Data *ret = talloc_zero(mem_ctx, union winreg_Data);
    1047           0 :         switch (level) {
    1048           0 :                 case REG_NONE:
    1049           0 :                         break;
    1050             : 
    1051           0 :                 case REG_SZ:
    1052           0 :                         if (in == NULL) {
    1053           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->string");
    1054           0 :                                 talloc_free(ret); return NULL;
    1055             :                         }
    1056             :                         {
    1057           0 :                                 const char *test_str;
    1058           0 :                                 const char *talloc_str;
    1059           0 :                                 PyObject *unicode = NULL;
    1060           0 :                                 if (PyUnicode_Check(in)) {
    1061           0 :                                         unicode = PyUnicode_AsEncodedString(in, "utf-8", "ignore");
    1062           0 :                                         if (unicode == NULL) {
    1063           0 :                                                 talloc_free(ret); return NULL;
    1064             :                                         }
    1065           0 :                                         test_str = PyBytes_AS_STRING(unicode);
    1066           0 :                                 } else if (PyBytes_Check(in)) {
    1067           0 :                                         test_str = PyBytes_AS_STRING(in);
    1068             :                                 } else {
    1069           0 :                                         PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(in)->tp_name);
    1070           0 :                                         talloc_free(ret); return NULL;
    1071             :                                 }
    1072           0 :                                 talloc_str = talloc_strdup(mem_ctx, test_str);
    1073           0 :                                 if (unicode != NULL) {
    1074           0 :                                         Py_DECREF(unicode);
    1075             :                                 }
    1076           0 :                                 if (talloc_str == NULL) {
    1077           0 :                                         PyErr_NoMemory();
    1078           0 :                                         talloc_free(ret); return NULL;
    1079             :                                 }
    1080           0 :                                 ret->string = talloc_str;
    1081             :                         }
    1082           0 :                         break;
    1083             : 
    1084           0 :                 case REG_EXPAND_SZ:
    1085           0 :                         if (in == NULL) {
    1086           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->string");
    1087           0 :                                 talloc_free(ret); return NULL;
    1088             :                         }
    1089             :                         {
    1090           0 :                                 const char *test_str;
    1091           0 :                                 const char *talloc_str;
    1092           0 :                                 PyObject *unicode = NULL;
    1093           0 :                                 if (PyUnicode_Check(in)) {
    1094           0 :                                         unicode = PyUnicode_AsEncodedString(in, "utf-8", "ignore");
    1095           0 :                                         if (unicode == NULL) {
    1096           0 :                                                 talloc_free(ret); return NULL;
    1097             :                                         }
    1098           0 :                                         test_str = PyBytes_AS_STRING(unicode);
    1099           0 :                                 } else if (PyBytes_Check(in)) {
    1100           0 :                                         test_str = PyBytes_AS_STRING(in);
    1101             :                                 } else {
    1102           0 :                                         PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(in)->tp_name);
    1103           0 :                                         talloc_free(ret); return NULL;
    1104             :                                 }
    1105           0 :                                 talloc_str = talloc_strdup(mem_ctx, test_str);
    1106           0 :                                 if (unicode != NULL) {
    1107           0 :                                         Py_DECREF(unicode);
    1108             :                                 }
    1109           0 :                                 if (talloc_str == NULL) {
    1110           0 :                                         PyErr_NoMemory();
    1111           0 :                                         talloc_free(ret); return NULL;
    1112             :                                 }
    1113           0 :                                 ret->string = talloc_str;
    1114             :                         }
    1115           0 :                         break;
    1116             : 
    1117           0 :                 case REG_BINARY:
    1118           0 :                         if (in == NULL) {
    1119           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->binary");
    1120           0 :                                 talloc_free(ret); return NULL;
    1121             :                         }
    1122           0 :                         ret->binary = data_blob_talloc(mem_ctx, PyBytes_AS_STRING(in), PyBytes_GET_SIZE(in));
    1123           0 :                         break;
    1124             : 
    1125           0 :                 case REG_DWORD:
    1126           0 :                         if (in == NULL) {
    1127           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->value");
    1128           0 :                                 talloc_free(ret); return NULL;
    1129             :                         }
    1130             :                         {
    1131           0 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(ret->value));
    1132           0 :                                 if (PyLong_Check(in)) {
    1133           0 :                                         unsigned long long test_var;
    1134           0 :                                         test_var = PyLong_AsUnsignedLongLong(in);
    1135           0 :                                         if (PyErr_Occurred() != NULL) {
    1136           0 :                                                 talloc_free(ret); return NULL;
    1137             :                                         }
    1138           0 :                                         if (test_var > uint_max) {
    1139           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    1140             :                                                   PyLong_Type.tp_name, uint_max, test_var);
    1141           0 :                                                 talloc_free(ret); return NULL;
    1142             :                                         }
    1143           0 :                                         ret->value = test_var;
    1144             :                                 } else {
    1145           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    1146             :                                           PyLong_Type.tp_name);
    1147           0 :                                         talloc_free(ret); return NULL;
    1148             :                                 }
    1149             :                         }
    1150           0 :                         break;
    1151             : 
    1152           0 :                 case REG_DWORD_BIG_ENDIAN:
    1153           0 :                         if (in == NULL) {
    1154           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->value");
    1155           0 :                                 talloc_free(ret); return NULL;
    1156             :                         }
    1157             :                         {
    1158           0 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(ret->value));
    1159           0 :                                 if (PyLong_Check(in)) {
    1160           0 :                                         unsigned long long test_var;
    1161           0 :                                         test_var = PyLong_AsUnsignedLongLong(in);
    1162           0 :                                         if (PyErr_Occurred() != NULL) {
    1163           0 :                                                 talloc_free(ret); return NULL;
    1164             :                                         }
    1165           0 :                                         if (test_var > uint_max) {
    1166           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    1167             :                                                   PyLong_Type.tp_name, uint_max, test_var);
    1168           0 :                                                 talloc_free(ret); return NULL;
    1169             :                                         }
    1170           0 :                                         ret->value = test_var;
    1171             :                                 } else {
    1172           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    1173             :                                           PyLong_Type.tp_name);
    1174           0 :                                         talloc_free(ret); return NULL;
    1175             :                                 }
    1176             :                         }
    1177           0 :                         break;
    1178             : 
    1179           0 :                 case REG_MULTI_SZ:
    1180           0 :                         if (in == NULL) {
    1181           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->string_array");
    1182           0 :                                 talloc_free(ret); return NULL;
    1183             :                         }
    1184           0 :                         ret->string_array = pytalloc_get_ptr(in);
    1185           0 :                         break;
    1186             : 
    1187           0 :                 case REG_QWORD:
    1188           0 :                         if (in == NULL) {
    1189           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->qword");
    1190           0 :                                 talloc_free(ret); return NULL;
    1191             :                         }
    1192             :                         {
    1193           0 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(ret->qword));
    1194           0 :                                 if (PyLong_Check(in)) {
    1195           0 :                                         unsigned long long test_var;
    1196           0 :                                         test_var = PyLong_AsUnsignedLongLong(in);
    1197           0 :                                         if (PyErr_Occurred() != NULL) {
    1198           0 :                                                 talloc_free(ret); return NULL;
    1199             :                                         }
    1200           0 :                                         if (test_var > uint_max) {
    1201           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    1202             :                                                   PyLong_Type.tp_name, uint_max, test_var);
    1203           0 :                                                 talloc_free(ret); return NULL;
    1204             :                                         }
    1205           0 :                                         ret->qword = test_var;
    1206             :                                 } else {
    1207           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    1208             :                                           PyLong_Type.tp_name);
    1209           0 :                                         talloc_free(ret); return NULL;
    1210             :                                 }
    1211             :                         }
    1212           0 :                         break;
    1213             : 
    1214           0 :                 default:
    1215           0 :                         if (in == NULL) {
    1216           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->data");
    1217           0 :                                 talloc_free(ret); return NULL;
    1218             :                         }
    1219           0 :                         ret->data = data_blob_talloc(mem_ctx, PyBytes_AS_STRING(in), PyBytes_GET_SIZE(in));
    1220           0 :                         break;
    1221             : 
    1222             :         }
    1223             : 
    1224           0 :         return ret;
    1225             : }
    1226             : 
    1227           0 : static PyObject *py_winreg_Data_import(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1228             : {
    1229           0 :         const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
    1230           0 :         PyObject *mem_ctx_obj = NULL;
    1231           0 :         TALLOC_CTX *mem_ctx = NULL;
    1232           0 :         int level = 0;
    1233           0 :         PyObject *in_obj = NULL;
    1234           0 :         union winreg_Data *in = NULL;
    1235             : 
    1236           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:import",
    1237             :                 discard_const_p(char *, kwnames),
    1238             :                 &mem_ctx_obj,
    1239             :                 &level,
    1240             :                 &in_obj)) {
    1241           0 :                 return NULL;
    1242             :         }
    1243           0 :         mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
    1244           0 :         if (mem_ctx == NULL) {
    1245           0 :                 PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
    1246           0 :                 return NULL;
    1247             :         }
    1248           0 :         in = (union winreg_Data *)pytalloc_get_ptr(in_obj);
    1249           0 :         if (in == NULL) {
    1250           0 :                 PyErr_Format(PyExc_TypeError, "in needs to be a pointer to union winreg_Data!");
    1251           0 :                 return NULL;
    1252             :         }
    1253             : 
    1254           0 :         return py_import_winreg_Data(mem_ctx, level, in);
    1255             : }
    1256             : 
    1257           0 : static PyObject *py_winreg_Data_export(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1258             : {
    1259           0 :         const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
    1260           0 :         PyObject *mem_ctx_obj = NULL;
    1261           0 :         TALLOC_CTX *mem_ctx = NULL;
    1262           0 :         int level = 0;
    1263           0 :         PyObject *in = NULL;
    1264           0 :         union winreg_Data *out = NULL;
    1265             : 
    1266           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:export",
    1267             :                 discard_const_p(char *, kwnames),
    1268             :                 &mem_ctx_obj,
    1269             :                 &level,
    1270             :                 &in)) {
    1271           0 :                 return NULL;
    1272             :         }
    1273           0 :         mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
    1274           0 :         if (mem_ctx == NULL) {
    1275           0 :                 PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
    1276           0 :                 return NULL;
    1277             :         }
    1278             : 
    1279           0 :         out = py_export_winreg_Data(mem_ctx, level, in);
    1280           0 :         if (out == NULL) {
    1281           0 :                 return NULL;
    1282             :         }
    1283             : 
    1284           0 :         return pytalloc_GenericObject_reference(out);
    1285             : }
    1286             : 
    1287             : static PyMethodDef py_winreg_Data_methods[] = {
    1288             :         { "__import__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_Data_import),
    1289             :                 METH_VARARGS|METH_KEYWORDS|METH_CLASS,
    1290             :                 "T.__import__(mem_ctx, level, in) => ret." },
    1291             :         { "__export__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_Data_export),
    1292             :                 METH_VARARGS|METH_KEYWORDS|METH_CLASS,
    1293             :                 "T.__export__(mem_ctx, level, in) => ret." },
    1294             :         { NULL, NULL, 0, NULL }
    1295             : };
    1296             : 
    1297           0 : static PyObject *py_winreg_Data_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1298             : {
    1299           0 :         PyErr_Format(PyExc_TypeError, "New %s Objects are not supported", type->tp_name);
    1300           0 :         return NULL;
    1301             : }
    1302             : 
    1303             : 
    1304             : static PyTypeObject winreg_Data_Type = {
    1305             :         PyVarObject_HEAD_INIT(NULL, 0)
    1306             :         .tp_name = "misc.winreg_Data",
    1307             :         .tp_getset = NULL,
    1308             :         .tp_methods = py_winreg_Data_methods,
    1309             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    1310             :         .tp_new = py_winreg_Data_new,
    1311             : };
    1312             : 
    1313       12410 : static PyObject *py_import_winreg_Data_GPO(TALLOC_CTX *mem_ctx, int level, union winreg_Data_GPO *in)
    1314             : {
    1315           0 :         PyObject *ret;
    1316             : 
    1317       12410 :         switch (level) {
    1318        1656 :                 case REG_NONE:
    1319        1656 :                         ret = Py_None;
    1320        1380 :                         Py_INCREF(ret);
    1321        1656 :                         return ret;
    1322             : 
    1323        5054 :                 case REG_SZ:
    1324        5054 :                         ret = PyString_FromStringOrNULL(in->string);
    1325        5054 :                         return ret;
    1326             : 
    1327         184 :                 case REG_EXPAND_SZ:
    1328         184 :                         ret = PyString_FromStringOrNULL(in->string);
    1329         184 :                         return ret;
    1330             : 
    1331          78 :                 case REG_BINARY:
    1332          78 :                         ret = PyBytes_FromStringAndSize((char *)(in->binary).data, (in->binary).length);
    1333          78 :                         return ret;
    1334             : 
    1335        5090 :                 case REG_DWORD:
    1336        5090 :                         ret = PyLong_FromUnsignedLongLong((uint32_t)(in->value));
    1337        5090 :                         return ret;
    1338             : 
    1339           0 :                 case REG_DWORD_BIG_ENDIAN:
    1340           0 :                         ret = PyLong_FromUnsignedLongLong((uint32_t)(in->value));
    1341           0 :                         return ret;
    1342             : 
    1343         144 :                 case REG_QWORD:
    1344         144 :                         ret = PyLong_FromUnsignedLongLong(in->qword);
    1345         144 :                         return ret;
    1346             : 
    1347         204 :                 default:
    1348         204 :                         ret = PyBytes_FromStringAndSize((char *)(in->data).data, (in->data).length);
    1349         204 :                         return ret;
    1350             : 
    1351             :         }
    1352             :         PyErr_SetString(PyExc_TypeError, "unknown union level");
    1353             :         return NULL;
    1354             : }
    1355             : 
    1356        3968 : static union winreg_Data_GPO *py_export_winreg_Data_GPO(TALLOC_CTX *mem_ctx, int level, PyObject *in)
    1357             : {
    1358        3968 :         union winreg_Data_GPO *ret = talloc_zero(mem_ctx, union winreg_Data_GPO);
    1359        3968 :         switch (level) {
    1360           0 :                 case REG_NONE:
    1361           0 :                         break;
    1362             : 
    1363        1966 :                 case REG_SZ:
    1364        1966 :                         if (in == NULL) {
    1365           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->string");
    1366           0 :                                 talloc_free(ret); return NULL;
    1367             :                         }
    1368             :                         {
    1369           0 :                                 const char *test_str;
    1370           0 :                                 const char *talloc_str;
    1371        1966 :                                 PyObject *unicode = NULL;
    1372        1966 :                                 if (PyUnicode_Check(in)) {
    1373        1890 :                                         unicode = PyUnicode_AsEncodedString(in, "utf-8", "ignore");
    1374        1890 :                                         if (unicode == NULL) {
    1375           0 :                                                 talloc_free(ret); return NULL;
    1376             :                                         }
    1377        1890 :                                         test_str = PyBytes_AS_STRING(unicode);
    1378          76 :                                 } else if (PyBytes_Check(in)) {
    1379          76 :                                         test_str = PyBytes_AS_STRING(in);
    1380             :                                 } else {
    1381           0 :                                         PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(in)->tp_name);
    1382           0 :                                         talloc_free(ret); return NULL;
    1383             :                                 }
    1384        1966 :                                 talloc_str = talloc_strdup(mem_ctx, test_str);
    1385        1966 :                                 if (unicode != NULL) {
    1386        1329 :                                         Py_DECREF(unicode);
    1387             :                                 }
    1388        1966 :                                 if (talloc_str == NULL) {
    1389           0 :                                         PyErr_NoMemory();
    1390           0 :                                         talloc_free(ret); return NULL;
    1391             :                                 }
    1392        1966 :                                 ret->string = talloc_str;
    1393             :                         }
    1394        1966 :                         break;
    1395             : 
    1396         152 :                 case REG_EXPAND_SZ:
    1397         152 :                         if (in == NULL) {
    1398           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->string");
    1399           0 :                                 talloc_free(ret); return NULL;
    1400             :                         }
    1401             :                         {
    1402           0 :                                 const char *test_str;
    1403           0 :                                 const char *talloc_str;
    1404         152 :                                 PyObject *unicode = NULL;
    1405         152 :                                 if (PyUnicode_Check(in)) {
    1406         152 :                                         unicode = PyUnicode_AsEncodedString(in, "utf-8", "ignore");
    1407         152 :                                         if (unicode == NULL) {
    1408           0 :                                                 talloc_free(ret); return NULL;
    1409             :                                         }
    1410         152 :                                         test_str = PyBytes_AS_STRING(unicode);
    1411           0 :                                 } else if (PyBytes_Check(in)) {
    1412           0 :                                         test_str = PyBytes_AS_STRING(in);
    1413             :                                 } else {
    1414           0 :                                         PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(in)->tp_name);
    1415           0 :                                         talloc_free(ret); return NULL;
    1416             :                                 }
    1417         152 :                                 talloc_str = talloc_strdup(mem_ctx, test_str);
    1418         152 :                                 if (unicode != NULL) {
    1419         124 :                                         Py_DECREF(unicode);
    1420             :                                 }
    1421         152 :                                 if (talloc_str == NULL) {
    1422           0 :                                         PyErr_NoMemory();
    1423           0 :                                         talloc_free(ret); return NULL;
    1424             :                                 }
    1425         152 :                                 ret->string = talloc_str;
    1426             :                         }
    1427         152 :                         break;
    1428             : 
    1429          78 :                 case REG_BINARY:
    1430          78 :                         if (in == NULL) {
    1431           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->binary");
    1432           0 :                                 talloc_free(ret); return NULL;
    1433             :                         }
    1434          78 :                         ret->binary = data_blob_talloc(mem_ctx, PyBytes_AS_STRING(in), PyBytes_GET_SIZE(in));
    1435          78 :                         break;
    1436             : 
    1437        1464 :                 case REG_DWORD:
    1438        1464 :                         if (in == NULL) {
    1439           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->value");
    1440           0 :                                 talloc_free(ret); return NULL;
    1441             :                         }
    1442             :                         {
    1443        1464 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(ret->value));
    1444        1464 :                                 if (PyLong_Check(in)) {
    1445           0 :                                         unsigned long long test_var;
    1446        1464 :                                         test_var = PyLong_AsUnsignedLongLong(in);
    1447        1464 :                                         if (PyErr_Occurred() != NULL) {
    1448           0 :                                                 talloc_free(ret); return NULL;
    1449             :                                         }
    1450        1464 :                                         if (test_var > uint_max) {
    1451           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    1452             :                                                   PyLong_Type.tp_name, uint_max, test_var);
    1453           0 :                                                 talloc_free(ret); return NULL;
    1454             :                                         }
    1455        1464 :                                         ret->value = test_var;
    1456             :                                 } else {
    1457           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    1458             :                                           PyLong_Type.tp_name);
    1459           0 :                                         talloc_free(ret); return NULL;
    1460             :                                 }
    1461             :                         }
    1462        1464 :                         break;
    1463             : 
    1464           0 :                 case REG_DWORD_BIG_ENDIAN:
    1465           0 :                         if (in == NULL) {
    1466           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->value");
    1467           0 :                                 talloc_free(ret); return NULL;
    1468             :                         }
    1469             :                         {
    1470           0 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(ret->value));
    1471           0 :                                 if (PyLong_Check(in)) {
    1472           0 :                                         unsigned long long test_var;
    1473           0 :                                         test_var = PyLong_AsUnsignedLongLong(in);
    1474           0 :                                         if (PyErr_Occurred() != NULL) {
    1475           0 :                                                 talloc_free(ret); return NULL;
    1476             :                                         }
    1477           0 :                                         if (test_var > uint_max) {
    1478           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    1479             :                                                   PyLong_Type.tp_name, uint_max, test_var);
    1480           0 :                                                 talloc_free(ret); return NULL;
    1481             :                                         }
    1482           0 :                                         ret->value = test_var;
    1483             :                                 } else {
    1484           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    1485             :                                           PyLong_Type.tp_name);
    1486           0 :                                         talloc_free(ret); return NULL;
    1487             :                                 }
    1488             :                         }
    1489           0 :                         break;
    1490             : 
    1491         144 :                 case REG_QWORD:
    1492         144 :                         if (in == NULL) {
    1493           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->qword");
    1494           0 :                                 talloc_free(ret); return NULL;
    1495             :                         }
    1496             :                         {
    1497         144 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(ret->qword));
    1498         144 :                                 if (PyLong_Check(in)) {
    1499           0 :                                         unsigned long long test_var;
    1500         144 :                                         test_var = PyLong_AsUnsignedLongLong(in);
    1501         144 :                                         if (PyErr_Occurred() != NULL) {
    1502           0 :                                                 talloc_free(ret); return NULL;
    1503             :                                         }
    1504         144 :                                         if (test_var > uint_max) {
    1505           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    1506             :                                                   PyLong_Type.tp_name, uint_max, test_var);
    1507           0 :                                                 talloc_free(ret); return NULL;
    1508             :                                         }
    1509         144 :                                         ret->qword = test_var;
    1510             :                                 } else {
    1511           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    1512             :                                           PyLong_Type.tp_name);
    1513           0 :                                         talloc_free(ret); return NULL;
    1514             :                                 }
    1515             :                         }
    1516         144 :                         break;
    1517             : 
    1518         164 :                 default:
    1519         164 :                         if (in == NULL) {
    1520           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->data");
    1521           0 :                                 talloc_free(ret); return NULL;
    1522             :                         }
    1523         164 :                         ret->data = data_blob_talloc(mem_ctx, PyBytes_AS_STRING(in), PyBytes_GET_SIZE(in));
    1524         164 :                         break;
    1525             : 
    1526             :         }
    1527             : 
    1528        3968 :         return ret;
    1529             : }
    1530             : 
    1531       12410 : static PyObject *py_winreg_Data_GPO_import(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1532             : {
    1533       12410 :         const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
    1534       12410 :         PyObject *mem_ctx_obj = NULL;
    1535       12410 :         TALLOC_CTX *mem_ctx = NULL;
    1536       12410 :         int level = 0;
    1537       12410 :         PyObject *in_obj = NULL;
    1538       12410 :         union winreg_Data_GPO *in = NULL;
    1539             : 
    1540       12410 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:import",
    1541             :                 discard_const_p(char *, kwnames),
    1542             :                 &mem_ctx_obj,
    1543             :                 &level,
    1544             :                 &in_obj)) {
    1545           0 :                 return NULL;
    1546             :         }
    1547       12410 :         mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
    1548       12410 :         if (mem_ctx == NULL) {
    1549           0 :                 PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
    1550           0 :                 return NULL;
    1551             :         }
    1552       12410 :         in = (union winreg_Data_GPO *)pytalloc_get_ptr(in_obj);
    1553       12410 :         if (in == NULL) {
    1554           0 :                 PyErr_Format(PyExc_TypeError, "in needs to be a pointer to union winreg_Data_GPO!");
    1555           0 :                 return NULL;
    1556             :         }
    1557             : 
    1558       12410 :         return py_import_winreg_Data_GPO(mem_ctx, level, in);
    1559             : }
    1560             : 
    1561        3968 : static PyObject *py_winreg_Data_GPO_export(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1562             : {
    1563        3968 :         const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
    1564        3968 :         PyObject *mem_ctx_obj = NULL;
    1565        3968 :         TALLOC_CTX *mem_ctx = NULL;
    1566        3968 :         int level = 0;
    1567        3968 :         PyObject *in = NULL;
    1568        3968 :         union winreg_Data_GPO *out = NULL;
    1569             : 
    1570        3968 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:export",
    1571             :                 discard_const_p(char *, kwnames),
    1572             :                 &mem_ctx_obj,
    1573             :                 &level,
    1574             :                 &in)) {
    1575           0 :                 return NULL;
    1576             :         }
    1577        3968 :         mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
    1578        3968 :         if (mem_ctx == NULL) {
    1579           0 :                 PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
    1580           0 :                 return NULL;
    1581             :         }
    1582             : 
    1583        3968 :         out = py_export_winreg_Data_GPO(mem_ctx, level, in);
    1584        3968 :         if (out == NULL) {
    1585           0 :                 return NULL;
    1586             :         }
    1587             : 
    1588        3968 :         return pytalloc_GenericObject_reference(out);
    1589             : }
    1590             : 
    1591             : static PyMethodDef py_winreg_Data_GPO_methods[] = {
    1592             :         { "__import__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_Data_GPO_import),
    1593             :                 METH_VARARGS|METH_KEYWORDS|METH_CLASS,
    1594             :                 "T.__import__(mem_ctx, level, in) => ret." },
    1595             :         { "__export__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_Data_GPO_export),
    1596             :                 METH_VARARGS|METH_KEYWORDS|METH_CLASS,
    1597             :                 "T.__export__(mem_ctx, level, in) => ret." },
    1598             :         { NULL, NULL, 0, NULL }
    1599             : };
    1600             : 
    1601           0 : static PyObject *py_winreg_Data_GPO_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1602             : {
    1603           0 :         PyErr_Format(PyExc_TypeError, "New %s Objects are not supported", type->tp_name);
    1604           0 :         return NULL;
    1605             : }
    1606             : 
    1607             : 
    1608             : static PyTypeObject winreg_Data_GPO_Type = {
    1609             :         PyVarObject_HEAD_INIT(NULL, 0)
    1610             :         .tp_name = "misc.winreg_Data_GPO",
    1611             :         .tp_getset = NULL,
    1612             :         .tp_methods = py_winreg_Data_GPO_methods,
    1613             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    1614             :         .tp_new = py_winreg_Data_GPO_new,
    1615             : };
    1616             : 
    1617             : static PyMethodDef misc_methods[] = {
    1618             :         { NULL, NULL, 0, NULL }
    1619             : };
    1620             : 
    1621             : static struct PyModuleDef moduledef = {
    1622             :         PyModuleDef_HEAD_INIT,
    1623             :         .m_name = "misc",
    1624             :         .m_doc = "misc DCE/RPC",
    1625             :         .m_size = -1,
    1626             :         .m_methods = misc_methods,
    1627             : };
    1628        7670 : MODULE_INIT_FUNC(misc)
    1629             : {
    1630        7670 :         PyObject *m = NULL;
    1631        7670 :         PyObject *dep_talloc = NULL;
    1632             : 
    1633        7670 :         dep_talloc = PyImport_ImportModule("talloc");
    1634        7670 :         if (dep_talloc == NULL)
    1635           0 :                 goto out;
    1636             : 
    1637        7670 :         BaseObject_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "BaseObject");
    1638        7670 :         if (BaseObject_Type == NULL)
    1639           0 :                 goto out;
    1640             : 
    1641        7670 :         GUID_Type.tp_base = BaseObject_Type;
    1642        7670 :         GUID_Type.tp_basicsize = pytalloc_BaseObject_size();
    1643             : 
    1644        7670 :         ndr_syntax_id_Type.tp_base = BaseObject_Type;
    1645        7670 :         ndr_syntax_id_Type.tp_basicsize = pytalloc_BaseObject_size();
    1646             : 
    1647        7670 :         policy_handle_Type.tp_base = BaseObject_Type;
    1648        7670 :         policy_handle_Type.tp_basicsize = pytalloc_BaseObject_size();
    1649             : 
    1650        7670 :         KRB5_EDATA_NTSTATUS_Type.tp_base = BaseObject_Type;
    1651        7670 :         KRB5_EDATA_NTSTATUS_Type.tp_basicsize = pytalloc_BaseObject_size();
    1652             : 
    1653        7670 :         winreg_Data_Type.tp_base = BaseObject_Type;
    1654        7670 :         winreg_Data_Type.tp_basicsize = pytalloc_BaseObject_size();
    1655             : 
    1656        7670 :         winreg_Data_GPO_Type.tp_base = BaseObject_Type;
    1657        7670 :         winreg_Data_GPO_Type.tp_basicsize = pytalloc_BaseObject_size();
    1658             : 
    1659        7670 :         if (PyType_Ready(&GUID_Type) < 0)
    1660           0 :                 goto out;
    1661        7670 :         if (PyType_Ready(&ndr_syntax_id_Type) < 0)
    1662           0 :                 goto out;
    1663        7670 :         if (PyType_Ready(&policy_handle_Type) < 0)
    1664           0 :                 goto out;
    1665        7670 :         if (PyType_Ready(&KRB5_EDATA_NTSTATUS_Type) < 0)
    1666           0 :                 goto out;
    1667        7670 :         if (PyType_Ready(&winreg_Data_Type) < 0)
    1668           0 :                 goto out;
    1669        7670 :         if (PyType_Ready(&winreg_Data_GPO_Type) < 0)
    1670           0 :                 goto out;
    1671             : #ifdef PY_GUID_PATCH
    1672        7670 :         PY_GUID_PATCH(&GUID_Type);
    1673             : #endif
    1674             : #ifdef PY_NDR_SYNTAX_ID_PATCH
    1675             :         PY_NDR_SYNTAX_ID_PATCH(&ndr_syntax_id_Type);
    1676             : #endif
    1677             : #ifdef PY_POLICY_HANDLE_PATCH
    1678        7670 :         PY_POLICY_HANDLE_PATCH(&policy_handle_Type);
    1679             : #endif
    1680             : #ifdef PY_KRB5_EDATA_NTSTATUS_PATCH
    1681             :         PY_KRB5_EDATA_NTSTATUS_PATCH(&KRB5_EDATA_NTSTATUS_Type);
    1682             : #endif
    1683             : #ifdef PY_WINREG_DATA_PATCH
    1684             :         PY_WINREG_DATA_PATCH(&winreg_Data_Type);
    1685             : #endif
    1686             : #ifdef PY_WINREG_DATA_GPO_PATCH
    1687             :         PY_WINREG_DATA_GPO_PATCH(&winreg_Data_GPO_Type);
    1688             : #endif
    1689             : 
    1690        7670 :         m = PyModule_Create(&moduledef);
    1691        7670 :         if (m == NULL)
    1692           0 :                 goto out;
    1693             : 
    1694        7670 :         PyModule_AddObject(m, "SV_TYPE_ALL", PyLong_FromUnsignedLongLong(0xFFFFFFFF));
    1695        7670 :         PyModule_AddObject(m, "SEC_CHAN_NULL", PyLong_FromLong((uint16_t)(SEC_CHAN_NULL)));
    1696        7670 :         PyModule_AddObject(m, "SEC_CHAN_LOCAL", PyLong_FromLong((uint16_t)(SEC_CHAN_LOCAL)));
    1697        7670 :         PyModule_AddObject(m, "SEC_CHAN_WKSTA", PyLong_FromLong((uint16_t)(SEC_CHAN_WKSTA)));
    1698        7670 :         PyModule_AddObject(m, "SEC_CHAN_DNS_DOMAIN", PyLong_FromLong((uint16_t)(SEC_CHAN_DNS_DOMAIN)));
    1699        7670 :         PyModule_AddObject(m, "SEC_CHAN_DOMAIN", PyLong_FromLong((uint16_t)(SEC_CHAN_DOMAIN)));
    1700        7670 :         PyModule_AddObject(m, "SEC_CHAN_LANMAN", PyLong_FromLong((uint16_t)(SEC_CHAN_LANMAN)));
    1701        7670 :         PyModule_AddObject(m, "SEC_CHAN_BDC", PyLong_FromLong((uint16_t)(SEC_CHAN_BDC)));
    1702        7670 :         PyModule_AddObject(m, "SEC_CHAN_RODC", PyLong_FromLong((uint16_t)(SEC_CHAN_RODC)));
    1703        7670 :         PyModule_AddObject(m, "REG_NONE", PyLong_FromUnsignedLongLong((uint32_t)(REG_NONE)));
    1704        7670 :         PyModule_AddObject(m, "REG_SZ", PyLong_FromUnsignedLongLong((uint32_t)(REG_SZ)));
    1705        7670 :         PyModule_AddObject(m, "REG_EXPAND_SZ", PyLong_FromUnsignedLongLong((uint32_t)(REG_EXPAND_SZ)));
    1706        7670 :         PyModule_AddObject(m, "REG_BINARY", PyLong_FromUnsignedLongLong((uint32_t)(REG_BINARY)));
    1707        7670 :         PyModule_AddObject(m, "REG_DWORD", PyLong_FromUnsignedLongLong((uint32_t)(REG_DWORD)));
    1708        7670 :         PyModule_AddObject(m, "REG_DWORD_BIG_ENDIAN", PyLong_FromUnsignedLongLong((uint32_t)(REG_DWORD_BIG_ENDIAN)));
    1709        7670 :         PyModule_AddObject(m, "REG_LINK", PyLong_FromUnsignedLongLong((uint32_t)(REG_LINK)));
    1710        7670 :         PyModule_AddObject(m, "REG_MULTI_SZ", PyLong_FromUnsignedLongLong((uint32_t)(REG_MULTI_SZ)));
    1711        7670 :         PyModule_AddObject(m, "REG_RESOURCE_LIST", PyLong_FromUnsignedLongLong((uint32_t)(REG_RESOURCE_LIST)));
    1712        7670 :         PyModule_AddObject(m, "REG_FULL_RESOURCE_DESCRIPTOR", PyLong_FromUnsignedLongLong((uint32_t)(REG_FULL_RESOURCE_DESCRIPTOR)));
    1713        7670 :         PyModule_AddObject(m, "REG_RESOURCE_REQUIREMENTS_LIST", PyLong_FromUnsignedLongLong((uint32_t)(REG_RESOURCE_REQUIREMENTS_LIST)));
    1714        7670 :         PyModule_AddObject(m, "REG_QWORD", PyLong_FromUnsignedLongLong((uint32_t)(REG_QWORD)));
    1715        7670 :         PyModule_AddObject(m, "SAM_DATABASE_DOMAIN", PyLong_FromUnsignedLongLong((uint32_t)(SAM_DATABASE_DOMAIN)));
    1716        7670 :         PyModule_AddObject(m, "SAM_DATABASE_BUILTIN", PyLong_FromUnsignedLongLong((uint32_t)(SAM_DATABASE_BUILTIN)));
    1717        7670 :         PyModule_AddObject(m, "SAM_DATABASE_PRIVS", PyLong_FromUnsignedLongLong((uint32_t)(SAM_DATABASE_PRIVS)));
    1718        7670 :         PyModule_AddObject(m, "SV_TYPE_WORKSTATION", PyLong_FromUnsignedLongLong((uint32_t)(SV_TYPE_WORKSTATION)));
    1719        7670 :         PyModule_AddObject(m, "SV_TYPE_SERVER", PyLong_FromUnsignedLongLong((uint32_t)(SV_TYPE_SERVER)));
    1720        7670 :         PyModule_AddObject(m, "SV_TYPE_SQLSERVER", PyLong_FromUnsignedLongLong((uint32_t)(SV_TYPE_SQLSERVER)));
    1721        7670 :         PyModule_AddObject(m, "SV_TYPE_DOMAIN_CTRL", PyLong_FromUnsignedLongLong((uint32_t)(SV_TYPE_DOMAIN_CTRL)));
    1722        7670 :         PyModule_AddObject(m, "SV_TYPE_DOMAIN_BAKCTRL", PyLong_FromUnsignedLongLong((uint32_t)(SV_TYPE_DOMAIN_BAKCTRL)));
    1723        7670 :         PyModule_AddObject(m, "SV_TYPE_TIME_SOURCE", PyLong_FromUnsignedLongLong((uint32_t)(SV_TYPE_TIME_SOURCE)));
    1724        7670 :         PyModule_AddObject(m, "SV_TYPE_AFP", PyLong_FromUnsignedLongLong((uint32_t)(SV_TYPE_AFP)));
    1725        7670 :         PyModule_AddObject(m, "SV_TYPE_NOVELL", PyLong_FromUnsignedLongLong((uint32_t)(SV_TYPE_NOVELL)));
    1726        7670 :         PyModule_AddObject(m, "SV_TYPE_DOMAIN_MEMBER", PyLong_FromUnsignedLongLong((uint32_t)(SV_TYPE_DOMAIN_MEMBER)));
    1727        7670 :         PyModule_AddObject(m, "SV_TYPE_PRINTQ_SERVER", PyLong_FromUnsignedLongLong((uint32_t)(SV_TYPE_PRINTQ_SERVER)));
    1728        7670 :         PyModule_AddObject(m, "SV_TYPE_DIALIN_SERVER", PyLong_FromUnsignedLongLong((uint32_t)(SV_TYPE_DIALIN_SERVER)));
    1729        7670 :         PyModule_AddObject(m, "SV_TYPE_SERVER_UNIX", PyLong_FromUnsignedLongLong((uint32_t)(SV_TYPE_SERVER_UNIX)));
    1730        7670 :         PyModule_AddObject(m, "SV_TYPE_NT", PyLong_FromUnsignedLongLong((uint32_t)(SV_TYPE_NT)));
    1731        7670 :         PyModule_AddObject(m, "SV_TYPE_WFW", PyLong_FromUnsignedLongLong((uint32_t)(SV_TYPE_WFW)));
    1732        7670 :         PyModule_AddObject(m, "SV_TYPE_SERVER_MFPN", PyLong_FromUnsignedLongLong((uint32_t)(SV_TYPE_SERVER_MFPN)));
    1733        7670 :         PyModule_AddObject(m, "SV_TYPE_SERVER_NT", PyLong_FromUnsignedLongLong((uint32_t)(SV_TYPE_SERVER_NT)));
    1734        7670 :         PyModule_AddObject(m, "SV_TYPE_POTENTIAL_BROWSER", PyLong_FromUnsignedLongLong((uint32_t)(SV_TYPE_POTENTIAL_BROWSER)));
    1735        7670 :         PyModule_AddObject(m, "SV_TYPE_BACKUP_BROWSER", PyLong_FromUnsignedLongLong((uint32_t)(SV_TYPE_BACKUP_BROWSER)));
    1736        7670 :         PyModule_AddObject(m, "SV_TYPE_MASTER_BROWSER", PyLong_FromUnsignedLongLong((uint32_t)(SV_TYPE_MASTER_BROWSER)));
    1737        7670 :         PyModule_AddObject(m, "SV_TYPE_DOMAIN_MASTER", PyLong_FromUnsignedLongLong((uint32_t)(SV_TYPE_DOMAIN_MASTER)));
    1738        7670 :         PyModule_AddObject(m, "SV_TYPE_SERVER_OSF", PyLong_FromUnsignedLongLong((uint32_t)(SV_TYPE_SERVER_OSF)));
    1739        7670 :         PyModule_AddObject(m, "SV_TYPE_SERVER_VMS", PyLong_FromUnsignedLongLong((uint32_t)(SV_TYPE_SERVER_VMS)));
    1740        7670 :         PyModule_AddObject(m, "SV_TYPE_WIN95_PLUS", PyLong_FromUnsignedLongLong((uint32_t)(SV_TYPE_WIN95_PLUS)));
    1741        7670 :         PyModule_AddObject(m, "SV_TYPE_DFS_SERVER", PyLong_FromUnsignedLongLong((uint32_t)(SV_TYPE_DFS_SERVER)));
    1742        7670 :         PyModule_AddObject(m, "SV_TYPE_ALTERNATE_XPORT", PyLong_FromUnsignedLongLong((uint32_t)(SV_TYPE_ALTERNATE_XPORT)));
    1743        7670 :         PyModule_AddObject(m, "SV_TYPE_LOCAL_LIST_ONLY", PyLong_FromUnsignedLongLong((uint32_t)(SV_TYPE_LOCAL_LIST_ONLY)));
    1744        7670 :         PyModule_AddObject(m, "SV_TYPE_DOMAIN_ENUM", PyLong_FromUnsignedLongLong((uint32_t)(SV_TYPE_DOMAIN_ENUM)));
    1745        6422 :         Py_INCREF((PyObject *)(void *)&GUID_Type);
    1746        7670 :         PyModule_AddObject(m, "GUID", (PyObject *)(void *)&GUID_Type);
    1747        6422 :         Py_INCREF((PyObject *)(void *)&ndr_syntax_id_Type);
    1748        7670 :         PyModule_AddObject(m, "ndr_syntax_id", (PyObject *)(void *)&ndr_syntax_id_Type);
    1749        6422 :         Py_INCREF((PyObject *)(void *)&policy_handle_Type);
    1750        7670 :         PyModule_AddObject(m, "policy_handle", (PyObject *)(void *)&policy_handle_Type);
    1751        6422 :         Py_INCREF((PyObject *)(void *)&KRB5_EDATA_NTSTATUS_Type);
    1752        7670 :         PyModule_AddObject(m, "KRB5_EDATA_NTSTATUS", (PyObject *)(void *)&KRB5_EDATA_NTSTATUS_Type);
    1753        6422 :         Py_INCREF((PyObject *)(void *)&winreg_Data_Type);
    1754        7670 :         PyModule_AddObject(m, "winreg_Data", (PyObject *)(void *)&winreg_Data_Type);
    1755        6422 :         Py_INCREF((PyObject *)(void *)&winreg_Data_GPO_Type);
    1756        7670 :         PyModule_AddObject(m, "winreg_Data_GPO", (PyObject *)(void *)&winreg_Data_GPO_Type);
    1757             : #ifdef PY_MOD_MISC_PATCH
    1758             :         PY_MOD_MISC_PATCH(m);
    1759             : #endif
    1760        7670 :         out:
    1761        7670 :         Py_XDECREF(dep_talloc);
    1762        7670 :         return m;
    1763             : 
    1764             : }

Generated by: LCOV version 1.14