LCOV - code coverage report
Current view: top level - bin/default/librpc/gen_ndr - py_idmap.c (source / functions) Hit Total Coverage
Test: coverage report for master 2f515e9b Lines: 38 260 14.6 %
Date: 2024-04-21 15:09:00 Functions: 1 20 5.0 %

          Line data    Source code
       1             : 
       2             : /* Python wrapper functions auto-generated by pidl */
       3             : #define PY_SSIZE_T_CLEAN 1 /* We use Py_ssize_t for PyArg_ParseTupleAndKeywords */
       4             : #include "lib/replace/system/python.h"
       5             : #include "python/py3compat.h"
       6             : #include "includes.h"
       7             : #include "python/modules.h"
       8             : #include <pytalloc.h>
       9             : #include "librpc/rpc/pyrpc.h"
      10             : #include "librpc/rpc/pyrpc_util.h"
      11             : #include "bin/default/librpc/gen_ndr/ndr_idmap.h"
      12             : 
      13             : 
      14             : /*
      15             :  * Suppress compiler warnings if the generated code does not call these
      16             :  * functions
      17             :  */
      18             : #ifndef _MAYBE_UNUSED_
      19             : #ifdef __has_attribute
      20             : #if __has_attribute(unused)
      21             : #define _MAYBE_UNUSED_ __attribute__ ((unused))
      22             : #else
      23             : #define _MAYBE_UNUSED_
      24             : #endif
      25             : #endif
      26             : #endif
      27             : /*
      28             :  * These functions are here to ensure they can be optimized out by
      29             :  * the compiler based on the constant input values
      30             :  */
      31             : 
      32           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 unixid_Type;
      66             : static PyTypeObject id_map_Type;
      67             : 
      68             : static PyTypeObject *BaseObject_Type;
      69             : static PyTypeObject *dom_sid_Type;
      70             : 
      71           0 : static PyObject *py_unixid_get_id(PyObject *obj, void *closure)
      72             : {
      73           0 :         struct unixid *object = pytalloc_get_ptr(obj);
      74           0 :         PyObject *py_id;
      75           0 :         py_id = PyLong_FromUnsignedLongLong((uint32_t)(object->id));
      76           0 :         return py_id;
      77             : }
      78             : 
      79           0 : static int py_unixid_set_id(PyObject *py_obj, PyObject *value, void *closure)
      80             : {
      81           0 :         struct unixid *object = pytalloc_get_ptr(py_obj);
      82           0 :         if (value == NULL) {
      83           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->id");
      84           0 :                 return -1;
      85             :         }
      86             :         {
      87           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->id));
      88           0 :                 if (PyLong_Check(value)) {
      89           0 :                         unsigned long long test_var;
      90           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
      91           0 :                         if (PyErr_Occurred() != NULL) {
      92           0 :                                 return -1;
      93             :                         }
      94           0 :                         if (test_var > uint_max) {
      95           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
      96             :                                   PyLong_Type.tp_name, uint_max, test_var);
      97           0 :                                 return -1;
      98             :                         }
      99           0 :                         object->id = test_var;
     100             :                 } else {
     101           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
     102             :                           PyLong_Type.tp_name);
     103           0 :                         return -1;
     104             :                 }
     105             :         }
     106           0 :         return 0;
     107             : }
     108             : 
     109           0 : static PyObject *py_unixid_get_type(PyObject *obj, void *closure)
     110             : {
     111           0 :         struct unixid *object = pytalloc_get_ptr(obj);
     112           0 :         PyObject *py_type;
     113           0 :         py_type = PyLong_FromLong((uint16_t)(object->type));
     114           0 :         return py_type;
     115             : }
     116             : 
     117           0 : static int py_unixid_set_type(PyObject *py_obj, PyObject *value, void *closure)
     118             : {
     119           0 :         struct unixid *object = pytalloc_get_ptr(py_obj);
     120           0 :         if (value == NULL) {
     121           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->type");
     122           0 :                 return -1;
     123             :         }
     124             :         {
     125           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->type));
     126           0 :                 if (PyLong_Check(value)) {
     127           0 :                         unsigned long long test_var;
     128           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     129           0 :                         if (PyErr_Occurred() != NULL) {
     130           0 :                                 return -1;
     131             :                         }
     132           0 :                         if (test_var > uint_max) {
     133           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
     134             :                                   PyLong_Type.tp_name, uint_max, test_var);
     135           0 :                                 return -1;
     136             :                         }
     137           0 :                         object->type = test_var;
     138             :                 } else {
     139           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
     140             :                           PyLong_Type.tp_name);
     141           0 :                         return -1;
     142             :                 }
     143             :         }
     144           0 :         return 0;
     145             : }
     146             : 
     147             : static PyGetSetDef py_unixid_getsetters[] = {
     148             :         {
     149             :                 .name = discard_const_p(char, "id"),
     150             :                 .get = py_unixid_get_id,
     151             :                 .set = py_unixid_set_id,
     152             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
     153             :         },
     154             :         {
     155             :                 .name = discard_const_p(char, "type"),
     156             :                 .get = py_unixid_get_type,
     157             :                 .set = py_unixid_set_type,
     158             :                 .doc = discard_const_p(char, "PIDL-generated element of base type id_type")
     159             :         },
     160             :         { .name = NULL }
     161             : };
     162             : 
     163           0 : static PyObject *py_unixid_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     164             : {
     165           0 :         return pytalloc_new(struct unixid, type);
     166             : }
     167             : 
     168           0 : static PyObject *py_unixid_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
     169             : {
     170           0 :         struct unixid *object = pytalloc_get_ptr(py_obj);
     171           0 :         PyObject *ret = NULL;
     172           0 :         DATA_BLOB blob;
     173           0 :         enum ndr_err_code err;
     174           0 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
     175           0 :         if (tmp_ctx == NULL) {
     176           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
     177           0 :                 return NULL;
     178             :         }
     179           0 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_unixid);
     180           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
     181           0 :                 TALLOC_FREE(tmp_ctx);
     182           0 :                 PyErr_SetNdrError(err);
     183           0 :                 return NULL;
     184             :         }
     185             : 
     186           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
     187           0 :         TALLOC_FREE(tmp_ctx);
     188           0 :         return ret;
     189             : }
     190             : 
     191           0 : static PyObject *py_unixid_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
     192             : {
     193           0 :         struct unixid *object = pytalloc_get_ptr(py_obj);
     194           0 :         DATA_BLOB blob = {.data = NULL, .length = 0};
     195           0 :         Py_ssize_t blob_length = 0;
     196           0 :         enum ndr_err_code err;
     197           0 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
     198           0 :         PyObject *allow_remaining_obj = NULL;
     199           0 :         bool allow_remaining = false;
     200             : 
     201           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
     202             :                 discard_const_p(char *, kwnames),
     203             :                 &blob.data, &blob_length,
     204             :                 &allow_remaining_obj)) {
     205           0 :                 return NULL;
     206             :         }
     207           0 :         blob.length = blob_length;
     208             : 
     209           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
     210           0 :                 allow_remaining = true;
     211             :         }
     212             : 
     213           0 :         if (allow_remaining) {
     214           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_unixid);
     215             :         } else {
     216           0 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_unixid);
     217             :         }
     218           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
     219           0 :                 PyErr_SetNdrError(err);
     220           0 :                 return NULL;
     221             :         }
     222             : 
     223           0 :         Py_RETURN_NONE;
     224             : }
     225             : 
     226           0 : static PyObject *py_unixid_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
     227             : {
     228           0 :         struct unixid *object = pytalloc_get_ptr(py_obj);
     229           0 :         PyObject *ret;
     230           0 :         char *retstr;
     231             : 
     232           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_unixid, "unixid", object);
     233           0 :         ret = PyUnicode_FromString(retstr);
     234           0 :         talloc_free(retstr);
     235             : 
     236           0 :         return ret;
     237             : }
     238             : 
     239             : static PyMethodDef py_unixid_methods[] = {
     240             :         { "__ndr_pack__", (PyCFunction)py_unixid_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
     241             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_unixid_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
     242             :         { "__ndr_print__", (PyCFunction)py_unixid_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
     243             :         { NULL, NULL, 0, NULL }
     244             : };
     245             : 
     246             : 
     247             : static PyTypeObject unixid_Type = {
     248             :         PyVarObject_HEAD_INIT(NULL, 0)
     249             :         .tp_name = "idmap.unixid",
     250             :         .tp_getset = py_unixid_getsetters,
     251             :         .tp_methods = py_unixid_methods,
     252             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
     253             :         .tp_new = py_unixid_new,
     254             : };
     255             : 
     256             : 
     257           0 : static PyObject *py_id_map_get_sid(PyObject *obj, void *closure)
     258             : {
     259           0 :         struct id_map *object = pytalloc_get_ptr(obj);
     260           0 :         PyObject *py_sid;
     261           0 :         if (object->sid == NULL) {
     262           0 :                 Py_RETURN_NONE;
     263             :         }
     264           0 :         if (object->sid == NULL) {
     265           0 :                 py_sid = Py_None;
     266           0 :                 Py_INCREF(py_sid);
     267             :         } else {
     268           0 :                 py_sid = pytalloc_reference_ex(dom_sid_Type, object->sid, object->sid);
     269             :         }
     270           0 :         return py_sid;
     271             : }
     272             : 
     273           0 : static int py_id_map_set_sid(PyObject *py_obj, PyObject *value, void *closure)
     274             : {
     275           0 :         struct id_map *object = pytalloc_get_ptr(py_obj);
     276           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->sid));
     277           0 :         if (value == NULL) {
     278           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->sid");
     279           0 :                 return -1;
     280             :         }
     281           0 :         if (value == Py_None) {
     282           0 :                 object->sid = NULL;
     283             :         } else {
     284           0 :                 object->sid = NULL;
     285           0 :                 PY_CHECK_TYPE(dom_sid_Type, value, return -1;);
     286           0 :                 if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
     287           0 :                         PyErr_NoMemory();
     288           0 :                         return -1;
     289             :                 }
     290           0 :                 object->sid = (struct dom_sid *)pytalloc_get_ptr(value);
     291             :         }
     292           0 :         return 0;
     293             : }
     294             : 
     295           0 : static PyObject *py_id_map_get_xid(PyObject *obj, void *closure)
     296             : {
     297           0 :         struct id_map *object = pytalloc_get_ptr(obj);
     298           0 :         PyObject *py_xid;
     299           0 :         py_xid = pytalloc_reference_ex(&unixid_Type, pytalloc_get_mem_ctx(obj), &object->xid);
     300           0 :         return py_xid;
     301             : }
     302             : 
     303           0 : static int py_id_map_set_xid(PyObject *py_obj, PyObject *value, void *closure)
     304             : {
     305           0 :         struct id_map *object = pytalloc_get_ptr(py_obj);
     306           0 :         if (value == NULL) {
     307           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->xid");
     308           0 :                 return -1;
     309             :         }
     310           0 :         PY_CHECK_TYPE(&unixid_Type, value, return -1;);
     311           0 :         if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
     312           0 :                 PyErr_NoMemory();
     313           0 :                 return -1;
     314             :         }
     315           0 :         object->xid = *(struct unixid *)pytalloc_get_ptr(value);
     316           0 :         return 0;
     317             : }
     318             : 
     319           0 : static PyObject *py_id_map_get_status(PyObject *obj, void *closure)
     320             : {
     321           0 :         struct id_map *object = pytalloc_get_ptr(obj);
     322           0 :         PyObject *py_status;
     323           0 :         py_status = PyLong_FromLong((uint16_t)(object->status));
     324           0 :         return py_status;
     325             : }
     326             : 
     327           0 : static int py_id_map_set_status(PyObject *py_obj, PyObject *value, void *closure)
     328             : {
     329           0 :         struct id_map *object = pytalloc_get_ptr(py_obj);
     330           0 :         if (value == NULL) {
     331           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->status");
     332           0 :                 return -1;
     333             :         }
     334             :         {
     335           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->status));
     336           0 :                 if (PyLong_Check(value)) {
     337           0 :                         unsigned long long test_var;
     338           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     339           0 :                         if (PyErr_Occurred() != NULL) {
     340           0 :                                 return -1;
     341             :                         }
     342           0 :                         if (test_var > uint_max) {
     343           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
     344             :                                   PyLong_Type.tp_name, uint_max, test_var);
     345           0 :                                 return -1;
     346             :                         }
     347           0 :                         object->status = test_var;
     348             :                 } else {
     349           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
     350             :                           PyLong_Type.tp_name);
     351           0 :                         return -1;
     352             :                 }
     353             :         }
     354           0 :         return 0;
     355             : }
     356             : 
     357             : static PyGetSetDef py_id_map_getsetters[] = {
     358             :         {
     359             :                 .name = discard_const_p(char, "sid"),
     360             :                 .get = py_id_map_get_sid,
     361             :                 .set = py_id_map_set_sid,
     362             :                 .doc = discard_const_p(char, "PIDL-generated element of base type dom_sid")
     363             :         },
     364             :         {
     365             :                 .name = discard_const_p(char, "xid"),
     366             :                 .get = py_id_map_get_xid,
     367             :                 .set = py_id_map_set_xid,
     368             :                 .doc = discard_const_p(char, "PIDL-generated element of base type unixid")
     369             :         },
     370             :         {
     371             :                 .name = discard_const_p(char, "status"),
     372             :                 .get = py_id_map_get_status,
     373             :                 .set = py_id_map_set_status,
     374             :                 .doc = discard_const_p(char, "PIDL-generated element of base type id_mapping")
     375             :         },
     376             :         { .name = NULL }
     377             : };
     378             : 
     379           0 : static PyObject *py_id_map_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
     380             : {
     381           0 :         return pytalloc_new(struct id_map, type);
     382             : }
     383             : 
     384           0 : static PyObject *py_id_map_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
     385             : {
     386           0 :         struct id_map *object = pytalloc_get_ptr(py_obj);
     387           0 :         PyObject *ret = NULL;
     388           0 :         DATA_BLOB blob;
     389           0 :         enum ndr_err_code err;
     390           0 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
     391           0 :         if (tmp_ctx == NULL) {
     392           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
     393           0 :                 return NULL;
     394             :         }
     395           0 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_id_map);
     396           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
     397           0 :                 TALLOC_FREE(tmp_ctx);
     398           0 :                 PyErr_SetNdrError(err);
     399           0 :                 return NULL;
     400             :         }
     401             : 
     402           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
     403           0 :         TALLOC_FREE(tmp_ctx);
     404           0 :         return ret;
     405             : }
     406             : 
     407           0 : static PyObject *py_id_map_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
     408             : {
     409           0 :         struct id_map *object = pytalloc_get_ptr(py_obj);
     410           0 :         DATA_BLOB blob = {.data = NULL, .length = 0};
     411           0 :         Py_ssize_t blob_length = 0;
     412           0 :         enum ndr_err_code err;
     413           0 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
     414           0 :         PyObject *allow_remaining_obj = NULL;
     415           0 :         bool allow_remaining = false;
     416             : 
     417           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
     418             :                 discard_const_p(char *, kwnames),
     419             :                 &blob.data, &blob_length,
     420             :                 &allow_remaining_obj)) {
     421           0 :                 return NULL;
     422             :         }
     423           0 :         blob.length = blob_length;
     424             : 
     425           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
     426           0 :                 allow_remaining = true;
     427             :         }
     428             : 
     429           0 :         if (allow_remaining) {
     430           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_id_map);
     431             :         } else {
     432           0 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_id_map);
     433             :         }
     434           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
     435           0 :                 PyErr_SetNdrError(err);
     436           0 :                 return NULL;
     437             :         }
     438             : 
     439           0 :         Py_RETURN_NONE;
     440             : }
     441             : 
     442           0 : static PyObject *py_id_map_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
     443             : {
     444           0 :         struct id_map *object = pytalloc_get_ptr(py_obj);
     445           0 :         PyObject *ret;
     446           0 :         char *retstr;
     447             : 
     448           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_id_map, "id_map", object);
     449           0 :         ret = PyUnicode_FromString(retstr);
     450           0 :         talloc_free(retstr);
     451             : 
     452           0 :         return ret;
     453             : }
     454             : 
     455             : static PyMethodDef py_id_map_methods[] = {
     456             :         { "__ndr_pack__", (PyCFunction)py_id_map_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
     457             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_id_map_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
     458             :         { "__ndr_print__", (PyCFunction)py_id_map_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
     459             :         { NULL, NULL, 0, NULL }
     460             : };
     461             : 
     462             : 
     463             : static PyTypeObject id_map_Type = {
     464             :         PyVarObject_HEAD_INIT(NULL, 0)
     465             :         .tp_name = "idmap.id_map",
     466             :         .tp_getset = py_id_map_getsetters,
     467             :         .tp_methods = py_id_map_methods,
     468             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
     469             :         .tp_new = py_id_map_new,
     470             : };
     471             : 
     472             : static PyMethodDef idmap_methods[] = {
     473             :         { NULL, NULL, 0, NULL }
     474             : };
     475             : 
     476             : static struct PyModuleDef moduledef = {
     477             :         PyModuleDef_HEAD_INIT,
     478             :         .m_name = "idmap",
     479             :         .m_doc = "idmap DCE/RPC",
     480             :         .m_size = -1,
     481             :         .m_methods = idmap_methods,
     482             : };
     483        1874 : MODULE_INIT_FUNC(idmap)
     484             : {
     485        1874 :         PyObject *m = NULL;
     486        1874 :         PyObject *dep_samba_dcerpc_security = NULL;
     487        1874 :         PyObject *dep_talloc = NULL;
     488             : 
     489        1874 :         dep_samba_dcerpc_security = PyImport_ImportModule("samba.dcerpc.security");
     490        1874 :         if (dep_samba_dcerpc_security == NULL)
     491           0 :                 goto out;
     492             : 
     493        1874 :         dep_talloc = PyImport_ImportModule("talloc");
     494        1874 :         if (dep_talloc == NULL)
     495           0 :                 goto out;
     496             : 
     497        1874 :         BaseObject_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "BaseObject");
     498        1874 :         if (BaseObject_Type == NULL)
     499           0 :                 goto out;
     500             : 
     501        1874 :         dom_sid_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_security, "dom_sid");
     502        1874 :         if (dom_sid_Type == NULL)
     503           0 :                 goto out;
     504             : 
     505        1874 :         unixid_Type.tp_base = BaseObject_Type;
     506        1874 :         unixid_Type.tp_basicsize = pytalloc_BaseObject_size();
     507             : 
     508        1874 :         id_map_Type.tp_base = BaseObject_Type;
     509        1874 :         id_map_Type.tp_basicsize = pytalloc_BaseObject_size();
     510             : 
     511        1874 :         if (PyType_Ready(&unixid_Type) < 0)
     512           0 :                 goto out;
     513        1874 :         if (PyType_Ready(&id_map_Type) < 0)
     514           0 :                 goto out;
     515             : #ifdef PY_UNIXID_PATCH
     516             :         PY_UNIXID_PATCH(&unixid_Type);
     517             : #endif
     518             : #ifdef PY_ID_MAP_PATCH
     519             :         PY_ID_MAP_PATCH(&id_map_Type);
     520             : #endif
     521             : 
     522        1874 :         m = PyModule_Create(&moduledef);
     523        1874 :         if (m == NULL)
     524           0 :                 goto out;
     525             : 
     526        1874 :         PyModule_AddObject(m, "ID_TYPE_NOT_SPECIFIED", PyLong_FromLong((uint16_t)(ID_TYPE_NOT_SPECIFIED)));
     527        1874 :         PyModule_AddObject(m, "ID_TYPE_UID", PyLong_FromLong((uint16_t)(ID_TYPE_UID)));
     528        1874 :         PyModule_AddObject(m, "ID_TYPE_GID", PyLong_FromLong((uint16_t)(ID_TYPE_GID)));
     529        1874 :         PyModule_AddObject(m, "ID_TYPE_BOTH", PyLong_FromLong((uint16_t)(ID_TYPE_BOTH)));
     530        1874 :         PyModule_AddObject(m, "ID_TYPE_WB_REQUIRE_TYPE", PyLong_FromLong((uint16_t)(ID_TYPE_WB_REQUIRE_TYPE)));
     531        1874 :         PyModule_AddObject(m, "ID_UNKNOWN", PyLong_FromLong((uint16_t)(ID_UNKNOWN)));
     532        1874 :         PyModule_AddObject(m, "ID_MAPPED", PyLong_FromLong((uint16_t)(ID_MAPPED)));
     533        1874 :         PyModule_AddObject(m, "ID_UNMAPPED", PyLong_FromLong((uint16_t)(ID_UNMAPPED)));
     534        1874 :         PyModule_AddObject(m, "ID_EXPIRED", PyLong_FromLong((uint16_t)(ID_EXPIRED)));
     535        1874 :         PyModule_AddObject(m, "ID_REQUIRE_TYPE", PyLong_FromLong((uint16_t)(ID_REQUIRE_TYPE)));
     536        1561 :         Py_INCREF((PyObject *)(void *)&unixid_Type);
     537        1874 :         PyModule_AddObject(m, "unixid", (PyObject *)(void *)&unixid_Type);
     538        1561 :         Py_INCREF((PyObject *)(void *)&id_map_Type);
     539        1874 :         PyModule_AddObject(m, "id_map", (PyObject *)(void *)&id_map_Type);
     540             : #ifdef PY_MOD_IDMAP_PATCH
     541             :         PY_MOD_IDMAP_PATCH(m);
     542             : #endif
     543        1874 :         out:
     544        1874 :         Py_XDECREF(dep_samba_dcerpc_security);
     545        1874 :         Py_XDECREF(dep_talloc);
     546        1874 :         return m;
     547             : 
     548             : }

Generated by: LCOV version 1.14