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 abartlet/fix-coverage dd10fb34 Lines: 305 902 33.8 %
Date: 2021-09-23 10:06:22 Functions: 20 53 37.7 %

          Line data    Source code
       1             : 
       2             : /* Python wrapper functions auto-generated by pidl */
       3             : #define PY_SSIZE_T_CLEAN 1 /* We use Py_ssize_t for PyArg_ParseTupleAndKeywords */
       4             : #include <Python.h>
       5             : #include "python/py3compat.h"
       6             : #include "includes.h"
       7             : #include "python/modules.h"
       8             : #include <pytalloc.h>
       9             : #include "librpc/rpc/pyrpc.h"
      10             : #include "librpc/rpc/pyrpc_util.h"
      11             : #include "bin/default/librpc/gen_ndr/ndr_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        1956 : static inline unsigned long long ndr_sizeof2uintmax(size_t var_size)
      33             : {
      34        1956 :         switch (var_size) {
      35         144 :         case 8:
      36         144 :                 return UINT64_MAX;
      37        1812 :         case 4:
      38        1812 :                 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 = (struct GUID *)pytalloc_get_ptr(obj);
      78             :         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 = (struct GUID *)pytalloc_get_ptr(py_obj);
      86           0 :         if (value == NULL) {
      87           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct 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             :                         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 = (struct GUID *)pytalloc_get_ptr(obj);
     116             :         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 = (struct GUID *)pytalloc_get_ptr(py_obj);
     124           7 :         if (value == NULL) {
     125           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct 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             :                         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 = (struct GUID *)pytalloc_get_ptr(obj);
     154             :         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 = (struct GUID *)pytalloc_get_ptr(py_obj);
     162           0 :         if (value == NULL) {
     163           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct 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             :                         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 = (struct GUID *)pytalloc_get_ptr(obj);
     192             :         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             :                         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 = (struct GUID *)pytalloc_get_ptr(py_obj);
     211           0 :         if (value == NULL) {
     212           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->clock_seq");
     213           0 :                 return -1;
     214             :         }
     215           0 :         PY_CHECK_TYPE(&PyList_Type, value, return -1;);
     216             :         {
     217             :                 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: struct 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             :                                         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 = (struct GUID *)pytalloc_get_ptr(obj);
     255             :         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          36 :                 for (node_cntr_0 = 0; node_cntr_0 < (6); node_cntr_0++) {
     263             :                         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 = (struct GUID *)pytalloc_get_ptr(py_obj);
     274           6 :         if (value == NULL) {
     275           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->node");
     276           0 :                 return -1;
     277             :         }
     278           6 :         PY_CHECK_TYPE(&PyList_Type, value, return -1;);
     279             :         {
     280             :                 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          28 :                 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: struct 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             :                                         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    11869306 : static PyObject *py_GUID_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     350             : {
     351    11869306 :         return pytalloc_new(struct GUID, type);
     352             : }
     353             : 
     354       21492 : static PyObject *py_GUID_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
     355             : {
     356       21492 :         struct GUID *object = (struct GUID *)pytalloc_get_ptr(py_obj);
     357       21492 :         PyObject *ret = NULL;
     358             :         DATA_BLOB blob;
     359             :         enum ndr_err_code err;
     360       21492 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
     361       21492 :         if (tmp_ctx == NULL) {
     362           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
     363           0 :                 return NULL;
     364             :         }
     365       21492 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_GUID);
     366       21492 :         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       21492 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
     373       21492 :         TALLOC_FREE(tmp_ctx);
     374       21492 :         return ret;
     375             : }
     376             : 
     377        3186 : static PyObject *py_GUID_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
     378             : {
     379        3186 :         struct GUID *object = (struct GUID *)pytalloc_get_ptr(py_obj);
     380        3186 :         DATA_BLOB blob = {.data = NULL, .length = 0};
     381        3186 :         Py_ssize_t blob_length = 0;
     382             :         enum ndr_err_code err;
     383        3186 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
     384        3186 :         PyObject *allow_remaining_obj = NULL;
     385        3186 :         bool allow_remaining = false;
     386             : 
     387        3186 :         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        3186 :         blob.length = blob_length;
     394             : 
     395        3186 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
     396           0 :                 allow_remaining = true;
     397             :         }
     398             : 
     399        2973 :         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        3186 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_GUID);
     403             :         }
     404        3186 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
     405           0 :                 PyErr_SetNdrError(err);
     406           0 :                 return NULL;
     407             :         }
     408             : 
     409        3186 :         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 = (struct GUID *)pytalloc_get_ptr(py_obj);
     415             :         PyObject *ret;
     416             :         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        1686 : static PyObject *py_ndr_syntax_id_get_uuid(PyObject *obj, void *closure)
     444             : {
     445        1686 :         struct ndr_syntax_id *object = (struct ndr_syntax_id *)pytalloc_get_ptr(obj);
     446             :         PyObject *py_uuid;
     447        1686 :         py_uuid = pytalloc_reference_ex(&GUID_Type, pytalloc_get_mem_ctx(obj), &object->uuid);
     448        1686 :         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 = (struct ndr_syntax_id *)pytalloc_get_ptr(py_obj);
     454           0 :         if (value == NULL) {
     455           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct 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        1686 : static PyObject *py_ndr_syntax_id_get_if_version(PyObject *obj, void *closure)
     468             : {
     469        1686 :         struct ndr_syntax_id *object = (struct ndr_syntax_id *)pytalloc_get_ptr(obj);
     470             :         PyObject *py_if_version;
     471        1686 :         py_if_version = PyLong_FromUnsignedLongLong((uint32_t)object->if_version);
     472        1686 :         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 = (struct ndr_syntax_id *)pytalloc_get_ptr(py_obj);
     478           0 :         if (value == NULL) {
     479           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct 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             :                         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 = (struct ndr_syntax_id *)pytalloc_get_ptr(py_obj);
     529          96 :         PyObject *ret = NULL;
     530             :         DATA_BLOB blob;
     531             :         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 = (struct ndr_syntax_id *)pytalloc_get_ptr(py_obj);
     552           0 :         DATA_BLOB blob = {.data = NULL, .length = 0};
     553           0 :         Py_ssize_t blob_length = 0;
     554             :         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 = (struct ndr_syntax_id *)pytalloc_get_ptr(py_obj);
     587             :         PyObject *ret;
     588             :         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 = (struct policy_handle *)pytalloc_get_ptr(obj);
     618             :         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 = (struct policy_handle *)pytalloc_get_ptr(py_obj);
     626           0 :         if (value == NULL) {
     627           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct 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             :                         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 = (struct policy_handle *)pytalloc_get_ptr(obj);
     656             :         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 = (struct policy_handle *)pytalloc_get_ptr(py_obj);
     664           0 :         if (value == NULL) {
     665           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct 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 = (struct policy_handle *)pytalloc_get_ptr(py_obj);
     701           0 :         PyObject *ret = NULL;
     702             :         DATA_BLOB blob;
     703             :         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 = (struct policy_handle *)pytalloc_get_ptr(py_obj);
     724           0 :         DATA_BLOB blob = {.data = NULL, .length = 0};
     725           0 :         Py_ssize_t blob_length = 0;
     726             :         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 = (struct policy_handle *)pytalloc_get_ptr(py_obj);
     759             :         PyObject *ret;
     760             :         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 = (struct KRB5_EDATA_NTSTATUS *)pytalloc_get_ptr(obj);
     790             :         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 = (struct KRB5_EDATA_NTSTATUS *)pytalloc_get_ptr(py_obj);
     798           0 :         if (value == NULL) {
     799           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct 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 = (struct KRB5_EDATA_NTSTATUS *)pytalloc_get_ptr(obj);
     809             :         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 = (struct KRB5_EDATA_NTSTATUS *)pytalloc_get_ptr(py_obj);
     817           0 :         if (value == NULL) {
     818           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct 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             :                         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 = (struct KRB5_EDATA_NTSTATUS *)pytalloc_get_ptr(obj);
     847             :         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 = (struct KRB5_EDATA_NTSTATUS *)pytalloc_get_ptr(py_obj);
     855           0 :         if (value == NULL) {
     856           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct 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             :                         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 = (struct KRB5_EDATA_NTSTATUS *)pytalloc_get_ptr(py_obj);
     912           0 :         PyObject *ret = NULL;
     913             :         DATA_BLOB blob;
     914             :         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 = (struct KRB5_EDATA_NTSTATUS *)pytalloc_get_ptr(py_obj);
     935           0 :         DATA_BLOB blob = {.data = NULL, .length = 0};
     936           0 :         Py_ssize_t blob_length = 0;
     937             :         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 = (struct KRB5_EDATA_NTSTATUS *)pytalloc_get_ptr(py_obj);
     970             :         PyObject *ret;
     971             :         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             :         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: struct ret->string");
    1054           0 :                                 talloc_free(ret); return NULL;
    1055             :                         }
    1056             :                         {
    1057             :                                 const char *test_str;
    1058             :                                 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 :                                                 PyErr_NoMemory();
    1064           0 :                                                 talloc_free(ret); return NULL;
    1065             :                                         }
    1066           0 :                                         test_str = PyBytes_AS_STRING(unicode);
    1067           0 :                                 } else if (PyBytes_Check(in)) {
    1068           0 :                                         test_str = PyBytes_AS_STRING(in);
    1069             :                                 } else {
    1070           0 :                                         PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(in)->tp_name);
    1071           0 :                                         talloc_free(ret); return NULL;
    1072             :                                 }
    1073           0 :                                 talloc_str = talloc_strdup(mem_ctx, test_str);
    1074           0 :                                 if (unicode != NULL) {
    1075           0 :                                         Py_DECREF(unicode);
    1076             :                                 }
    1077           0 :                                 if (talloc_str == NULL) {
    1078           0 :                                         PyErr_NoMemory();
    1079           0 :                                         talloc_free(ret); return NULL;
    1080             :                                 }
    1081           0 :                                 ret->string = talloc_str;
    1082             :                         }
    1083           0 :                         break;
    1084             : 
    1085           0 :                 case REG_EXPAND_SZ:
    1086           0 :                         if (in == NULL) {
    1087           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->string");
    1088           0 :                                 talloc_free(ret); return NULL;
    1089             :                         }
    1090             :                         {
    1091             :                                 const char *test_str;
    1092             :                                 const char *talloc_str;
    1093           0 :                                 PyObject *unicode = NULL;
    1094           0 :                                 if (PyUnicode_Check(in)) {
    1095           0 :                                         unicode = PyUnicode_AsEncodedString(in, "utf-8", "ignore");
    1096           0 :                                         if (unicode == NULL) {
    1097           0 :                                                 PyErr_NoMemory();
    1098           0 :                                                 talloc_free(ret); return NULL;
    1099             :                                         }
    1100           0 :                                         test_str = PyBytes_AS_STRING(unicode);
    1101           0 :                                 } else if (PyBytes_Check(in)) {
    1102           0 :                                         test_str = PyBytes_AS_STRING(in);
    1103             :                                 } else {
    1104           0 :                                         PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(in)->tp_name);
    1105           0 :                                         talloc_free(ret); return NULL;
    1106             :                                 }
    1107           0 :                                 talloc_str = talloc_strdup(mem_ctx, test_str);
    1108           0 :                                 if (unicode != NULL) {
    1109           0 :                                         Py_DECREF(unicode);
    1110             :                                 }
    1111           0 :                                 if (talloc_str == NULL) {
    1112           0 :                                         PyErr_NoMemory();
    1113           0 :                                         talloc_free(ret); return NULL;
    1114             :                                 }
    1115           0 :                                 ret->string = talloc_str;
    1116             :                         }
    1117           0 :                         break;
    1118             : 
    1119           0 :                 case REG_BINARY:
    1120           0 :                         if (in == NULL) {
    1121           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->binary");
    1122           0 :                                 talloc_free(ret); return NULL;
    1123             :                         }
    1124           0 :                         ret->binary = data_blob_talloc(mem_ctx, PyBytes_AS_STRING(in), PyBytes_GET_SIZE(in));
    1125           0 :                         break;
    1126             : 
    1127           0 :                 case REG_DWORD:
    1128           0 :                         if (in == NULL) {
    1129           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->value");
    1130           0 :                                 talloc_free(ret); return NULL;
    1131             :                         }
    1132             :                         {
    1133           0 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(ret->value));
    1134           0 :                                 if (PyLong_Check(in)) {
    1135             :                                         unsigned long long test_var;
    1136           0 :                                         test_var = PyLong_AsUnsignedLongLong(in);
    1137           0 :                                         if (PyErr_Occurred() != NULL) {
    1138           0 :                                                 talloc_free(ret); return NULL;
    1139             :                                         }
    1140           0 :                                         if (test_var > uint_max) {
    1141           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    1142             :                                                   PyLong_Type.tp_name, uint_max, test_var);
    1143           0 :                                                 talloc_free(ret); return NULL;
    1144             :                                         }
    1145           0 :                                         ret->value = test_var;
    1146             :                                 } else {
    1147           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    1148             :                                           PyLong_Type.tp_name);
    1149           0 :                                         talloc_free(ret); return NULL;
    1150             :                                 }
    1151             :                         }
    1152           0 :                         break;
    1153             : 
    1154           0 :                 case REG_DWORD_BIG_ENDIAN:
    1155           0 :                         if (in == NULL) {
    1156           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->value");
    1157           0 :                                 talloc_free(ret); return NULL;
    1158             :                         }
    1159             :                         {
    1160           0 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(ret->value));
    1161           0 :                                 if (PyLong_Check(in)) {
    1162             :                                         unsigned long long test_var;
    1163           0 :                                         test_var = PyLong_AsUnsignedLongLong(in);
    1164           0 :                                         if (PyErr_Occurred() != NULL) {
    1165           0 :                                                 talloc_free(ret); return NULL;
    1166             :                                         }
    1167           0 :                                         if (test_var > uint_max) {
    1168           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    1169             :                                                   PyLong_Type.tp_name, uint_max, test_var);
    1170           0 :                                                 talloc_free(ret); return NULL;
    1171             :                                         }
    1172           0 :                                         ret->value = test_var;
    1173             :                                 } else {
    1174           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    1175             :                                           PyLong_Type.tp_name);
    1176           0 :                                         talloc_free(ret); return NULL;
    1177             :                                 }
    1178             :                         }
    1179           0 :                         break;
    1180             : 
    1181           0 :                 case REG_MULTI_SZ:
    1182           0 :                         if (in == NULL) {
    1183           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->string_array");
    1184           0 :                                 talloc_free(ret); return NULL;
    1185             :                         }
    1186           0 :                         ret->string_array = pytalloc_get_ptr(in);
    1187           0 :                         break;
    1188             : 
    1189           0 :                 case REG_QWORD:
    1190           0 :                         if (in == NULL) {
    1191           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->qword");
    1192           0 :                                 talloc_free(ret); return NULL;
    1193             :                         }
    1194             :                         {
    1195           0 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(ret->qword));
    1196           0 :                                 if (PyLong_Check(in)) {
    1197             :                                         unsigned long long test_var;
    1198           0 :                                         test_var = PyLong_AsUnsignedLongLong(in);
    1199           0 :                                         if (PyErr_Occurred() != NULL) {
    1200           0 :                                                 talloc_free(ret); return NULL;
    1201             :                                         }
    1202           0 :                                         if (test_var > uint_max) {
    1203           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    1204             :                                                   PyLong_Type.tp_name, uint_max, test_var);
    1205           0 :                                                 talloc_free(ret); return NULL;
    1206             :                                         }
    1207           0 :                                         ret->qword = test_var;
    1208             :                                 } else {
    1209           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    1210             :                                           PyLong_Type.tp_name);
    1211           0 :                                         talloc_free(ret); return NULL;
    1212             :                                 }
    1213             :                         }
    1214           0 :                         break;
    1215             : 
    1216           0 :                 default:
    1217           0 :                         if (in == NULL) {
    1218           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->data");
    1219           0 :                                 talloc_free(ret); return NULL;
    1220             :                         }
    1221           0 :                         ret->data = data_blob_talloc(mem_ctx, PyBytes_AS_STRING(in), PyBytes_GET_SIZE(in));
    1222           0 :                         break;
    1223             : 
    1224             :         }
    1225             : 
    1226           0 :         return ret;
    1227             : }
    1228             : 
    1229           0 : static PyObject *py_winreg_Data_import(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1230             : {
    1231           0 :         const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
    1232           0 :         PyObject *mem_ctx_obj = NULL;
    1233           0 :         TALLOC_CTX *mem_ctx = NULL;
    1234           0 :         int level = 0;
    1235           0 :         PyObject *in_obj = NULL;
    1236           0 :         union winreg_Data *in = NULL;
    1237             : 
    1238           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:import",
    1239             :                 discard_const_p(char *, kwnames),
    1240             :                 &mem_ctx_obj,
    1241             :                 &level,
    1242             :                 &in_obj)) {
    1243           0 :                 return NULL;
    1244             :         }
    1245           0 :         mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
    1246           0 :         if (mem_ctx == NULL) {
    1247           0 :                 PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
    1248           0 :                 return NULL;
    1249             :         }
    1250           0 :         in = (union winreg_Data *)pytalloc_get_ptr(in_obj);
    1251           0 :         if (in == NULL) {
    1252           0 :                 PyErr_Format(PyExc_TypeError, "in needs to be a pointer to union winreg_Data!");
    1253           0 :                 return NULL;
    1254             :         }
    1255             : 
    1256           0 :         return py_import_winreg_Data(mem_ctx, level, in);
    1257             : }
    1258             : 
    1259           0 : static PyObject *py_winreg_Data_export(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1260             : {
    1261           0 :         const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
    1262           0 :         PyObject *mem_ctx_obj = NULL;
    1263           0 :         TALLOC_CTX *mem_ctx = NULL;
    1264           0 :         int level = 0;
    1265           0 :         PyObject *in = NULL;
    1266           0 :         union winreg_Data *out = NULL;
    1267             : 
    1268           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:export",
    1269             :                 discard_const_p(char *, kwnames),
    1270             :                 &mem_ctx_obj,
    1271             :                 &level,
    1272             :                 &in)) {
    1273           0 :                 return NULL;
    1274             :         }
    1275           0 :         mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
    1276           0 :         if (mem_ctx == NULL) {
    1277           0 :                 PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
    1278           0 :                 return NULL;
    1279             :         }
    1280             : 
    1281           0 :         out = py_export_winreg_Data(mem_ctx, level, in);
    1282           0 :         if (out == NULL) {
    1283           0 :                 return NULL;
    1284             :         }
    1285             : 
    1286           0 :         return pytalloc_GenericObject_reference(out);
    1287             : }
    1288             : 
    1289             : static PyMethodDef py_winreg_Data_methods[] = {
    1290             :         { "__import__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_Data_import),
    1291             :                 METH_VARARGS|METH_KEYWORDS|METH_CLASS,
    1292             :                 "T.__import__(mem_ctx, level, in) => ret." },
    1293             :         { "__export__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_Data_export),
    1294             :                 METH_VARARGS|METH_KEYWORDS|METH_CLASS,
    1295             :                 "T.__export__(mem_ctx, level, in) => ret." },
    1296             :         { NULL, NULL, 0, NULL }
    1297             : };
    1298             : 
    1299           0 : static PyObject *py_winreg_Data_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1300             : {
    1301           0 :         PyErr_Format(PyExc_TypeError, "New %s Objects are not supported", type->tp_name);
    1302           0 :         return NULL;
    1303             : }
    1304             : 
    1305             : 
    1306             : static PyTypeObject winreg_Data_Type = {
    1307             :         PyVarObject_HEAD_INIT(NULL, 0)
    1308             :         .tp_name = "misc.winreg_Data",
    1309             :         .tp_getset = NULL,
    1310             :         .tp_methods = py_winreg_Data_methods,
    1311             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    1312             :         .tp_new = py_winreg_Data_new,
    1313             : };
    1314             : 
    1315        7174 : static PyObject *py_import_winreg_Data_GPO(TALLOC_CTX *mem_ctx, int level, union winreg_Data_GPO *in)
    1316             : {
    1317             :         PyObject *ret;
    1318             : 
    1319        7174 :         switch (level) {
    1320        1656 :                 case REG_NONE:
    1321        1656 :                         ret = Py_None;
    1322        1656 :                         Py_INCREF(ret);
    1323        1656 :                         return ret;
    1324             : 
    1325        2614 :                 case REG_SZ:
    1326        2614 :                         ret = PyString_FromStringOrNULL(in->string);
    1327        2614 :                         return ret;
    1328             : 
    1329         160 :                 case REG_EXPAND_SZ:
    1330         160 :                         ret = PyString_FromStringOrNULL(in->string);
    1331         160 :                         return ret;
    1332             : 
    1333          72 :                 case REG_BINARY:
    1334          72 :                         ret = PyBytes_FromStringAndSize((char *)(in->binary).data, (in->binary).length);
    1335          72 :                         return ret;
    1336             : 
    1337        2364 :                 case REG_DWORD:
    1338        2364 :                         ret = PyLong_FromUnsignedLongLong((uint32_t)in->value);
    1339        2364 :                         return ret;
    1340             : 
    1341           0 :                 case REG_DWORD_BIG_ENDIAN:
    1342           0 :                         ret = PyLong_FromUnsignedLongLong((uint32_t)in->value);
    1343           0 :                         return ret;
    1344             : 
    1345         144 :                 case REG_QWORD:
    1346         144 :                         ret = PyLong_FromUnsignedLongLong(in->qword);
    1347         144 :                         return ret;
    1348             : 
    1349         164 :                 default:
    1350         164 :                         ret = PyBytes_FromStringAndSize((char *)(in->data).data, (in->data).length);
    1351         164 :                         return ret;
    1352             : 
    1353             :         }
    1354             :         PyErr_SetString(PyExc_TypeError, "unknown union level");
    1355             :         return NULL;
    1356             : }
    1357             : 
    1358        4640 : static union winreg_Data_GPO *py_export_winreg_Data_GPO(TALLOC_CTX *mem_ctx, int level, PyObject *in)
    1359             : {
    1360        4640 :         union winreg_Data_GPO *ret = talloc_zero(mem_ctx, union winreg_Data_GPO);
    1361        4640 :         switch (level) {
    1362           0 :                 case REG_NONE:
    1363           0 :                         break;
    1364             : 
    1365        2306 :                 case REG_SZ:
    1366        2306 :                         if (in == NULL) {
    1367           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->string");
    1368           0 :                                 talloc_free(ret); return NULL;
    1369             :                         }
    1370             :                         {
    1371             :                                 const char *test_str;
    1372             :                                 const char *talloc_str;
    1373        2306 :                                 PyObject *unicode = NULL;
    1374        2306 :                                 if (PyUnicode_Check(in)) {
    1375        2274 :                                         unicode = PyUnicode_AsEncodedString(in, "utf-8", "ignore");
    1376        2274 :                                         if (unicode == NULL) {
    1377           0 :                                                 PyErr_NoMemory();
    1378           0 :                                                 talloc_free(ret); return NULL;
    1379             :                                         }
    1380        2274 :                                         test_str = PyBytes_AS_STRING(unicode);
    1381          32 :                                 } else if (PyBytes_Check(in)) {
    1382          32 :                                         test_str = PyBytes_AS_STRING(in);
    1383             :                                 } else {
    1384           0 :                                         PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(in)->tp_name);
    1385           0 :                                         talloc_free(ret); return NULL;
    1386             :                                 }
    1387        2306 :                                 talloc_str = talloc_strdup(mem_ctx, test_str);
    1388        2306 :                                 if (unicode != NULL) {
    1389        2274 :                                         Py_DECREF(unicode);
    1390             :                                 }
    1391        2306 :                                 if (talloc_str == NULL) {
    1392           0 :                                         PyErr_NoMemory();
    1393           0 :                                         talloc_free(ret); return NULL;
    1394             :                                 }
    1395        2306 :                                 ret->string = talloc_str;
    1396             :                         }
    1397        2306 :                         break;
    1398             : 
    1399         152 :                 case REG_EXPAND_SZ:
    1400         152 :                         if (in == NULL) {
    1401           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->string");
    1402           0 :                                 talloc_free(ret); return NULL;
    1403             :                         }
    1404             :                         {
    1405             :                                 const char *test_str;
    1406             :                                 const char *talloc_str;
    1407         152 :                                 PyObject *unicode = NULL;
    1408         152 :                                 if (PyUnicode_Check(in)) {
    1409         152 :                                         unicode = PyUnicode_AsEncodedString(in, "utf-8", "ignore");
    1410         152 :                                         if (unicode == NULL) {
    1411           0 :                                                 PyErr_NoMemory();
    1412           0 :                                                 talloc_free(ret); return NULL;
    1413             :                                         }
    1414         152 :                                         test_str = PyBytes_AS_STRING(unicode);
    1415           0 :                                 } else if (PyBytes_Check(in)) {
    1416           0 :                                         test_str = PyBytes_AS_STRING(in);
    1417             :                                 } else {
    1418           0 :                                         PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(in)->tp_name);
    1419           0 :                                         talloc_free(ret); return NULL;
    1420             :                                 }
    1421         152 :                                 talloc_str = talloc_strdup(mem_ctx, test_str);
    1422         152 :                                 if (unicode != NULL) {
    1423         152 :                                         Py_DECREF(unicode);
    1424             :                                 }
    1425         152 :                                 if (talloc_str == NULL) {
    1426           0 :                                         PyErr_NoMemory();
    1427           0 :                                         talloc_free(ret); return NULL;
    1428             :                                 }
    1429         152 :                                 ret->string = talloc_str;
    1430             :                         }
    1431         152 :                         break;
    1432             : 
    1433          72 :                 case REG_BINARY:
    1434          72 :                         if (in == NULL) {
    1435           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->binary");
    1436           0 :                                 talloc_free(ret); return NULL;
    1437             :                         }
    1438          72 :                         ret->binary = data_blob_talloc(mem_ctx, PyBytes_AS_STRING(in), PyBytes_GET_SIZE(in));
    1439          72 :                         break;
    1440             : 
    1441        1812 :                 case REG_DWORD:
    1442        1812 :                         if (in == NULL) {
    1443           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->value");
    1444           0 :                                 talloc_free(ret); return NULL;
    1445             :                         }
    1446             :                         {
    1447        1812 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(ret->value));
    1448        1812 :                                 if (PyLong_Check(in)) {
    1449             :                                         unsigned long long test_var;
    1450        1812 :                                         test_var = PyLong_AsUnsignedLongLong(in);
    1451        1812 :                                         if (PyErr_Occurred() != NULL) {
    1452           0 :                                                 talloc_free(ret); return NULL;
    1453             :                                         }
    1454        1812 :                                         if (test_var > uint_max) {
    1455           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    1456             :                                                   PyLong_Type.tp_name, uint_max, test_var);
    1457           0 :                                                 talloc_free(ret); return NULL;
    1458             :                                         }
    1459        1812 :                                         ret->value = test_var;
    1460             :                                 } else {
    1461           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    1462             :                                           PyLong_Type.tp_name);
    1463           0 :                                         talloc_free(ret); return NULL;
    1464             :                                 }
    1465             :                         }
    1466        1812 :                         break;
    1467             : 
    1468           0 :                 case REG_DWORD_BIG_ENDIAN:
    1469           0 :                         if (in == NULL) {
    1470           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->value");
    1471           0 :                                 talloc_free(ret); return NULL;
    1472             :                         }
    1473             :                         {
    1474           0 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(ret->value));
    1475           0 :                                 if (PyLong_Check(in)) {
    1476             :                                         unsigned long long test_var;
    1477           0 :                                         test_var = PyLong_AsUnsignedLongLong(in);
    1478           0 :                                         if (PyErr_Occurred() != NULL) {
    1479           0 :                                                 talloc_free(ret); return NULL;
    1480             :                                         }
    1481           0 :                                         if (test_var > uint_max) {
    1482           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    1483             :                                                   PyLong_Type.tp_name, uint_max, test_var);
    1484           0 :                                                 talloc_free(ret); return NULL;
    1485             :                                         }
    1486           0 :                                         ret->value = test_var;
    1487             :                                 } else {
    1488           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    1489             :                                           PyLong_Type.tp_name);
    1490           0 :                                         talloc_free(ret); return NULL;
    1491             :                                 }
    1492             :                         }
    1493           0 :                         break;
    1494             : 
    1495         144 :                 case REG_QWORD:
    1496         144 :                         if (in == NULL) {
    1497           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->qword");
    1498           0 :                                 talloc_free(ret); return NULL;
    1499             :                         }
    1500             :                         {
    1501         144 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(ret->qword));
    1502         144 :                                 if (PyLong_Check(in)) {
    1503             :                                         unsigned long long test_var;
    1504         144 :                                         test_var = PyLong_AsUnsignedLongLong(in);
    1505         144 :                                         if (PyErr_Occurred() != NULL) {
    1506           0 :                                                 talloc_free(ret); return NULL;
    1507             :                                         }
    1508         144 :                                         if (test_var > uint_max) {
    1509           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    1510             :                                                   PyLong_Type.tp_name, uint_max, test_var);
    1511           0 :                                                 talloc_free(ret); return NULL;
    1512             :                                         }
    1513         144 :                                         ret->qword = test_var;
    1514             :                                 } else {
    1515           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    1516             :                                           PyLong_Type.tp_name);
    1517           0 :                                         talloc_free(ret); return NULL;
    1518             :                                 }
    1519             :                         }
    1520         144 :                         break;
    1521             : 
    1522         154 :                 default:
    1523         154 :                         if (in == NULL) {
    1524           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->data");
    1525           0 :                                 talloc_free(ret); return NULL;
    1526             :                         }
    1527         154 :                         ret->data = data_blob_talloc(mem_ctx, PyBytes_AS_STRING(in), PyBytes_GET_SIZE(in));
    1528         154 :                         break;
    1529             : 
    1530             :         }
    1531             : 
    1532        4640 :         return ret;
    1533             : }
    1534             : 
    1535        7174 : static PyObject *py_winreg_Data_GPO_import(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1536             : {
    1537        7174 :         const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
    1538        7174 :         PyObject *mem_ctx_obj = NULL;
    1539        7174 :         TALLOC_CTX *mem_ctx = NULL;
    1540        7174 :         int level = 0;
    1541        7174 :         PyObject *in_obj = NULL;
    1542        7174 :         union winreg_Data_GPO *in = NULL;
    1543             : 
    1544        7174 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:import",
    1545             :                 discard_const_p(char *, kwnames),
    1546             :                 &mem_ctx_obj,
    1547             :                 &level,
    1548             :                 &in_obj)) {
    1549           0 :                 return NULL;
    1550             :         }
    1551        7174 :         mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
    1552        7174 :         if (mem_ctx == NULL) {
    1553           0 :                 PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
    1554           0 :                 return NULL;
    1555             :         }
    1556        7174 :         in = (union winreg_Data_GPO *)pytalloc_get_ptr(in_obj);
    1557        7174 :         if (in == NULL) {
    1558           0 :                 PyErr_Format(PyExc_TypeError, "in needs to be a pointer to union winreg_Data_GPO!");
    1559           0 :                 return NULL;
    1560             :         }
    1561             : 
    1562        7174 :         return py_import_winreg_Data_GPO(mem_ctx, level, in);
    1563             : }
    1564             : 
    1565        4640 : static PyObject *py_winreg_Data_GPO_export(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1566             : {
    1567        4640 :         const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
    1568        4640 :         PyObject *mem_ctx_obj = NULL;
    1569        4640 :         TALLOC_CTX *mem_ctx = NULL;
    1570        4640 :         int level = 0;
    1571        4640 :         PyObject *in = NULL;
    1572        4640 :         union winreg_Data_GPO *out = NULL;
    1573             : 
    1574        4640 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:export",
    1575             :                 discard_const_p(char *, kwnames),
    1576             :                 &mem_ctx_obj,
    1577             :                 &level,
    1578             :                 &in)) {
    1579           0 :                 return NULL;
    1580             :         }
    1581        4640 :         mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
    1582        4640 :         if (mem_ctx == NULL) {
    1583           0 :                 PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
    1584           0 :                 return NULL;
    1585             :         }
    1586             : 
    1587        4640 :         out = py_export_winreg_Data_GPO(mem_ctx, level, in);
    1588        4640 :         if (out == NULL) {
    1589           0 :                 return NULL;
    1590             :         }
    1591             : 
    1592        4640 :         return pytalloc_GenericObject_reference(out);
    1593             : }
    1594             : 
    1595             : static PyMethodDef py_winreg_Data_GPO_methods[] = {
    1596             :         { "__import__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_Data_GPO_import),
    1597             :                 METH_VARARGS|METH_KEYWORDS|METH_CLASS,
    1598             :                 "T.__import__(mem_ctx, level, in) => ret." },
    1599             :         { "__export__", PY_DISCARD_FUNC_SIG(PyCFunction,py_winreg_Data_GPO_export),
    1600             :                 METH_VARARGS|METH_KEYWORDS|METH_CLASS,
    1601             :                 "T.__export__(mem_ctx, level, in) => ret." },
    1602             :         { NULL, NULL, 0, NULL }
    1603             : };
    1604             : 
    1605           0 : static PyObject *py_winreg_Data_GPO_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1606             : {
    1607           0 :         PyErr_Format(PyExc_TypeError, "New %s Objects are not supported", type->tp_name);
    1608           0 :         return NULL;
    1609             : }
    1610             : 
    1611             : 
    1612             : static PyTypeObject winreg_Data_GPO_Type = {
    1613             :         PyVarObject_HEAD_INIT(NULL, 0)
    1614             :         .tp_name = "misc.winreg_Data_GPO",
    1615             :         .tp_getset = NULL,
    1616             :         .tp_methods = py_winreg_Data_GPO_methods,
    1617             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    1618             :         .tp_new = py_winreg_Data_GPO_new,
    1619             : };
    1620             : 
    1621             : static PyMethodDef misc_methods[] = {
    1622             :         { NULL, NULL, 0, NULL }
    1623             : };
    1624             : 
    1625             : static struct PyModuleDef moduledef = {
    1626             :         PyModuleDef_HEAD_INIT,
    1627             :         .m_name = "misc",
    1628             :         .m_doc = "misc DCE/RPC",
    1629             :         .m_size = -1,
    1630             :         .m_methods = misc_methods,
    1631             : };
    1632        5015 : MODULE_INIT_FUNC(misc)
    1633             : {
    1634        5015 :         PyObject *m = NULL;
    1635        5015 :         PyObject *dep_talloc = NULL;
    1636             : 
    1637        5015 :         dep_talloc = PyImport_ImportModule("talloc");
    1638        5015 :         if (dep_talloc == NULL)
    1639           0 :                 goto out;
    1640             : 
    1641        5015 :         BaseObject_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "BaseObject");
    1642        5015 :         if (BaseObject_Type == NULL)
    1643           0 :                 goto out;
    1644             : 
    1645        5015 :         GUID_Type.tp_base = BaseObject_Type;
    1646        5015 :         GUID_Type.tp_basicsize = pytalloc_BaseObject_size();
    1647             : 
    1648        5015 :         ndr_syntax_id_Type.tp_base = BaseObject_Type;
    1649        5015 :         ndr_syntax_id_Type.tp_basicsize = pytalloc_BaseObject_size();
    1650             : 
    1651        5015 :         policy_handle_Type.tp_base = BaseObject_Type;
    1652        5015 :         policy_handle_Type.tp_basicsize = pytalloc_BaseObject_size();
    1653             : 
    1654        5015 :         KRB5_EDATA_NTSTATUS_Type.tp_base = BaseObject_Type;
    1655        5015 :         KRB5_EDATA_NTSTATUS_Type.tp_basicsize = pytalloc_BaseObject_size();
    1656             : 
    1657        5015 :         winreg_Data_Type.tp_base = BaseObject_Type;
    1658        5015 :         winreg_Data_Type.tp_basicsize = pytalloc_BaseObject_size();
    1659             : 
    1660        5015 :         winreg_Data_GPO_Type.tp_base = BaseObject_Type;
    1661        5015 :         winreg_Data_GPO_Type.tp_basicsize = pytalloc_BaseObject_size();
    1662             : 
    1663        5015 :         if (PyType_Ready(&GUID_Type) < 0)
    1664           0 :                 goto out;
    1665        5015 :         if (PyType_Ready(&ndr_syntax_id_Type) < 0)
    1666           0 :                 goto out;
    1667        5015 :         if (PyType_Ready(&policy_handle_Type) < 0)
    1668           0 :                 goto out;
    1669        5015 :         if (PyType_Ready(&KRB5_EDATA_NTSTATUS_Type) < 0)
    1670           0 :                 goto out;
    1671        5015 :         if (PyType_Ready(&winreg_Data_Type) < 0)
    1672           0 :                 goto out;
    1673        5015 :         if (PyType_Ready(&winreg_Data_GPO_Type) < 0)
    1674           0 :                 goto out;
    1675             : #ifdef PY_GUID_PATCH
    1676        5015 :         PY_GUID_PATCH(&GUID_Type);
    1677             : #endif
    1678             : #ifdef PY_NDR_SYNTAX_ID_PATCH
    1679             :         PY_NDR_SYNTAX_ID_PATCH(&ndr_syntax_id_Type);
    1680             : #endif
    1681             : #ifdef PY_POLICY_HANDLE_PATCH
    1682        5015 :         PY_POLICY_HANDLE_PATCH(&policy_handle_Type);
    1683             : #endif
    1684             : #ifdef PY_KRB5_EDATA_NTSTATUS_PATCH
    1685             :         PY_KRB5_EDATA_NTSTATUS_PATCH(&KRB5_EDATA_NTSTATUS_Type);
    1686             : #endif
    1687             : #ifdef PY_WINREG_DATA_PATCH
    1688             :         PY_WINREG_DATA_PATCH(&winreg_Data_Type);
    1689             : #endif
    1690             : #ifdef PY_WINREG_DATA_GPO_PATCH
    1691             :         PY_WINREG_DATA_GPO_PATCH(&winreg_Data_GPO_Type);
    1692             : #endif
    1693             : 
    1694        5015 :         m = PyModule_Create(&moduledef);
    1695        5015 :         if (m == NULL)
    1696           0 :                 goto out;
    1697             : 
    1698        5015 :         PyModule_AddObject(m, "SV_TYPE_ALL", PyLong_FromUnsignedLongLong(0xFFFFFFFF));
    1699        5015 :         PyModule_AddObject(m, "SEC_CHAN_NULL", PyLong_FromLong((uint16_t)SEC_CHAN_NULL));
    1700        5015 :         PyModule_AddObject(m, "SEC_CHAN_LOCAL", PyLong_FromLong((uint16_t)SEC_CHAN_LOCAL));
    1701        5015 :         PyModule_AddObject(m, "SEC_CHAN_WKSTA", PyLong_FromLong((uint16_t)SEC_CHAN_WKSTA));
    1702        5015 :         PyModule_AddObject(m, "SEC_CHAN_DNS_DOMAIN", PyLong_FromLong((uint16_t)SEC_CHAN_DNS_DOMAIN));
    1703        5015 :         PyModule_AddObject(m, "SEC_CHAN_DOMAIN", PyLong_FromLong((uint16_t)SEC_CHAN_DOMAIN));
    1704        5015 :         PyModule_AddObject(m, "SEC_CHAN_LANMAN", PyLong_FromLong((uint16_t)SEC_CHAN_LANMAN));
    1705        5015 :         PyModule_AddObject(m, "SEC_CHAN_BDC", PyLong_FromLong((uint16_t)SEC_CHAN_BDC));
    1706        5015 :         PyModule_AddObject(m, "SEC_CHAN_RODC", PyLong_FromLong((uint16_t)SEC_CHAN_RODC));
    1707        5015 :         PyModule_AddObject(m, "REG_NONE", PyLong_FromUnsignedLongLong((uint32_t)REG_NONE));
    1708        5015 :         PyModule_AddObject(m, "REG_SZ", PyLong_FromUnsignedLongLong((uint32_t)REG_SZ));
    1709        5015 :         PyModule_AddObject(m, "REG_EXPAND_SZ", PyLong_FromUnsignedLongLong((uint32_t)REG_EXPAND_SZ));
    1710        5015 :         PyModule_AddObject(m, "REG_BINARY", PyLong_FromUnsignedLongLong((uint32_t)REG_BINARY));
    1711        5015 :         PyModule_AddObject(m, "REG_DWORD", PyLong_FromUnsignedLongLong((uint32_t)REG_DWORD));
    1712        5015 :         PyModule_AddObject(m, "REG_DWORD_BIG_ENDIAN", PyLong_FromUnsignedLongLong((uint32_t)REG_DWORD_BIG_ENDIAN));
    1713        5015 :         PyModule_AddObject(m, "REG_LINK", PyLong_FromUnsignedLongLong((uint32_t)REG_LINK));
    1714        5015 :         PyModule_AddObject(m, "REG_MULTI_SZ", PyLong_FromUnsignedLongLong((uint32_t)REG_MULTI_SZ));
    1715        5015 :         PyModule_AddObject(m, "REG_RESOURCE_LIST", PyLong_FromUnsignedLongLong((uint32_t)REG_RESOURCE_LIST));
    1716        5015 :         PyModule_AddObject(m, "REG_FULL_RESOURCE_DESCRIPTOR", PyLong_FromUnsignedLongLong((uint32_t)REG_FULL_RESOURCE_DESCRIPTOR));
    1717        5015 :         PyModule_AddObject(m, "REG_RESOURCE_REQUIREMENTS_LIST", PyLong_FromUnsignedLongLong((uint32_t)REG_RESOURCE_REQUIREMENTS_LIST));
    1718        5015 :         PyModule_AddObject(m, "REG_QWORD", PyLong_FromUnsignedLongLong((uint32_t)REG_QWORD));
    1719        5015 :         PyModule_AddObject(m, "SAM_DATABASE_DOMAIN", PyLong_FromUnsignedLongLong((uint32_t)SAM_DATABASE_DOMAIN));
    1720        5015 :         PyModule_AddObject(m, "SAM_DATABASE_BUILTIN", PyLong_FromUnsignedLongLong((uint32_t)SAM_DATABASE_BUILTIN));
    1721        5015 :         PyModule_AddObject(m, "SAM_DATABASE_PRIVS", PyLong_FromUnsignedLongLong((uint32_t)SAM_DATABASE_PRIVS));
    1722        5015 :         PyModule_AddObject(m, "SV_TYPE_WORKSTATION", PyLong_FromUnsignedLongLong((uint32_t)SV_TYPE_WORKSTATION));
    1723        5015 :         PyModule_AddObject(m, "SV_TYPE_SERVER", PyLong_FromUnsignedLongLong((uint32_t)SV_TYPE_SERVER));
    1724        5015 :         PyModule_AddObject(m, "SV_TYPE_SQLSERVER", PyLong_FromUnsignedLongLong((uint32_t)SV_TYPE_SQLSERVER));
    1725        5015 :         PyModule_AddObject(m, "SV_TYPE_DOMAIN_CTRL", PyLong_FromUnsignedLongLong((uint32_t)SV_TYPE_DOMAIN_CTRL));
    1726        5015 :         PyModule_AddObject(m, "SV_TYPE_DOMAIN_BAKCTRL", PyLong_FromUnsignedLongLong((uint32_t)SV_TYPE_DOMAIN_BAKCTRL));
    1727        5015 :         PyModule_AddObject(m, "SV_TYPE_TIME_SOURCE", PyLong_FromUnsignedLongLong((uint32_t)SV_TYPE_TIME_SOURCE));
    1728        5015 :         PyModule_AddObject(m, "SV_TYPE_AFP", PyLong_FromUnsignedLongLong((uint32_t)SV_TYPE_AFP));
    1729        5015 :         PyModule_AddObject(m, "SV_TYPE_NOVELL", PyLong_FromUnsignedLongLong((uint32_t)SV_TYPE_NOVELL));
    1730        5015 :         PyModule_AddObject(m, "SV_TYPE_DOMAIN_MEMBER", PyLong_FromUnsignedLongLong((uint32_t)SV_TYPE_DOMAIN_MEMBER));
    1731        5015 :         PyModule_AddObject(m, "SV_TYPE_PRINTQ_SERVER", PyLong_FromUnsignedLongLong((uint32_t)SV_TYPE_PRINTQ_SERVER));
    1732        5015 :         PyModule_AddObject(m, "SV_TYPE_DIALIN_SERVER", PyLong_FromUnsignedLongLong((uint32_t)SV_TYPE_DIALIN_SERVER));
    1733        5015 :         PyModule_AddObject(m, "SV_TYPE_SERVER_UNIX", PyLong_FromUnsignedLongLong((uint32_t)SV_TYPE_SERVER_UNIX));
    1734        5015 :         PyModule_AddObject(m, "SV_TYPE_NT", PyLong_FromUnsignedLongLong((uint32_t)SV_TYPE_NT));
    1735        5015 :         PyModule_AddObject(m, "SV_TYPE_WFW", PyLong_FromUnsignedLongLong((uint32_t)SV_TYPE_WFW));
    1736        5015 :         PyModule_AddObject(m, "SV_TYPE_SERVER_MFPN", PyLong_FromUnsignedLongLong((uint32_t)SV_TYPE_SERVER_MFPN));
    1737        5015 :         PyModule_AddObject(m, "SV_TYPE_SERVER_NT", PyLong_FromUnsignedLongLong((uint32_t)SV_TYPE_SERVER_NT));
    1738        5015 :         PyModule_AddObject(m, "SV_TYPE_POTENTIAL_BROWSER", PyLong_FromUnsignedLongLong((uint32_t)SV_TYPE_POTENTIAL_BROWSER));
    1739        5015 :         PyModule_AddObject(m, "SV_TYPE_BACKUP_BROWSER", PyLong_FromUnsignedLongLong((uint32_t)SV_TYPE_BACKUP_BROWSER));
    1740        5015 :         PyModule_AddObject(m, "SV_TYPE_MASTER_BROWSER", PyLong_FromUnsignedLongLong((uint32_t)SV_TYPE_MASTER_BROWSER));
    1741        5015 :         PyModule_AddObject(m, "SV_TYPE_DOMAIN_MASTER", PyLong_FromUnsignedLongLong((uint32_t)SV_TYPE_DOMAIN_MASTER));
    1742        5015 :         PyModule_AddObject(m, "SV_TYPE_SERVER_OSF", PyLong_FromUnsignedLongLong((uint32_t)SV_TYPE_SERVER_OSF));
    1743        5015 :         PyModule_AddObject(m, "SV_TYPE_SERVER_VMS", PyLong_FromUnsignedLongLong((uint32_t)SV_TYPE_SERVER_VMS));
    1744        5015 :         PyModule_AddObject(m, "SV_TYPE_WIN95_PLUS", PyLong_FromUnsignedLongLong((uint32_t)SV_TYPE_WIN95_PLUS));
    1745        5015 :         PyModule_AddObject(m, "SV_TYPE_DFS_SERVER", PyLong_FromUnsignedLongLong((uint32_t)SV_TYPE_DFS_SERVER));
    1746        5015 :         PyModule_AddObject(m, "SV_TYPE_ALTERNATE_XPORT", PyLong_FromUnsignedLongLong((uint32_t)SV_TYPE_ALTERNATE_XPORT));
    1747        5015 :         PyModule_AddObject(m, "SV_TYPE_LOCAL_LIST_ONLY", PyLong_FromUnsignedLongLong((uint32_t)SV_TYPE_LOCAL_LIST_ONLY));
    1748        5015 :         PyModule_AddObject(m, "SV_TYPE_DOMAIN_ENUM", PyLong_FromUnsignedLongLong((uint32_t)SV_TYPE_DOMAIN_ENUM));
    1749        5015 :         Py_INCREF((PyObject *)(void *)&GUID_Type);
    1750        5015 :         PyModule_AddObject(m, "GUID", (PyObject *)(void *)&GUID_Type);
    1751        5015 :         Py_INCREF((PyObject *)(void *)&ndr_syntax_id_Type);
    1752        5015 :         PyModule_AddObject(m, "ndr_syntax_id", (PyObject *)(void *)&ndr_syntax_id_Type);
    1753        5015 :         Py_INCREF((PyObject *)(void *)&policy_handle_Type);
    1754        5015 :         PyModule_AddObject(m, "policy_handle", (PyObject *)(void *)&policy_handle_Type);
    1755        5015 :         Py_INCREF((PyObject *)(void *)&KRB5_EDATA_NTSTATUS_Type);
    1756        5015 :         PyModule_AddObject(m, "KRB5_EDATA_NTSTATUS", (PyObject *)(void *)&KRB5_EDATA_NTSTATUS_Type);
    1757        5015 :         Py_INCREF((PyObject *)(void *)&winreg_Data_Type);
    1758        5015 :         PyModule_AddObject(m, "winreg_Data", (PyObject *)(void *)&winreg_Data_Type);
    1759        5015 :         Py_INCREF((PyObject *)(void *)&winreg_Data_GPO_Type);
    1760        5015 :         PyModule_AddObject(m, "winreg_Data_GPO", (PyObject *)(void *)&winreg_Data_GPO_Type);
    1761             : #ifdef PY_MOD_MISC_PATCH
    1762             :         PY_MOD_MISC_PATCH(m);
    1763             : #endif
    1764        5015 :         out:
    1765        5015 :         Py_XDECREF(dep_talloc);
    1766        5015 :         return m;
    1767             : 
    1768             : }

Generated by: LCOV version 1.13