LCOV - code coverage report
Current view: top level - bin/default/librpc/gen_ndr - py_unixinfo.c (source / functions) Hit Total Coverage
Test: coverage report for abartlet/fix-coverage dd10fb34 Lines: 72 1338 5.4 %
Date: 2021-09-23 10:06:22 Functions: 1 110 0.9 %

          Line data    Source code
       1             : 
       2             : /* Python wrapper functions auto-generated by pidl */
       3             : #define PY_SSIZE_T_CLEAN 1 /* We use Py_ssize_t for PyArg_ParseTupleAndKeywords */
       4             : #include <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_unixinfo.h"
      12             : #include "bin/default/librpc/gen_ndr/ndr_unixinfo_c.h"
      13             : 
      14             : /*
      15             :  * Suppress compiler warnings if the generated code does not call these
      16             :  * functions
      17             :  */
      18             : #ifndef _MAYBE_UNUSED_
      19             : #ifdef __has_attribute
      20             : #if __has_attribute(unused)
      21             : #define _MAYBE_UNUSED_ __attribute__ ((unused))
      22             : #else
      23             : #define _MAYBE_UNUSED_
      24             : #endif
      25             : #endif
      26             : #endif
      27             : /*
      28             :  * These functions are here to ensure they can be optimized out by
      29             :  * the compiler based on the constant input values
      30             :  */
      31             : 
      32           0 : static inline unsigned long long ndr_sizeof2uintmax(size_t var_size)
      33             : {
      34           0 :         switch (var_size) {
      35           0 :         case 8:
      36           0 :                 return UINT64_MAX;
      37           0 :         case 4:
      38           0 :                 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             : #include "librpc/gen_ndr/security.h"
      65             : static PyTypeObject unixinfo_GetPWUidInfo_Type;
      66             : static PyTypeObject unixinfo_InterfaceType;
      67             : static PyTypeObject unixinfo_SidToUid_Type;
      68             : static PyTypeObject unixinfo_UidToSid_Type;
      69             : static PyTypeObject unixinfo_SidToGid_Type;
      70             : static PyTypeObject unixinfo_GidToSid_Type;
      71             : static PyTypeObject unixinfo_GetPWUid_Type;
      72             : 
      73             : static PyTypeObject *BaseObject_Type;
      74             : static PyTypeObject *dom_sid_Type;
      75             : static PyTypeObject *ClientConnection_Type;
      76             : static PyTypeObject *ndr_syntax_id_Type;
      77             : 
      78           0 : static PyObject *py_unixinfo_GetPWUidInfo_get_status(PyObject *obj, void *closure)
      79             : {
      80           0 :         struct unixinfo_GetPWUidInfo *object = (struct unixinfo_GetPWUidInfo *)pytalloc_get_ptr(obj);
      81             :         PyObject *py_status;
      82           0 :         py_status = PyErr_FromNTSTATUS(object->status);
      83           0 :         return py_status;
      84             : }
      85             : 
      86           0 : static int py_unixinfo_GetPWUidInfo_set_status(PyObject *py_obj, PyObject *value, void *closure)
      87             : {
      88           0 :         struct unixinfo_GetPWUidInfo *object = (struct unixinfo_GetPWUidInfo *)pytalloc_get_ptr(py_obj);
      89           0 :         if (value == NULL) {
      90           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->status");
      91           0 :                 return -1;
      92             :         }
      93           0 :         object->status = NT_STATUS(PyLong_AsLong(value));
      94           0 :         return 0;
      95             : }
      96             : 
      97           0 : static PyObject *py_unixinfo_GetPWUidInfo_get_homedir(PyObject *obj, void *closure)
      98             : {
      99           0 :         struct unixinfo_GetPWUidInfo *object = (struct unixinfo_GetPWUidInfo *)pytalloc_get_ptr(obj);
     100             :         PyObject *py_homedir;
     101           0 :         if (object->homedir == NULL) {
     102           0 :                 py_homedir = Py_None;
     103           0 :                 Py_INCREF(py_homedir);
     104             :         } else {
     105           0 :                 py_homedir = PyUnicode_Decode(object->homedir, strlen(object->homedir), "utf-8", "ignore");
     106             :         }
     107           0 :         return py_homedir;
     108             : }
     109             : 
     110           0 : static int py_unixinfo_GetPWUidInfo_set_homedir(PyObject *py_obj, PyObject *value, void *closure)
     111             : {
     112           0 :         struct unixinfo_GetPWUidInfo *object = (struct unixinfo_GetPWUidInfo *)pytalloc_get_ptr(py_obj);
     113           0 :         if (value == NULL) {
     114           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->homedir");
     115           0 :                 return -1;
     116             :         }
     117             :         {
     118             :                 const char *test_str;
     119             :                 const char *talloc_str;
     120           0 :                 PyObject *unicode = NULL;
     121           0 :                 if (PyUnicode_Check(value)) {
     122           0 :                         unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
     123           0 :                         if (unicode == NULL) {
     124           0 :                                 PyErr_NoMemory();
     125           0 :                                 return -1;
     126             :                         }
     127           0 :                         test_str = PyBytes_AS_STRING(unicode);
     128           0 :                 } else if (PyBytes_Check(value)) {
     129           0 :                         test_str = PyBytes_AS_STRING(value);
     130             :                 } else {
     131           0 :                         PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
     132           0 :                         return -1;
     133             :                 }
     134           0 :                 talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
     135           0 :                 if (unicode != NULL) {
     136           0 :                         Py_DECREF(unicode);
     137             :                 }
     138           0 :                 if (talloc_str == NULL) {
     139           0 :                         PyErr_NoMemory();
     140           0 :                         return -1;
     141             :                 }
     142           0 :                 object->homedir = talloc_str;
     143             :         }
     144           0 :         return 0;
     145             : }
     146             : 
     147           0 : static PyObject *py_unixinfo_GetPWUidInfo_get_shell(PyObject *obj, void *closure)
     148             : {
     149           0 :         struct unixinfo_GetPWUidInfo *object = (struct unixinfo_GetPWUidInfo *)pytalloc_get_ptr(obj);
     150             :         PyObject *py_shell;
     151           0 :         if (object->shell == NULL) {
     152           0 :                 py_shell = Py_None;
     153           0 :                 Py_INCREF(py_shell);
     154             :         } else {
     155           0 :                 py_shell = PyUnicode_Decode(object->shell, strlen(object->shell), "utf-8", "ignore");
     156             :         }
     157           0 :         return py_shell;
     158             : }
     159             : 
     160           0 : static int py_unixinfo_GetPWUidInfo_set_shell(PyObject *py_obj, PyObject *value, void *closure)
     161             : {
     162           0 :         struct unixinfo_GetPWUidInfo *object = (struct unixinfo_GetPWUidInfo *)pytalloc_get_ptr(py_obj);
     163           0 :         if (value == NULL) {
     164           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->shell");
     165           0 :                 return -1;
     166             :         }
     167             :         {
     168             :                 const char *test_str;
     169             :                 const char *talloc_str;
     170           0 :                 PyObject *unicode = NULL;
     171           0 :                 if (PyUnicode_Check(value)) {
     172           0 :                         unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
     173           0 :                         if (unicode == NULL) {
     174           0 :                                 PyErr_NoMemory();
     175           0 :                                 return -1;
     176             :                         }
     177           0 :                         test_str = PyBytes_AS_STRING(unicode);
     178           0 :                 } else if (PyBytes_Check(value)) {
     179           0 :                         test_str = PyBytes_AS_STRING(value);
     180             :                 } else {
     181           0 :                         PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
     182           0 :                         return -1;
     183             :                 }
     184           0 :                 talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
     185           0 :                 if (unicode != NULL) {
     186           0 :                         Py_DECREF(unicode);
     187             :                 }
     188           0 :                 if (talloc_str == NULL) {
     189           0 :                         PyErr_NoMemory();
     190           0 :                         return -1;
     191             :                 }
     192           0 :                 object->shell = talloc_str;
     193             :         }
     194           0 :         return 0;
     195             : }
     196             : 
     197             : static PyGetSetDef py_unixinfo_GetPWUidInfo_getsetters[] = {
     198             :         {
     199             :                 .name = discard_const_p(char, "status"),
     200             :                 .get = py_unixinfo_GetPWUidInfo_get_status,
     201             :                 .set = py_unixinfo_GetPWUidInfo_set_status,
     202             :                 .doc = discard_const_p(char, "PIDL-generated element of base type NTSTATUS")
     203             :         },
     204             :         {
     205             :                 .name = discard_const_p(char, "homedir"),
     206             :                 .get = py_unixinfo_GetPWUidInfo_get_homedir,
     207             :                 .set = py_unixinfo_GetPWUidInfo_set_homedir,
     208             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
     209             :         },
     210             :         {
     211             :                 .name = discard_const_p(char, "shell"),
     212             :                 .get = py_unixinfo_GetPWUidInfo_get_shell,
     213             :                 .set = py_unixinfo_GetPWUidInfo_set_shell,
     214             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
     215             :         },
     216             :         { .name = NULL }
     217             : };
     218             : 
     219           0 : static PyObject *py_unixinfo_GetPWUidInfo_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     220             : {
     221           0 :         return pytalloc_new(struct unixinfo_GetPWUidInfo, type);
     222             : }
     223             : 
     224             : 
     225             : static PyTypeObject unixinfo_GetPWUidInfo_Type = {
     226             :         PyVarObject_HEAD_INIT(NULL, 0)
     227             :         .tp_name = "unixinfo.GetPWUidInfo",
     228             :         .tp_getset = py_unixinfo_GetPWUidInfo_getsetters,
     229             :         .tp_methods = NULL,
     230             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
     231             :         .tp_new = py_unixinfo_GetPWUidInfo_new,
     232             : };
     233             : 
     234             : 
     235             : 
     236           0 : static PyObject *py_unixinfo_SidToUid_in_get_sid(PyObject *obj, void *closure)
     237             : {
     238           0 :         struct unixinfo_SidToUid *object = (struct unixinfo_SidToUid *)pytalloc_get_ptr(obj);
     239             :         PyObject *py_sid;
     240           0 :         py_sid = pytalloc_reference_ex(dom_sid_Type, pytalloc_get_mem_ctx(obj), &object->in.sid);
     241           0 :         return py_sid;
     242             : }
     243             : 
     244           0 : static int py_unixinfo_SidToUid_in_set_sid(PyObject *py_obj, PyObject *value, void *closure)
     245             : {
     246           0 :         struct unixinfo_SidToUid *object = (struct unixinfo_SidToUid *)pytalloc_get_ptr(py_obj);
     247           0 :         if (value == NULL) {
     248           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.sid");
     249           0 :                 return -1;
     250             :         }
     251           0 :         PY_CHECK_TYPE(dom_sid_Type, value, return -1;);
     252           0 :         if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
     253           0 :                 PyErr_NoMemory();
     254           0 :                 return -1;
     255             :         }
     256           0 :         object->in.sid = *(struct dom_sid *)pytalloc_get_ptr(value);
     257           0 :         return 0;
     258             : }
     259             : 
     260           0 : static PyObject *py_unixinfo_SidToUid_out_get_uid(PyObject *obj, void *closure)
     261             : {
     262           0 :         struct unixinfo_SidToUid *object = (struct unixinfo_SidToUid *)pytalloc_get_ptr(obj);
     263             :         PyObject *py_uid;
     264           0 :         if (object->out.uid == NULL) {
     265           0 :                 Py_RETURN_NONE;
     266             :         }
     267           0 :         py_uid = PyLong_FromUnsignedLongLong(*object->out.uid);
     268           0 :         return py_uid;
     269             : }
     270             : 
     271           0 : static int py_unixinfo_SidToUid_out_set_uid(PyObject *py_obj, PyObject *value, void *closure)
     272             : {
     273           0 :         struct unixinfo_SidToUid *object = (struct unixinfo_SidToUid *)pytalloc_get_ptr(py_obj);
     274           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.uid));
     275           0 :         if (value == NULL) {
     276           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.uid");
     277           0 :                 return -1;
     278             :         }
     279           0 :         object->out.uid = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.uid);
     280           0 :         if (object->out.uid == NULL) {
     281           0 :                 PyErr_NoMemory();
     282           0 :                 return -1;
     283             :         }
     284             :         {
     285           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.uid));
     286           0 :                 if (PyLong_Check(value)) {
     287             :                         unsigned long long test_var;
     288           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     289           0 :                         if (PyErr_Occurred() != NULL) {
     290           0 :                                 return -1;
     291             :                         }
     292           0 :                         if (test_var > uint_max) {
     293           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
     294             :                                   PyLong_Type.tp_name, uint_max, test_var);
     295           0 :                                 return -1;
     296             :                         }
     297           0 :                         *object->out.uid = test_var;
     298             :                 } else {
     299           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
     300             :                           PyLong_Type.tp_name);
     301           0 :                         return -1;
     302             :                 }
     303             :         }
     304           0 :         return 0;
     305             : }
     306             : 
     307           0 : static PyObject *py_unixinfo_SidToUid_get_result(PyObject *obj, void *closure)
     308             : {
     309           0 :         struct unixinfo_SidToUid *object = (struct unixinfo_SidToUid *)pytalloc_get_ptr(obj);
     310             :         PyObject *py_result;
     311           0 :         py_result = PyErr_FromNTSTATUS(object->out.result);
     312           0 :         return py_result;
     313             : }
     314             : 
     315           0 : static int py_unixinfo_SidToUid_set_result(PyObject *py_obj, PyObject *value, void *closure)
     316             : {
     317           0 :         struct unixinfo_SidToUid *object = (struct unixinfo_SidToUid *)pytalloc_get_ptr(py_obj);
     318           0 :         if (value == NULL) {
     319           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
     320           0 :                 return -1;
     321             :         }
     322           0 :         object->out.result = NT_STATUS(PyLong_AsLong(value));
     323           0 :         return 0;
     324             : }
     325             : 
     326             : static PyGetSetDef py_unixinfo_SidToUid_getsetters[] = {
     327             :         {
     328             :                 .name = discard_const_p(char, "in_sid"),
     329             :                 .get = py_unixinfo_SidToUid_in_get_sid,
     330             :                 .set = py_unixinfo_SidToUid_in_set_sid,
     331             :                 .doc = discard_const_p(char, "PIDL-generated element of base type dom_sid")
     332             :         },
     333             :         {
     334             :                 .name = discard_const_p(char, "out_uid"),
     335             :                 .get = py_unixinfo_SidToUid_out_get_uid,
     336             :                 .set = py_unixinfo_SidToUid_out_set_uid,
     337             :                 .doc = discard_const_p(char, "PIDL-generated element of base type hyper")
     338             :         },
     339             :         {
     340             :                 .name = discard_const_p(char, "result"),
     341             :                 .get = py_unixinfo_SidToUid_get_result,
     342             :                 .set = py_unixinfo_SidToUid_set_result,
     343             :                 .doc = discard_const_p(char, "PIDL-generated element of type NTSTATUS")
     344             :         },
     345             :         { .name = NULL }
     346             : };
     347             : 
     348           0 : static PyObject *py_unixinfo_SidToUid_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     349             : {
     350           0 :         PyObject *self = pytalloc_new(struct unixinfo_SidToUid, type);
     351           0 :         struct unixinfo_SidToUid *_self = (struct unixinfo_SidToUid *)pytalloc_get_ptr(self);
     352           0 :         TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
     353           0 :         _self->out.uid = talloc_zero(mem_ctx, uint64_t);
     354           0 :         return self;
     355             : }
     356             : 
     357           0 : static PyObject *py_unixinfo_SidToUid_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
     358             : {
     359             : 
     360             : 
     361           0 :         return PyLong_FromLong(0);
     362             : }
     363             : 
     364           0 : static PyObject *py_unixinfo_SidToUid_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
     365             : {
     366           0 :         const struct ndr_interface_call *call = NULL;
     367           0 :         struct unixinfo_SidToUid *object = (struct unixinfo_SidToUid *)pytalloc_get_ptr(py_obj);
     368           0 :         PyObject *ret = NULL;
     369           0 :         struct ndr_push *push = NULL;
     370             :         DATA_BLOB blob;
     371             :         enum ndr_err_code err;
     372             : 
     373           0 :         if (ndr_table_unixinfo.num_calls < 1) {
     374           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_unixinfo_SidToUid_ndr_pack");
     375           0 :                 return NULL;
     376             :         }
     377           0 :         call = &ndr_table_unixinfo.calls[0];
     378             : 
     379           0 :         push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
     380           0 :         if (push == NULL) {
     381           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
     382           0 :                 return NULL;
     383             :         }
     384             : 
     385           0 :         push->flags |= ndr_push_flags;
     386             : 
     387           0 :         err = call->ndr_push(push, ndr_inout_flags, object);
     388           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
     389           0 :                 TALLOC_FREE(push);
     390           0 :                 PyErr_SetNdrError(err);
     391           0 :                 return NULL;
     392             :         }
     393           0 :         blob = ndr_push_blob(push);
     394           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
     395           0 :         TALLOC_FREE(push);
     396           0 :         return ret;
     397             : }
     398             : 
     399           0 : static PyObject *py_unixinfo_SidToUid_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
     400             : {
     401           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
     402           0 :         PyObject *bigendian_obj = NULL;
     403           0 :         PyObject *ndr64_obj = NULL;
     404           0 :         uint32_t ndr_push_flags = 0;
     405             : 
     406           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
     407             :                 discard_const_p(char *, kwnames),
     408             :                 &bigendian_obj,
     409             :                 &ndr64_obj)) {
     410           0 :                 return NULL;
     411             :         }
     412             : 
     413           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
     414           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
     415             :         }
     416           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
     417           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
     418             :         }
     419             : 
     420           0 :         return py_unixinfo_SidToUid_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
     421             : }
     422             : 
     423           0 : static PyObject *py_unixinfo_SidToUid_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
     424             : {
     425           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
     426           0 :         PyObject *bigendian_obj = NULL;
     427           0 :         PyObject *ndr64_obj = NULL;
     428           0 :         uint32_t ndr_push_flags = 0;
     429             : 
     430           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
     431             :                 discard_const_p(char *, kwnames),
     432             :                 &bigendian_obj,
     433             :                 &ndr64_obj)) {
     434           0 :                 return NULL;
     435             :         }
     436             : 
     437           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
     438           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
     439             :         }
     440           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
     441           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
     442             :         }
     443             : 
     444           0 :         return py_unixinfo_SidToUid_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
     445             : }
     446             : 
     447           0 : static PyObject *py_unixinfo_SidToUid_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
     448             : {
     449           0 :         const struct ndr_interface_call *call = NULL;
     450           0 :         struct unixinfo_SidToUid *object = (struct unixinfo_SidToUid *)pytalloc_get_ptr(py_obj);
     451           0 :         struct ndr_pull *pull = NULL;
     452             :         enum ndr_err_code err;
     453             : 
     454           0 :         if (ndr_table_unixinfo.num_calls < 1) {
     455           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_unixinfo_SidToUid_ndr_unpack");
     456           0 :                 return NULL;
     457             :         }
     458           0 :         call = &ndr_table_unixinfo.calls[0];
     459             : 
     460           0 :         pull = ndr_pull_init_blob(blob, object);
     461           0 :         if (pull == NULL) {
     462           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
     463           0 :                 return NULL;
     464             :         }
     465             : 
     466           0 :         pull->flags |= ndr_pull_flags;
     467             : 
     468           0 :         err = call->ndr_pull(pull, ndr_inout_flags, object);
     469           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
     470           0 :                 TALLOC_FREE(pull);
     471           0 :                 PyErr_SetNdrError(err);
     472           0 :                 return NULL;
     473             :         }
     474           0 :         if (!allow_remaining) {
     475             :                 uint32_t highest_ofs;
     476             : 
     477           0 :                 if (pull->offset > pull->relative_highest_offset) {
     478           0 :                         highest_ofs = pull->offset;
     479             :                 } else {
     480           0 :                         highest_ofs = pull->relative_highest_offset;
     481             :                 }
     482           0 :                 if (highest_ofs < pull->data_size) {
     483           0 :                         err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
     484             :                                 "not all bytes consumed ofs[%u] size[%u]",
     485             :                                 highest_ofs, pull->data_size);
     486           0 :                         TALLOC_FREE(pull);
     487           0 :                         PyErr_SetNdrError(err);
     488           0 :                         return NULL;
     489             :                 }
     490             :         }
     491             : 
     492           0 :         TALLOC_FREE(pull);
     493           0 :         Py_RETURN_NONE;
     494             : }
     495             : 
     496           0 : static PyObject *py_unixinfo_SidToUid_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
     497             : {
     498             :         DATA_BLOB blob;
     499           0 :         Py_ssize_t blob_length = 0;
     500           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
     501           0 :         PyObject *bigendian_obj = NULL;
     502           0 :         PyObject *ndr64_obj = NULL;
     503           0 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
     504           0 :         PyObject *allow_remaining_obj = NULL;
     505           0 :         bool allow_remaining = false;
     506             : 
     507           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
     508             :                 discard_const_p(char *, kwnames),
     509             :                 &blob.data, &blob_length,
     510             :                 &bigendian_obj,
     511             :                 &ndr64_obj,
     512             :                 &allow_remaining_obj)) {
     513           0 :                 return NULL;
     514             :         }
     515           0 :         blob.length = blob_length;
     516             : 
     517           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
     518           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
     519             :         }
     520           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
     521           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
     522             :         }
     523             : 
     524           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
     525           0 :                 allow_remaining = true;
     526             :         }
     527             : 
     528           0 :         return py_unixinfo_SidToUid_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
     529             : }
     530             : 
     531           0 : static PyObject *py_unixinfo_SidToUid_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
     532             : {
     533             :         DATA_BLOB blob;
     534           0 :         Py_ssize_t blob_length = 0;
     535           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
     536           0 :         PyObject *bigendian_obj = NULL;
     537           0 :         PyObject *ndr64_obj = NULL;
     538           0 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
     539           0 :         PyObject *allow_remaining_obj = NULL;
     540           0 :         bool allow_remaining = false;
     541             : 
     542           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
     543             :                 discard_const_p(char *, kwnames),
     544             :                 &blob.data, &blob_length,
     545             :                 &bigendian_obj,
     546             :                 &ndr64_obj,
     547             :                 &allow_remaining_obj)) {
     548           0 :                 return NULL;
     549             :         }
     550           0 :         blob.length = blob_length;
     551             : 
     552           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
     553           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
     554             :         }
     555           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
     556           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
     557             :         }
     558             : 
     559           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
     560           0 :                 allow_remaining = true;
     561             :         }
     562             : 
     563           0 :         return py_unixinfo_SidToUid_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
     564             : }
     565             : 
     566           0 : static PyObject *py_unixinfo_SidToUid_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
     567             : {
     568           0 :         const struct ndr_interface_call *call = NULL;
     569           0 :         struct unixinfo_SidToUid *object = (struct unixinfo_SidToUid *)pytalloc_get_ptr(py_obj);
     570             :         PyObject *ret;
     571             :         char *retstr;
     572             : 
     573           0 :         if (ndr_table_unixinfo.num_calls < 1) {
     574           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_unixinfo_SidToUid_ndr_print");
     575           0 :                 return NULL;
     576             :         }
     577           0 :         call = &ndr_table_unixinfo.calls[0];
     578             : 
     579           0 :         retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
     580           0 :         ret = PyUnicode_FromString(retstr);
     581           0 :         TALLOC_FREE(retstr);
     582             : 
     583           0 :         return ret;
     584             : }
     585             : 
     586           0 : static PyObject *py_unixinfo_SidToUid_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
     587             : {
     588           0 :         return py_unixinfo_SidToUid_ndr_print(py_obj, "unixinfo_SidToUid_in", NDR_IN);
     589             : }
     590             : 
     591           0 : static PyObject *py_unixinfo_SidToUid_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
     592             : {
     593           0 :         return py_unixinfo_SidToUid_ndr_print(py_obj, "unixinfo_SidToUid_out", NDR_OUT);
     594             : }
     595             : 
     596             : static PyMethodDef py_unixinfo_SidToUid_methods[] = {
     597             :         { "opnum", (PyCFunction)py_unixinfo_SidToUid_ndr_opnum, METH_NOARGS|METH_CLASS,
     598             :                 "unixinfo.SidToUid.opnum() -> 0 (0x00) " },
     599             :         { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_unixinfo_SidToUid_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
     600             :                 "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
     601             :         { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_unixinfo_SidToUid_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
     602             :                 "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
     603             :         { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_unixinfo_SidToUid_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
     604             :                 "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
     605             :         { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_unixinfo_SidToUid_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
     606             :                 "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
     607             :         { "__ndr_print_in__", (PyCFunction)py_unixinfo_SidToUid_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
     608             :         { "__ndr_print_out__", (PyCFunction)py_unixinfo_SidToUid_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
     609             :         { NULL, NULL, 0, NULL }
     610             : };
     611             : 
     612             : 
     613             : static PyTypeObject unixinfo_SidToUid_Type = {
     614             :         PyVarObject_HEAD_INIT(NULL, 0)
     615             :         .tp_name = "unixinfo.SidToUid",
     616             :         .tp_getset = py_unixinfo_SidToUid_getsetters,
     617             :         .tp_methods = py_unixinfo_SidToUid_methods,
     618             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
     619             :         .tp_new = py_unixinfo_SidToUid_new,
     620             : };
     621             : 
     622           0 : static bool pack_py_unixinfo_SidToUid_args_in(PyObject *args, PyObject *kwargs, struct unixinfo_SidToUid *r)
     623             : {
     624             :         PyObject *py_sid;
     625           0 :         const char *kwnames[] = {
     626             :                 "sid", NULL
     627             :         };
     628             : 
     629           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:unixinfo_SidToUid", discard_const_p(char *, kwnames), &py_sid)) {
     630           0 :                 return false;
     631             :         }
     632             : 
     633           0 :         if (py_sid == NULL) {
     634           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.sid");
     635           0 :                 return false;
     636             :         }
     637           0 :         PY_CHECK_TYPE(dom_sid_Type, py_sid, return false;);
     638           0 :         if (talloc_reference(r, pytalloc_get_mem_ctx(py_sid)) == NULL) {
     639           0 :                 PyErr_NoMemory();
     640           0 :                 return false;
     641             :         }
     642           0 :         r->in.sid = *(struct dom_sid *)pytalloc_get_ptr(py_sid);
     643           0 :         return true;
     644             : }
     645             : 
     646           0 : static PyObject *unpack_py_unixinfo_SidToUid_args_out(struct unixinfo_SidToUid *r)
     647             : {
     648             :         PyObject *result;
     649             :         PyObject *py_uid;
     650           0 :         py_uid = PyLong_FromUnsignedLongLong(*r->out.uid);
     651           0 :         result = py_uid;
     652           0 :         if (NT_STATUS_IS_ERR(r->out.result)) {
     653           0 :                 PyErr_SetNTSTATUS(r->out.result);
     654           0 :                 return NULL;
     655             :         }
     656             : 
     657           0 :         return result;
     658             : }
     659             : 
     660             : 
     661           0 : static PyObject *py_unixinfo_UidToSid_in_get_uid(PyObject *obj, void *closure)
     662             : {
     663           0 :         struct unixinfo_UidToSid *object = (struct unixinfo_UidToSid *)pytalloc_get_ptr(obj);
     664             :         PyObject *py_uid;
     665           0 :         py_uid = PyLong_FromUnsignedLongLong(object->in.uid);
     666           0 :         return py_uid;
     667             : }
     668             : 
     669           0 : static int py_unixinfo_UidToSid_in_set_uid(PyObject *py_obj, PyObject *value, void *closure)
     670             : {
     671           0 :         struct unixinfo_UidToSid *object = (struct unixinfo_UidToSid *)pytalloc_get_ptr(py_obj);
     672           0 :         if (value == NULL) {
     673           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.uid");
     674           0 :                 return -1;
     675             :         }
     676             :         {
     677           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.uid));
     678           0 :                 if (PyLong_Check(value)) {
     679             :                         unsigned long long test_var;
     680           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     681           0 :                         if (PyErr_Occurred() != NULL) {
     682           0 :                                 return -1;
     683             :                         }
     684           0 :                         if (test_var > uint_max) {
     685           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
     686             :                                   PyLong_Type.tp_name, uint_max, test_var);
     687           0 :                                 return -1;
     688             :                         }
     689           0 :                         object->in.uid = test_var;
     690             :                 } else {
     691           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
     692             :                           PyLong_Type.tp_name);
     693           0 :                         return -1;
     694             :                 }
     695             :         }
     696           0 :         return 0;
     697             : }
     698             : 
     699           0 : static PyObject *py_unixinfo_UidToSid_out_get_sid(PyObject *obj, void *closure)
     700             : {
     701           0 :         struct unixinfo_UidToSid *object = (struct unixinfo_UidToSid *)pytalloc_get_ptr(obj);
     702             :         PyObject *py_sid;
     703           0 :         if (object->out.sid == NULL) {
     704           0 :                 Py_RETURN_NONE;
     705             :         }
     706           0 :         py_sid = pytalloc_reference_ex(dom_sid_Type, object->out.sid, object->out.sid);
     707           0 :         return py_sid;
     708             : }
     709             : 
     710           0 : static int py_unixinfo_UidToSid_out_set_sid(PyObject *py_obj, PyObject *value, void *closure)
     711             : {
     712           0 :         struct unixinfo_UidToSid *object = (struct unixinfo_UidToSid *)pytalloc_get_ptr(py_obj);
     713           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.sid));
     714           0 :         if (value == NULL) {
     715           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.sid");
     716           0 :                 return -1;
     717             :         }
     718           0 :         object->out.sid = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.sid);
     719           0 :         if (object->out.sid == NULL) {
     720           0 :                 PyErr_NoMemory();
     721           0 :                 return -1;
     722             :         }
     723           0 :         PY_CHECK_TYPE(dom_sid_Type, value, return -1;);
     724           0 :         if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
     725           0 :                 PyErr_NoMemory();
     726           0 :                 return -1;
     727             :         }
     728           0 :         object->out.sid = (struct dom_sid *)pytalloc_get_ptr(value);
     729           0 :         return 0;
     730             : }
     731             : 
     732           0 : static PyObject *py_unixinfo_UidToSid_get_result(PyObject *obj, void *closure)
     733             : {
     734           0 :         struct unixinfo_UidToSid *object = (struct unixinfo_UidToSid *)pytalloc_get_ptr(obj);
     735             :         PyObject *py_result;
     736           0 :         py_result = PyErr_FromNTSTATUS(object->out.result);
     737           0 :         return py_result;
     738             : }
     739             : 
     740           0 : static int py_unixinfo_UidToSid_set_result(PyObject *py_obj, PyObject *value, void *closure)
     741             : {
     742           0 :         struct unixinfo_UidToSid *object = (struct unixinfo_UidToSid *)pytalloc_get_ptr(py_obj);
     743           0 :         if (value == NULL) {
     744           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
     745           0 :                 return -1;
     746             :         }
     747           0 :         object->out.result = NT_STATUS(PyLong_AsLong(value));
     748           0 :         return 0;
     749             : }
     750             : 
     751             : static PyGetSetDef py_unixinfo_UidToSid_getsetters[] = {
     752             :         {
     753             :                 .name = discard_const_p(char, "in_uid"),
     754             :                 .get = py_unixinfo_UidToSid_in_get_uid,
     755             :                 .set = py_unixinfo_UidToSid_in_set_uid,
     756             :                 .doc = discard_const_p(char, "PIDL-generated element of base type hyper")
     757             :         },
     758             :         {
     759             :                 .name = discard_const_p(char, "out_sid"),
     760             :                 .get = py_unixinfo_UidToSid_out_get_sid,
     761             :                 .set = py_unixinfo_UidToSid_out_set_sid,
     762             :                 .doc = discard_const_p(char, "PIDL-generated element of base type dom_sid")
     763             :         },
     764             :         {
     765             :                 .name = discard_const_p(char, "result"),
     766             :                 .get = py_unixinfo_UidToSid_get_result,
     767             :                 .set = py_unixinfo_UidToSid_set_result,
     768             :                 .doc = discard_const_p(char, "PIDL-generated element of type NTSTATUS")
     769             :         },
     770             :         { .name = NULL }
     771             : };
     772             : 
     773           0 : static PyObject *py_unixinfo_UidToSid_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     774             : {
     775           0 :         PyObject *self = pytalloc_new(struct unixinfo_UidToSid, type);
     776           0 :         struct unixinfo_UidToSid *_self = (struct unixinfo_UidToSid *)pytalloc_get_ptr(self);
     777           0 :         TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
     778           0 :         _self->out.sid = talloc_zero(mem_ctx, struct dom_sid);
     779           0 :         return self;
     780             : }
     781             : 
     782           0 : static PyObject *py_unixinfo_UidToSid_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
     783             : {
     784             : 
     785             : 
     786           0 :         return PyLong_FromLong(1);
     787             : }
     788             : 
     789           0 : static PyObject *py_unixinfo_UidToSid_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
     790             : {
     791           0 :         const struct ndr_interface_call *call = NULL;
     792           0 :         struct unixinfo_UidToSid *object = (struct unixinfo_UidToSid *)pytalloc_get_ptr(py_obj);
     793           0 :         PyObject *ret = NULL;
     794           0 :         struct ndr_push *push = NULL;
     795             :         DATA_BLOB blob;
     796             :         enum ndr_err_code err;
     797             : 
     798           0 :         if (ndr_table_unixinfo.num_calls < 2) {
     799           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_unixinfo_UidToSid_ndr_pack");
     800           0 :                 return NULL;
     801             :         }
     802           0 :         call = &ndr_table_unixinfo.calls[1];
     803             : 
     804           0 :         push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
     805           0 :         if (push == NULL) {
     806           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
     807           0 :                 return NULL;
     808             :         }
     809             : 
     810           0 :         push->flags |= ndr_push_flags;
     811             : 
     812           0 :         err = call->ndr_push(push, ndr_inout_flags, object);
     813           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
     814           0 :                 TALLOC_FREE(push);
     815           0 :                 PyErr_SetNdrError(err);
     816           0 :                 return NULL;
     817             :         }
     818           0 :         blob = ndr_push_blob(push);
     819           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
     820           0 :         TALLOC_FREE(push);
     821           0 :         return ret;
     822             : }
     823             : 
     824           0 : static PyObject *py_unixinfo_UidToSid_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
     825             : {
     826           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
     827           0 :         PyObject *bigendian_obj = NULL;
     828           0 :         PyObject *ndr64_obj = NULL;
     829           0 :         uint32_t ndr_push_flags = 0;
     830             : 
     831           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
     832             :                 discard_const_p(char *, kwnames),
     833             :                 &bigendian_obj,
     834             :                 &ndr64_obj)) {
     835           0 :                 return NULL;
     836             :         }
     837             : 
     838           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
     839           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
     840             :         }
     841           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
     842           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
     843             :         }
     844             : 
     845           0 :         return py_unixinfo_UidToSid_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
     846             : }
     847             : 
     848           0 : static PyObject *py_unixinfo_UidToSid_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
     849             : {
     850           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
     851           0 :         PyObject *bigendian_obj = NULL;
     852           0 :         PyObject *ndr64_obj = NULL;
     853           0 :         uint32_t ndr_push_flags = 0;
     854             : 
     855           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
     856             :                 discard_const_p(char *, kwnames),
     857             :                 &bigendian_obj,
     858             :                 &ndr64_obj)) {
     859           0 :                 return NULL;
     860             :         }
     861             : 
     862           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
     863           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
     864             :         }
     865           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
     866           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
     867             :         }
     868             : 
     869           0 :         return py_unixinfo_UidToSid_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
     870             : }
     871             : 
     872           0 : static PyObject *py_unixinfo_UidToSid_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
     873             : {
     874           0 :         const struct ndr_interface_call *call = NULL;
     875           0 :         struct unixinfo_UidToSid *object = (struct unixinfo_UidToSid *)pytalloc_get_ptr(py_obj);
     876           0 :         struct ndr_pull *pull = NULL;
     877             :         enum ndr_err_code err;
     878             : 
     879           0 :         if (ndr_table_unixinfo.num_calls < 2) {
     880           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_unixinfo_UidToSid_ndr_unpack");
     881           0 :                 return NULL;
     882             :         }
     883           0 :         call = &ndr_table_unixinfo.calls[1];
     884             : 
     885           0 :         pull = ndr_pull_init_blob(blob, object);
     886           0 :         if (pull == NULL) {
     887           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
     888           0 :                 return NULL;
     889             :         }
     890             : 
     891           0 :         pull->flags |= ndr_pull_flags;
     892             : 
     893           0 :         err = call->ndr_pull(pull, ndr_inout_flags, object);
     894           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
     895           0 :                 TALLOC_FREE(pull);
     896           0 :                 PyErr_SetNdrError(err);
     897           0 :                 return NULL;
     898             :         }
     899           0 :         if (!allow_remaining) {
     900             :                 uint32_t highest_ofs;
     901             : 
     902           0 :                 if (pull->offset > pull->relative_highest_offset) {
     903           0 :                         highest_ofs = pull->offset;
     904             :                 } else {
     905           0 :                         highest_ofs = pull->relative_highest_offset;
     906             :                 }
     907           0 :                 if (highest_ofs < pull->data_size) {
     908           0 :                         err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
     909             :                                 "not all bytes consumed ofs[%u] size[%u]",
     910             :                                 highest_ofs, pull->data_size);
     911           0 :                         TALLOC_FREE(pull);
     912           0 :                         PyErr_SetNdrError(err);
     913           0 :                         return NULL;
     914             :                 }
     915             :         }
     916             : 
     917           0 :         TALLOC_FREE(pull);
     918           0 :         Py_RETURN_NONE;
     919             : }
     920             : 
     921           0 : static PyObject *py_unixinfo_UidToSid_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
     922             : {
     923             :         DATA_BLOB blob;
     924           0 :         Py_ssize_t blob_length = 0;
     925           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
     926           0 :         PyObject *bigendian_obj = NULL;
     927           0 :         PyObject *ndr64_obj = NULL;
     928           0 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
     929           0 :         PyObject *allow_remaining_obj = NULL;
     930           0 :         bool allow_remaining = false;
     931             : 
     932           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
     933             :                 discard_const_p(char *, kwnames),
     934             :                 &blob.data, &blob_length,
     935             :                 &bigendian_obj,
     936             :                 &ndr64_obj,
     937             :                 &allow_remaining_obj)) {
     938           0 :                 return NULL;
     939             :         }
     940           0 :         blob.length = blob_length;
     941             : 
     942           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
     943           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
     944             :         }
     945           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
     946           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
     947             :         }
     948             : 
     949           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
     950           0 :                 allow_remaining = true;
     951             :         }
     952             : 
     953           0 :         return py_unixinfo_UidToSid_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
     954             : }
     955             : 
     956           0 : static PyObject *py_unixinfo_UidToSid_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
     957             : {
     958             :         DATA_BLOB blob;
     959           0 :         Py_ssize_t blob_length = 0;
     960           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
     961           0 :         PyObject *bigendian_obj = NULL;
     962           0 :         PyObject *ndr64_obj = NULL;
     963           0 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
     964           0 :         PyObject *allow_remaining_obj = NULL;
     965           0 :         bool allow_remaining = false;
     966             : 
     967           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
     968             :                 discard_const_p(char *, kwnames),
     969             :                 &blob.data, &blob_length,
     970             :                 &bigendian_obj,
     971             :                 &ndr64_obj,
     972             :                 &allow_remaining_obj)) {
     973           0 :                 return NULL;
     974             :         }
     975           0 :         blob.length = blob_length;
     976             : 
     977           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
     978           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
     979             :         }
     980           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
     981           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
     982             :         }
     983             : 
     984           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
     985           0 :                 allow_remaining = true;
     986             :         }
     987             : 
     988           0 :         return py_unixinfo_UidToSid_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
     989             : }
     990             : 
     991           0 : static PyObject *py_unixinfo_UidToSid_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
     992             : {
     993           0 :         const struct ndr_interface_call *call = NULL;
     994           0 :         struct unixinfo_UidToSid *object = (struct unixinfo_UidToSid *)pytalloc_get_ptr(py_obj);
     995             :         PyObject *ret;
     996             :         char *retstr;
     997             : 
     998           0 :         if (ndr_table_unixinfo.num_calls < 2) {
     999           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_unixinfo_UidToSid_ndr_print");
    1000           0 :                 return NULL;
    1001             :         }
    1002           0 :         call = &ndr_table_unixinfo.calls[1];
    1003             : 
    1004           0 :         retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
    1005           0 :         ret = PyUnicode_FromString(retstr);
    1006           0 :         TALLOC_FREE(retstr);
    1007             : 
    1008           0 :         return ret;
    1009             : }
    1010             : 
    1011           0 : static PyObject *py_unixinfo_UidToSid_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    1012             : {
    1013           0 :         return py_unixinfo_UidToSid_ndr_print(py_obj, "unixinfo_UidToSid_in", NDR_IN);
    1014             : }
    1015             : 
    1016           0 : static PyObject *py_unixinfo_UidToSid_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    1017             : {
    1018           0 :         return py_unixinfo_UidToSid_ndr_print(py_obj, "unixinfo_UidToSid_out", NDR_OUT);
    1019             : }
    1020             : 
    1021             : static PyMethodDef py_unixinfo_UidToSid_methods[] = {
    1022             :         { "opnum", (PyCFunction)py_unixinfo_UidToSid_ndr_opnum, METH_NOARGS|METH_CLASS,
    1023             :                 "unixinfo.UidToSid.opnum() -> 1 (0x01) " },
    1024             :         { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_unixinfo_UidToSid_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
    1025             :                 "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
    1026             :         { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_unixinfo_UidToSid_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
    1027             :                 "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
    1028             :         { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_unixinfo_UidToSid_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
    1029             :                 "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
    1030             :         { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_unixinfo_UidToSid_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
    1031             :                 "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
    1032             :         { "__ndr_print_in__", (PyCFunction)py_unixinfo_UidToSid_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
    1033             :         { "__ndr_print_out__", (PyCFunction)py_unixinfo_UidToSid_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
    1034             :         { NULL, NULL, 0, NULL }
    1035             : };
    1036             : 
    1037             : 
    1038             : static PyTypeObject unixinfo_UidToSid_Type = {
    1039             :         PyVarObject_HEAD_INIT(NULL, 0)
    1040             :         .tp_name = "unixinfo.UidToSid",
    1041             :         .tp_getset = py_unixinfo_UidToSid_getsetters,
    1042             :         .tp_methods = py_unixinfo_UidToSid_methods,
    1043             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    1044             :         .tp_new = py_unixinfo_UidToSid_new,
    1045             : };
    1046             : 
    1047           0 : static bool pack_py_unixinfo_UidToSid_args_in(PyObject *args, PyObject *kwargs, struct unixinfo_UidToSid *r)
    1048             : {
    1049             :         PyObject *py_uid;
    1050           0 :         const char *kwnames[] = {
    1051             :                 "uid", NULL
    1052             :         };
    1053             : 
    1054           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:unixinfo_UidToSid", discard_const_p(char *, kwnames), &py_uid)) {
    1055           0 :                 return false;
    1056             :         }
    1057             : 
    1058           0 :         if (py_uid == NULL) {
    1059           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.uid");
    1060           0 :                 return false;
    1061             :         }
    1062             :         {
    1063           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.uid));
    1064           0 :                 if (PyLong_Check(py_uid)) {
    1065             :                         unsigned long long test_var;
    1066           0 :                         test_var = PyLong_AsUnsignedLongLong(py_uid);
    1067           0 :                         if (PyErr_Occurred() != NULL) {
    1068           0 :                                 return false;
    1069             :                         }
    1070           0 :                         if (test_var > uint_max) {
    1071           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    1072             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1073           0 :                                 return false;
    1074             :                         }
    1075           0 :                         r->in.uid = test_var;
    1076             :                 } else {
    1077           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    1078             :                           PyLong_Type.tp_name);
    1079           0 :                         return false;
    1080             :                 }
    1081             :         }
    1082           0 :         return true;
    1083             : }
    1084             : 
    1085           0 : static PyObject *unpack_py_unixinfo_UidToSid_args_out(struct unixinfo_UidToSid *r)
    1086             : {
    1087             :         PyObject *result;
    1088             :         PyObject *py_sid;
    1089           0 :         py_sid = pytalloc_reference_ex(dom_sid_Type, r->out.sid, r->out.sid);
    1090           0 :         result = py_sid;
    1091           0 :         if (NT_STATUS_IS_ERR(r->out.result)) {
    1092           0 :                 PyErr_SetNTSTATUS(r->out.result);
    1093           0 :                 return NULL;
    1094             :         }
    1095             : 
    1096           0 :         return result;
    1097             : }
    1098             : 
    1099             : 
    1100           0 : static PyObject *py_unixinfo_SidToGid_in_get_sid(PyObject *obj, void *closure)
    1101             : {
    1102           0 :         struct unixinfo_SidToGid *object = (struct unixinfo_SidToGid *)pytalloc_get_ptr(obj);
    1103             :         PyObject *py_sid;
    1104           0 :         py_sid = pytalloc_reference_ex(dom_sid_Type, pytalloc_get_mem_ctx(obj), &object->in.sid);
    1105           0 :         return py_sid;
    1106             : }
    1107             : 
    1108           0 : static int py_unixinfo_SidToGid_in_set_sid(PyObject *py_obj, PyObject *value, void *closure)
    1109             : {
    1110           0 :         struct unixinfo_SidToGid *object = (struct unixinfo_SidToGid *)pytalloc_get_ptr(py_obj);
    1111           0 :         if (value == NULL) {
    1112           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.sid");
    1113           0 :                 return -1;
    1114             :         }
    1115           0 :         PY_CHECK_TYPE(dom_sid_Type, value, return -1;);
    1116           0 :         if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
    1117           0 :                 PyErr_NoMemory();
    1118           0 :                 return -1;
    1119             :         }
    1120           0 :         object->in.sid = *(struct dom_sid *)pytalloc_get_ptr(value);
    1121           0 :         return 0;
    1122             : }
    1123             : 
    1124           0 : static PyObject *py_unixinfo_SidToGid_out_get_gid(PyObject *obj, void *closure)
    1125             : {
    1126           0 :         struct unixinfo_SidToGid *object = (struct unixinfo_SidToGid *)pytalloc_get_ptr(obj);
    1127             :         PyObject *py_gid;
    1128           0 :         if (object->out.gid == NULL) {
    1129           0 :                 Py_RETURN_NONE;
    1130             :         }
    1131           0 :         py_gid = PyLong_FromUnsignedLongLong(*object->out.gid);
    1132           0 :         return py_gid;
    1133             : }
    1134             : 
    1135           0 : static int py_unixinfo_SidToGid_out_set_gid(PyObject *py_obj, PyObject *value, void *closure)
    1136             : {
    1137           0 :         struct unixinfo_SidToGid *object = (struct unixinfo_SidToGid *)pytalloc_get_ptr(py_obj);
    1138           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.gid));
    1139           0 :         if (value == NULL) {
    1140           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.gid");
    1141           0 :                 return -1;
    1142             :         }
    1143           0 :         object->out.gid = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.gid);
    1144           0 :         if (object->out.gid == NULL) {
    1145           0 :                 PyErr_NoMemory();
    1146           0 :                 return -1;
    1147             :         }
    1148             :         {
    1149           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.gid));
    1150           0 :                 if (PyLong_Check(value)) {
    1151             :                         unsigned long long test_var;
    1152           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1153           0 :                         if (PyErr_Occurred() != NULL) {
    1154           0 :                                 return -1;
    1155             :                         }
    1156           0 :                         if (test_var > uint_max) {
    1157           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    1158             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1159           0 :                                 return -1;
    1160             :                         }
    1161           0 :                         *object->out.gid = test_var;
    1162             :                 } else {
    1163           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    1164             :                           PyLong_Type.tp_name);
    1165           0 :                         return -1;
    1166             :                 }
    1167             :         }
    1168           0 :         return 0;
    1169             : }
    1170             : 
    1171           0 : static PyObject *py_unixinfo_SidToGid_get_result(PyObject *obj, void *closure)
    1172             : {
    1173           0 :         struct unixinfo_SidToGid *object = (struct unixinfo_SidToGid *)pytalloc_get_ptr(obj);
    1174             :         PyObject *py_result;
    1175           0 :         py_result = PyErr_FromNTSTATUS(object->out.result);
    1176           0 :         return py_result;
    1177             : }
    1178             : 
    1179           0 : static int py_unixinfo_SidToGid_set_result(PyObject *py_obj, PyObject *value, void *closure)
    1180             : {
    1181           0 :         struct unixinfo_SidToGid *object = (struct unixinfo_SidToGid *)pytalloc_get_ptr(py_obj);
    1182           0 :         if (value == NULL) {
    1183           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
    1184           0 :                 return -1;
    1185             :         }
    1186           0 :         object->out.result = NT_STATUS(PyLong_AsLong(value));
    1187           0 :         return 0;
    1188             : }
    1189             : 
    1190             : static PyGetSetDef py_unixinfo_SidToGid_getsetters[] = {
    1191             :         {
    1192             :                 .name = discard_const_p(char, "in_sid"),
    1193             :                 .get = py_unixinfo_SidToGid_in_get_sid,
    1194             :                 .set = py_unixinfo_SidToGid_in_set_sid,
    1195             :                 .doc = discard_const_p(char, "PIDL-generated element of base type dom_sid")
    1196             :         },
    1197             :         {
    1198             :                 .name = discard_const_p(char, "out_gid"),
    1199             :                 .get = py_unixinfo_SidToGid_out_get_gid,
    1200             :                 .set = py_unixinfo_SidToGid_out_set_gid,
    1201             :                 .doc = discard_const_p(char, "PIDL-generated element of base type hyper")
    1202             :         },
    1203             :         {
    1204             :                 .name = discard_const_p(char, "result"),
    1205             :                 .get = py_unixinfo_SidToGid_get_result,
    1206             :                 .set = py_unixinfo_SidToGid_set_result,
    1207             :                 .doc = discard_const_p(char, "PIDL-generated element of type NTSTATUS")
    1208             :         },
    1209             :         { .name = NULL }
    1210             : };
    1211             : 
    1212           0 : static PyObject *py_unixinfo_SidToGid_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1213             : {
    1214           0 :         PyObject *self = pytalloc_new(struct unixinfo_SidToGid, type);
    1215           0 :         struct unixinfo_SidToGid *_self = (struct unixinfo_SidToGid *)pytalloc_get_ptr(self);
    1216           0 :         TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
    1217           0 :         _self->out.gid = talloc_zero(mem_ctx, uint64_t);
    1218           0 :         return self;
    1219             : }
    1220             : 
    1221           0 : static PyObject *py_unixinfo_SidToGid_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
    1222             : {
    1223             : 
    1224             : 
    1225           0 :         return PyLong_FromLong(2);
    1226             : }
    1227             : 
    1228           0 : static PyObject *py_unixinfo_SidToGid_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
    1229             : {
    1230           0 :         const struct ndr_interface_call *call = NULL;
    1231           0 :         struct unixinfo_SidToGid *object = (struct unixinfo_SidToGid *)pytalloc_get_ptr(py_obj);
    1232           0 :         PyObject *ret = NULL;
    1233           0 :         struct ndr_push *push = NULL;
    1234             :         DATA_BLOB blob;
    1235             :         enum ndr_err_code err;
    1236             : 
    1237           0 :         if (ndr_table_unixinfo.num_calls < 3) {
    1238           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_unixinfo_SidToGid_ndr_pack");
    1239           0 :                 return NULL;
    1240             :         }
    1241           0 :         call = &ndr_table_unixinfo.calls[2];
    1242             : 
    1243           0 :         push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
    1244           0 :         if (push == NULL) {
    1245           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    1246           0 :                 return NULL;
    1247             :         }
    1248             : 
    1249           0 :         push->flags |= ndr_push_flags;
    1250             : 
    1251           0 :         err = call->ndr_push(push, ndr_inout_flags, object);
    1252           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    1253           0 :                 TALLOC_FREE(push);
    1254           0 :                 PyErr_SetNdrError(err);
    1255           0 :                 return NULL;
    1256             :         }
    1257           0 :         blob = ndr_push_blob(push);
    1258           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    1259           0 :         TALLOC_FREE(push);
    1260           0 :         return ret;
    1261             : }
    1262             : 
    1263           0 : static PyObject *py_unixinfo_SidToGid_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    1264             : {
    1265           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
    1266           0 :         PyObject *bigendian_obj = NULL;
    1267           0 :         PyObject *ndr64_obj = NULL;
    1268           0 :         uint32_t ndr_push_flags = 0;
    1269             : 
    1270           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
    1271             :                 discard_const_p(char *, kwnames),
    1272             :                 &bigendian_obj,
    1273             :                 &ndr64_obj)) {
    1274           0 :                 return NULL;
    1275             :         }
    1276             : 
    1277           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    1278           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
    1279             :         }
    1280           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    1281           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
    1282             :         }
    1283             : 
    1284           0 :         return py_unixinfo_SidToGid_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
    1285             : }
    1286             : 
    1287           0 : static PyObject *py_unixinfo_SidToGid_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    1288             : {
    1289           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
    1290           0 :         PyObject *bigendian_obj = NULL;
    1291           0 :         PyObject *ndr64_obj = NULL;
    1292           0 :         uint32_t ndr_push_flags = 0;
    1293             : 
    1294           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
    1295             :                 discard_const_p(char *, kwnames),
    1296             :                 &bigendian_obj,
    1297             :                 &ndr64_obj)) {
    1298           0 :                 return NULL;
    1299             :         }
    1300             : 
    1301           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    1302           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
    1303             :         }
    1304           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    1305           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
    1306             :         }
    1307             : 
    1308           0 :         return py_unixinfo_SidToGid_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
    1309             : }
    1310             : 
    1311           0 : static PyObject *py_unixinfo_SidToGid_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
    1312             : {
    1313           0 :         const struct ndr_interface_call *call = NULL;
    1314           0 :         struct unixinfo_SidToGid *object = (struct unixinfo_SidToGid *)pytalloc_get_ptr(py_obj);
    1315           0 :         struct ndr_pull *pull = NULL;
    1316             :         enum ndr_err_code err;
    1317             : 
    1318           0 :         if (ndr_table_unixinfo.num_calls < 3) {
    1319           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_unixinfo_SidToGid_ndr_unpack");
    1320           0 :                 return NULL;
    1321             :         }
    1322           0 :         call = &ndr_table_unixinfo.calls[2];
    1323             : 
    1324           0 :         pull = ndr_pull_init_blob(blob, object);
    1325           0 :         if (pull == NULL) {
    1326           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    1327           0 :                 return NULL;
    1328             :         }
    1329             : 
    1330           0 :         pull->flags |= ndr_pull_flags;
    1331             : 
    1332           0 :         err = call->ndr_pull(pull, ndr_inout_flags, object);
    1333           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    1334           0 :                 TALLOC_FREE(pull);
    1335           0 :                 PyErr_SetNdrError(err);
    1336           0 :                 return NULL;
    1337             :         }
    1338           0 :         if (!allow_remaining) {
    1339             :                 uint32_t highest_ofs;
    1340             : 
    1341           0 :                 if (pull->offset > pull->relative_highest_offset) {
    1342           0 :                         highest_ofs = pull->offset;
    1343             :                 } else {
    1344           0 :                         highest_ofs = pull->relative_highest_offset;
    1345             :                 }
    1346           0 :                 if (highest_ofs < pull->data_size) {
    1347           0 :                         err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
    1348             :                                 "not all bytes consumed ofs[%u] size[%u]",
    1349             :                                 highest_ofs, pull->data_size);
    1350           0 :                         TALLOC_FREE(pull);
    1351           0 :                         PyErr_SetNdrError(err);
    1352           0 :                         return NULL;
    1353             :                 }
    1354             :         }
    1355             : 
    1356           0 :         TALLOC_FREE(pull);
    1357           0 :         Py_RETURN_NONE;
    1358             : }
    1359             : 
    1360           0 : static PyObject *py_unixinfo_SidToGid_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    1361             : {
    1362             :         DATA_BLOB blob;
    1363           0 :         Py_ssize_t blob_length = 0;
    1364           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
    1365           0 :         PyObject *bigendian_obj = NULL;
    1366           0 :         PyObject *ndr64_obj = NULL;
    1367           0 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
    1368           0 :         PyObject *allow_remaining_obj = NULL;
    1369           0 :         bool allow_remaining = false;
    1370             : 
    1371           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
    1372             :                 discard_const_p(char *, kwnames),
    1373             :                 &blob.data, &blob_length,
    1374             :                 &bigendian_obj,
    1375             :                 &ndr64_obj,
    1376             :                 &allow_remaining_obj)) {
    1377           0 :                 return NULL;
    1378             :         }
    1379           0 :         blob.length = blob_length;
    1380             : 
    1381           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    1382           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
    1383             :         }
    1384           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    1385           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
    1386             :         }
    1387             : 
    1388           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    1389           0 :                 allow_remaining = true;
    1390             :         }
    1391             : 
    1392           0 :         return py_unixinfo_SidToGid_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
    1393             : }
    1394             : 
    1395           0 : static PyObject *py_unixinfo_SidToGid_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    1396             : {
    1397             :         DATA_BLOB blob;
    1398           0 :         Py_ssize_t blob_length = 0;
    1399           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
    1400           0 :         PyObject *bigendian_obj = NULL;
    1401           0 :         PyObject *ndr64_obj = NULL;
    1402           0 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
    1403           0 :         PyObject *allow_remaining_obj = NULL;
    1404           0 :         bool allow_remaining = false;
    1405             : 
    1406           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
    1407             :                 discard_const_p(char *, kwnames),
    1408             :                 &blob.data, &blob_length,
    1409             :                 &bigendian_obj,
    1410             :                 &ndr64_obj,
    1411             :                 &allow_remaining_obj)) {
    1412           0 :                 return NULL;
    1413             :         }
    1414           0 :         blob.length = blob_length;
    1415             : 
    1416           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    1417           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
    1418             :         }
    1419           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    1420           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
    1421             :         }
    1422             : 
    1423           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    1424           0 :                 allow_remaining = true;
    1425             :         }
    1426             : 
    1427           0 :         return py_unixinfo_SidToGid_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
    1428             : }
    1429             : 
    1430           0 : static PyObject *py_unixinfo_SidToGid_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
    1431             : {
    1432           0 :         const struct ndr_interface_call *call = NULL;
    1433           0 :         struct unixinfo_SidToGid *object = (struct unixinfo_SidToGid *)pytalloc_get_ptr(py_obj);
    1434             :         PyObject *ret;
    1435             :         char *retstr;
    1436             : 
    1437           0 :         if (ndr_table_unixinfo.num_calls < 3) {
    1438           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_unixinfo_SidToGid_ndr_print");
    1439           0 :                 return NULL;
    1440             :         }
    1441           0 :         call = &ndr_table_unixinfo.calls[2];
    1442             : 
    1443           0 :         retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
    1444           0 :         ret = PyUnicode_FromString(retstr);
    1445           0 :         TALLOC_FREE(retstr);
    1446             : 
    1447           0 :         return ret;
    1448             : }
    1449             : 
    1450           0 : static PyObject *py_unixinfo_SidToGid_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    1451             : {
    1452           0 :         return py_unixinfo_SidToGid_ndr_print(py_obj, "unixinfo_SidToGid_in", NDR_IN);
    1453             : }
    1454             : 
    1455           0 : static PyObject *py_unixinfo_SidToGid_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    1456             : {
    1457           0 :         return py_unixinfo_SidToGid_ndr_print(py_obj, "unixinfo_SidToGid_out", NDR_OUT);
    1458             : }
    1459             : 
    1460             : static PyMethodDef py_unixinfo_SidToGid_methods[] = {
    1461             :         { "opnum", (PyCFunction)py_unixinfo_SidToGid_ndr_opnum, METH_NOARGS|METH_CLASS,
    1462             :                 "unixinfo.SidToGid.opnum() -> 2 (0x02) " },
    1463             :         { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_unixinfo_SidToGid_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
    1464             :                 "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
    1465             :         { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_unixinfo_SidToGid_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
    1466             :                 "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
    1467             :         { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_unixinfo_SidToGid_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
    1468             :                 "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
    1469             :         { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_unixinfo_SidToGid_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
    1470             :                 "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
    1471             :         { "__ndr_print_in__", (PyCFunction)py_unixinfo_SidToGid_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
    1472             :         { "__ndr_print_out__", (PyCFunction)py_unixinfo_SidToGid_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
    1473             :         { NULL, NULL, 0, NULL }
    1474             : };
    1475             : 
    1476             : 
    1477             : static PyTypeObject unixinfo_SidToGid_Type = {
    1478             :         PyVarObject_HEAD_INIT(NULL, 0)
    1479             :         .tp_name = "unixinfo.SidToGid",
    1480             :         .tp_getset = py_unixinfo_SidToGid_getsetters,
    1481             :         .tp_methods = py_unixinfo_SidToGid_methods,
    1482             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    1483             :         .tp_new = py_unixinfo_SidToGid_new,
    1484             : };
    1485             : 
    1486           0 : static bool pack_py_unixinfo_SidToGid_args_in(PyObject *args, PyObject *kwargs, struct unixinfo_SidToGid *r)
    1487             : {
    1488             :         PyObject *py_sid;
    1489           0 :         const char *kwnames[] = {
    1490             :                 "sid", NULL
    1491             :         };
    1492             : 
    1493           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:unixinfo_SidToGid", discard_const_p(char *, kwnames), &py_sid)) {
    1494           0 :                 return false;
    1495             :         }
    1496             : 
    1497           0 :         if (py_sid == NULL) {
    1498           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.sid");
    1499           0 :                 return false;
    1500             :         }
    1501           0 :         PY_CHECK_TYPE(dom_sid_Type, py_sid, return false;);
    1502           0 :         if (talloc_reference(r, pytalloc_get_mem_ctx(py_sid)) == NULL) {
    1503           0 :                 PyErr_NoMemory();
    1504           0 :                 return false;
    1505             :         }
    1506           0 :         r->in.sid = *(struct dom_sid *)pytalloc_get_ptr(py_sid);
    1507           0 :         return true;
    1508             : }
    1509             : 
    1510           0 : static PyObject *unpack_py_unixinfo_SidToGid_args_out(struct unixinfo_SidToGid *r)
    1511             : {
    1512             :         PyObject *result;
    1513             :         PyObject *py_gid;
    1514           0 :         py_gid = PyLong_FromUnsignedLongLong(*r->out.gid);
    1515           0 :         result = py_gid;
    1516           0 :         if (NT_STATUS_IS_ERR(r->out.result)) {
    1517           0 :                 PyErr_SetNTSTATUS(r->out.result);
    1518           0 :                 return NULL;
    1519             :         }
    1520             : 
    1521           0 :         return result;
    1522             : }
    1523             : 
    1524             : 
    1525           0 : static PyObject *py_unixinfo_GidToSid_in_get_gid(PyObject *obj, void *closure)
    1526             : {
    1527           0 :         struct unixinfo_GidToSid *object = (struct unixinfo_GidToSid *)pytalloc_get_ptr(obj);
    1528             :         PyObject *py_gid;
    1529           0 :         py_gid = PyLong_FromUnsignedLongLong(object->in.gid);
    1530           0 :         return py_gid;
    1531             : }
    1532             : 
    1533           0 : static int py_unixinfo_GidToSid_in_set_gid(PyObject *py_obj, PyObject *value, void *closure)
    1534             : {
    1535           0 :         struct unixinfo_GidToSid *object = (struct unixinfo_GidToSid *)pytalloc_get_ptr(py_obj);
    1536           0 :         if (value == NULL) {
    1537           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.gid");
    1538           0 :                 return -1;
    1539             :         }
    1540             :         {
    1541           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.gid));
    1542           0 :                 if (PyLong_Check(value)) {
    1543             :                         unsigned long long test_var;
    1544           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1545           0 :                         if (PyErr_Occurred() != NULL) {
    1546           0 :                                 return -1;
    1547             :                         }
    1548           0 :                         if (test_var > uint_max) {
    1549           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    1550             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1551           0 :                                 return -1;
    1552             :                         }
    1553           0 :                         object->in.gid = test_var;
    1554             :                 } else {
    1555           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    1556             :                           PyLong_Type.tp_name);
    1557           0 :                         return -1;
    1558             :                 }
    1559             :         }
    1560           0 :         return 0;
    1561             : }
    1562             : 
    1563           0 : static PyObject *py_unixinfo_GidToSid_out_get_sid(PyObject *obj, void *closure)
    1564             : {
    1565           0 :         struct unixinfo_GidToSid *object = (struct unixinfo_GidToSid *)pytalloc_get_ptr(obj);
    1566             :         PyObject *py_sid;
    1567           0 :         if (object->out.sid == NULL) {
    1568           0 :                 Py_RETURN_NONE;
    1569             :         }
    1570           0 :         py_sid = pytalloc_reference_ex(dom_sid_Type, object->out.sid, object->out.sid);
    1571           0 :         return py_sid;
    1572             : }
    1573             : 
    1574           0 : static int py_unixinfo_GidToSid_out_set_sid(PyObject *py_obj, PyObject *value, void *closure)
    1575             : {
    1576           0 :         struct unixinfo_GidToSid *object = (struct unixinfo_GidToSid *)pytalloc_get_ptr(py_obj);
    1577           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.sid));
    1578           0 :         if (value == NULL) {
    1579           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.sid");
    1580           0 :                 return -1;
    1581             :         }
    1582           0 :         object->out.sid = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.sid);
    1583           0 :         if (object->out.sid == NULL) {
    1584           0 :                 PyErr_NoMemory();
    1585           0 :                 return -1;
    1586             :         }
    1587           0 :         PY_CHECK_TYPE(dom_sid_Type, value, return -1;);
    1588           0 :         if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
    1589           0 :                 PyErr_NoMemory();
    1590           0 :                 return -1;
    1591             :         }
    1592           0 :         object->out.sid = (struct dom_sid *)pytalloc_get_ptr(value);
    1593           0 :         return 0;
    1594             : }
    1595             : 
    1596           0 : static PyObject *py_unixinfo_GidToSid_get_result(PyObject *obj, void *closure)
    1597             : {
    1598           0 :         struct unixinfo_GidToSid *object = (struct unixinfo_GidToSid *)pytalloc_get_ptr(obj);
    1599             :         PyObject *py_result;
    1600           0 :         py_result = PyErr_FromNTSTATUS(object->out.result);
    1601           0 :         return py_result;
    1602             : }
    1603             : 
    1604           0 : static int py_unixinfo_GidToSid_set_result(PyObject *py_obj, PyObject *value, void *closure)
    1605             : {
    1606           0 :         struct unixinfo_GidToSid *object = (struct unixinfo_GidToSid *)pytalloc_get_ptr(py_obj);
    1607           0 :         if (value == NULL) {
    1608           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
    1609           0 :                 return -1;
    1610             :         }
    1611           0 :         object->out.result = NT_STATUS(PyLong_AsLong(value));
    1612           0 :         return 0;
    1613             : }
    1614             : 
    1615             : static PyGetSetDef py_unixinfo_GidToSid_getsetters[] = {
    1616             :         {
    1617             :                 .name = discard_const_p(char, "in_gid"),
    1618             :                 .get = py_unixinfo_GidToSid_in_get_gid,
    1619             :                 .set = py_unixinfo_GidToSid_in_set_gid,
    1620             :                 .doc = discard_const_p(char, "PIDL-generated element of base type hyper")
    1621             :         },
    1622             :         {
    1623             :                 .name = discard_const_p(char, "out_sid"),
    1624             :                 .get = py_unixinfo_GidToSid_out_get_sid,
    1625             :                 .set = py_unixinfo_GidToSid_out_set_sid,
    1626             :                 .doc = discard_const_p(char, "PIDL-generated element of base type dom_sid")
    1627             :         },
    1628             :         {
    1629             :                 .name = discard_const_p(char, "result"),
    1630             :                 .get = py_unixinfo_GidToSid_get_result,
    1631             :                 .set = py_unixinfo_GidToSid_set_result,
    1632             :                 .doc = discard_const_p(char, "PIDL-generated element of type NTSTATUS")
    1633             :         },
    1634             :         { .name = NULL }
    1635             : };
    1636             : 
    1637           0 : static PyObject *py_unixinfo_GidToSid_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1638             : {
    1639           0 :         PyObject *self = pytalloc_new(struct unixinfo_GidToSid, type);
    1640           0 :         struct unixinfo_GidToSid *_self = (struct unixinfo_GidToSid *)pytalloc_get_ptr(self);
    1641           0 :         TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
    1642           0 :         _self->out.sid = talloc_zero(mem_ctx, struct dom_sid);
    1643           0 :         return self;
    1644             : }
    1645             : 
    1646           0 : static PyObject *py_unixinfo_GidToSid_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
    1647             : {
    1648             : 
    1649             : 
    1650           0 :         return PyLong_FromLong(3);
    1651             : }
    1652             : 
    1653           0 : static PyObject *py_unixinfo_GidToSid_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
    1654             : {
    1655           0 :         const struct ndr_interface_call *call = NULL;
    1656           0 :         struct unixinfo_GidToSid *object = (struct unixinfo_GidToSid *)pytalloc_get_ptr(py_obj);
    1657           0 :         PyObject *ret = NULL;
    1658           0 :         struct ndr_push *push = NULL;
    1659             :         DATA_BLOB blob;
    1660             :         enum ndr_err_code err;
    1661             : 
    1662           0 :         if (ndr_table_unixinfo.num_calls < 4) {
    1663           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_unixinfo_GidToSid_ndr_pack");
    1664           0 :                 return NULL;
    1665             :         }
    1666           0 :         call = &ndr_table_unixinfo.calls[3];
    1667             : 
    1668           0 :         push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
    1669           0 :         if (push == NULL) {
    1670           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    1671           0 :                 return NULL;
    1672             :         }
    1673             : 
    1674           0 :         push->flags |= ndr_push_flags;
    1675             : 
    1676           0 :         err = call->ndr_push(push, ndr_inout_flags, object);
    1677           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    1678           0 :                 TALLOC_FREE(push);
    1679           0 :                 PyErr_SetNdrError(err);
    1680           0 :                 return NULL;
    1681             :         }
    1682           0 :         blob = ndr_push_blob(push);
    1683           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    1684           0 :         TALLOC_FREE(push);
    1685           0 :         return ret;
    1686             : }
    1687             : 
    1688           0 : static PyObject *py_unixinfo_GidToSid_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    1689             : {
    1690           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
    1691           0 :         PyObject *bigendian_obj = NULL;
    1692           0 :         PyObject *ndr64_obj = NULL;
    1693           0 :         uint32_t ndr_push_flags = 0;
    1694             : 
    1695           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
    1696             :                 discard_const_p(char *, kwnames),
    1697             :                 &bigendian_obj,
    1698             :                 &ndr64_obj)) {
    1699           0 :                 return NULL;
    1700             :         }
    1701             : 
    1702           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    1703           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
    1704             :         }
    1705           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    1706           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
    1707             :         }
    1708             : 
    1709           0 :         return py_unixinfo_GidToSid_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
    1710             : }
    1711             : 
    1712           0 : static PyObject *py_unixinfo_GidToSid_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    1713             : {
    1714           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
    1715           0 :         PyObject *bigendian_obj = NULL;
    1716           0 :         PyObject *ndr64_obj = NULL;
    1717           0 :         uint32_t ndr_push_flags = 0;
    1718             : 
    1719           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
    1720             :                 discard_const_p(char *, kwnames),
    1721             :                 &bigendian_obj,
    1722             :                 &ndr64_obj)) {
    1723           0 :                 return NULL;
    1724             :         }
    1725             : 
    1726           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    1727           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
    1728             :         }
    1729           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    1730           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
    1731             :         }
    1732             : 
    1733           0 :         return py_unixinfo_GidToSid_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
    1734             : }
    1735             : 
    1736           0 : static PyObject *py_unixinfo_GidToSid_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
    1737             : {
    1738           0 :         const struct ndr_interface_call *call = NULL;
    1739           0 :         struct unixinfo_GidToSid *object = (struct unixinfo_GidToSid *)pytalloc_get_ptr(py_obj);
    1740           0 :         struct ndr_pull *pull = NULL;
    1741             :         enum ndr_err_code err;
    1742             : 
    1743           0 :         if (ndr_table_unixinfo.num_calls < 4) {
    1744           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_unixinfo_GidToSid_ndr_unpack");
    1745           0 :                 return NULL;
    1746             :         }
    1747           0 :         call = &ndr_table_unixinfo.calls[3];
    1748             : 
    1749           0 :         pull = ndr_pull_init_blob(blob, object);
    1750           0 :         if (pull == NULL) {
    1751           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    1752           0 :                 return NULL;
    1753             :         }
    1754             : 
    1755           0 :         pull->flags |= ndr_pull_flags;
    1756             : 
    1757           0 :         err = call->ndr_pull(pull, ndr_inout_flags, object);
    1758           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    1759           0 :                 TALLOC_FREE(pull);
    1760           0 :                 PyErr_SetNdrError(err);
    1761           0 :                 return NULL;
    1762             :         }
    1763           0 :         if (!allow_remaining) {
    1764             :                 uint32_t highest_ofs;
    1765             : 
    1766           0 :                 if (pull->offset > pull->relative_highest_offset) {
    1767           0 :                         highest_ofs = pull->offset;
    1768             :                 } else {
    1769           0 :                         highest_ofs = pull->relative_highest_offset;
    1770             :                 }
    1771           0 :                 if (highest_ofs < pull->data_size) {
    1772           0 :                         err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
    1773             :                                 "not all bytes consumed ofs[%u] size[%u]",
    1774             :                                 highest_ofs, pull->data_size);
    1775           0 :                         TALLOC_FREE(pull);
    1776           0 :                         PyErr_SetNdrError(err);
    1777           0 :                         return NULL;
    1778             :                 }
    1779             :         }
    1780             : 
    1781           0 :         TALLOC_FREE(pull);
    1782           0 :         Py_RETURN_NONE;
    1783             : }
    1784             : 
    1785           0 : static PyObject *py_unixinfo_GidToSid_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    1786             : {
    1787             :         DATA_BLOB blob;
    1788           0 :         Py_ssize_t blob_length = 0;
    1789           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
    1790           0 :         PyObject *bigendian_obj = NULL;
    1791           0 :         PyObject *ndr64_obj = NULL;
    1792           0 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
    1793           0 :         PyObject *allow_remaining_obj = NULL;
    1794           0 :         bool allow_remaining = false;
    1795             : 
    1796           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
    1797             :                 discard_const_p(char *, kwnames),
    1798             :                 &blob.data, &blob_length,
    1799             :                 &bigendian_obj,
    1800             :                 &ndr64_obj,
    1801             :                 &allow_remaining_obj)) {
    1802           0 :                 return NULL;
    1803             :         }
    1804           0 :         blob.length = blob_length;
    1805             : 
    1806           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    1807           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
    1808             :         }
    1809           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    1810           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
    1811             :         }
    1812             : 
    1813           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    1814           0 :                 allow_remaining = true;
    1815             :         }
    1816             : 
    1817           0 :         return py_unixinfo_GidToSid_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
    1818             : }
    1819             : 
    1820           0 : static PyObject *py_unixinfo_GidToSid_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    1821             : {
    1822             :         DATA_BLOB blob;
    1823           0 :         Py_ssize_t blob_length = 0;
    1824           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
    1825           0 :         PyObject *bigendian_obj = NULL;
    1826           0 :         PyObject *ndr64_obj = NULL;
    1827           0 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
    1828           0 :         PyObject *allow_remaining_obj = NULL;
    1829           0 :         bool allow_remaining = false;
    1830             : 
    1831           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
    1832             :                 discard_const_p(char *, kwnames),
    1833             :                 &blob.data, &blob_length,
    1834             :                 &bigendian_obj,
    1835             :                 &ndr64_obj,
    1836             :                 &allow_remaining_obj)) {
    1837           0 :                 return NULL;
    1838             :         }
    1839           0 :         blob.length = blob_length;
    1840             : 
    1841           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    1842           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
    1843             :         }
    1844           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    1845           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
    1846             :         }
    1847             : 
    1848           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    1849           0 :                 allow_remaining = true;
    1850             :         }
    1851             : 
    1852           0 :         return py_unixinfo_GidToSid_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
    1853             : }
    1854             : 
    1855           0 : static PyObject *py_unixinfo_GidToSid_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
    1856             : {
    1857           0 :         const struct ndr_interface_call *call = NULL;
    1858           0 :         struct unixinfo_GidToSid *object = (struct unixinfo_GidToSid *)pytalloc_get_ptr(py_obj);
    1859             :         PyObject *ret;
    1860             :         char *retstr;
    1861             : 
    1862           0 :         if (ndr_table_unixinfo.num_calls < 4) {
    1863           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_unixinfo_GidToSid_ndr_print");
    1864           0 :                 return NULL;
    1865             :         }
    1866           0 :         call = &ndr_table_unixinfo.calls[3];
    1867             : 
    1868           0 :         retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
    1869           0 :         ret = PyUnicode_FromString(retstr);
    1870           0 :         TALLOC_FREE(retstr);
    1871             : 
    1872           0 :         return ret;
    1873             : }
    1874             : 
    1875           0 : static PyObject *py_unixinfo_GidToSid_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    1876             : {
    1877           0 :         return py_unixinfo_GidToSid_ndr_print(py_obj, "unixinfo_GidToSid_in", NDR_IN);
    1878             : }
    1879             : 
    1880           0 : static PyObject *py_unixinfo_GidToSid_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    1881             : {
    1882           0 :         return py_unixinfo_GidToSid_ndr_print(py_obj, "unixinfo_GidToSid_out", NDR_OUT);
    1883             : }
    1884             : 
    1885             : static PyMethodDef py_unixinfo_GidToSid_methods[] = {
    1886             :         { "opnum", (PyCFunction)py_unixinfo_GidToSid_ndr_opnum, METH_NOARGS|METH_CLASS,
    1887             :                 "unixinfo.GidToSid.opnum() -> 3 (0x03) " },
    1888             :         { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_unixinfo_GidToSid_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
    1889             :                 "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
    1890             :         { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_unixinfo_GidToSid_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
    1891             :                 "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
    1892             :         { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_unixinfo_GidToSid_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
    1893             :                 "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
    1894             :         { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_unixinfo_GidToSid_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
    1895             :                 "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
    1896             :         { "__ndr_print_in__", (PyCFunction)py_unixinfo_GidToSid_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
    1897             :         { "__ndr_print_out__", (PyCFunction)py_unixinfo_GidToSid_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
    1898             :         { NULL, NULL, 0, NULL }
    1899             : };
    1900             : 
    1901             : 
    1902             : static PyTypeObject unixinfo_GidToSid_Type = {
    1903             :         PyVarObject_HEAD_INIT(NULL, 0)
    1904             :         .tp_name = "unixinfo.GidToSid",
    1905             :         .tp_getset = py_unixinfo_GidToSid_getsetters,
    1906             :         .tp_methods = py_unixinfo_GidToSid_methods,
    1907             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    1908             :         .tp_new = py_unixinfo_GidToSid_new,
    1909             : };
    1910             : 
    1911           0 : static bool pack_py_unixinfo_GidToSid_args_in(PyObject *args, PyObject *kwargs, struct unixinfo_GidToSid *r)
    1912             : {
    1913             :         PyObject *py_gid;
    1914           0 :         const char *kwnames[] = {
    1915             :                 "gid", NULL
    1916             :         };
    1917             : 
    1918           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:unixinfo_GidToSid", discard_const_p(char *, kwnames), &py_gid)) {
    1919           0 :                 return false;
    1920             :         }
    1921             : 
    1922           0 :         if (py_gid == NULL) {
    1923           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.gid");
    1924           0 :                 return false;
    1925             :         }
    1926             :         {
    1927           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.gid));
    1928           0 :                 if (PyLong_Check(py_gid)) {
    1929             :                         unsigned long long test_var;
    1930           0 :                         test_var = PyLong_AsUnsignedLongLong(py_gid);
    1931           0 :                         if (PyErr_Occurred() != NULL) {
    1932           0 :                                 return false;
    1933             :                         }
    1934           0 :                         if (test_var > uint_max) {
    1935           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    1936             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1937           0 :                                 return false;
    1938             :                         }
    1939           0 :                         r->in.gid = test_var;
    1940             :                 } else {
    1941           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    1942             :                           PyLong_Type.tp_name);
    1943           0 :                         return false;
    1944             :                 }
    1945             :         }
    1946           0 :         return true;
    1947             : }
    1948             : 
    1949           0 : static PyObject *unpack_py_unixinfo_GidToSid_args_out(struct unixinfo_GidToSid *r)
    1950             : {
    1951             :         PyObject *result;
    1952             :         PyObject *py_sid;
    1953           0 :         py_sid = pytalloc_reference_ex(dom_sid_Type, r->out.sid, r->out.sid);
    1954           0 :         result = py_sid;
    1955           0 :         if (NT_STATUS_IS_ERR(r->out.result)) {
    1956           0 :                 PyErr_SetNTSTATUS(r->out.result);
    1957           0 :                 return NULL;
    1958             :         }
    1959             : 
    1960           0 :         return result;
    1961             : }
    1962             : 
    1963             : 
    1964           0 : static PyObject *py_unixinfo_GetPWUid_in_get_count(PyObject *obj, void *closure)
    1965             : {
    1966           0 :         struct unixinfo_GetPWUid *object = (struct unixinfo_GetPWUid *)pytalloc_get_ptr(obj);
    1967             :         PyObject *py_count;
    1968           0 :         if (object->in.count == NULL) {
    1969           0 :                 Py_RETURN_NONE;
    1970             :         }
    1971           0 :         py_count = PyLong_FromUnsignedLongLong((uint32_t)*object->in.count);
    1972           0 :         return py_count;
    1973             : }
    1974             : 
    1975           0 : static int py_unixinfo_GetPWUid_in_set_count(PyObject *py_obj, PyObject *value, void *closure)
    1976             : {
    1977           0 :         struct unixinfo_GetPWUid *object = (struct unixinfo_GetPWUid *)pytalloc_get_ptr(py_obj);
    1978           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->in.count));
    1979           0 :         if (value == NULL) {
    1980           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.count");
    1981           0 :                 return -1;
    1982             :         }
    1983           0 :         object->in.count = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.count);
    1984           0 :         if (object->in.count == NULL) {
    1985           0 :                 PyErr_NoMemory();
    1986           0 :                 return -1;
    1987             :         }
    1988             :         {
    1989           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->in.count));
    1990           0 :                 if (PyLong_Check(value)) {
    1991             :                         unsigned long long test_var;
    1992           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1993           0 :                         if (PyErr_Occurred() != NULL) {
    1994           0 :                                 return -1;
    1995             :                         }
    1996           0 :                         if (test_var > uint_max) {
    1997           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    1998             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1999           0 :                                 return -1;
    2000             :                         }
    2001           0 :                         *object->in.count = test_var;
    2002             :                 } else {
    2003           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    2004             :                           PyLong_Type.tp_name);
    2005           0 :                         return -1;
    2006             :                 }
    2007             :         }
    2008           0 :         return 0;
    2009             : }
    2010             : 
    2011           0 : static PyObject *py_unixinfo_GetPWUid_out_get_count(PyObject *obj, void *closure)
    2012             : {
    2013           0 :         struct unixinfo_GetPWUid *object = (struct unixinfo_GetPWUid *)pytalloc_get_ptr(obj);
    2014             :         PyObject *py_count;
    2015           0 :         if (object->out.count == NULL) {
    2016           0 :                 Py_RETURN_NONE;
    2017             :         }
    2018           0 :         py_count = PyLong_FromUnsignedLongLong((uint32_t)*object->out.count);
    2019           0 :         return py_count;
    2020             : }
    2021             : 
    2022           0 : static int py_unixinfo_GetPWUid_out_set_count(PyObject *py_obj, PyObject *value, void *closure)
    2023             : {
    2024           0 :         struct unixinfo_GetPWUid *object = (struct unixinfo_GetPWUid *)pytalloc_get_ptr(py_obj);
    2025           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.count));
    2026           0 :         if (value == NULL) {
    2027           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.count");
    2028           0 :                 return -1;
    2029             :         }
    2030           0 :         object->out.count = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.count);
    2031           0 :         if (object->out.count == NULL) {
    2032           0 :                 PyErr_NoMemory();
    2033           0 :                 return -1;
    2034             :         }
    2035             :         {
    2036           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(*object->out.count));
    2037           0 :                 if (PyLong_Check(value)) {
    2038             :                         unsigned long long test_var;
    2039           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    2040           0 :                         if (PyErr_Occurred() != NULL) {
    2041           0 :                                 return -1;
    2042             :                         }
    2043           0 :                         if (test_var > uint_max) {
    2044           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    2045             :                                   PyLong_Type.tp_name, uint_max, test_var);
    2046           0 :                                 return -1;
    2047             :                         }
    2048           0 :                         *object->out.count = test_var;
    2049             :                 } else {
    2050           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    2051             :                           PyLong_Type.tp_name);
    2052           0 :                         return -1;
    2053             :                 }
    2054             :         }
    2055           0 :         return 0;
    2056             : }
    2057             : 
    2058           0 : static PyObject *py_unixinfo_GetPWUid_in_get_uids(PyObject *obj, void *closure)
    2059             : {
    2060           0 :         struct unixinfo_GetPWUid *object = (struct unixinfo_GetPWUid *)pytalloc_get_ptr(obj);
    2061             :         PyObject *py_uids;
    2062           0 :         py_uids = PyList_New(*object->in.count);
    2063           0 :         if (py_uids == NULL) {
    2064           0 :                 return NULL;
    2065             :         }
    2066             :         {
    2067             :                 int uids_cntr_0;
    2068           0 :                 for (uids_cntr_0 = 0; uids_cntr_0 < (*object->in.count); uids_cntr_0++) {
    2069             :                         PyObject *py_uids_0;
    2070           0 :                         py_uids_0 = PyLong_FromUnsignedLongLong(object->in.uids[uids_cntr_0]);
    2071           0 :                         PyList_SetItem(py_uids, uids_cntr_0, py_uids_0);
    2072             :                 }
    2073             :         }
    2074           0 :         return py_uids;
    2075             : }
    2076             : 
    2077           0 : static int py_unixinfo_GetPWUid_in_set_uids(PyObject *py_obj, PyObject *value, void *closure)
    2078             : {
    2079           0 :         struct unixinfo_GetPWUid *object = (struct unixinfo_GetPWUid *)pytalloc_get_ptr(py_obj);
    2080           0 :         if (value == NULL) {
    2081           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.uids");
    2082           0 :                 return -1;
    2083             :         }
    2084           0 :         PY_CHECK_TYPE(&PyList_Type, value, return -1;);
    2085             :         {
    2086             :                 int uids_cntr_0;
    2087           0 :                 object->in.uids = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->in.uids, PyList_GET_SIZE(value));
    2088           0 :                 if (!object->in.uids) { return -1;; }
    2089           0 :                 talloc_set_name_const(object->in.uids, "ARRAY: object->in.uids");
    2090           0 :                 for (uids_cntr_0 = 0; uids_cntr_0 < PyList_GET_SIZE(value); uids_cntr_0++) {
    2091           0 :                         if (PyList_GET_ITEM(value, uids_cntr_0) == NULL) {
    2092           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.uids[uids_cntr_0]");
    2093           0 :                                 return -1;
    2094             :                         }
    2095             :                         {
    2096           0 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.uids[uids_cntr_0]));
    2097           0 :                                 if (PyLong_Check(PyList_GET_ITEM(value, uids_cntr_0))) {
    2098             :                                         unsigned long long test_var;
    2099           0 :                                         test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, uids_cntr_0));
    2100           0 :                                         if (PyErr_Occurred() != NULL) {
    2101           0 :                                                 return -1;
    2102             :                                         }
    2103           0 :                                         if (test_var > uint_max) {
    2104           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    2105             :                                                   PyLong_Type.tp_name, uint_max, test_var);
    2106           0 :                                                 return -1;
    2107             :                                         }
    2108           0 :                                         object->in.uids[uids_cntr_0] = test_var;
    2109             :                                 } else {
    2110           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    2111             :                                           PyLong_Type.tp_name);
    2112           0 :                                         return -1;
    2113             :                                 }
    2114             :                         }
    2115             :                 }
    2116             :         }
    2117           0 :         return 0;
    2118             : }
    2119             : 
    2120           0 : static PyObject *py_unixinfo_GetPWUid_out_get_infos(PyObject *obj, void *closure)
    2121             : {
    2122           0 :         struct unixinfo_GetPWUid *object = (struct unixinfo_GetPWUid *)pytalloc_get_ptr(obj);
    2123             :         PyObject *py_infos;
    2124           0 :         py_infos = PyList_New(*object->out.count);
    2125           0 :         if (py_infos == NULL) {
    2126           0 :                 return NULL;
    2127             :         }
    2128             :         {
    2129             :                 int infos_cntr_0;
    2130           0 :                 for (infos_cntr_0 = 0; infos_cntr_0 < (*object->out.count); infos_cntr_0++) {
    2131             :                         PyObject *py_infos_0;
    2132           0 :                         py_infos_0 = pytalloc_reference_ex(&unixinfo_GetPWUidInfo_Type, object->out.infos, &object->out.infos[infos_cntr_0]);
    2133           0 :                         PyList_SetItem(py_infos, infos_cntr_0, py_infos_0);
    2134             :                 }
    2135             :         }
    2136           0 :         return py_infos;
    2137             : }
    2138             : 
    2139           0 : static int py_unixinfo_GetPWUid_out_set_infos(PyObject *py_obj, PyObject *value, void *closure)
    2140             : {
    2141           0 :         struct unixinfo_GetPWUid *object = (struct unixinfo_GetPWUid *)pytalloc_get_ptr(py_obj);
    2142           0 :         if (value == NULL) {
    2143           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.infos");
    2144           0 :                 return -1;
    2145             :         }
    2146           0 :         PY_CHECK_TYPE(&PyList_Type, value, return -1;);
    2147             :         {
    2148             :                 int infos_cntr_0;
    2149           0 :                 object->out.infos = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->out.infos, PyList_GET_SIZE(value));
    2150           0 :                 if (!object->out.infos) { return -1;; }
    2151           0 :                 talloc_set_name_const(object->out.infos, "ARRAY: object->out.infos");
    2152           0 :                 for (infos_cntr_0 = 0; infos_cntr_0 < PyList_GET_SIZE(value); infos_cntr_0++) {
    2153           0 :                         if (PyList_GET_ITEM(value, infos_cntr_0) == NULL) {
    2154           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.infos[infos_cntr_0]");
    2155           0 :                                 return -1;
    2156             :                         }
    2157           0 :                         PY_CHECK_TYPE(&unixinfo_GetPWUidInfo_Type, PyList_GET_ITEM(value, infos_cntr_0), return -1;);
    2158           0 :                         if (talloc_reference(object->out.infos, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, infos_cntr_0))) == NULL) {
    2159           0 :                                 PyErr_NoMemory();
    2160           0 :                                 return -1;
    2161             :                         }
    2162           0 :                         object->out.infos[infos_cntr_0] = *(struct unixinfo_GetPWUidInfo *)pytalloc_get_ptr(PyList_GET_ITEM(value, infos_cntr_0));
    2163             :                 }
    2164             :         }
    2165           0 :         return 0;
    2166             : }
    2167             : 
    2168           0 : static PyObject *py_unixinfo_GetPWUid_get_result(PyObject *obj, void *closure)
    2169             : {
    2170           0 :         struct unixinfo_GetPWUid *object = (struct unixinfo_GetPWUid *)pytalloc_get_ptr(obj);
    2171             :         PyObject *py_result;
    2172           0 :         py_result = PyErr_FromNTSTATUS(object->out.result);
    2173           0 :         return py_result;
    2174             : }
    2175             : 
    2176           0 : static int py_unixinfo_GetPWUid_set_result(PyObject *py_obj, PyObject *value, void *closure)
    2177             : {
    2178           0 :         struct unixinfo_GetPWUid *object = (struct unixinfo_GetPWUid *)pytalloc_get_ptr(py_obj);
    2179           0 :         if (value == NULL) {
    2180           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result");
    2181           0 :                 return -1;
    2182             :         }
    2183           0 :         object->out.result = NT_STATUS(PyLong_AsLong(value));
    2184           0 :         return 0;
    2185             : }
    2186             : 
    2187             : static PyGetSetDef py_unixinfo_GetPWUid_getsetters[] = {
    2188             :         {
    2189             :                 .name = discard_const_p(char, "in_count"),
    2190             :                 .get = py_unixinfo_GetPWUid_in_get_count,
    2191             :                 .set = py_unixinfo_GetPWUid_in_set_count,
    2192             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    2193             :         },
    2194             :         {
    2195             :                 .name = discard_const_p(char, "out_count"),
    2196             :                 .get = py_unixinfo_GetPWUid_out_get_count,
    2197             :                 .set = py_unixinfo_GetPWUid_out_set_count,
    2198             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    2199             :         },
    2200             :         {
    2201             :                 .name = discard_const_p(char, "in_uids"),
    2202             :                 .get = py_unixinfo_GetPWUid_in_get_uids,
    2203             :                 .set = py_unixinfo_GetPWUid_in_set_uids,
    2204             :                 .doc = discard_const_p(char, "PIDL-generated element of base type hyper")
    2205             :         },
    2206             :         {
    2207             :                 .name = discard_const_p(char, "out_infos"),
    2208             :                 .get = py_unixinfo_GetPWUid_out_get_infos,
    2209             :                 .set = py_unixinfo_GetPWUid_out_set_infos,
    2210             :                 .doc = discard_const_p(char, "PIDL-generated element of base type unixinfo_GetPWUidInfo")
    2211             :         },
    2212             :         {
    2213             :                 .name = discard_const_p(char, "result"),
    2214             :                 .get = py_unixinfo_GetPWUid_get_result,
    2215             :                 .set = py_unixinfo_GetPWUid_set_result,
    2216             :                 .doc = discard_const_p(char, "PIDL-generated element of type NTSTATUS")
    2217             :         },
    2218             :         { .name = NULL }
    2219             : };
    2220             : 
    2221           0 : static PyObject *py_unixinfo_GetPWUid_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    2222             : {
    2223           0 :         PyObject *self = pytalloc_new(struct unixinfo_GetPWUid, type);
    2224           0 :         struct unixinfo_GetPWUid *_self = (struct unixinfo_GetPWUid *)pytalloc_get_ptr(self);
    2225           0 :         TALLOC_CTX *mem_ctx = pytalloc_get_mem_ctx(self);
    2226           0 :         _self->in.count = talloc_zero(mem_ctx, uint32_t);
    2227           0 :         _self->out.count = talloc_zero(mem_ctx, uint32_t);
    2228           0 :         return self;
    2229             : }
    2230             : 
    2231           0 : static PyObject *py_unixinfo_GetPWUid_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored))
    2232             : {
    2233             : 
    2234             : 
    2235           0 :         return PyLong_FromLong(4);
    2236             : }
    2237             : 
    2238           0 : static PyObject *py_unixinfo_GetPWUid_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags)
    2239             : {
    2240           0 :         const struct ndr_interface_call *call = NULL;
    2241           0 :         struct unixinfo_GetPWUid *object = (struct unixinfo_GetPWUid *)pytalloc_get_ptr(py_obj);
    2242           0 :         PyObject *ret = NULL;
    2243           0 :         struct ndr_push *push = NULL;
    2244             :         DATA_BLOB blob;
    2245             :         enum ndr_err_code err;
    2246             : 
    2247           0 :         if (ndr_table_unixinfo.num_calls < 5) {
    2248           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_unixinfo_GetPWUid_ndr_pack");
    2249           0 :                 return NULL;
    2250             :         }
    2251           0 :         call = &ndr_table_unixinfo.calls[4];
    2252             : 
    2253           0 :         push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj));
    2254           0 :         if (push == NULL) {
    2255           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    2256           0 :                 return NULL;
    2257             :         }
    2258             : 
    2259           0 :         push->flags |= ndr_push_flags;
    2260             : 
    2261           0 :         err = call->ndr_push(push, ndr_inout_flags, object);
    2262           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    2263           0 :                 TALLOC_FREE(push);
    2264           0 :                 PyErr_SetNdrError(err);
    2265           0 :                 return NULL;
    2266             :         }
    2267           0 :         blob = ndr_push_blob(push);
    2268           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    2269           0 :         TALLOC_FREE(push);
    2270           0 :         return ret;
    2271             : }
    2272             : 
    2273           0 : static PyObject *py_unixinfo_GetPWUid_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    2274             : {
    2275           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
    2276           0 :         PyObject *bigendian_obj = NULL;
    2277           0 :         PyObject *ndr64_obj = NULL;
    2278           0 :         uint32_t ndr_push_flags = 0;
    2279             : 
    2280           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__",
    2281             :                 discard_const_p(char *, kwnames),
    2282             :                 &bigendian_obj,
    2283             :                 &ndr64_obj)) {
    2284           0 :                 return NULL;
    2285             :         }
    2286             : 
    2287           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    2288           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
    2289             :         }
    2290           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    2291           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
    2292             :         }
    2293             : 
    2294           0 :         return py_unixinfo_GetPWUid_ndr_pack(py_obj, NDR_IN, ndr_push_flags);
    2295             : }
    2296             : 
    2297           0 : static PyObject *py_unixinfo_GetPWUid_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    2298             : {
    2299           0 :         const char * const kwnames[] = { "bigendian", "ndr64", NULL };
    2300           0 :         PyObject *bigendian_obj = NULL;
    2301           0 :         PyObject *ndr64_obj = NULL;
    2302           0 :         uint32_t ndr_push_flags = 0;
    2303             : 
    2304           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__",
    2305             :                 discard_const_p(char *, kwnames),
    2306             :                 &bigendian_obj,
    2307             :                 &ndr64_obj)) {
    2308           0 :                 return NULL;
    2309             :         }
    2310             : 
    2311           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    2312           0 :                 ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN;
    2313             :         }
    2314           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    2315           0 :                 ndr_push_flags |= LIBNDR_FLAG_NDR64;
    2316             :         }
    2317             : 
    2318           0 :         return py_unixinfo_GetPWUid_ndr_pack(py_obj, NDR_OUT, ndr_push_flags);
    2319             : }
    2320             : 
    2321           0 : static PyObject *py_unixinfo_GetPWUid_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining)
    2322             : {
    2323           0 :         const struct ndr_interface_call *call = NULL;
    2324           0 :         struct unixinfo_GetPWUid *object = (struct unixinfo_GetPWUid *)pytalloc_get_ptr(py_obj);
    2325           0 :         struct ndr_pull *pull = NULL;
    2326             :         enum ndr_err_code err;
    2327             : 
    2328           0 :         if (ndr_table_unixinfo.num_calls < 5) {
    2329           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_unixinfo_GetPWUid_ndr_unpack");
    2330           0 :                 return NULL;
    2331             :         }
    2332           0 :         call = &ndr_table_unixinfo.calls[4];
    2333             : 
    2334           0 :         pull = ndr_pull_init_blob(blob, object);
    2335           0 :         if (pull == NULL) {
    2336           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    2337           0 :                 return NULL;
    2338             :         }
    2339             : 
    2340           0 :         pull->flags |= ndr_pull_flags;
    2341             : 
    2342           0 :         err = call->ndr_pull(pull, ndr_inout_flags, object);
    2343           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    2344           0 :                 TALLOC_FREE(pull);
    2345           0 :                 PyErr_SetNdrError(err);
    2346           0 :                 return NULL;
    2347             :         }
    2348           0 :         if (!allow_remaining) {
    2349             :                 uint32_t highest_ofs;
    2350             : 
    2351           0 :                 if (pull->offset > pull->relative_highest_offset) {
    2352           0 :                         highest_ofs = pull->offset;
    2353             :                 } else {
    2354           0 :                         highest_ofs = pull->relative_highest_offset;
    2355             :                 }
    2356           0 :                 if (highest_ofs < pull->data_size) {
    2357           0 :                         err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES,
    2358             :                                 "not all bytes consumed ofs[%u] size[%u]",
    2359             :                                 highest_ofs, pull->data_size);
    2360           0 :                         TALLOC_FREE(pull);
    2361           0 :                         PyErr_SetNdrError(err);
    2362           0 :                         return NULL;
    2363             :                 }
    2364             :         }
    2365             : 
    2366           0 :         TALLOC_FREE(pull);
    2367           0 :         Py_RETURN_NONE;
    2368             : }
    2369             : 
    2370           0 : static PyObject *py_unixinfo_GetPWUid_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    2371             : {
    2372             :         DATA_BLOB blob;
    2373           0 :         Py_ssize_t blob_length = 0;
    2374           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
    2375           0 :         PyObject *bigendian_obj = NULL;
    2376           0 :         PyObject *ndr64_obj = NULL;
    2377           0 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
    2378           0 :         PyObject *allow_remaining_obj = NULL;
    2379           0 :         bool allow_remaining = false;
    2380             : 
    2381           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__",
    2382             :                 discard_const_p(char *, kwnames),
    2383             :                 &blob.data, &blob_length,
    2384             :                 &bigendian_obj,
    2385             :                 &ndr64_obj,
    2386             :                 &allow_remaining_obj)) {
    2387           0 :                 return NULL;
    2388             :         }
    2389           0 :         blob.length = blob_length;
    2390             : 
    2391           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    2392           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
    2393             :         }
    2394           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    2395           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
    2396             :         }
    2397             : 
    2398           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    2399           0 :                 allow_remaining = true;
    2400             :         }
    2401             : 
    2402           0 :         return py_unixinfo_GetPWUid_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining);
    2403             : }
    2404             : 
    2405           0 : static PyObject *py_unixinfo_GetPWUid_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    2406             : {
    2407             :         DATA_BLOB blob;
    2408           0 :         Py_ssize_t blob_length = 0;
    2409           0 :         const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL };
    2410           0 :         PyObject *bigendian_obj = NULL;
    2411           0 :         PyObject *ndr64_obj = NULL;
    2412           0 :         uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC;
    2413           0 :         PyObject *allow_remaining_obj = NULL;
    2414           0 :         bool allow_remaining = false;
    2415             : 
    2416           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__",
    2417             :                 discard_const_p(char *, kwnames),
    2418             :                 &blob.data, &blob_length,
    2419             :                 &bigendian_obj,
    2420             :                 &ndr64_obj,
    2421             :                 &allow_remaining_obj)) {
    2422           0 :                 return NULL;
    2423             :         }
    2424           0 :         blob.length = blob_length;
    2425             : 
    2426           0 :         if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) {
    2427           0 :                 ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN;
    2428             :         }
    2429           0 :         if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) {
    2430           0 :                 ndr_pull_flags |= LIBNDR_FLAG_NDR64;
    2431             :         }
    2432             : 
    2433           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    2434           0 :                 allow_remaining = true;
    2435             :         }
    2436             : 
    2437           0 :         return py_unixinfo_GetPWUid_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining);
    2438             : }
    2439             : 
    2440           0 : static PyObject *py_unixinfo_GetPWUid_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags)
    2441             : {
    2442           0 :         const struct ndr_interface_call *call = NULL;
    2443           0 :         struct unixinfo_GetPWUid *object = (struct unixinfo_GetPWUid *)pytalloc_get_ptr(py_obj);
    2444             :         PyObject *ret;
    2445             :         char *retstr;
    2446             : 
    2447           0 :         if (ndr_table_unixinfo.num_calls < 5) {
    2448           0 :                 PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_unixinfo_GetPWUid_ndr_print");
    2449           0 :                 return NULL;
    2450             :         }
    2451           0 :         call = &ndr_table_unixinfo.calls[4];
    2452             : 
    2453           0 :         retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object);
    2454           0 :         ret = PyUnicode_FromString(retstr);
    2455           0 :         TALLOC_FREE(retstr);
    2456             : 
    2457           0 :         return ret;
    2458             : }
    2459             : 
    2460           0 : static PyObject *py_unixinfo_GetPWUid_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    2461             : {
    2462           0 :         return py_unixinfo_GetPWUid_ndr_print(py_obj, "unixinfo_GetPWUid_in", NDR_IN);
    2463             : }
    2464             : 
    2465           0 : static PyObject *py_unixinfo_GetPWUid_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    2466             : {
    2467           0 :         return py_unixinfo_GetPWUid_ndr_print(py_obj, "unixinfo_GetPWUid_out", NDR_OUT);
    2468             : }
    2469             : 
    2470             : static PyMethodDef py_unixinfo_GetPWUid_methods[] = {
    2471             :         { "opnum", (PyCFunction)py_unixinfo_GetPWUid_ndr_opnum, METH_NOARGS|METH_CLASS,
    2472             :                 "unixinfo.GetPWUid.opnum() -> 4 (0x04) " },
    2473             :         { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_unixinfo_GetPWUid_ndr_pack_in), METH_VARARGS|METH_KEYWORDS,
    2474             :                 "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" },
    2475             :         { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_unixinfo_GetPWUid_ndr_pack_out), METH_VARARGS|METH_KEYWORDS,
    2476             :                 "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" },
    2477             :         { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_unixinfo_GetPWUid_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS,
    2478             :                 "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" },
    2479             :         { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_unixinfo_GetPWUid_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS,
    2480             :                 "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" },
    2481             :         { "__ndr_print_in__", (PyCFunction)py_unixinfo_GetPWUid_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" },
    2482             :         { "__ndr_print_out__", (PyCFunction)py_unixinfo_GetPWUid_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" },
    2483             :         { NULL, NULL, 0, NULL }
    2484             : };
    2485             : 
    2486             : 
    2487             : static PyTypeObject unixinfo_GetPWUid_Type = {
    2488             :         PyVarObject_HEAD_INIT(NULL, 0)
    2489             :         .tp_name = "unixinfo.GetPWUid",
    2490             :         .tp_getset = py_unixinfo_GetPWUid_getsetters,
    2491             :         .tp_methods = py_unixinfo_GetPWUid_methods,
    2492             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    2493             :         .tp_new = py_unixinfo_GetPWUid_new,
    2494             : };
    2495             : 
    2496           0 : static bool pack_py_unixinfo_GetPWUid_args_in(PyObject *args, PyObject *kwargs, struct unixinfo_GetPWUid *r)
    2497             : {
    2498             :         PyObject *py_uids;
    2499           0 :         const char *kwnames[] = {
    2500             :                 "uids", NULL
    2501             :         };
    2502             : 
    2503           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:unixinfo_GetPWUid", discard_const_p(char *, kwnames), &py_uids)) {
    2504           0 :                 return false;
    2505             :         }
    2506             : 
    2507           0 :         PY_CHECK_TYPE(&PyList_Type, py_uids, return false;);
    2508           0 :         r->in.count = talloc_ptrtype(r, r->in.count);
    2509           0 :         if (r->in.count == NULL) {
    2510           0 :                 PyErr_NoMemory();
    2511           0 :                 return false;
    2512             :         }
    2513           0 :         *r->in.count = PyList_GET_SIZE(py_uids);
    2514           0 :         if (py_uids == NULL) {
    2515           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.uids");
    2516           0 :                 return false;
    2517             :         }
    2518           0 :         PY_CHECK_TYPE(&PyList_Type, py_uids, return false;);
    2519             :         {
    2520             :                 int uids_cntr_0;
    2521           0 :                 r->in.uids = talloc_array_ptrtype(r, r->in.uids, PyList_GET_SIZE(py_uids));
    2522           0 :                 if (!r->in.uids) { return false;; }
    2523           0 :                 talloc_set_name_const(r->in.uids, "ARRAY: r->in.uids");
    2524           0 :                 for (uids_cntr_0 = 0; uids_cntr_0 < PyList_GET_SIZE(py_uids); uids_cntr_0++) {
    2525           0 :                         if (PyList_GET_ITEM(py_uids, uids_cntr_0) == NULL) {
    2526           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.uids[uids_cntr_0]");
    2527           0 :                                 return false;
    2528             :                         }
    2529             :                         {
    2530           0 :                                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.uids[uids_cntr_0]));
    2531           0 :                                 if (PyLong_Check(PyList_GET_ITEM(py_uids, uids_cntr_0))) {
    2532             :                                         unsigned long long test_var;
    2533           0 :                                         test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(py_uids, uids_cntr_0));
    2534           0 :                                         if (PyErr_Occurred() != NULL) {
    2535           0 :                                                 return false;
    2536             :                                         }
    2537           0 :                                         if (test_var > uint_max) {
    2538           0 :                                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\
    2539             :                                                   PyLong_Type.tp_name, uint_max, test_var);
    2540           0 :                                                 return false;
    2541             :                                         }
    2542           0 :                                         r->in.uids[uids_cntr_0] = test_var;
    2543             :                                 } else {
    2544           0 :                                         PyErr_Format(PyExc_TypeError, "Expected type %s",\
    2545             :                                           PyLong_Type.tp_name);
    2546           0 :                                         return false;
    2547             :                                 }
    2548             :                         }
    2549             :                 }
    2550             :         }
    2551           0 :         return true;
    2552             : }
    2553             : 
    2554           0 : static PyObject *unpack_py_unixinfo_GetPWUid_args_out(struct unixinfo_GetPWUid *r)
    2555             : {
    2556             :         PyObject *result;
    2557             :         PyObject *py_infos;
    2558           0 :         py_infos = PyList_New(*r->out.count);
    2559           0 :         if (py_infos == NULL) {
    2560           0 :                 return NULL;
    2561             :         }
    2562             :         {
    2563             :                 int infos_cntr_0;
    2564           0 :                 for (infos_cntr_0 = 0; infos_cntr_0 < (*r->out.count); infos_cntr_0++) {
    2565             :                         PyObject *py_infos_0;
    2566           0 :                         py_infos_0 = pytalloc_reference_ex(&unixinfo_GetPWUidInfo_Type, r->out.infos, &r->out.infos[infos_cntr_0]);
    2567           0 :                         PyList_SetItem(py_infos, infos_cntr_0, py_infos_0);
    2568             :                 }
    2569             :         }
    2570           0 :         result = py_infos;
    2571           0 :         if (NT_STATUS_IS_ERR(r->out.result)) {
    2572           0 :                 PyErr_SetNTSTATUS(r->out.result);
    2573           0 :                 return NULL;
    2574             :         }
    2575             : 
    2576           0 :         return result;
    2577             : }
    2578             : 
    2579             : const struct PyNdrRpcMethodDef py_ndr_unixinfo_methods[] = {
    2580             :         { "SidToUid", "S.SidToUid(sid) -> uid", (py_dcerpc_call_fn)dcerpc_unixinfo_SidToUid_r, (py_data_pack_fn)pack_py_unixinfo_SidToUid_args_in, (py_data_unpack_fn)unpack_py_unixinfo_SidToUid_args_out, 0, &ndr_table_unixinfo },
    2581             :         { "UidToSid", "S.UidToSid(uid) -> sid", (py_dcerpc_call_fn)dcerpc_unixinfo_UidToSid_r, (py_data_pack_fn)pack_py_unixinfo_UidToSid_args_in, (py_data_unpack_fn)unpack_py_unixinfo_UidToSid_args_out, 1, &ndr_table_unixinfo },
    2582             :         { "SidToGid", "S.SidToGid(sid) -> gid", (py_dcerpc_call_fn)dcerpc_unixinfo_SidToGid_r, (py_data_pack_fn)pack_py_unixinfo_SidToGid_args_in, (py_data_unpack_fn)unpack_py_unixinfo_SidToGid_args_out, 2, &ndr_table_unixinfo },
    2583             :         { "GidToSid", "S.GidToSid(gid) -> sid", (py_dcerpc_call_fn)dcerpc_unixinfo_GidToSid_r, (py_data_pack_fn)pack_py_unixinfo_GidToSid_args_in, (py_data_unpack_fn)unpack_py_unixinfo_GidToSid_args_out, 3, &ndr_table_unixinfo },
    2584             :         { "GetPWUid", "S.GetPWUid(uids) -> infos", (py_dcerpc_call_fn)dcerpc_unixinfo_GetPWUid_r, (py_data_pack_fn)pack_py_unixinfo_GetPWUid_args_in, (py_data_unpack_fn)unpack_py_unixinfo_GetPWUid_args_out, 4, &ndr_table_unixinfo },
    2585             :         {0}
    2586             : };
    2587             : 
    2588           0 : static PyObject *interface_unixinfo_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    2589             : {
    2590           0 :         return py_dcerpc_interface_init_helper(type, args, kwargs, &ndr_table_unixinfo);
    2591             : }
    2592             : 
    2593             : #define PY_DOC_UNIXINFO "Unixinfo specific stuff"
    2594             : static PyTypeObject unixinfo_InterfaceType = {
    2595             :         PyVarObject_HEAD_INIT(NULL, 0)
    2596             :         .tp_name = "unixinfo.unixinfo",
    2597             :         .tp_basicsize = sizeof(dcerpc_InterfaceObject),
    2598             :         .tp_doc = "unixinfo(binding, lp_ctx=None, credentials=None) -> connection\n"
    2599             : "\n"
    2600             : "binding should be a DCE/RPC binding string (for example: ncacn_ip_tcp:127.0.0.1)\n"
    2601             : "lp_ctx should be a path to a smb.conf file or a param.LoadParm object\n"
    2602             : "credentials should be a credentials.Credentials object.\n\n"PY_DOC_UNIXINFO,
    2603             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    2604             :         .tp_new = interface_unixinfo_new,
    2605             : };
    2606             : 
    2607           0 : static PyObject *syntax_unixinfo_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    2608             : {
    2609           0 :         return py_dcerpc_syntax_init_helper(type, args, kwargs, &ndr_table_unixinfo.syntax_id);
    2610             : }
    2611             : 
    2612             : #define PY_DOC_UNIXINFO_SYNTAX "Unixinfo specific stuff"
    2613             : static PyTypeObject unixinfo_SyntaxType = {
    2614             :         PyVarObject_HEAD_INIT(NULL, 0)
    2615             :         .tp_name = "unixinfo.unixinfo_abstract_syntax",
    2616             :         .tp_doc = "unixinfo_abstract_syntax()\n"PY_DOC_UNIXINFO_SYNTAX,
    2617             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    2618             :         .tp_new = syntax_unixinfo_new,
    2619             : };
    2620             : 
    2621             : static PyMethodDef unixinfo_methods[] = {
    2622             :         { NULL, NULL, 0, NULL }
    2623             : };
    2624             : 
    2625             : static struct PyModuleDef moduledef = {
    2626             :         PyModuleDef_HEAD_INIT,
    2627             :         .m_name = "unixinfo",
    2628             :         .m_doc = "unixinfo DCE/RPC",
    2629             :         .m_size = -1,
    2630             :         .m_methods = unixinfo_methods,
    2631             : };
    2632           4 : MODULE_INIT_FUNC(unixinfo)
    2633             : {
    2634           4 :         PyObject *m = NULL;
    2635           4 :         PyObject *dep_samba_dcerpc_security = NULL;
    2636           4 :         PyObject *dep_talloc = NULL;
    2637           4 :         PyObject *dep_samba_dcerpc_base = NULL;
    2638           4 :         PyObject *dep_samba_dcerpc_misc = NULL;
    2639             : 
    2640           4 :         dep_samba_dcerpc_security = PyImport_ImportModule("samba.dcerpc.security");
    2641           4 :         if (dep_samba_dcerpc_security == NULL)
    2642           0 :                 goto out;
    2643             : 
    2644           4 :         dep_talloc = PyImport_ImportModule("talloc");
    2645           4 :         if (dep_talloc == NULL)
    2646           0 :                 goto out;
    2647             : 
    2648           4 :         dep_samba_dcerpc_base = PyImport_ImportModule("samba.dcerpc.base");
    2649           4 :         if (dep_samba_dcerpc_base == NULL)
    2650           0 :                 goto out;
    2651             : 
    2652           4 :         dep_samba_dcerpc_misc = PyImport_ImportModule("samba.dcerpc.misc");
    2653           4 :         if (dep_samba_dcerpc_misc == NULL)
    2654           0 :                 goto out;
    2655             : 
    2656           4 :         BaseObject_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "BaseObject");
    2657           4 :         if (BaseObject_Type == NULL)
    2658           0 :                 goto out;
    2659             : 
    2660           4 :         dom_sid_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_security, "dom_sid");
    2661           4 :         if (dom_sid_Type == NULL)
    2662           0 :                 goto out;
    2663             : 
    2664           4 :         ClientConnection_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_base, "ClientConnection");
    2665           4 :         if (ClientConnection_Type == NULL)
    2666           0 :                 goto out;
    2667             : 
    2668           4 :         ndr_syntax_id_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_misc, "ndr_syntax_id");
    2669           4 :         if (ndr_syntax_id_Type == NULL)
    2670           0 :                 goto out;
    2671             : 
    2672           4 :         unixinfo_GetPWUidInfo_Type.tp_base = BaseObject_Type;
    2673           4 :         unixinfo_GetPWUidInfo_Type.tp_basicsize = pytalloc_BaseObject_size();
    2674             : 
    2675           4 :         unixinfo_SidToUid_Type.tp_base = BaseObject_Type;
    2676           4 :         unixinfo_SidToUid_Type.tp_basicsize = pytalloc_BaseObject_size();
    2677             : 
    2678           4 :         unixinfo_UidToSid_Type.tp_base = BaseObject_Type;
    2679           4 :         unixinfo_UidToSid_Type.tp_basicsize = pytalloc_BaseObject_size();
    2680             : 
    2681           4 :         unixinfo_SidToGid_Type.tp_base = BaseObject_Type;
    2682           4 :         unixinfo_SidToGid_Type.tp_basicsize = pytalloc_BaseObject_size();
    2683             : 
    2684           4 :         unixinfo_GidToSid_Type.tp_base = BaseObject_Type;
    2685           4 :         unixinfo_GidToSid_Type.tp_basicsize = pytalloc_BaseObject_size();
    2686             : 
    2687           4 :         unixinfo_GetPWUid_Type.tp_base = BaseObject_Type;
    2688           4 :         unixinfo_GetPWUid_Type.tp_basicsize = pytalloc_BaseObject_size();
    2689             : 
    2690           4 :         unixinfo_InterfaceType.tp_base = ClientConnection_Type;
    2691             : 
    2692           4 :         unixinfo_SyntaxType.tp_base = ndr_syntax_id_Type;
    2693           4 :         unixinfo_SyntaxType.tp_basicsize = pytalloc_BaseObject_size();
    2694             : 
    2695           4 :         if (PyType_Ready(&unixinfo_GetPWUidInfo_Type) < 0)
    2696           0 :                 goto out;
    2697           4 :         if (PyType_Ready(&unixinfo_SidToUid_Type) < 0)
    2698           0 :                 goto out;
    2699           4 :         if (PyType_Ready(&unixinfo_UidToSid_Type) < 0)
    2700           0 :                 goto out;
    2701           4 :         if (PyType_Ready(&unixinfo_SidToGid_Type) < 0)
    2702           0 :                 goto out;
    2703           4 :         if (PyType_Ready(&unixinfo_GidToSid_Type) < 0)
    2704           0 :                 goto out;
    2705           4 :         if (PyType_Ready(&unixinfo_GetPWUid_Type) < 0)
    2706           0 :                 goto out;
    2707           4 :         if (PyType_Ready(&unixinfo_InterfaceType) < 0)
    2708           0 :                 goto out;
    2709           4 :         if (PyType_Ready(&unixinfo_SyntaxType) < 0)
    2710           0 :                 goto out;
    2711           4 :         if (!PyInterface_AddNdrRpcMethods(&unixinfo_InterfaceType, py_ndr_unixinfo_methods))
    2712           0 :                 return NULL;
    2713             : 
    2714             : #ifdef PY_GETPWUIDINFO_PATCH
    2715             :         PY_GETPWUIDINFO_PATCH(&unixinfo_GetPWUidInfo_Type);
    2716             : #endif
    2717             : #ifdef PY_SIDTOUID_PATCH
    2718             :         PY_SIDTOUID_PATCH(&unixinfo_SidToUid_Type);
    2719             : #endif
    2720             : #ifdef PY_UIDTOSID_PATCH
    2721             :         PY_UIDTOSID_PATCH(&unixinfo_UidToSid_Type);
    2722             : #endif
    2723             : #ifdef PY_SIDTOGID_PATCH
    2724             :         PY_SIDTOGID_PATCH(&unixinfo_SidToGid_Type);
    2725             : #endif
    2726             : #ifdef PY_GIDTOSID_PATCH
    2727             :         PY_GIDTOSID_PATCH(&unixinfo_GidToSid_Type);
    2728             : #endif
    2729             : #ifdef PY_GETPWUID_PATCH
    2730             :         PY_GETPWUID_PATCH(&unixinfo_GetPWUid_Type);
    2731             : #endif
    2732             : #ifdef PY_UNIXINFO_PATCH
    2733             :         PY_UNIXINFO_PATCH(&unixinfo_InterfaceType);
    2734             : #endif
    2735             : #ifdef PY_UNIXINFO_ABSTRACT_SYNTAX_PATCH
    2736             :         PY_UNIXINFO_ABSTRACT_SYNTAX_PATCH(&unixinfo_SyntaxType);
    2737             : #endif
    2738             : #ifdef PY_ABSTRACT_SYNTAX_PATCH
    2739             :         PY_ABSTRACT_SYNTAX_PATCH(&unixinfo_SyntaxType);
    2740             : #endif
    2741             : 
    2742           4 :         m = PyModule_Create(&moduledef);
    2743           4 :         if (m == NULL)
    2744           0 :                 goto out;
    2745             : 
    2746           4 :         Py_INCREF((PyObject *)(void *)&unixinfo_GetPWUidInfo_Type);
    2747           4 :         PyModule_AddObject(m, "GetPWUidInfo", (PyObject *)(void *)&unixinfo_GetPWUidInfo_Type);
    2748           4 :         Py_INCREF((PyObject *)(void *)&unixinfo_SidToUid_Type);
    2749           4 :         PyModule_AddObject(m, "SidToUid", (PyObject *)(void *)&unixinfo_SidToUid_Type);
    2750           4 :         Py_INCREF((PyObject *)(void *)&unixinfo_UidToSid_Type);
    2751           4 :         PyModule_AddObject(m, "UidToSid", (PyObject *)(void *)&unixinfo_UidToSid_Type);
    2752           4 :         Py_INCREF((PyObject *)(void *)&unixinfo_SidToGid_Type);
    2753           4 :         PyModule_AddObject(m, "SidToGid", (PyObject *)(void *)&unixinfo_SidToGid_Type);
    2754           4 :         Py_INCREF((PyObject *)(void *)&unixinfo_GidToSid_Type);
    2755           4 :         PyModule_AddObject(m, "GidToSid", (PyObject *)(void *)&unixinfo_GidToSid_Type);
    2756           4 :         Py_INCREF((PyObject *)(void *)&unixinfo_GetPWUid_Type);
    2757           4 :         PyModule_AddObject(m, "GetPWUid", (PyObject *)(void *)&unixinfo_GetPWUid_Type);
    2758           4 :         Py_INCREF((PyObject *)(void *)&unixinfo_InterfaceType);
    2759           4 :         PyModule_AddObject(m, "unixinfo", (PyObject *)(void *)&unixinfo_InterfaceType);
    2760           4 :         Py_INCREF((PyObject *)(void *)&unixinfo_SyntaxType);
    2761           4 :         PyModule_AddObject(m, "unixinfo_abstract_syntax", (PyObject *)(void *)&unixinfo_SyntaxType);
    2762           4 :         Py_INCREF((PyObject *)(void *)&unixinfo_SyntaxType);
    2763           4 :         PyModule_AddObject(m, "abstract_syntax", (PyObject *)(void *)&unixinfo_SyntaxType);
    2764             : #ifdef PY_MOD_UNIXINFO_PATCH
    2765             :         PY_MOD_UNIXINFO_PATCH(m);
    2766             : #endif
    2767           4 :         out:
    2768           4 :         Py_XDECREF(dep_samba_dcerpc_security);
    2769           4 :         Py_XDECREF(dep_talloc);
    2770           4 :         Py_XDECREF(dep_samba_dcerpc_base);
    2771           4 :         Py_XDECREF(dep_samba_dcerpc_misc);
    2772           4 :         return m;
    2773             : 
    2774             : }

Generated by: LCOV version 1.13