LCOV - code coverage report
Current view: top level - bin/default/librpc/gen_ndr - py_auth.c (source / functions) Hit Total Coverage
Test: coverage report for master 2f515e9b Lines: 151 1638 9.2 %
Date: 2024-04-21 15:09:00 Functions: 12 118 10.2 %

          Line data    Source code
       1             : 
       2             : /* Python wrapper functions auto-generated by pidl */
       3             : #define PY_SSIZE_T_CLEAN 1 /* We use Py_ssize_t for PyArg_ParseTupleAndKeywords */
       4             : #include "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_auth.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/misc.h"
      65             : #include "librpc/gen_ndr/security.h"
      66             : #include "librpc/gen_ndr/lsa.h"
      67             : #include "librpc/gen_ndr/krb5pac.h"
      68             : static PyTypeObject auth_user_info_Type;
      69             : static PyTypeObject auth_user_info_torture_Type;
      70             : static PyTypeObject auth_user_info_unix_Type;
      71             : static PyTypeObject auth_SidAttr_Type;
      72             : static PyTypeObject auth_user_info_dc_Type;
      73             : static PyTypeObject auth_session_info_Type;
      74             : static PyTypeObject auth_session_info_transport_Type;
      75             : 
      76             : static PyTypeObject *BaseObject_Type;
      77             : static PyTypeObject *dom_sid_Type;
      78             : static PyTypeObject *security_token_Type;
      79             : static PyTypeObject *security_unix_token_Type;
      80             : static PyTypeObject *GUID_Type;
      81             : #include "librpc/ndr/py_auth.c"
      82             : 
      83             : 
      84           2 : static PyObject *py_auth_user_info_get_account_name(PyObject *obj, void *closure)
      85             : {
      86           2 :         struct auth_user_info *object = pytalloc_get_ptr(obj);
      87           0 :         PyObject *py_account_name;
      88           2 :         if (object->account_name == NULL) {
      89           0 :                 Py_RETURN_NONE;
      90             :         }
      91           2 :         if (object->account_name == NULL) {
      92           0 :                 py_account_name = Py_None;
      93           0 :                 Py_INCREF(py_account_name);
      94             :         } else {
      95           2 :                 if (object->account_name == NULL) {
      96           0 :                         py_account_name = Py_None;
      97           0 :                         Py_INCREF(py_account_name);
      98             :                 } else {
      99           2 :                         py_account_name = PyUnicode_Decode(object->account_name, strlen(object->account_name), "utf-8", "ignore");
     100             :                 }
     101             :         }
     102           2 :         return py_account_name;
     103             : }
     104             : 
     105           0 : static int py_auth_user_info_set_account_name(PyObject *py_obj, PyObject *value, void *closure)
     106             : {
     107           0 :         struct auth_user_info *object = pytalloc_get_ptr(py_obj);
     108           0 :         if (value == NULL) {
     109           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->account_name");
     110           0 :                 return -1;
     111             :         }
     112           0 :         if (value == Py_None) {
     113           0 :                 object->account_name = NULL;
     114             :         } else {
     115           0 :                 object->account_name = NULL;
     116             :                 {
     117           0 :                         const char *test_str;
     118           0 :                         const char *talloc_str;
     119           0 :                         PyObject *unicode = NULL;
     120           0 :                         if (PyUnicode_Check(value)) {
     121           0 :                                 unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
     122           0 :                                 if (unicode == NULL) {
     123           0 :                                         return -1;
     124             :                                 }
     125           0 :                                 test_str = PyBytes_AS_STRING(unicode);
     126           0 :                         } else if (PyBytes_Check(value)) {
     127           0 :                                 test_str = PyBytes_AS_STRING(value);
     128             :                         } else {
     129           0 :                                 PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
     130           0 :                                 return -1;
     131             :                         }
     132           0 :                         talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
     133           0 :                         if (unicode != NULL) {
     134           0 :                                 Py_DECREF(unicode);
     135             :                         }
     136           0 :                         if (talloc_str == NULL) {
     137           0 :                                 PyErr_NoMemory();
     138           0 :                                 return -1;
     139             :                         }
     140           0 :                         object->account_name = talloc_str;
     141             :                 }
     142             :         }
     143           0 :         return 0;
     144             : }
     145             : 
     146           0 : static PyObject *py_auth_user_info_get_user_principal_name(PyObject *obj, void *closure)
     147             : {
     148           0 :         struct auth_user_info *object = pytalloc_get_ptr(obj);
     149           0 :         PyObject *py_user_principal_name;
     150           0 :         if (object->user_principal_name == NULL) {
     151           0 :                 Py_RETURN_NONE;
     152             :         }
     153           0 :         if (object->user_principal_name == NULL) {
     154           0 :                 py_user_principal_name = Py_None;
     155           0 :                 Py_INCREF(py_user_principal_name);
     156             :         } else {
     157           0 :                 if (object->user_principal_name == NULL) {
     158           0 :                         py_user_principal_name = Py_None;
     159           0 :                         Py_INCREF(py_user_principal_name);
     160             :                 } else {
     161           0 :                         py_user_principal_name = PyUnicode_Decode(object->user_principal_name, strlen(object->user_principal_name), "utf-8", "ignore");
     162             :                 }
     163             :         }
     164           0 :         return py_user_principal_name;
     165             : }
     166             : 
     167           0 : static int py_auth_user_info_set_user_principal_name(PyObject *py_obj, PyObject *value, void *closure)
     168             : {
     169           0 :         struct auth_user_info *object = pytalloc_get_ptr(py_obj);
     170           0 :         if (value == NULL) {
     171           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->user_principal_name");
     172           0 :                 return -1;
     173             :         }
     174           0 :         if (value == Py_None) {
     175           0 :                 object->user_principal_name = NULL;
     176             :         } else {
     177           0 :                 object->user_principal_name = NULL;
     178             :                 {
     179           0 :                         const char *test_str;
     180           0 :                         const char *talloc_str;
     181           0 :                         PyObject *unicode = NULL;
     182           0 :                         if (PyUnicode_Check(value)) {
     183           0 :                                 unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
     184           0 :                                 if (unicode == NULL) {
     185           0 :                                         return -1;
     186             :                                 }
     187           0 :                                 test_str = PyBytes_AS_STRING(unicode);
     188           0 :                         } else if (PyBytes_Check(value)) {
     189           0 :                                 test_str = PyBytes_AS_STRING(value);
     190             :                         } else {
     191           0 :                                 PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
     192           0 :                                 return -1;
     193             :                         }
     194           0 :                         talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
     195           0 :                         if (unicode != NULL) {
     196           0 :                                 Py_DECREF(unicode);
     197             :                         }
     198           0 :                         if (talloc_str == NULL) {
     199           0 :                                 PyErr_NoMemory();
     200           0 :                                 return -1;
     201             :                         }
     202           0 :                         object->user_principal_name = talloc_str;
     203             :                 }
     204             :         }
     205           0 :         return 0;
     206             : }
     207             : 
     208           0 : static PyObject *py_auth_user_info_get_user_principal_constructed(PyObject *obj, void *closure)
     209             : {
     210           0 :         struct auth_user_info *object = pytalloc_get_ptr(obj);
     211           0 :         PyObject *py_user_principal_constructed;
     212           0 :         py_user_principal_constructed = PyLong_FromLong((uint16_t)(object->user_principal_constructed));
     213           0 :         return py_user_principal_constructed;
     214             : }
     215             : 
     216           0 : static int py_auth_user_info_set_user_principal_constructed(PyObject *py_obj, PyObject *value, void *closure)
     217             : {
     218           0 :         struct auth_user_info *object = pytalloc_get_ptr(py_obj);
     219           0 :         if (value == NULL) {
     220           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->user_principal_constructed");
     221           0 :                 return -1;
     222             :         }
     223             :         {
     224           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->user_principal_constructed));
     225           0 :                 if (PyLong_Check(value)) {
     226           0 :                         unsigned long long test_var;
     227           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     228           0 :                         if (PyErr_Occurred() != NULL) {
     229           0 :                                 return -1;
     230             :                         }
     231           0 :                         if (test_var > uint_max) {
     232           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
     233             :                                   PyLong_Type.tp_name, uint_max, test_var);
     234           0 :                                 return -1;
     235             :                         }
     236           0 :                         object->user_principal_constructed = test_var;
     237             :                 } else {
     238           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
     239             :                           PyLong_Type.tp_name);
     240           0 :                         return -1;
     241             :                 }
     242             :         }
     243           0 :         return 0;
     244             : }
     245             : 
     246           2 : static PyObject *py_auth_user_info_get_domain_name(PyObject *obj, void *closure)
     247             : {
     248           2 :         struct auth_user_info *object = pytalloc_get_ptr(obj);
     249           0 :         PyObject *py_domain_name;
     250           2 :         if (object->domain_name == NULL) {
     251           0 :                 Py_RETURN_NONE;
     252             :         }
     253           2 :         if (object->domain_name == NULL) {
     254           0 :                 py_domain_name = Py_None;
     255           0 :                 Py_INCREF(py_domain_name);
     256             :         } else {
     257           2 :                 if (object->domain_name == NULL) {
     258           0 :                         py_domain_name = Py_None;
     259           0 :                         Py_INCREF(py_domain_name);
     260             :                 } else {
     261           2 :                         py_domain_name = PyUnicode_Decode(object->domain_name, strlen(object->domain_name), "utf-8", "ignore");
     262             :                 }
     263             :         }
     264           2 :         return py_domain_name;
     265             : }
     266             : 
     267           0 : static int py_auth_user_info_set_domain_name(PyObject *py_obj, PyObject *value, void *closure)
     268             : {
     269           0 :         struct auth_user_info *object = pytalloc_get_ptr(py_obj);
     270           0 :         if (value == NULL) {
     271           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->domain_name");
     272           0 :                 return -1;
     273             :         }
     274           0 :         if (value == Py_None) {
     275           0 :                 object->domain_name = NULL;
     276             :         } else {
     277           0 :                 object->domain_name = NULL;
     278             :                 {
     279           0 :                         const char *test_str;
     280           0 :                         const char *talloc_str;
     281           0 :                         PyObject *unicode = NULL;
     282           0 :                         if (PyUnicode_Check(value)) {
     283           0 :                                 unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
     284           0 :                                 if (unicode == NULL) {
     285           0 :                                         return -1;
     286             :                                 }
     287           0 :                                 test_str = PyBytes_AS_STRING(unicode);
     288           0 :                         } else if (PyBytes_Check(value)) {
     289           0 :                                 test_str = PyBytes_AS_STRING(value);
     290             :                         } else {
     291           0 :                                 PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
     292           0 :                                 return -1;
     293             :                         }
     294           0 :                         talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
     295           0 :                         if (unicode != NULL) {
     296           0 :                                 Py_DECREF(unicode);
     297             :                         }
     298           0 :                         if (talloc_str == NULL) {
     299           0 :                                 PyErr_NoMemory();
     300           0 :                                 return -1;
     301             :                         }
     302           0 :                         object->domain_name = talloc_str;
     303             :                 }
     304             :         }
     305           0 :         return 0;
     306             : }
     307             : 
     308           0 : static PyObject *py_auth_user_info_get_dns_domain_name(PyObject *obj, void *closure)
     309             : {
     310           0 :         struct auth_user_info *object = pytalloc_get_ptr(obj);
     311           0 :         PyObject *py_dns_domain_name;
     312           0 :         if (object->dns_domain_name == NULL) {
     313           0 :                 Py_RETURN_NONE;
     314             :         }
     315           0 :         if (object->dns_domain_name == NULL) {
     316           0 :                 py_dns_domain_name = Py_None;
     317           0 :                 Py_INCREF(py_dns_domain_name);
     318             :         } else {
     319           0 :                 if (object->dns_domain_name == NULL) {
     320           0 :                         py_dns_domain_name = Py_None;
     321           0 :                         Py_INCREF(py_dns_domain_name);
     322             :                 } else {
     323           0 :                         py_dns_domain_name = PyUnicode_Decode(object->dns_domain_name, strlen(object->dns_domain_name), "utf-8", "ignore");
     324             :                 }
     325             :         }
     326           0 :         return py_dns_domain_name;
     327             : }
     328             : 
     329           0 : static int py_auth_user_info_set_dns_domain_name(PyObject *py_obj, PyObject *value, void *closure)
     330             : {
     331           0 :         struct auth_user_info *object = pytalloc_get_ptr(py_obj);
     332           0 :         if (value == NULL) {
     333           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->dns_domain_name");
     334           0 :                 return -1;
     335             :         }
     336           0 :         if (value == Py_None) {
     337           0 :                 object->dns_domain_name = NULL;
     338             :         } else {
     339           0 :                 object->dns_domain_name = NULL;
     340             :                 {
     341           0 :                         const char *test_str;
     342           0 :                         const char *talloc_str;
     343           0 :                         PyObject *unicode = NULL;
     344           0 :                         if (PyUnicode_Check(value)) {
     345           0 :                                 unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
     346           0 :                                 if (unicode == NULL) {
     347           0 :                                         return -1;
     348             :                                 }
     349           0 :                                 test_str = PyBytes_AS_STRING(unicode);
     350           0 :                         } else if (PyBytes_Check(value)) {
     351           0 :                                 test_str = PyBytes_AS_STRING(value);
     352             :                         } else {
     353           0 :                                 PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
     354           0 :                                 return -1;
     355             :                         }
     356           0 :                         talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
     357           0 :                         if (unicode != NULL) {
     358           0 :                                 Py_DECREF(unicode);
     359             :                         }
     360           0 :                         if (talloc_str == NULL) {
     361           0 :                                 PyErr_NoMemory();
     362           0 :                                 return -1;
     363             :                         }
     364           0 :                         object->dns_domain_name = talloc_str;
     365             :                 }
     366             :         }
     367           0 :         return 0;
     368             : }
     369             : 
     370           2 : static PyObject *py_auth_user_info_get_full_name(PyObject *obj, void *closure)
     371             : {
     372           2 :         struct auth_user_info *object = pytalloc_get_ptr(obj);
     373           0 :         PyObject *py_full_name;
     374           2 :         if (object->full_name == NULL) {
     375           0 :                 Py_RETURN_NONE;
     376             :         }
     377           2 :         if (object->full_name == NULL) {
     378           0 :                 py_full_name = Py_None;
     379           0 :                 Py_INCREF(py_full_name);
     380             :         } else {
     381           2 :                 if (object->full_name == NULL) {
     382           0 :                         py_full_name = Py_None;
     383           0 :                         Py_INCREF(py_full_name);
     384             :                 } else {
     385           2 :                         py_full_name = PyUnicode_Decode(object->full_name, strlen(object->full_name), "utf-8", "ignore");
     386             :                 }
     387             :         }
     388           2 :         return py_full_name;
     389             : }
     390             : 
     391           0 : static int py_auth_user_info_set_full_name(PyObject *py_obj, PyObject *value, void *closure)
     392             : {
     393           0 :         struct auth_user_info *object = pytalloc_get_ptr(py_obj);
     394           0 :         if (value == NULL) {
     395           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->full_name");
     396           0 :                 return -1;
     397             :         }
     398           0 :         if (value == Py_None) {
     399           0 :                 object->full_name = NULL;
     400             :         } else {
     401           0 :                 object->full_name = NULL;
     402             :                 {
     403           0 :                         const char *test_str;
     404           0 :                         const char *talloc_str;
     405           0 :                         PyObject *unicode = NULL;
     406           0 :                         if (PyUnicode_Check(value)) {
     407           0 :                                 unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
     408           0 :                                 if (unicode == NULL) {
     409           0 :                                         return -1;
     410             :                                 }
     411           0 :                                 test_str = PyBytes_AS_STRING(unicode);
     412           0 :                         } else if (PyBytes_Check(value)) {
     413           0 :                                 test_str = PyBytes_AS_STRING(value);
     414             :                         } else {
     415           0 :                                 PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
     416           0 :                                 return -1;
     417             :                         }
     418           0 :                         talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
     419           0 :                         if (unicode != NULL) {
     420           0 :                                 Py_DECREF(unicode);
     421             :                         }
     422           0 :                         if (talloc_str == NULL) {
     423           0 :                                 PyErr_NoMemory();
     424           0 :                                 return -1;
     425             :                         }
     426           0 :                         object->full_name = talloc_str;
     427             :                 }
     428             :         }
     429           0 :         return 0;
     430             : }
     431             : 
     432           0 : static PyObject *py_auth_user_info_get_logon_script(PyObject *obj, void *closure)
     433             : {
     434           0 :         struct auth_user_info *object = pytalloc_get_ptr(obj);
     435           0 :         PyObject *py_logon_script;
     436           0 :         if (object->logon_script == NULL) {
     437           0 :                 Py_RETURN_NONE;
     438             :         }
     439           0 :         if (object->logon_script == NULL) {
     440           0 :                 py_logon_script = Py_None;
     441           0 :                 Py_INCREF(py_logon_script);
     442             :         } else {
     443           0 :                 if (object->logon_script == NULL) {
     444           0 :                         py_logon_script = Py_None;
     445           0 :                         Py_INCREF(py_logon_script);
     446             :                 } else {
     447           0 :                         py_logon_script = PyUnicode_Decode(object->logon_script, strlen(object->logon_script), "utf-8", "ignore");
     448             :                 }
     449             :         }
     450           0 :         return py_logon_script;
     451             : }
     452             : 
     453           0 : static int py_auth_user_info_set_logon_script(PyObject *py_obj, PyObject *value, void *closure)
     454             : {
     455           0 :         struct auth_user_info *object = pytalloc_get_ptr(py_obj);
     456           0 :         if (value == NULL) {
     457           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->logon_script");
     458           0 :                 return -1;
     459             :         }
     460           0 :         if (value == Py_None) {
     461           0 :                 object->logon_script = NULL;
     462             :         } else {
     463           0 :                 object->logon_script = NULL;
     464             :                 {
     465           0 :                         const char *test_str;
     466           0 :                         const char *talloc_str;
     467           0 :                         PyObject *unicode = NULL;
     468           0 :                         if (PyUnicode_Check(value)) {
     469           0 :                                 unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
     470           0 :                                 if (unicode == NULL) {
     471           0 :                                         return -1;
     472             :                                 }
     473           0 :                                 test_str = PyBytes_AS_STRING(unicode);
     474           0 :                         } else if (PyBytes_Check(value)) {
     475           0 :                                 test_str = PyBytes_AS_STRING(value);
     476             :                         } else {
     477           0 :                                 PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
     478           0 :                                 return -1;
     479             :                         }
     480           0 :                         talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
     481           0 :                         if (unicode != NULL) {
     482           0 :                                 Py_DECREF(unicode);
     483             :                         }
     484           0 :                         if (talloc_str == NULL) {
     485           0 :                                 PyErr_NoMemory();
     486           0 :                                 return -1;
     487             :                         }
     488           0 :                         object->logon_script = talloc_str;
     489             :                 }
     490             :         }
     491           0 :         return 0;
     492             : }
     493             : 
     494           0 : static PyObject *py_auth_user_info_get_profile_path(PyObject *obj, void *closure)
     495             : {
     496           0 :         struct auth_user_info *object = pytalloc_get_ptr(obj);
     497           0 :         PyObject *py_profile_path;
     498           0 :         if (object->profile_path == NULL) {
     499           0 :                 Py_RETURN_NONE;
     500             :         }
     501           0 :         if (object->profile_path == NULL) {
     502           0 :                 py_profile_path = Py_None;
     503           0 :                 Py_INCREF(py_profile_path);
     504             :         } else {
     505           0 :                 if (object->profile_path == NULL) {
     506           0 :                         py_profile_path = Py_None;
     507           0 :                         Py_INCREF(py_profile_path);
     508             :                 } else {
     509           0 :                         py_profile_path = PyUnicode_Decode(object->profile_path, strlen(object->profile_path), "utf-8", "ignore");
     510             :                 }
     511             :         }
     512           0 :         return py_profile_path;
     513             : }
     514             : 
     515           0 : static int py_auth_user_info_set_profile_path(PyObject *py_obj, PyObject *value, void *closure)
     516             : {
     517           0 :         struct auth_user_info *object = pytalloc_get_ptr(py_obj);
     518           0 :         if (value == NULL) {
     519           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->profile_path");
     520           0 :                 return -1;
     521             :         }
     522           0 :         if (value == Py_None) {
     523           0 :                 object->profile_path = NULL;
     524             :         } else {
     525           0 :                 object->profile_path = NULL;
     526             :                 {
     527           0 :                         const char *test_str;
     528           0 :                         const char *talloc_str;
     529           0 :                         PyObject *unicode = NULL;
     530           0 :                         if (PyUnicode_Check(value)) {
     531           0 :                                 unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
     532           0 :                                 if (unicode == NULL) {
     533           0 :                                         return -1;
     534             :                                 }
     535           0 :                                 test_str = PyBytes_AS_STRING(unicode);
     536           0 :                         } else if (PyBytes_Check(value)) {
     537           0 :                                 test_str = PyBytes_AS_STRING(value);
     538             :                         } else {
     539           0 :                                 PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
     540           0 :                                 return -1;
     541             :                         }
     542           0 :                         talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
     543           0 :                         if (unicode != NULL) {
     544           0 :                                 Py_DECREF(unicode);
     545             :                         }
     546           0 :                         if (talloc_str == NULL) {
     547           0 :                                 PyErr_NoMemory();
     548           0 :                                 return -1;
     549             :                         }
     550           0 :                         object->profile_path = talloc_str;
     551             :                 }
     552             :         }
     553           0 :         return 0;
     554             : }
     555             : 
     556           0 : static PyObject *py_auth_user_info_get_home_directory(PyObject *obj, void *closure)
     557             : {
     558           0 :         struct auth_user_info *object = pytalloc_get_ptr(obj);
     559           0 :         PyObject *py_home_directory;
     560           0 :         if (object->home_directory == NULL) {
     561           0 :                 Py_RETURN_NONE;
     562             :         }
     563           0 :         if (object->home_directory == NULL) {
     564           0 :                 py_home_directory = Py_None;
     565           0 :                 Py_INCREF(py_home_directory);
     566             :         } else {
     567           0 :                 if (object->home_directory == NULL) {
     568           0 :                         py_home_directory = Py_None;
     569           0 :                         Py_INCREF(py_home_directory);
     570             :                 } else {
     571           0 :                         py_home_directory = PyUnicode_Decode(object->home_directory, strlen(object->home_directory), "utf-8", "ignore");
     572             :                 }
     573             :         }
     574           0 :         return py_home_directory;
     575             : }
     576             : 
     577           0 : static int py_auth_user_info_set_home_directory(PyObject *py_obj, PyObject *value, void *closure)
     578             : {
     579           0 :         struct auth_user_info *object = pytalloc_get_ptr(py_obj);
     580           0 :         if (value == NULL) {
     581           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->home_directory");
     582           0 :                 return -1;
     583             :         }
     584           0 :         if (value == Py_None) {
     585           0 :                 object->home_directory = NULL;
     586             :         } else {
     587           0 :                 object->home_directory = NULL;
     588             :                 {
     589           0 :                         const char *test_str;
     590           0 :                         const char *talloc_str;
     591           0 :                         PyObject *unicode = NULL;
     592           0 :                         if (PyUnicode_Check(value)) {
     593           0 :                                 unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
     594           0 :                                 if (unicode == NULL) {
     595           0 :                                         return -1;
     596             :                                 }
     597           0 :                                 test_str = PyBytes_AS_STRING(unicode);
     598           0 :                         } else if (PyBytes_Check(value)) {
     599           0 :                                 test_str = PyBytes_AS_STRING(value);
     600             :                         } else {
     601           0 :                                 PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
     602           0 :                                 return -1;
     603             :                         }
     604           0 :                         talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
     605           0 :                         if (unicode != NULL) {
     606           0 :                                 Py_DECREF(unicode);
     607             :                         }
     608           0 :                         if (talloc_str == NULL) {
     609           0 :                                 PyErr_NoMemory();
     610           0 :                                 return -1;
     611             :                         }
     612           0 :                         object->home_directory = talloc_str;
     613             :                 }
     614             :         }
     615           0 :         return 0;
     616             : }
     617             : 
     618           0 : static PyObject *py_auth_user_info_get_home_drive(PyObject *obj, void *closure)
     619             : {
     620           0 :         struct auth_user_info *object = pytalloc_get_ptr(obj);
     621           0 :         PyObject *py_home_drive;
     622           0 :         if (object->home_drive == NULL) {
     623           0 :                 Py_RETURN_NONE;
     624             :         }
     625           0 :         if (object->home_drive == NULL) {
     626           0 :                 py_home_drive = Py_None;
     627           0 :                 Py_INCREF(py_home_drive);
     628             :         } else {
     629           0 :                 if (object->home_drive == NULL) {
     630           0 :                         py_home_drive = Py_None;
     631           0 :                         Py_INCREF(py_home_drive);
     632             :                 } else {
     633           0 :                         py_home_drive = PyUnicode_Decode(object->home_drive, strlen(object->home_drive), "utf-8", "ignore");
     634             :                 }
     635             :         }
     636           0 :         return py_home_drive;
     637             : }
     638             : 
     639           0 : static int py_auth_user_info_set_home_drive(PyObject *py_obj, PyObject *value, void *closure)
     640             : {
     641           0 :         struct auth_user_info *object = pytalloc_get_ptr(py_obj);
     642           0 :         if (value == NULL) {
     643           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->home_drive");
     644           0 :                 return -1;
     645             :         }
     646           0 :         if (value == Py_None) {
     647           0 :                 object->home_drive = NULL;
     648             :         } else {
     649           0 :                 object->home_drive = NULL;
     650             :                 {
     651           0 :                         const char *test_str;
     652           0 :                         const char *talloc_str;
     653           0 :                         PyObject *unicode = NULL;
     654           0 :                         if (PyUnicode_Check(value)) {
     655           0 :                                 unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
     656           0 :                                 if (unicode == NULL) {
     657           0 :                                         return -1;
     658             :                                 }
     659           0 :                                 test_str = PyBytes_AS_STRING(unicode);
     660           0 :                         } else if (PyBytes_Check(value)) {
     661           0 :                                 test_str = PyBytes_AS_STRING(value);
     662             :                         } else {
     663           0 :                                 PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
     664           0 :                                 return -1;
     665             :                         }
     666           0 :                         talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
     667           0 :                         if (unicode != NULL) {
     668           0 :                                 Py_DECREF(unicode);
     669             :                         }
     670           0 :                         if (talloc_str == NULL) {
     671           0 :                                 PyErr_NoMemory();
     672           0 :                                 return -1;
     673             :                         }
     674           0 :                         object->home_drive = talloc_str;
     675             :                 }
     676             :         }
     677           0 :         return 0;
     678             : }
     679             : 
     680           0 : static PyObject *py_auth_user_info_get_logon_server(PyObject *obj, void *closure)
     681             : {
     682           0 :         struct auth_user_info *object = pytalloc_get_ptr(obj);
     683           0 :         PyObject *py_logon_server;
     684           0 :         if (object->logon_server == NULL) {
     685           0 :                 Py_RETURN_NONE;
     686             :         }
     687           0 :         if (object->logon_server == NULL) {
     688           0 :                 py_logon_server = Py_None;
     689           0 :                 Py_INCREF(py_logon_server);
     690             :         } else {
     691           0 :                 if (object->logon_server == NULL) {
     692           0 :                         py_logon_server = Py_None;
     693           0 :                         Py_INCREF(py_logon_server);
     694             :                 } else {
     695           0 :                         py_logon_server = PyUnicode_Decode(object->logon_server, strlen(object->logon_server), "utf-8", "ignore");
     696             :                 }
     697             :         }
     698           0 :         return py_logon_server;
     699             : }
     700             : 
     701           0 : static int py_auth_user_info_set_logon_server(PyObject *py_obj, PyObject *value, void *closure)
     702             : {
     703           0 :         struct auth_user_info *object = pytalloc_get_ptr(py_obj);
     704           0 :         if (value == NULL) {
     705           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->logon_server");
     706           0 :                 return -1;
     707             :         }
     708           0 :         if (value == Py_None) {
     709           0 :                 object->logon_server = NULL;
     710             :         } else {
     711           0 :                 object->logon_server = NULL;
     712             :                 {
     713           0 :                         const char *test_str;
     714           0 :                         const char *talloc_str;
     715           0 :                         PyObject *unicode = NULL;
     716           0 :                         if (PyUnicode_Check(value)) {
     717           0 :                                 unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
     718           0 :                                 if (unicode == NULL) {
     719           0 :                                         return -1;
     720             :                                 }
     721           0 :                                 test_str = PyBytes_AS_STRING(unicode);
     722           0 :                         } else if (PyBytes_Check(value)) {
     723           0 :                                 test_str = PyBytes_AS_STRING(value);
     724             :                         } else {
     725           0 :                                 PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
     726           0 :                                 return -1;
     727             :                         }
     728           0 :                         talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
     729           0 :                         if (unicode != NULL) {
     730           0 :                                 Py_DECREF(unicode);
     731             :                         }
     732           0 :                         if (talloc_str == NULL) {
     733           0 :                                 PyErr_NoMemory();
     734           0 :                                 return -1;
     735             :                         }
     736           0 :                         object->logon_server = talloc_str;
     737             :                 }
     738             :         }
     739           0 :         return 0;
     740             : }
     741             : 
     742           0 : static PyObject *py_auth_user_info_get_last_logon(PyObject *obj, void *closure)
     743             : {
     744           0 :         struct auth_user_info *object = pytalloc_get_ptr(obj);
     745           0 :         PyObject *py_last_logon;
     746           0 :         py_last_logon = PyLong_FromUnsignedLongLong(object->last_logon);
     747           0 :         return py_last_logon;
     748             : }
     749             : 
     750           0 : static int py_auth_user_info_set_last_logon(PyObject *py_obj, PyObject *value, void *closure)
     751             : {
     752           0 :         struct auth_user_info *object = pytalloc_get_ptr(py_obj);
     753           0 :         if (value == NULL) {
     754           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->last_logon");
     755           0 :                 return -1;
     756             :         }
     757             :         {
     758           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->last_logon));
     759           0 :                 if (PyLong_Check(value)) {
     760           0 :                         unsigned long long test_var;
     761           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     762           0 :                         if (PyErr_Occurred() != NULL) {
     763           0 :                                 return -1;
     764             :                         }
     765           0 :                         if (test_var > uint_max) {
     766           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
     767             :                                   PyLong_Type.tp_name, uint_max, test_var);
     768           0 :                                 return -1;
     769             :                         }
     770           0 :                         object->last_logon = test_var;
     771             :                 } else {
     772           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
     773             :                           PyLong_Type.tp_name);
     774           0 :                         return -1;
     775             :                 }
     776             :         }
     777           0 :         return 0;
     778             : }
     779             : 
     780           0 : static PyObject *py_auth_user_info_get_last_logoff(PyObject *obj, void *closure)
     781             : {
     782           0 :         struct auth_user_info *object = pytalloc_get_ptr(obj);
     783           0 :         PyObject *py_last_logoff;
     784           0 :         py_last_logoff = PyLong_FromUnsignedLongLong(object->last_logoff);
     785           0 :         return py_last_logoff;
     786             : }
     787             : 
     788           0 : static int py_auth_user_info_set_last_logoff(PyObject *py_obj, PyObject *value, void *closure)
     789             : {
     790           0 :         struct auth_user_info *object = pytalloc_get_ptr(py_obj);
     791           0 :         if (value == NULL) {
     792           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->last_logoff");
     793           0 :                 return -1;
     794             :         }
     795             :         {
     796           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->last_logoff));
     797           0 :                 if (PyLong_Check(value)) {
     798           0 :                         unsigned long long test_var;
     799           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     800           0 :                         if (PyErr_Occurred() != NULL) {
     801           0 :                                 return -1;
     802             :                         }
     803           0 :                         if (test_var > uint_max) {
     804           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
     805             :                                   PyLong_Type.tp_name, uint_max, test_var);
     806           0 :                                 return -1;
     807             :                         }
     808           0 :                         object->last_logoff = test_var;
     809             :                 } else {
     810           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
     811             :                           PyLong_Type.tp_name);
     812           0 :                         return -1;
     813             :                 }
     814             :         }
     815           0 :         return 0;
     816             : }
     817             : 
     818           0 : static PyObject *py_auth_user_info_get_acct_expiry(PyObject *obj, void *closure)
     819             : {
     820           0 :         struct auth_user_info *object = pytalloc_get_ptr(obj);
     821           0 :         PyObject *py_acct_expiry;
     822           0 :         py_acct_expiry = PyLong_FromUnsignedLongLong(object->acct_expiry);
     823           0 :         return py_acct_expiry;
     824             : }
     825             : 
     826           0 : static int py_auth_user_info_set_acct_expiry(PyObject *py_obj, PyObject *value, void *closure)
     827             : {
     828           0 :         struct auth_user_info *object = pytalloc_get_ptr(py_obj);
     829           0 :         if (value == NULL) {
     830           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->acct_expiry");
     831           0 :                 return -1;
     832             :         }
     833             :         {
     834           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->acct_expiry));
     835           0 :                 if (PyLong_Check(value)) {
     836           0 :                         unsigned long long test_var;
     837           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     838           0 :                         if (PyErr_Occurred() != NULL) {
     839           0 :                                 return -1;
     840             :                         }
     841           0 :                         if (test_var > uint_max) {
     842           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
     843             :                                   PyLong_Type.tp_name, uint_max, test_var);
     844           0 :                                 return -1;
     845             :                         }
     846           0 :                         object->acct_expiry = test_var;
     847             :                 } else {
     848           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
     849             :                           PyLong_Type.tp_name);
     850           0 :                         return -1;
     851             :                 }
     852             :         }
     853           0 :         return 0;
     854             : }
     855             : 
     856           0 : static PyObject *py_auth_user_info_get_last_password_change(PyObject *obj, void *closure)
     857             : {
     858           0 :         struct auth_user_info *object = pytalloc_get_ptr(obj);
     859           0 :         PyObject *py_last_password_change;
     860           0 :         py_last_password_change = PyLong_FromUnsignedLongLong(object->last_password_change);
     861           0 :         return py_last_password_change;
     862             : }
     863             : 
     864           0 : static int py_auth_user_info_set_last_password_change(PyObject *py_obj, PyObject *value, void *closure)
     865             : {
     866           0 :         struct auth_user_info *object = pytalloc_get_ptr(py_obj);
     867           0 :         if (value == NULL) {
     868           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->last_password_change");
     869           0 :                 return -1;
     870             :         }
     871             :         {
     872           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->last_password_change));
     873           0 :                 if (PyLong_Check(value)) {
     874           0 :                         unsigned long long test_var;
     875           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     876           0 :                         if (PyErr_Occurred() != NULL) {
     877           0 :                                 return -1;
     878             :                         }
     879           0 :                         if (test_var > uint_max) {
     880           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
     881             :                                   PyLong_Type.tp_name, uint_max, test_var);
     882           0 :                                 return -1;
     883             :                         }
     884           0 :                         object->last_password_change = test_var;
     885             :                 } else {
     886           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
     887             :                           PyLong_Type.tp_name);
     888           0 :                         return -1;
     889             :                 }
     890             :         }
     891           0 :         return 0;
     892             : }
     893             : 
     894           0 : static PyObject *py_auth_user_info_get_allow_password_change(PyObject *obj, void *closure)
     895             : {
     896           0 :         struct auth_user_info *object = pytalloc_get_ptr(obj);
     897           0 :         PyObject *py_allow_password_change;
     898           0 :         py_allow_password_change = PyLong_FromUnsignedLongLong(object->allow_password_change);
     899           0 :         return py_allow_password_change;
     900             : }
     901             : 
     902           0 : static int py_auth_user_info_set_allow_password_change(PyObject *py_obj, PyObject *value, void *closure)
     903             : {
     904           0 :         struct auth_user_info *object = pytalloc_get_ptr(py_obj);
     905           0 :         if (value == NULL) {
     906           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->allow_password_change");
     907           0 :                 return -1;
     908             :         }
     909             :         {
     910           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->allow_password_change));
     911           0 :                 if (PyLong_Check(value)) {
     912           0 :                         unsigned long long test_var;
     913           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     914           0 :                         if (PyErr_Occurred() != NULL) {
     915           0 :                                 return -1;
     916             :                         }
     917           0 :                         if (test_var > uint_max) {
     918           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
     919             :                                   PyLong_Type.tp_name, uint_max, test_var);
     920           0 :                                 return -1;
     921             :                         }
     922           0 :                         object->allow_password_change = test_var;
     923             :                 } else {
     924           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
     925             :                           PyLong_Type.tp_name);
     926           0 :                         return -1;
     927             :                 }
     928             :         }
     929           0 :         return 0;
     930             : }
     931             : 
     932           0 : static PyObject *py_auth_user_info_get_force_password_change(PyObject *obj, void *closure)
     933             : {
     934           0 :         struct auth_user_info *object = pytalloc_get_ptr(obj);
     935           0 :         PyObject *py_force_password_change;
     936           0 :         py_force_password_change = PyLong_FromUnsignedLongLong(object->force_password_change);
     937           0 :         return py_force_password_change;
     938             : }
     939             : 
     940           0 : static int py_auth_user_info_set_force_password_change(PyObject *py_obj, PyObject *value, void *closure)
     941             : {
     942           0 :         struct auth_user_info *object = pytalloc_get_ptr(py_obj);
     943           0 :         if (value == NULL) {
     944           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->force_password_change");
     945           0 :                 return -1;
     946             :         }
     947             :         {
     948           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->force_password_change));
     949           0 :                 if (PyLong_Check(value)) {
     950           0 :                         unsigned long long test_var;
     951           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     952           0 :                         if (PyErr_Occurred() != NULL) {
     953           0 :                                 return -1;
     954             :                         }
     955           0 :                         if (test_var > uint_max) {
     956           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
     957             :                                   PyLong_Type.tp_name, uint_max, test_var);
     958           0 :                                 return -1;
     959             :                         }
     960           0 :                         object->force_password_change = test_var;
     961             :                 } else {
     962           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
     963             :                           PyLong_Type.tp_name);
     964           0 :                         return -1;
     965             :                 }
     966             :         }
     967           0 :         return 0;
     968             : }
     969             : 
     970           0 : static PyObject *py_auth_user_info_get_logon_count(PyObject *obj, void *closure)
     971             : {
     972           0 :         struct auth_user_info *object = pytalloc_get_ptr(obj);
     973           0 :         PyObject *py_logon_count;
     974           0 :         py_logon_count = PyLong_FromLong((uint16_t)(object->logon_count));
     975           0 :         return py_logon_count;
     976             : }
     977             : 
     978           0 : static int py_auth_user_info_set_logon_count(PyObject *py_obj, PyObject *value, void *closure)
     979             : {
     980           0 :         struct auth_user_info *object = pytalloc_get_ptr(py_obj);
     981           0 :         if (value == NULL) {
     982           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->logon_count");
     983           0 :                 return -1;
     984             :         }
     985             :         {
     986           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->logon_count));
     987           0 :                 if (PyLong_Check(value)) {
     988           0 :                         unsigned long long test_var;
     989           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
     990           0 :                         if (PyErr_Occurred() != NULL) {
     991           0 :                                 return -1;
     992             :                         }
     993           0 :                         if (test_var > uint_max) {
     994           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
     995             :                                   PyLong_Type.tp_name, uint_max, test_var);
     996           0 :                                 return -1;
     997             :                         }
     998           0 :                         object->logon_count = test_var;
     999             :                 } else {
    1000           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    1001             :                           PyLong_Type.tp_name);
    1002           0 :                         return -1;
    1003             :                 }
    1004             :         }
    1005           0 :         return 0;
    1006             : }
    1007             : 
    1008           0 : static PyObject *py_auth_user_info_get_bad_password_count(PyObject *obj, void *closure)
    1009             : {
    1010           0 :         struct auth_user_info *object = pytalloc_get_ptr(obj);
    1011           0 :         PyObject *py_bad_password_count;
    1012           0 :         py_bad_password_count = PyLong_FromLong((uint16_t)(object->bad_password_count));
    1013           0 :         return py_bad_password_count;
    1014             : }
    1015             : 
    1016           0 : static int py_auth_user_info_set_bad_password_count(PyObject *py_obj, PyObject *value, void *closure)
    1017             : {
    1018           0 :         struct auth_user_info *object = pytalloc_get_ptr(py_obj);
    1019           0 :         if (value == NULL) {
    1020           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->bad_password_count");
    1021           0 :                 return -1;
    1022             :         }
    1023             :         {
    1024           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->bad_password_count));
    1025           0 :                 if (PyLong_Check(value)) {
    1026           0 :                         unsigned long long test_var;
    1027           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1028           0 :                         if (PyErr_Occurred() != NULL) {
    1029           0 :                                 return -1;
    1030             :                         }
    1031           0 :                         if (test_var > uint_max) {
    1032           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    1033             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1034           0 :                                 return -1;
    1035             :                         }
    1036           0 :                         object->bad_password_count = test_var;
    1037             :                 } else {
    1038           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    1039             :                           PyLong_Type.tp_name);
    1040           0 :                         return -1;
    1041             :                 }
    1042             :         }
    1043           0 :         return 0;
    1044             : }
    1045             : 
    1046           0 : static PyObject *py_auth_user_info_get_acct_flags(PyObject *obj, void *closure)
    1047             : {
    1048           0 :         struct auth_user_info *object = pytalloc_get_ptr(obj);
    1049           0 :         PyObject *py_acct_flags;
    1050           0 :         py_acct_flags = PyLong_FromUnsignedLongLong((uint32_t)(object->acct_flags));
    1051           0 :         return py_acct_flags;
    1052             : }
    1053             : 
    1054           0 : static int py_auth_user_info_set_acct_flags(PyObject *py_obj, PyObject *value, void *closure)
    1055             : {
    1056           0 :         struct auth_user_info *object = pytalloc_get_ptr(py_obj);
    1057           0 :         if (value == NULL) {
    1058           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->acct_flags");
    1059           0 :                 return -1;
    1060             :         }
    1061             :         {
    1062           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->acct_flags));
    1063           0 :                 if (PyLong_Check(value)) {
    1064           0 :                         unsigned long long test_var;
    1065           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1066           0 :                         if (PyErr_Occurred() != NULL) {
    1067           0 :                                 return -1;
    1068             :                         }
    1069           0 :                         if (test_var > uint_max) {
    1070           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    1071             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1072           0 :                                 return -1;
    1073             :                         }
    1074           0 :                         object->acct_flags = test_var;
    1075             :                 } else {
    1076           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    1077             :                           PyLong_Type.tp_name);
    1078           0 :                         return -1;
    1079             :                 }
    1080             :         }
    1081           0 :         return 0;
    1082             : }
    1083             : 
    1084           0 : static PyObject *py_auth_user_info_get_user_flags(PyObject *obj, void *closure)
    1085             : {
    1086           0 :         struct auth_user_info *object = pytalloc_get_ptr(obj);
    1087           0 :         PyObject *py_user_flags;
    1088           0 :         py_user_flags = PyLong_FromUnsignedLongLong((uint32_t)(object->user_flags));
    1089           0 :         return py_user_flags;
    1090             : }
    1091             : 
    1092           0 : static int py_auth_user_info_set_user_flags(PyObject *py_obj, PyObject *value, void *closure)
    1093             : {
    1094           0 :         struct auth_user_info *object = pytalloc_get_ptr(py_obj);
    1095           0 :         if (value == NULL) {
    1096           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->user_flags");
    1097           0 :                 return -1;
    1098             :         }
    1099             :         {
    1100           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->user_flags));
    1101           0 :                 if (PyLong_Check(value)) {
    1102           0 :                         unsigned long long test_var;
    1103           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1104           0 :                         if (PyErr_Occurred() != NULL) {
    1105           0 :                                 return -1;
    1106             :                         }
    1107           0 :                         if (test_var > uint_max) {
    1108           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    1109             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1110           0 :                                 return -1;
    1111             :                         }
    1112           0 :                         object->user_flags = test_var;
    1113             :                 } else {
    1114           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    1115             :                           PyLong_Type.tp_name);
    1116           0 :                         return -1;
    1117             :                 }
    1118             :         }
    1119           0 :         return 0;
    1120             : }
    1121             : 
    1122             : static PyGetSetDef py_auth_user_info_getsetters[] = {
    1123             :         {
    1124             :                 .name = discard_const_p(char, "account_name"),
    1125             :                 .get = py_auth_user_info_get_account_name,
    1126             :                 .set = py_auth_user_info_set_account_name,
    1127             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
    1128             :         },
    1129             :         {
    1130             :                 .name = discard_const_p(char, "user_principal_name"),
    1131             :                 .get = py_auth_user_info_get_user_principal_name,
    1132             :                 .set = py_auth_user_info_set_user_principal_name,
    1133             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
    1134             :         },
    1135             :         {
    1136             :                 .name = discard_const_p(char, "user_principal_constructed"),
    1137             :                 .get = py_auth_user_info_get_user_principal_constructed,
    1138             :                 .set = py_auth_user_info_set_user_principal_constructed,
    1139             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
    1140             :         },
    1141             :         {
    1142             :                 .name = discard_const_p(char, "domain_name"),
    1143             :                 .get = py_auth_user_info_get_domain_name,
    1144             :                 .set = py_auth_user_info_set_domain_name,
    1145             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
    1146             :         },
    1147             :         {
    1148             :                 .name = discard_const_p(char, "dns_domain_name"),
    1149             :                 .get = py_auth_user_info_get_dns_domain_name,
    1150             :                 .set = py_auth_user_info_set_dns_domain_name,
    1151             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
    1152             :         },
    1153             :         {
    1154             :                 .name = discard_const_p(char, "full_name"),
    1155             :                 .get = py_auth_user_info_get_full_name,
    1156             :                 .set = py_auth_user_info_set_full_name,
    1157             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
    1158             :         },
    1159             :         {
    1160             :                 .name = discard_const_p(char, "logon_script"),
    1161             :                 .get = py_auth_user_info_get_logon_script,
    1162             :                 .set = py_auth_user_info_set_logon_script,
    1163             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
    1164             :         },
    1165             :         {
    1166             :                 .name = discard_const_p(char, "profile_path"),
    1167             :                 .get = py_auth_user_info_get_profile_path,
    1168             :                 .set = py_auth_user_info_set_profile_path,
    1169             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
    1170             :         },
    1171             :         {
    1172             :                 .name = discard_const_p(char, "home_directory"),
    1173             :                 .get = py_auth_user_info_get_home_directory,
    1174             :                 .set = py_auth_user_info_set_home_directory,
    1175             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
    1176             :         },
    1177             :         {
    1178             :                 .name = discard_const_p(char, "home_drive"),
    1179             :                 .get = py_auth_user_info_get_home_drive,
    1180             :                 .set = py_auth_user_info_set_home_drive,
    1181             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
    1182             :         },
    1183             :         {
    1184             :                 .name = discard_const_p(char, "logon_server"),
    1185             :                 .get = py_auth_user_info_get_logon_server,
    1186             :                 .set = py_auth_user_info_set_logon_server,
    1187             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
    1188             :         },
    1189             :         {
    1190             :                 .name = discard_const_p(char, "last_logon"),
    1191             :                 .get = py_auth_user_info_get_last_logon,
    1192             :                 .set = py_auth_user_info_set_last_logon,
    1193             :                 .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
    1194             :         },
    1195             :         {
    1196             :                 .name = discard_const_p(char, "last_logoff"),
    1197             :                 .get = py_auth_user_info_get_last_logoff,
    1198             :                 .set = py_auth_user_info_set_last_logoff,
    1199             :                 .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
    1200             :         },
    1201             :         {
    1202             :                 .name = discard_const_p(char, "acct_expiry"),
    1203             :                 .get = py_auth_user_info_get_acct_expiry,
    1204             :                 .set = py_auth_user_info_set_acct_expiry,
    1205             :                 .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
    1206             :         },
    1207             :         {
    1208             :                 .name = discard_const_p(char, "last_password_change"),
    1209             :                 .get = py_auth_user_info_get_last_password_change,
    1210             :                 .set = py_auth_user_info_set_last_password_change,
    1211             :                 .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
    1212             :         },
    1213             :         {
    1214             :                 .name = discard_const_p(char, "allow_password_change"),
    1215             :                 .get = py_auth_user_info_get_allow_password_change,
    1216             :                 .set = py_auth_user_info_set_allow_password_change,
    1217             :                 .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
    1218             :         },
    1219             :         {
    1220             :                 .name = discard_const_p(char, "force_password_change"),
    1221             :                 .get = py_auth_user_info_get_force_password_change,
    1222             :                 .set = py_auth_user_info_set_force_password_change,
    1223             :                 .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
    1224             :         },
    1225             :         {
    1226             :                 .name = discard_const_p(char, "logon_count"),
    1227             :                 .get = py_auth_user_info_get_logon_count,
    1228             :                 .set = py_auth_user_info_set_logon_count,
    1229             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
    1230             :         },
    1231             :         {
    1232             :                 .name = discard_const_p(char, "bad_password_count"),
    1233             :                 .get = py_auth_user_info_get_bad_password_count,
    1234             :                 .set = py_auth_user_info_set_bad_password_count,
    1235             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
    1236             :         },
    1237             :         {
    1238             :                 .name = discard_const_p(char, "acct_flags"),
    1239             :                 .get = py_auth_user_info_get_acct_flags,
    1240             :                 .set = py_auth_user_info_set_acct_flags,
    1241             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    1242             :         },
    1243             :         {
    1244             :                 .name = discard_const_p(char, "user_flags"),
    1245             :                 .get = py_auth_user_info_get_user_flags,
    1246             :                 .set = py_auth_user_info_set_user_flags,
    1247             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    1248             :         },
    1249             :         { .name = NULL }
    1250             : };
    1251             : 
    1252           0 : static PyObject *py_auth_user_info_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1253             : {
    1254           0 :         return pytalloc_new(struct auth_user_info, type);
    1255             : }
    1256             : 
    1257           0 : static PyObject *py_auth_user_info_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
    1258             : {
    1259           0 :         struct auth_user_info *object = pytalloc_get_ptr(py_obj);
    1260           0 :         PyObject *ret = NULL;
    1261           0 :         DATA_BLOB blob;
    1262           0 :         enum ndr_err_code err;
    1263           0 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
    1264           0 :         if (tmp_ctx == NULL) {
    1265           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    1266           0 :                 return NULL;
    1267             :         }
    1268           0 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_auth_user_info);
    1269           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    1270           0 :                 TALLOC_FREE(tmp_ctx);
    1271           0 :                 PyErr_SetNdrError(err);
    1272           0 :                 return NULL;
    1273             :         }
    1274             : 
    1275           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    1276           0 :         TALLOC_FREE(tmp_ctx);
    1277           0 :         return ret;
    1278             : }
    1279             : 
    1280           0 : static PyObject *py_auth_user_info_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    1281             : {
    1282           0 :         struct auth_user_info *object = pytalloc_get_ptr(py_obj);
    1283           0 :         DATA_BLOB blob = {.data = NULL, .length = 0};
    1284           0 :         Py_ssize_t blob_length = 0;
    1285           0 :         enum ndr_err_code err;
    1286           0 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
    1287           0 :         PyObject *allow_remaining_obj = NULL;
    1288           0 :         bool allow_remaining = false;
    1289             : 
    1290           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
    1291             :                 discard_const_p(char *, kwnames),
    1292             :                 &blob.data, &blob_length,
    1293             :                 &allow_remaining_obj)) {
    1294           0 :                 return NULL;
    1295             :         }
    1296           0 :         blob.length = blob_length;
    1297             : 
    1298           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    1299           0 :                 allow_remaining = true;
    1300             :         }
    1301             : 
    1302           0 :         if (allow_remaining) {
    1303           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_auth_user_info);
    1304             :         } else {
    1305           0 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_auth_user_info);
    1306             :         }
    1307           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    1308           0 :                 PyErr_SetNdrError(err);
    1309           0 :                 return NULL;
    1310             :         }
    1311             : 
    1312           0 :         Py_RETURN_NONE;
    1313             : }
    1314             : 
    1315           0 : static PyObject *py_auth_user_info_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    1316             : {
    1317           0 :         struct auth_user_info *object = pytalloc_get_ptr(py_obj);
    1318           0 :         PyObject *ret;
    1319           0 :         char *retstr;
    1320             : 
    1321           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_auth_user_info, "auth_user_info", object);
    1322           0 :         ret = PyUnicode_FromString(retstr);
    1323           0 :         talloc_free(retstr);
    1324             : 
    1325           0 :         return ret;
    1326             : }
    1327             : 
    1328             : static PyMethodDef py_auth_user_info_methods[] = {
    1329             :         { "__ndr_pack__", (PyCFunction)py_auth_user_info_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
    1330             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_auth_user_info_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
    1331             :         { "__ndr_print__", (PyCFunction)py_auth_user_info_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
    1332             :         { NULL, NULL, 0, NULL }
    1333             : };
    1334             : 
    1335             : 
    1336             : static PyTypeObject auth_user_info_Type = {
    1337             :         PyVarObject_HEAD_INIT(NULL, 0)
    1338             :         .tp_name = "auth.user_info",
    1339             :         .tp_getset = py_auth_user_info_getsetters,
    1340             :         .tp_methods = py_auth_user_info_methods,
    1341             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    1342             :         .tp_new = py_auth_user_info_new,
    1343             : };
    1344             : 
    1345             : 
    1346           0 : static PyObject *py_auth_user_info_torture_get_num_dc_sids(PyObject *obj, void *closure)
    1347             : {
    1348           0 :         struct auth_user_info_torture *object = pytalloc_get_ptr(obj);
    1349           0 :         PyObject *py_num_dc_sids;
    1350           0 :         py_num_dc_sids = PyLong_FromUnsignedLongLong((uint32_t)(object->num_dc_sids));
    1351           0 :         return py_num_dc_sids;
    1352             : }
    1353             : 
    1354           0 : static int py_auth_user_info_torture_set_num_dc_sids(PyObject *py_obj, PyObject *value, void *closure)
    1355             : {
    1356           0 :         struct auth_user_info_torture *object = pytalloc_get_ptr(py_obj);
    1357           0 :         if (value == NULL) {
    1358           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->num_dc_sids");
    1359           0 :                 return -1;
    1360             :         }
    1361             :         {
    1362           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->num_dc_sids));
    1363           0 :                 if (PyLong_Check(value)) {
    1364           0 :                         unsigned long long test_var;
    1365           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1366           0 :                         if (PyErr_Occurred() != NULL) {
    1367           0 :                                 return -1;
    1368             :                         }
    1369           0 :                         if (test_var > uint_max) {
    1370           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    1371             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1372           0 :                                 return -1;
    1373             :                         }
    1374           0 :                         object->num_dc_sids = test_var;
    1375             :                 } else {
    1376           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    1377             :                           PyLong_Type.tp_name);
    1378           0 :                         return -1;
    1379             :                 }
    1380             :         }
    1381           0 :         return 0;
    1382             : }
    1383             : 
    1384           0 : static PyObject *py_auth_user_info_torture_get_dc_sids(PyObject *obj, void *closure)
    1385             : {
    1386           0 :         struct auth_user_info_torture *object = pytalloc_get_ptr(obj);
    1387           0 :         PyObject *py_dc_sids;
    1388           0 :         py_dc_sids = PyList_New(object->num_dc_sids);
    1389           0 :         if (py_dc_sids == NULL) {
    1390           0 :                 return NULL;
    1391             :         }
    1392             :         {
    1393             :                 int dc_sids_cntr_0;
    1394           0 :                 for (dc_sids_cntr_0 = 0; dc_sids_cntr_0 < (object->num_dc_sids); dc_sids_cntr_0++) {
    1395           0 :                         PyObject *py_dc_sids_0;
    1396           0 :                         py_dc_sids_0 = pytalloc_reference_ex(&auth_SidAttr_Type, object->dc_sids, &(object->dc_sids)[dc_sids_cntr_0]);
    1397           0 :                         PyList_SetItem(py_dc_sids, dc_sids_cntr_0, py_dc_sids_0);
    1398             :                 }
    1399             :         }
    1400           0 :         return py_dc_sids;
    1401             : }
    1402             : 
    1403           0 : static int py_auth_user_info_torture_set_dc_sids(PyObject *py_obj, PyObject *value, void *closure)
    1404             : {
    1405           0 :         struct auth_user_info_torture *object = pytalloc_get_ptr(py_obj);
    1406           0 :         if (value == NULL) {
    1407           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->dc_sids");
    1408           0 :                 return -1;
    1409             :         }
    1410           0 :         PY_CHECK_TYPE(&PyList_Type, value, return -1;);
    1411             :         {
    1412           0 :                 int dc_sids_cntr_0;
    1413           0 :                 object->dc_sids = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->dc_sids, PyList_GET_SIZE(value));
    1414           0 :                 if (!object->dc_sids) { return -1; }
    1415           0 :                 talloc_set_name_const(object->dc_sids, "ARRAY: object->dc_sids");
    1416           0 :                 for (dc_sids_cntr_0 = 0; dc_sids_cntr_0 < PyList_GET_SIZE(value); dc_sids_cntr_0++) {
    1417           0 :                         if (PyList_GET_ITEM(value, dc_sids_cntr_0) == NULL) {
    1418           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->dc_sids)[dc_sids_cntr_0]");
    1419           0 :                                 return -1;
    1420             :                         }
    1421           0 :                         PY_CHECK_TYPE(&auth_SidAttr_Type, PyList_GET_ITEM(value, dc_sids_cntr_0), return -1;);
    1422           0 :                         if (talloc_reference(object->dc_sids, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, dc_sids_cntr_0))) == NULL) {
    1423           0 :                                 PyErr_NoMemory();
    1424           0 :                                 return -1;
    1425             :                         }
    1426           0 :                         (object->dc_sids)[dc_sids_cntr_0] = *(struct auth_SidAttr *)pytalloc_get_ptr(PyList_GET_ITEM(value, dc_sids_cntr_0));
    1427             :                 }
    1428             :         }
    1429           0 :         return 0;
    1430             : }
    1431             : 
    1432             : static PyGetSetDef py_auth_user_info_torture_getsetters[] = {
    1433             :         {
    1434             :                 .name = discard_const_p(char, "num_dc_sids"),
    1435             :                 .get = py_auth_user_info_torture_get_num_dc_sids,
    1436             :                 .set = py_auth_user_info_torture_set_num_dc_sids,
    1437             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    1438             :         },
    1439             :         {
    1440             :                 .name = discard_const_p(char, "dc_sids"),
    1441             :                 .get = py_auth_user_info_torture_get_dc_sids,
    1442             :                 .set = py_auth_user_info_torture_set_dc_sids,
    1443             :                 .doc = discard_const_p(char, "PIDL-generated element of base type auth_SidAttr")
    1444             :         },
    1445             :         { .name = NULL }
    1446             : };
    1447             : 
    1448           0 : static PyObject *py_auth_user_info_torture_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1449             : {
    1450           0 :         return pytalloc_new(struct auth_user_info_torture, type);
    1451             : }
    1452             : 
    1453           0 : static PyObject *py_auth_user_info_torture_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
    1454             : {
    1455           0 :         struct auth_user_info_torture *object = pytalloc_get_ptr(py_obj);
    1456           0 :         PyObject *ret = NULL;
    1457           0 :         DATA_BLOB blob;
    1458           0 :         enum ndr_err_code err;
    1459           0 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
    1460           0 :         if (tmp_ctx == NULL) {
    1461           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    1462           0 :                 return NULL;
    1463             :         }
    1464           0 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_auth_user_info_torture);
    1465           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    1466           0 :                 TALLOC_FREE(tmp_ctx);
    1467           0 :                 PyErr_SetNdrError(err);
    1468           0 :                 return NULL;
    1469             :         }
    1470             : 
    1471           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    1472           0 :         TALLOC_FREE(tmp_ctx);
    1473           0 :         return ret;
    1474             : }
    1475             : 
    1476           0 : static PyObject *py_auth_user_info_torture_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    1477             : {
    1478           0 :         struct auth_user_info_torture *object = pytalloc_get_ptr(py_obj);
    1479           0 :         DATA_BLOB blob = {.data = NULL, .length = 0};
    1480           0 :         Py_ssize_t blob_length = 0;
    1481           0 :         enum ndr_err_code err;
    1482           0 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
    1483           0 :         PyObject *allow_remaining_obj = NULL;
    1484           0 :         bool allow_remaining = false;
    1485             : 
    1486           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
    1487             :                 discard_const_p(char *, kwnames),
    1488             :                 &blob.data, &blob_length,
    1489             :                 &allow_remaining_obj)) {
    1490           0 :                 return NULL;
    1491             :         }
    1492           0 :         blob.length = blob_length;
    1493             : 
    1494           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    1495           0 :                 allow_remaining = true;
    1496             :         }
    1497             : 
    1498           0 :         if (allow_remaining) {
    1499           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_auth_user_info_torture);
    1500             :         } else {
    1501           0 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_auth_user_info_torture);
    1502             :         }
    1503           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    1504           0 :                 PyErr_SetNdrError(err);
    1505           0 :                 return NULL;
    1506             :         }
    1507             : 
    1508           0 :         Py_RETURN_NONE;
    1509             : }
    1510             : 
    1511           0 : static PyObject *py_auth_user_info_torture_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    1512             : {
    1513           0 :         struct auth_user_info_torture *object = pytalloc_get_ptr(py_obj);
    1514           0 :         PyObject *ret;
    1515           0 :         char *retstr;
    1516             : 
    1517           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_auth_user_info_torture, "auth_user_info_torture", object);
    1518           0 :         ret = PyUnicode_FromString(retstr);
    1519           0 :         talloc_free(retstr);
    1520             : 
    1521           0 :         return ret;
    1522             : }
    1523             : 
    1524             : static PyMethodDef py_auth_user_info_torture_methods[] = {
    1525             :         { "__ndr_pack__", (PyCFunction)py_auth_user_info_torture_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
    1526             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_auth_user_info_torture_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
    1527             :         { "__ndr_print__", (PyCFunction)py_auth_user_info_torture_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
    1528             :         { NULL, NULL, 0, NULL }
    1529             : };
    1530             : 
    1531             : 
    1532             : static PyTypeObject auth_user_info_torture_Type = {
    1533             :         PyVarObject_HEAD_INIT(NULL, 0)
    1534             :         .tp_name = "auth.user_info_torture",
    1535             :         .tp_getset = py_auth_user_info_torture_getsetters,
    1536             :         .tp_methods = py_auth_user_info_torture_methods,
    1537             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    1538             :         .tp_new = py_auth_user_info_torture_new,
    1539             : };
    1540             : 
    1541             : 
    1542           1 : static PyObject *py_auth_user_info_unix_get_unix_name(PyObject *obj, void *closure)
    1543             : {
    1544           1 :         struct auth_user_info_unix *object = pytalloc_get_ptr(obj);
    1545           0 :         PyObject *py_unix_name;
    1546           1 :         if (object->unix_name == NULL) {
    1547           0 :                 Py_RETURN_NONE;
    1548             :         }
    1549           1 :         if (object->unix_name == NULL) {
    1550           0 :                 py_unix_name = Py_None;
    1551           0 :                 Py_INCREF(py_unix_name);
    1552             :         } else {
    1553           1 :                 if (object->unix_name == NULL) {
    1554           0 :                         py_unix_name = Py_None;
    1555           0 :                         Py_INCREF(py_unix_name);
    1556             :                 } else {
    1557           1 :                         py_unix_name = PyUnicode_Decode(object->unix_name, strlen(object->unix_name), "utf-8", "ignore");
    1558             :                 }
    1559             :         }
    1560           1 :         return py_unix_name;
    1561             : }
    1562             : 
    1563           0 : static int py_auth_user_info_unix_set_unix_name(PyObject *py_obj, PyObject *value, void *closure)
    1564             : {
    1565           0 :         struct auth_user_info_unix *object = pytalloc_get_ptr(py_obj);
    1566           0 :         if (value == NULL) {
    1567           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->unix_name");
    1568           0 :                 return -1;
    1569             :         }
    1570           0 :         if (value == Py_None) {
    1571           0 :                 object->unix_name = NULL;
    1572             :         } else {
    1573           0 :                 object->unix_name = NULL;
    1574             :                 {
    1575           0 :                         const char *test_str;
    1576           0 :                         const char *talloc_str;
    1577           0 :                         PyObject *unicode = NULL;
    1578           0 :                         if (PyUnicode_Check(value)) {
    1579           0 :                                 unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
    1580           0 :                                 if (unicode == NULL) {
    1581           0 :                                         return -1;
    1582             :                                 }
    1583           0 :                                 test_str = PyBytes_AS_STRING(unicode);
    1584           0 :                         } else if (PyBytes_Check(value)) {
    1585           0 :                                 test_str = PyBytes_AS_STRING(value);
    1586             :                         } else {
    1587           0 :                                 PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
    1588           0 :                                 return -1;
    1589             :                         }
    1590           0 :                         talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
    1591           0 :                         if (unicode != NULL) {
    1592           0 :                                 Py_DECREF(unicode);
    1593             :                         }
    1594           0 :                         if (talloc_str == NULL) {
    1595           0 :                                 PyErr_NoMemory();
    1596           0 :                                 return -1;
    1597             :                         }
    1598           0 :                         object->unix_name = talloc_str;
    1599             :                 }
    1600             :         }
    1601           0 :         return 0;
    1602             : }
    1603             : 
    1604           1 : static PyObject *py_auth_user_info_unix_get_sanitized_username(PyObject *obj, void *closure)
    1605             : {
    1606           1 :         struct auth_user_info_unix *object = pytalloc_get_ptr(obj);
    1607           0 :         PyObject *py_sanitized_username;
    1608           1 :         if (object->sanitized_username == NULL) {
    1609           0 :                 Py_RETURN_NONE;
    1610             :         }
    1611           1 :         if (object->sanitized_username == NULL) {
    1612           0 :                 py_sanitized_username = Py_None;
    1613           0 :                 Py_INCREF(py_sanitized_username);
    1614             :         } else {
    1615           1 :                 if (object->sanitized_username == NULL) {
    1616           0 :                         py_sanitized_username = Py_None;
    1617           0 :                         Py_INCREF(py_sanitized_username);
    1618             :                 } else {
    1619           1 :                         py_sanitized_username = PyUnicode_Decode(object->sanitized_username, strlen(object->sanitized_username), "utf-8", "ignore");
    1620             :                 }
    1621             :         }
    1622           1 :         return py_sanitized_username;
    1623             : }
    1624             : 
    1625           0 : static int py_auth_user_info_unix_set_sanitized_username(PyObject *py_obj, PyObject *value, void *closure)
    1626             : {
    1627           0 :         struct auth_user_info_unix *object = pytalloc_get_ptr(py_obj);
    1628           0 :         if (value == NULL) {
    1629           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->sanitized_username");
    1630           0 :                 return -1;
    1631             :         }
    1632           0 :         if (value == Py_None) {
    1633           0 :                 object->sanitized_username = NULL;
    1634             :         } else {
    1635           0 :                 object->sanitized_username = NULL;
    1636             :                 {
    1637           0 :                         const char *test_str;
    1638           0 :                         const char *talloc_str;
    1639           0 :                         PyObject *unicode = NULL;
    1640           0 :                         if (PyUnicode_Check(value)) {
    1641           0 :                                 unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
    1642           0 :                                 if (unicode == NULL) {
    1643           0 :                                         return -1;
    1644             :                                 }
    1645           0 :                                 test_str = PyBytes_AS_STRING(unicode);
    1646           0 :                         } else if (PyBytes_Check(value)) {
    1647           0 :                                 test_str = PyBytes_AS_STRING(value);
    1648             :                         } else {
    1649           0 :                                 PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
    1650           0 :                                 return -1;
    1651             :                         }
    1652           0 :                         talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
    1653           0 :                         if (unicode != NULL) {
    1654           0 :                                 Py_DECREF(unicode);
    1655             :                         }
    1656           0 :                         if (talloc_str == NULL) {
    1657           0 :                                 PyErr_NoMemory();
    1658           0 :                                 return -1;
    1659             :                         }
    1660           0 :                         object->sanitized_username = talloc_str;
    1661             :                 }
    1662             :         }
    1663           0 :         return 0;
    1664             : }
    1665             : 
    1666             : static PyGetSetDef py_auth_user_info_unix_getsetters[] = {
    1667             :         {
    1668             :                 .name = discard_const_p(char, "unix_name"),
    1669             :                 .get = py_auth_user_info_unix_get_unix_name,
    1670             :                 .set = py_auth_user_info_unix_set_unix_name,
    1671             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
    1672             :         },
    1673             :         {
    1674             :                 .name = discard_const_p(char, "sanitized_username"),
    1675             :                 .get = py_auth_user_info_unix_get_sanitized_username,
    1676             :                 .set = py_auth_user_info_unix_set_sanitized_username,
    1677             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
    1678             :         },
    1679             :         { .name = NULL }
    1680             : };
    1681             : 
    1682           0 : static PyObject *py_auth_user_info_unix_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1683             : {
    1684           0 :         return pytalloc_new(struct auth_user_info_unix, type);
    1685             : }
    1686             : 
    1687           0 : static PyObject *py_auth_user_info_unix_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
    1688             : {
    1689           0 :         struct auth_user_info_unix *object = pytalloc_get_ptr(py_obj);
    1690           0 :         PyObject *ret = NULL;
    1691           0 :         DATA_BLOB blob;
    1692           0 :         enum ndr_err_code err;
    1693           0 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
    1694           0 :         if (tmp_ctx == NULL) {
    1695           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    1696           0 :                 return NULL;
    1697             :         }
    1698           0 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_auth_user_info_unix);
    1699           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    1700           0 :                 TALLOC_FREE(tmp_ctx);
    1701           0 :                 PyErr_SetNdrError(err);
    1702           0 :                 return NULL;
    1703             :         }
    1704             : 
    1705           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    1706           0 :         TALLOC_FREE(tmp_ctx);
    1707           0 :         return ret;
    1708             : }
    1709             : 
    1710           0 : static PyObject *py_auth_user_info_unix_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    1711             : {
    1712           0 :         struct auth_user_info_unix *object = pytalloc_get_ptr(py_obj);
    1713           0 :         DATA_BLOB blob = {.data = NULL, .length = 0};
    1714           0 :         Py_ssize_t blob_length = 0;
    1715           0 :         enum ndr_err_code err;
    1716           0 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
    1717           0 :         PyObject *allow_remaining_obj = NULL;
    1718           0 :         bool allow_remaining = false;
    1719             : 
    1720           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
    1721             :                 discard_const_p(char *, kwnames),
    1722             :                 &blob.data, &blob_length,
    1723             :                 &allow_remaining_obj)) {
    1724           0 :                 return NULL;
    1725             :         }
    1726           0 :         blob.length = blob_length;
    1727             : 
    1728           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    1729           0 :                 allow_remaining = true;
    1730             :         }
    1731             : 
    1732           0 :         if (allow_remaining) {
    1733           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_auth_user_info_unix);
    1734             :         } else {
    1735           0 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_auth_user_info_unix);
    1736             :         }
    1737           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    1738           0 :                 PyErr_SetNdrError(err);
    1739           0 :                 return NULL;
    1740             :         }
    1741             : 
    1742           0 :         Py_RETURN_NONE;
    1743             : }
    1744             : 
    1745           0 : static PyObject *py_auth_user_info_unix_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    1746             : {
    1747           0 :         struct auth_user_info_unix *object = pytalloc_get_ptr(py_obj);
    1748           0 :         PyObject *ret;
    1749           0 :         char *retstr;
    1750             : 
    1751           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_auth_user_info_unix, "auth_user_info_unix", object);
    1752           0 :         ret = PyUnicode_FromString(retstr);
    1753           0 :         talloc_free(retstr);
    1754             : 
    1755           0 :         return ret;
    1756             : }
    1757             : 
    1758             : static PyMethodDef py_auth_user_info_unix_methods[] = {
    1759             :         { "__ndr_pack__", (PyCFunction)py_auth_user_info_unix_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
    1760             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_auth_user_info_unix_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
    1761             :         { "__ndr_print__", (PyCFunction)py_auth_user_info_unix_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
    1762             :         { NULL, NULL, 0, NULL }
    1763             : };
    1764             : 
    1765             : 
    1766             : static PyTypeObject auth_user_info_unix_Type = {
    1767             :         PyVarObject_HEAD_INIT(NULL, 0)
    1768             :         .tp_name = "auth.user_info_unix",
    1769             :         .tp_getset = py_auth_user_info_unix_getsetters,
    1770             :         .tp_methods = py_auth_user_info_unix_methods,
    1771             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    1772             :         .tp_new = py_auth_user_info_unix_new,
    1773             : };
    1774             : 
    1775             : 
    1776           0 : static PyObject *py_auth_SidAttr_get_sid(PyObject *obj, void *closure)
    1777             : {
    1778           0 :         struct auth_SidAttr *object = pytalloc_get_ptr(obj);
    1779           0 :         PyObject *py_sid;
    1780           0 :         py_sid = pytalloc_reference_ex(dom_sid_Type, pytalloc_get_mem_ctx(obj), &object->sid);
    1781           0 :         return py_sid;
    1782             : }
    1783             : 
    1784           0 : static int py_auth_SidAttr_set_sid(PyObject *py_obj, PyObject *value, void *closure)
    1785             : {
    1786           0 :         struct auth_SidAttr *object = pytalloc_get_ptr(py_obj);
    1787           0 :         if (value == NULL) {
    1788           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->sid");
    1789           0 :                 return -1;
    1790             :         }
    1791           0 :         PY_CHECK_TYPE(dom_sid_Type, value, return -1;);
    1792           0 :         if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
    1793           0 :                 PyErr_NoMemory();
    1794           0 :                 return -1;
    1795             :         }
    1796           0 :         object->sid = *(struct dom_sid *)pytalloc_get_ptr(value);
    1797           0 :         return 0;
    1798             : }
    1799             : 
    1800           0 : static PyObject *py_auth_SidAttr_get_attrs(PyObject *obj, void *closure)
    1801             : {
    1802           0 :         struct auth_SidAttr *object = pytalloc_get_ptr(obj);
    1803           0 :         PyObject *py_attrs;
    1804           0 :         py_attrs = PyLong_FromUnsignedLongLong((uint32_t)(object->attrs));
    1805           0 :         return py_attrs;
    1806             : }
    1807             : 
    1808           0 : static int py_auth_SidAttr_set_attrs(PyObject *py_obj, PyObject *value, void *closure)
    1809             : {
    1810           0 :         struct auth_SidAttr *object = pytalloc_get_ptr(py_obj);
    1811           0 :         if (value == NULL) {
    1812           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->attrs");
    1813           0 :                 return -1;
    1814             :         }
    1815             :         {
    1816           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->attrs));
    1817           0 :                 if (PyLong_Check(value)) {
    1818           0 :                         unsigned long long test_var;
    1819           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1820           0 :                         if (PyErr_Occurred() != NULL) {
    1821           0 :                                 return -1;
    1822             :                         }
    1823           0 :                         if (test_var > uint_max) {
    1824           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    1825             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1826           0 :                                 return -1;
    1827             :                         }
    1828           0 :                         object->attrs = test_var;
    1829             :                 } else {
    1830           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    1831             :                           PyLong_Type.tp_name);
    1832           0 :                         return -1;
    1833             :                 }
    1834             :         }
    1835           0 :         return 0;
    1836             : }
    1837             : 
    1838             : static PyGetSetDef py_auth_SidAttr_getsetters[] = {
    1839             :         {
    1840             :                 .name = discard_const_p(char, "sid"),
    1841             :                 .get = py_auth_SidAttr_get_sid,
    1842             :                 .set = py_auth_SidAttr_set_sid,
    1843             :                 .doc = discard_const_p(char, "PIDL-generated element of base type dom_sid")
    1844             :         },
    1845             :         {
    1846             :                 .name = discard_const_p(char, "attrs"),
    1847             :                 .get = py_auth_SidAttr_get_attrs,
    1848             :                 .set = py_auth_SidAttr_set_attrs,
    1849             :                 .doc = discard_const_p(char, "PIDL-generated element of base type security_GroupAttrs")
    1850             :         },
    1851             :         { .name = NULL }
    1852             : };
    1853             : 
    1854           0 : static PyObject *py_auth_SidAttr_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    1855             : {
    1856           0 :         return pytalloc_new(struct auth_SidAttr, type);
    1857             : }
    1858             : 
    1859           0 : static PyObject *py_auth_SidAttr_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
    1860             : {
    1861           0 :         struct auth_SidAttr *object = pytalloc_get_ptr(py_obj);
    1862           0 :         PyObject *ret = NULL;
    1863           0 :         DATA_BLOB blob;
    1864           0 :         enum ndr_err_code err;
    1865           0 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
    1866           0 :         if (tmp_ctx == NULL) {
    1867           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    1868           0 :                 return NULL;
    1869             :         }
    1870           0 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_auth_SidAttr);
    1871           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    1872           0 :                 TALLOC_FREE(tmp_ctx);
    1873           0 :                 PyErr_SetNdrError(err);
    1874           0 :                 return NULL;
    1875             :         }
    1876             : 
    1877           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    1878           0 :         TALLOC_FREE(tmp_ctx);
    1879           0 :         return ret;
    1880             : }
    1881             : 
    1882           0 : static PyObject *py_auth_SidAttr_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    1883             : {
    1884           0 :         struct auth_SidAttr *object = pytalloc_get_ptr(py_obj);
    1885           0 :         DATA_BLOB blob = {.data = NULL, .length = 0};
    1886           0 :         Py_ssize_t blob_length = 0;
    1887           0 :         enum ndr_err_code err;
    1888           0 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
    1889           0 :         PyObject *allow_remaining_obj = NULL;
    1890           0 :         bool allow_remaining = false;
    1891             : 
    1892           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
    1893             :                 discard_const_p(char *, kwnames),
    1894             :                 &blob.data, &blob_length,
    1895             :                 &allow_remaining_obj)) {
    1896           0 :                 return NULL;
    1897             :         }
    1898           0 :         blob.length = blob_length;
    1899             : 
    1900           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    1901           0 :                 allow_remaining = true;
    1902             :         }
    1903             : 
    1904           0 :         if (allow_remaining) {
    1905           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_auth_SidAttr);
    1906             :         } else {
    1907           0 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_auth_SidAttr);
    1908             :         }
    1909           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    1910           0 :                 PyErr_SetNdrError(err);
    1911           0 :                 return NULL;
    1912             :         }
    1913             : 
    1914           0 :         Py_RETURN_NONE;
    1915             : }
    1916             : 
    1917           0 : static PyObject *py_auth_SidAttr_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    1918             : {
    1919           0 :         struct auth_SidAttr *object = pytalloc_get_ptr(py_obj);
    1920           0 :         PyObject *ret;
    1921           0 :         char *retstr;
    1922             : 
    1923           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_auth_SidAttr, "auth_SidAttr", object);
    1924           0 :         ret = PyUnicode_FromString(retstr);
    1925           0 :         talloc_free(retstr);
    1926             : 
    1927           0 :         return ret;
    1928             : }
    1929             : 
    1930             : static PyMethodDef py_auth_SidAttr_methods[] = {
    1931             :         { "__ndr_pack__", (PyCFunction)py_auth_SidAttr_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
    1932             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_auth_SidAttr_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
    1933             :         { "__ndr_print__", (PyCFunction)py_auth_SidAttr_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
    1934             :         { NULL, NULL, 0, NULL }
    1935             : };
    1936             : 
    1937             : 
    1938             : static PyTypeObject auth_SidAttr_Type = {
    1939             :         PyVarObject_HEAD_INIT(NULL, 0)
    1940             :         .tp_name = "auth.SidAttr",
    1941             :         .tp_getset = py_auth_SidAttr_getsetters,
    1942             :         .tp_methods = py_auth_SidAttr_methods,
    1943             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    1944             :         .tp_new = py_auth_SidAttr_new,
    1945             : };
    1946             : 
    1947             : 
    1948           0 : static PyObject *py_auth_user_info_dc_get_num_sids(PyObject *obj, void *closure)
    1949             : {
    1950           0 :         struct auth_user_info_dc *object = pytalloc_get_ptr(obj);
    1951           0 :         PyObject *py_num_sids;
    1952           0 :         py_num_sids = PyLong_FromUnsignedLongLong((uint32_t)(object->num_sids));
    1953           0 :         return py_num_sids;
    1954             : }
    1955             : 
    1956           0 : static int py_auth_user_info_dc_set_num_sids(PyObject *py_obj, PyObject *value, void *closure)
    1957             : {
    1958           0 :         struct auth_user_info_dc *object = pytalloc_get_ptr(py_obj);
    1959           0 :         if (value == NULL) {
    1960           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->num_sids");
    1961           0 :                 return -1;
    1962             :         }
    1963             :         {
    1964           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->num_sids));
    1965           0 :                 if (PyLong_Check(value)) {
    1966           0 :                         unsigned long long test_var;
    1967           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    1968           0 :                         if (PyErr_Occurred() != NULL) {
    1969           0 :                                 return -1;
    1970             :                         }
    1971           0 :                         if (test_var > uint_max) {
    1972           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    1973             :                                   PyLong_Type.tp_name, uint_max, test_var);
    1974           0 :                                 return -1;
    1975             :                         }
    1976           0 :                         object->num_sids = test_var;
    1977             :                 } else {
    1978           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    1979             :                           PyLong_Type.tp_name);
    1980           0 :                         return -1;
    1981             :                 }
    1982             :         }
    1983           0 :         return 0;
    1984             : }
    1985             : 
    1986           0 : static PyObject *py_auth_user_info_dc_get_sids(PyObject *obj, void *closure)
    1987             : {
    1988           0 :         struct auth_user_info_dc *object = pytalloc_get_ptr(obj);
    1989           0 :         PyObject *py_sids;
    1990           0 :         py_sids = PyList_New(object->num_sids);
    1991           0 :         if (py_sids == NULL) {
    1992           0 :                 return NULL;
    1993             :         }
    1994             :         {
    1995             :                 int sids_cntr_0;
    1996           0 :                 for (sids_cntr_0 = 0; sids_cntr_0 < (object->num_sids); sids_cntr_0++) {
    1997           0 :                         PyObject *py_sids_0;
    1998           0 :                         py_sids_0 = pytalloc_reference_ex(&auth_SidAttr_Type, object->sids, &(object->sids)[sids_cntr_0]);
    1999           0 :                         PyList_SetItem(py_sids, sids_cntr_0, py_sids_0);
    2000             :                 }
    2001             :         }
    2002           0 :         return py_sids;
    2003             : }
    2004             : 
    2005           0 : static int py_auth_user_info_dc_set_sids(PyObject *py_obj, PyObject *value, void *closure)
    2006             : {
    2007           0 :         struct auth_user_info_dc *object = pytalloc_get_ptr(py_obj);
    2008           0 :         if (value == NULL) {
    2009           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->sids");
    2010           0 :                 return -1;
    2011             :         }
    2012           0 :         PY_CHECK_TYPE(&PyList_Type, value, return -1;);
    2013             :         {
    2014           0 :                 int sids_cntr_0;
    2015           0 :                 object->sids = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->sids, PyList_GET_SIZE(value));
    2016           0 :                 if (!object->sids) { return -1; }
    2017           0 :                 talloc_set_name_const(object->sids, "ARRAY: object->sids");
    2018           0 :                 for (sids_cntr_0 = 0; sids_cntr_0 < PyList_GET_SIZE(value); sids_cntr_0++) {
    2019           0 :                         if (PyList_GET_ITEM(value, sids_cntr_0) == NULL) {
    2020           0 :                                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->sids)[sids_cntr_0]");
    2021           0 :                                 return -1;
    2022             :                         }
    2023           0 :                         PY_CHECK_TYPE(&auth_SidAttr_Type, PyList_GET_ITEM(value, sids_cntr_0), return -1;);
    2024           0 :                         if (talloc_reference(object->sids, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, sids_cntr_0))) == NULL) {
    2025           0 :                                 PyErr_NoMemory();
    2026           0 :                                 return -1;
    2027             :                         }
    2028           0 :                         (object->sids)[sids_cntr_0] = *(struct auth_SidAttr *)pytalloc_get_ptr(PyList_GET_ITEM(value, sids_cntr_0));
    2029             :                 }
    2030             :         }
    2031           0 :         return 0;
    2032             : }
    2033             : 
    2034           0 : static PyObject *py_auth_user_info_dc_get_info(PyObject *obj, void *closure)
    2035             : {
    2036           0 :         struct auth_user_info_dc *object = pytalloc_get_ptr(obj);
    2037           0 :         PyObject *py_info;
    2038           0 :         if (object->info == NULL) {
    2039           0 :                 Py_RETURN_NONE;
    2040             :         }
    2041           0 :         if (object->info == NULL) {
    2042           0 :                 py_info = Py_None;
    2043           0 :                 Py_INCREF(py_info);
    2044             :         } else {
    2045           0 :                 py_info = pytalloc_reference_ex(&auth_user_info_Type, object->info, object->info);
    2046             :         }
    2047           0 :         return py_info;
    2048             : }
    2049             : 
    2050           0 : static int py_auth_user_info_dc_set_info(PyObject *py_obj, PyObject *value, void *closure)
    2051             : {
    2052           0 :         struct auth_user_info_dc *object = pytalloc_get_ptr(py_obj);
    2053           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->info));
    2054           0 :         if (value == NULL) {
    2055           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->info");
    2056           0 :                 return -1;
    2057             :         }
    2058           0 :         if (value == Py_None) {
    2059           0 :                 object->info = NULL;
    2060             :         } else {
    2061           0 :                 object->info = NULL;
    2062           0 :                 PY_CHECK_TYPE(&auth_user_info_Type, value, return -1;);
    2063           0 :                 if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
    2064           0 :                         PyErr_NoMemory();
    2065           0 :                         return -1;
    2066             :                 }
    2067           0 :                 object->info = (struct auth_user_info *)pytalloc_get_ptr(value);
    2068             :         }
    2069           0 :         return 0;
    2070             : }
    2071             : 
    2072           0 : static PyObject *py_auth_user_info_dc_get_user_session_key(PyObject *obj, void *closure)
    2073             : {
    2074           0 :         struct auth_user_info_dc *object = pytalloc_get_ptr(obj);
    2075           0 :         PyObject *py_user_session_key;
    2076           0 :         py_user_session_key = PyBytes_FromStringAndSize((char *)(object->user_session_key).data, (object->user_session_key).length);
    2077           0 :         return py_user_session_key;
    2078             : }
    2079             : 
    2080           0 : static int py_auth_user_info_dc_set_user_session_key(PyObject *py_obj, PyObject *value, void *closure)
    2081             : {
    2082           0 :         struct auth_user_info_dc *object = pytalloc_get_ptr(py_obj);
    2083           0 :         if (value == NULL) {
    2084           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->user_session_key");
    2085           0 :                 return -1;
    2086             :         }
    2087           0 :         object->user_session_key = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
    2088           0 :         return 0;
    2089             : }
    2090             : 
    2091           0 : static PyObject *py_auth_user_info_dc_get_lm_session_key(PyObject *obj, void *closure)
    2092             : {
    2093           0 :         struct auth_user_info_dc *object = pytalloc_get_ptr(obj);
    2094           0 :         PyObject *py_lm_session_key;
    2095           0 :         py_lm_session_key = PyBytes_FromStringAndSize((char *)(object->lm_session_key).data, (object->lm_session_key).length);
    2096           0 :         return py_lm_session_key;
    2097             : }
    2098             : 
    2099           0 : static int py_auth_user_info_dc_set_lm_session_key(PyObject *py_obj, PyObject *value, void *closure)
    2100             : {
    2101           0 :         struct auth_user_info_dc *object = pytalloc_get_ptr(py_obj);
    2102           0 :         if (value == NULL) {
    2103           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->lm_session_key");
    2104           0 :                 return -1;
    2105             :         }
    2106           0 :         object->lm_session_key = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
    2107           0 :         return 0;
    2108             : }
    2109             : 
    2110           0 : static PyObject *py_auth_user_info_dc_get_ticket_type(PyObject *obj, void *closure)
    2111             : {
    2112           0 :         struct auth_user_info_dc *object = pytalloc_get_ptr(obj);
    2113           0 :         PyObject *py_ticket_type;
    2114           0 :         py_ticket_type = PyLong_FromLong((uint16_t)(object->ticket_type));
    2115           0 :         return py_ticket_type;
    2116             : }
    2117             : 
    2118           0 : static int py_auth_user_info_dc_set_ticket_type(PyObject *py_obj, PyObject *value, void *closure)
    2119             : {
    2120           0 :         struct auth_user_info_dc *object = pytalloc_get_ptr(py_obj);
    2121           0 :         if (value == NULL) {
    2122           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->ticket_type");
    2123           0 :                 return -1;
    2124             :         }
    2125             :         {
    2126           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->ticket_type));
    2127           0 :                 if (PyLong_Check(value)) {
    2128           0 :                         unsigned long long test_var;
    2129           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    2130           0 :                         if (PyErr_Occurred() != NULL) {
    2131           0 :                                 return -1;
    2132             :                         }
    2133           0 :                         if (test_var > uint_max) {
    2134           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    2135             :                                   PyLong_Type.tp_name, uint_max, test_var);
    2136           0 :                                 return -1;
    2137             :                         }
    2138           0 :                         object->ticket_type = test_var;
    2139             :                 } else {
    2140           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    2141             :                           PyLong_Type.tp_name);
    2142           0 :                         return -1;
    2143             :                 }
    2144             :         }
    2145           0 :         return 0;
    2146             : }
    2147             : 
    2148             : static PyGetSetDef py_auth_user_info_dc_getsetters[] = {
    2149             :         {
    2150             :                 .name = discard_const_p(char, "num_sids"),
    2151             :                 .get = py_auth_user_info_dc_get_num_sids,
    2152             :                 .set = py_auth_user_info_dc_set_num_sids,
    2153             :                 .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
    2154             :         },
    2155             :         {
    2156             :                 .name = discard_const_p(char, "sids"),
    2157             :                 .get = py_auth_user_info_dc_get_sids,
    2158             :                 .set = py_auth_user_info_dc_set_sids,
    2159             :                 .doc = discard_const_p(char, "PIDL-generated element of base type auth_SidAttr")
    2160             :         },
    2161             :         {
    2162             :                 .name = discard_const_p(char, "info"),
    2163             :                 .get = py_auth_user_info_dc_get_info,
    2164             :                 .set = py_auth_user_info_dc_set_info,
    2165             :                 .doc = discard_const_p(char, "PIDL-generated element of base type auth_user_info")
    2166             :         },
    2167             :         {
    2168             :                 .name = discard_const_p(char, "user_session_key"),
    2169             :                 .get = py_auth_user_info_dc_get_user_session_key,
    2170             :                 .set = py_auth_user_info_dc_set_user_session_key,
    2171             :                 .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
    2172             :         },
    2173             :         {
    2174             :                 .name = discard_const_p(char, "lm_session_key"),
    2175             :                 .get = py_auth_user_info_dc_get_lm_session_key,
    2176             :                 .set = py_auth_user_info_dc_set_lm_session_key,
    2177             :                 .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
    2178             :         },
    2179             :         {
    2180             :                 .name = discard_const_p(char, "ticket_type"),
    2181             :                 .get = py_auth_user_info_dc_get_ticket_type,
    2182             :                 .set = py_auth_user_info_dc_set_ticket_type,
    2183             :                 .doc = discard_const_p(char, "PIDL-generated element of base type ticket_type")
    2184             :         },
    2185             :         { .name = NULL }
    2186             : };
    2187             : 
    2188           0 : static PyObject *py_auth_user_info_dc_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    2189             : {
    2190           0 :         return pytalloc_new(struct auth_user_info_dc, type);
    2191             : }
    2192             : 
    2193           0 : static PyObject *py_auth_user_info_dc_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
    2194             : {
    2195           0 :         struct auth_user_info_dc *object = pytalloc_get_ptr(py_obj);
    2196           0 :         PyObject *ret = NULL;
    2197           0 :         DATA_BLOB blob;
    2198           0 :         enum ndr_err_code err;
    2199           0 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
    2200           0 :         if (tmp_ctx == NULL) {
    2201           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    2202           0 :                 return NULL;
    2203             :         }
    2204           0 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_auth_user_info_dc);
    2205           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    2206           0 :                 TALLOC_FREE(tmp_ctx);
    2207           0 :                 PyErr_SetNdrError(err);
    2208           0 :                 return NULL;
    2209             :         }
    2210             : 
    2211           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    2212           0 :         TALLOC_FREE(tmp_ctx);
    2213           0 :         return ret;
    2214             : }
    2215             : 
    2216           0 : static PyObject *py_auth_user_info_dc_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    2217             : {
    2218           0 :         struct auth_user_info_dc *object = pytalloc_get_ptr(py_obj);
    2219           0 :         DATA_BLOB blob = {.data = NULL, .length = 0};
    2220           0 :         Py_ssize_t blob_length = 0;
    2221           0 :         enum ndr_err_code err;
    2222           0 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
    2223           0 :         PyObject *allow_remaining_obj = NULL;
    2224           0 :         bool allow_remaining = false;
    2225             : 
    2226           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
    2227             :                 discard_const_p(char *, kwnames),
    2228             :                 &blob.data, &blob_length,
    2229             :                 &allow_remaining_obj)) {
    2230           0 :                 return NULL;
    2231             :         }
    2232           0 :         blob.length = blob_length;
    2233             : 
    2234           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    2235           0 :                 allow_remaining = true;
    2236             :         }
    2237             : 
    2238           0 :         if (allow_remaining) {
    2239           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_auth_user_info_dc);
    2240             :         } else {
    2241           0 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_auth_user_info_dc);
    2242             :         }
    2243           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    2244           0 :                 PyErr_SetNdrError(err);
    2245           0 :                 return NULL;
    2246             :         }
    2247             : 
    2248           0 :         Py_RETURN_NONE;
    2249             : }
    2250             : 
    2251           0 : static PyObject *py_auth_user_info_dc_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    2252             : {
    2253           0 :         struct auth_user_info_dc *object = pytalloc_get_ptr(py_obj);
    2254           0 :         PyObject *ret;
    2255           0 :         char *retstr;
    2256             : 
    2257           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_auth_user_info_dc, "auth_user_info_dc", object);
    2258           0 :         ret = PyUnicode_FromString(retstr);
    2259           0 :         talloc_free(retstr);
    2260             : 
    2261           0 :         return ret;
    2262             : }
    2263             : 
    2264             : static PyMethodDef py_auth_user_info_dc_methods[] = {
    2265             :         { "__ndr_pack__", (PyCFunction)py_auth_user_info_dc_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
    2266             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_auth_user_info_dc_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
    2267             :         { "__ndr_print__", (PyCFunction)py_auth_user_info_dc_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
    2268             :         { NULL, NULL, 0, NULL }
    2269             : };
    2270             : 
    2271             : 
    2272             : static PyTypeObject auth_user_info_dc_Type = {
    2273             :         PyVarObject_HEAD_INIT(NULL, 0)
    2274             :         .tp_name = "auth.user_info_dc",
    2275             :         .tp_getset = py_auth_user_info_dc_getsetters,
    2276             :         .tp_methods = py_auth_user_info_dc_methods,
    2277             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    2278             :         .tp_new = py_auth_user_info_dc_new,
    2279             : };
    2280             : 
    2281             : 
    2282         361 : static PyObject *py_auth_session_info_get_security_token(PyObject *obj, void *closure)
    2283             : {
    2284         361 :         struct auth_session_info *object = pytalloc_get_ptr(obj);
    2285           0 :         PyObject *py_security_token;
    2286         361 :         if (object->security_token == NULL) {
    2287           0 :                 Py_RETURN_NONE;
    2288             :         }
    2289         361 :         if (object->security_token == NULL) {
    2290           0 :                 py_security_token = Py_None;
    2291           0 :                 Py_INCREF(py_security_token);
    2292             :         } else {
    2293         361 :                 py_security_token = pytalloc_reference_ex(security_token_Type, object->security_token, object->security_token);
    2294             :         }
    2295         361 :         return py_security_token;
    2296             : }
    2297             : 
    2298           0 : static int py_auth_session_info_set_security_token(PyObject *py_obj, PyObject *value, void *closure)
    2299             : {
    2300           0 :         struct auth_session_info *object = pytalloc_get_ptr(py_obj);
    2301           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->security_token));
    2302           0 :         if (value == NULL) {
    2303           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->security_token");
    2304           0 :                 return -1;
    2305             :         }
    2306           0 :         if (value == Py_None) {
    2307           0 :                 object->security_token = NULL;
    2308             :         } else {
    2309           0 :                 object->security_token = NULL;
    2310           0 :                 PY_CHECK_TYPE(security_token_Type, value, return -1;);
    2311           0 :                 if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
    2312           0 :                         PyErr_NoMemory();
    2313           0 :                         return -1;
    2314             :                 }
    2315           0 :                 object->security_token = (struct security_token *)pytalloc_get_ptr(value);
    2316             :         }
    2317           0 :         return 0;
    2318             : }
    2319             : 
    2320           1 : static PyObject *py_auth_session_info_get_unix_token(PyObject *obj, void *closure)
    2321             : {
    2322           1 :         struct auth_session_info *object = pytalloc_get_ptr(obj);
    2323           0 :         PyObject *py_unix_token;
    2324           1 :         if (object->unix_token == NULL) {
    2325           0 :                 Py_RETURN_NONE;
    2326             :         }
    2327           1 :         if (object->unix_token == NULL) {
    2328           0 :                 py_unix_token = Py_None;
    2329           0 :                 Py_INCREF(py_unix_token);
    2330             :         } else {
    2331           1 :                 py_unix_token = pytalloc_reference_ex(security_unix_token_Type, object->unix_token, object->unix_token);
    2332             :         }
    2333           1 :         return py_unix_token;
    2334             : }
    2335             : 
    2336           0 : static int py_auth_session_info_set_unix_token(PyObject *py_obj, PyObject *value, void *closure)
    2337             : {
    2338           0 :         struct auth_session_info *object = pytalloc_get_ptr(py_obj);
    2339           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->unix_token));
    2340           0 :         if (value == NULL) {
    2341           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->unix_token");
    2342           0 :                 return -1;
    2343             :         }
    2344           0 :         if (value == Py_None) {
    2345           0 :                 object->unix_token = NULL;
    2346             :         } else {
    2347           0 :                 object->unix_token = NULL;
    2348           0 :                 PY_CHECK_TYPE(security_unix_token_Type, value, return -1;);
    2349           0 :                 if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
    2350           0 :                         PyErr_NoMemory();
    2351           0 :                         return -1;
    2352             :                 }
    2353           0 :                 object->unix_token = (struct security_unix_token *)pytalloc_get_ptr(value);
    2354             :         }
    2355           0 :         return 0;
    2356             : }
    2357             : 
    2358           8 : static PyObject *py_auth_session_info_get_info(PyObject *obj, void *closure)
    2359             : {
    2360           8 :         struct auth_session_info *object = pytalloc_get_ptr(obj);
    2361           0 :         PyObject *py_info;
    2362           8 :         if (object->info == NULL) {
    2363           0 :                 Py_RETURN_NONE;
    2364             :         }
    2365           8 :         if (object->info == NULL) {
    2366           0 :                 py_info = Py_None;
    2367           0 :                 Py_INCREF(py_info);
    2368             :         } else {
    2369           8 :                 py_info = pytalloc_reference_ex(&auth_user_info_Type, object->info, object->info);
    2370             :         }
    2371           8 :         return py_info;
    2372             : }
    2373             : 
    2374           0 : static int py_auth_session_info_set_info(PyObject *py_obj, PyObject *value, void *closure)
    2375             : {
    2376           0 :         struct auth_session_info *object = pytalloc_get_ptr(py_obj);
    2377           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->info));
    2378           0 :         if (value == NULL) {
    2379           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->info");
    2380           0 :                 return -1;
    2381             :         }
    2382           0 :         if (value == Py_None) {
    2383           0 :                 object->info = NULL;
    2384             :         } else {
    2385           0 :                 object->info = NULL;
    2386           0 :                 PY_CHECK_TYPE(&auth_user_info_Type, value, return -1;);
    2387           0 :                 if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
    2388           0 :                         PyErr_NoMemory();
    2389           0 :                         return -1;
    2390             :                 }
    2391           0 :                 object->info = (struct auth_user_info *)pytalloc_get_ptr(value);
    2392             :         }
    2393           0 :         return 0;
    2394             : }
    2395             : 
    2396           2 : static PyObject *py_auth_session_info_get_unix_info(PyObject *obj, void *closure)
    2397             : {
    2398           2 :         struct auth_session_info *object = pytalloc_get_ptr(obj);
    2399           0 :         PyObject *py_unix_info;
    2400           2 :         if (object->unix_info == NULL) {
    2401           0 :                 Py_RETURN_NONE;
    2402             :         }
    2403           2 :         if (object->unix_info == NULL) {
    2404           0 :                 py_unix_info = Py_None;
    2405           0 :                 Py_INCREF(py_unix_info);
    2406             :         } else {
    2407           2 :                 py_unix_info = pytalloc_reference_ex(&auth_user_info_unix_Type, object->unix_info, object->unix_info);
    2408             :         }
    2409           2 :         return py_unix_info;
    2410             : }
    2411             : 
    2412           0 : static int py_auth_session_info_set_unix_info(PyObject *py_obj, PyObject *value, void *closure)
    2413             : {
    2414           0 :         struct auth_session_info *object = pytalloc_get_ptr(py_obj);
    2415           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->unix_info));
    2416           0 :         if (value == NULL) {
    2417           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->unix_info");
    2418           0 :                 return -1;
    2419             :         }
    2420           0 :         if (value == Py_None) {
    2421           0 :                 object->unix_info = NULL;
    2422             :         } else {
    2423           0 :                 object->unix_info = NULL;
    2424           0 :                 PY_CHECK_TYPE(&auth_user_info_unix_Type, value, return -1;);
    2425           0 :                 if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
    2426           0 :                         PyErr_NoMemory();
    2427           0 :                         return -1;
    2428             :                 }
    2429           0 :                 object->unix_info = (struct auth_user_info_unix *)pytalloc_get_ptr(value);
    2430             :         }
    2431           0 :         return 0;
    2432             : }
    2433             : 
    2434           2 : static PyObject *py_auth_session_info_get_torture(PyObject *obj, void *closure)
    2435             : {
    2436           2 :         struct auth_session_info *object = pytalloc_get_ptr(obj);
    2437           0 :         PyObject *py_torture;
    2438           2 :         if (object->torture == NULL) {
    2439           0 :                 Py_RETURN_NONE;
    2440             :         }
    2441           2 :         if (object->torture == NULL) {
    2442           0 :                 py_torture = Py_None;
    2443           0 :                 Py_INCREF(py_torture);
    2444             :         } else {
    2445           2 :                 py_torture = pytalloc_reference_ex(&auth_user_info_torture_Type, object->torture, object->torture);
    2446             :         }
    2447           2 :         return py_torture;
    2448             : }
    2449             : 
    2450           0 : static int py_auth_session_info_set_torture(PyObject *py_obj, PyObject *value, void *closure)
    2451             : {
    2452           0 :         struct auth_session_info *object = pytalloc_get_ptr(py_obj);
    2453           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->torture));
    2454           0 :         if (value == NULL) {
    2455           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->torture");
    2456           0 :                 return -1;
    2457             :         }
    2458           0 :         if (value == Py_None) {
    2459           0 :                 object->torture = NULL;
    2460             :         } else {
    2461           0 :                 object->torture = NULL;
    2462           0 :                 PY_CHECK_TYPE(&auth_user_info_torture_Type, value, return -1;);
    2463           0 :                 if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
    2464           0 :                         PyErr_NoMemory();
    2465           0 :                         return -1;
    2466             :                 }
    2467           0 :                 object->torture = (struct auth_user_info_torture *)pytalloc_get_ptr(value);
    2468             :         }
    2469           0 :         return 0;
    2470             : }
    2471             : 
    2472           3 : static PyObject *py_auth_session_info_get_session_key(PyObject *obj, void *closure)
    2473             : {
    2474           3 :         struct auth_session_info *object = pytalloc_get_ptr(obj);
    2475           0 :         PyObject *py_session_key;
    2476           3 :         py_session_key = PyBytes_FromStringAndSize((char *)(object->session_key).data, (object->session_key).length);
    2477           3 :         return py_session_key;
    2478             : }
    2479             : 
    2480           0 : static int py_auth_session_info_set_session_key(PyObject *py_obj, PyObject *value, void *closure)
    2481             : {
    2482           0 :         struct auth_session_info *object = pytalloc_get_ptr(py_obj);
    2483           0 :         if (value == NULL) {
    2484           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->session_key");
    2485           0 :                 return -1;
    2486             :         }
    2487           0 :         object->session_key = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
    2488           0 :         return 0;
    2489             : }
    2490             : 
    2491           0 : static PyObject *py_auth_session_info_get_credentials(PyObject *obj, void *closure)
    2492             : {
    2493           0 :         struct auth_session_info *object = pytalloc_get_ptr(obj);
    2494           0 :         PyObject *py_credentials;
    2495           0 :         if (object->credentials == NULL) {
    2496           0 :                 Py_RETURN_NONE;
    2497             :         }
    2498           0 :         if (object->credentials == NULL) {
    2499           0 :                 py_credentials = Py_None;
    2500           0 :                 Py_INCREF(py_credentials);
    2501             :         } else {
    2502           0 :                 py_credentials = NULL;
    2503             :         }
    2504           0 :         return py_credentials;
    2505             : }
    2506             : 
    2507           0 : static int py_auth_session_info_set_credentials(PyObject *py_obj, PyObject *value, void *closure)
    2508             : {
    2509           0 :         struct auth_session_info *object = pytalloc_get_ptr(py_obj);
    2510           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->credentials));
    2511           0 :         if (value == NULL) {
    2512           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->credentials");
    2513           0 :                 return -1;
    2514             :         }
    2515           0 :         if (value == Py_None) {
    2516           0 :                 object->credentials = NULL;
    2517             :         } else {
    2518           0 :                 object->credentials = NULL;
    2519           0 :                 PyErr_SetString(PyExc_TypeError, "Can not convert C Type struct cli_credentials from Python");
    2520             :         }
    2521           0 :         return 0;
    2522             : }
    2523             : 
    2524           0 : static PyObject *py_auth_session_info_get_unique_session_token(PyObject *obj, void *closure)
    2525             : {
    2526           0 :         struct auth_session_info *object = pytalloc_get_ptr(obj);
    2527           0 :         PyObject *py_unique_session_token;
    2528           0 :         py_unique_session_token = pytalloc_reference_ex(GUID_Type, pytalloc_get_mem_ctx(obj), &object->unique_session_token);
    2529           0 :         return py_unique_session_token;
    2530             : }
    2531             : 
    2532           0 : static int py_auth_session_info_set_unique_session_token(PyObject *py_obj, PyObject *value, void *closure)
    2533             : {
    2534           0 :         struct auth_session_info *object = pytalloc_get_ptr(py_obj);
    2535           0 :         if (value == NULL) {
    2536           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->unique_session_token");
    2537           0 :                 return -1;
    2538             :         }
    2539           0 :         PY_CHECK_TYPE(GUID_Type, value, return -1;);
    2540           0 :         if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
    2541           0 :                 PyErr_NoMemory();
    2542           0 :                 return -1;
    2543             :         }
    2544           0 :         object->unique_session_token = *(struct GUID *)pytalloc_get_ptr(value);
    2545           0 :         return 0;
    2546             : }
    2547             : 
    2548           0 : static PyObject *py_auth_session_info_get_ticket_type(PyObject *obj, void *closure)
    2549             : {
    2550           0 :         struct auth_session_info *object = pytalloc_get_ptr(obj);
    2551           0 :         PyObject *py_ticket_type;
    2552           0 :         py_ticket_type = PyLong_FromLong((uint16_t)(object->ticket_type));
    2553           0 :         return py_ticket_type;
    2554             : }
    2555             : 
    2556           0 : static int py_auth_session_info_set_ticket_type(PyObject *py_obj, PyObject *value, void *closure)
    2557             : {
    2558           0 :         struct auth_session_info *object = pytalloc_get_ptr(py_obj);
    2559           0 :         if (value == NULL) {
    2560           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->ticket_type");
    2561           0 :                 return -1;
    2562             :         }
    2563             :         {
    2564           0 :                 const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->ticket_type));
    2565           0 :                 if (PyLong_Check(value)) {
    2566           0 :                         unsigned long long test_var;
    2567           0 :                         test_var = PyLong_AsUnsignedLongLong(value);
    2568           0 :                         if (PyErr_Occurred() != NULL) {
    2569           0 :                                 return -1;
    2570             :                         }
    2571           0 :                         if (test_var > uint_max) {
    2572           0 :                                 PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
    2573             :                                   PyLong_Type.tp_name, uint_max, test_var);
    2574           0 :                                 return -1;
    2575             :                         }
    2576           0 :                         object->ticket_type = test_var;
    2577             :                 } else {
    2578           0 :                         PyErr_Format(PyExc_TypeError, "Expected type %s",
    2579             :                           PyLong_Type.tp_name);
    2580           0 :                         return -1;
    2581             :                 }
    2582             :         }
    2583           0 :         return 0;
    2584             : }
    2585             : 
    2586             : static PyGetSetDef py_auth_session_info_getsetters[] = {
    2587             :         {
    2588             :                 .name = discard_const_p(char, "security_token"),
    2589             :                 .get = py_auth_session_info_get_security_token,
    2590             :                 .set = py_auth_session_info_set_security_token,
    2591             :                 .doc = discard_const_p(char, "PIDL-generated element of base type security_token")
    2592             :         },
    2593             :         {
    2594             :                 .name = discard_const_p(char, "unix_token"),
    2595             :                 .get = py_auth_session_info_get_unix_token,
    2596             :                 .set = py_auth_session_info_set_unix_token,
    2597             :                 .doc = discard_const_p(char, "PIDL-generated element of base type security_unix_token")
    2598             :         },
    2599             :         {
    2600             :                 .name = discard_const_p(char, "info"),
    2601             :                 .get = py_auth_session_info_get_info,
    2602             :                 .set = py_auth_session_info_set_info,
    2603             :                 .doc = discard_const_p(char, "PIDL-generated element of base type auth_user_info")
    2604             :         },
    2605             :         {
    2606             :                 .name = discard_const_p(char, "unix_info"),
    2607             :                 .get = py_auth_session_info_get_unix_info,
    2608             :                 .set = py_auth_session_info_set_unix_info,
    2609             :                 .doc = discard_const_p(char, "PIDL-generated element of base type auth_user_info_unix")
    2610             :         },
    2611             :         {
    2612             :                 .name = discard_const_p(char, "torture"),
    2613             :                 .get = py_auth_session_info_get_torture,
    2614             :                 .set = py_auth_session_info_set_torture,
    2615             :                 .doc = discard_const_p(char, "PIDL-generated element of base type auth_user_info_torture")
    2616             :         },
    2617             :         {
    2618             :                 .name = discard_const_p(char, "session_key"),
    2619             :                 .get = py_auth_session_info_get_session_key,
    2620             :                 .set = py_auth_session_info_set_session_key,
    2621             :                 .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
    2622             :         },
    2623             :         {
    2624             :                 .name = discard_const_p(char, "credentials"),
    2625             :                 .get = py_auth_session_info_get_credentials,
    2626             :                 .set = py_auth_session_info_set_credentials,
    2627             :                 .doc = discard_const_p(char, "PIDL-generated element of base type cli_credentials")
    2628             :         },
    2629             :         {
    2630             :                 .name = discard_const_p(char, "unique_session_token"),
    2631             :                 .get = py_auth_session_info_get_unique_session_token,
    2632             :                 .set = py_auth_session_info_set_unique_session_token,
    2633             :                 .doc = discard_const_p(char, "PIDL-generated element of base type GUID")
    2634             :         },
    2635             :         {
    2636             :                 .name = discard_const_p(char, "ticket_type"),
    2637             :                 .get = py_auth_session_info_get_ticket_type,
    2638             :                 .set = py_auth_session_info_set_ticket_type,
    2639             :                 .doc = discard_const_p(char, "PIDL-generated element of base type ticket_type")
    2640             :         },
    2641             :         { .name = NULL }
    2642             : };
    2643             : 
    2644           0 : static PyObject *py_auth_session_info_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    2645             : {
    2646           0 :         return pytalloc_new(struct auth_session_info, type);
    2647             : }
    2648             : 
    2649           0 : static PyObject *py_auth_session_info_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
    2650             : {
    2651           0 :         struct auth_session_info *object = pytalloc_get_ptr(py_obj);
    2652           0 :         PyObject *ret = NULL;
    2653           0 :         DATA_BLOB blob;
    2654           0 :         enum ndr_err_code err;
    2655           0 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
    2656           0 :         if (tmp_ctx == NULL) {
    2657           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    2658           0 :                 return NULL;
    2659             :         }
    2660           0 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_auth_session_info);
    2661           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    2662           0 :                 TALLOC_FREE(tmp_ctx);
    2663           0 :                 PyErr_SetNdrError(err);
    2664           0 :                 return NULL;
    2665             :         }
    2666             : 
    2667           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    2668           0 :         TALLOC_FREE(tmp_ctx);
    2669           0 :         return ret;
    2670             : }
    2671             : 
    2672           0 : static PyObject *py_auth_session_info_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    2673             : {
    2674           0 :         struct auth_session_info *object = pytalloc_get_ptr(py_obj);
    2675           0 :         DATA_BLOB blob = {.data = NULL, .length = 0};
    2676           0 :         Py_ssize_t blob_length = 0;
    2677           0 :         enum ndr_err_code err;
    2678           0 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
    2679           0 :         PyObject *allow_remaining_obj = NULL;
    2680           0 :         bool allow_remaining = false;
    2681             : 
    2682           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
    2683             :                 discard_const_p(char *, kwnames),
    2684             :                 &blob.data, &blob_length,
    2685             :                 &allow_remaining_obj)) {
    2686           0 :                 return NULL;
    2687             :         }
    2688           0 :         blob.length = blob_length;
    2689             : 
    2690           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    2691           0 :                 allow_remaining = true;
    2692             :         }
    2693             : 
    2694           0 :         if (allow_remaining) {
    2695           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_auth_session_info);
    2696             :         } else {
    2697           0 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_auth_session_info);
    2698             :         }
    2699           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    2700           0 :                 PyErr_SetNdrError(err);
    2701           0 :                 return NULL;
    2702             :         }
    2703             : 
    2704           0 :         Py_RETURN_NONE;
    2705             : }
    2706             : 
    2707           0 : static PyObject *py_auth_session_info_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    2708             : {
    2709           0 :         struct auth_session_info *object = pytalloc_get_ptr(py_obj);
    2710           0 :         PyObject *ret;
    2711           0 :         char *retstr;
    2712             : 
    2713           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_auth_session_info, "auth_session_info", object);
    2714           0 :         ret = PyUnicode_FromString(retstr);
    2715           0 :         talloc_free(retstr);
    2716             : 
    2717           0 :         return ret;
    2718             : }
    2719             : 
    2720             : static PyMethodDef py_auth_session_info_methods[] = {
    2721             :         { "__ndr_pack__", (PyCFunction)py_auth_session_info_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
    2722             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_auth_session_info_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
    2723             :         { "__ndr_print__", (PyCFunction)py_auth_session_info_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
    2724             :         { NULL, NULL, 0, NULL }
    2725             : };
    2726             : 
    2727             : 
    2728             : static PyTypeObject auth_session_info_Type = {
    2729             :         PyVarObject_HEAD_INIT(NULL, 0)
    2730             :         .tp_name = "auth.session_info",
    2731             :         .tp_getset = py_auth_session_info_getsetters,
    2732             :         .tp_methods = py_auth_session_info_methods,
    2733             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    2734             :         .tp_new = py_auth_session_info_new,
    2735             : };
    2736             : 
    2737             : 
    2738           0 : static PyObject *py_auth_session_info_transport_get_session_info(PyObject *obj, void *closure)
    2739             : {
    2740           0 :         struct auth_session_info_transport *object = pytalloc_get_ptr(obj);
    2741           0 :         PyObject *py_session_info;
    2742           0 :         if (object->session_info == NULL) {
    2743           0 :                 Py_RETURN_NONE;
    2744             :         }
    2745           0 :         if (object->session_info == NULL) {
    2746           0 :                 py_session_info = Py_None;
    2747           0 :                 Py_INCREF(py_session_info);
    2748             :         } else {
    2749           0 :                 py_session_info = pytalloc_reference_ex(&auth_session_info_Type, object->session_info, object->session_info);
    2750             :         }
    2751           0 :         return py_session_info;
    2752             : }
    2753             : 
    2754           0 : static int py_auth_session_info_transport_set_session_info(PyObject *py_obj, PyObject *value, void *closure)
    2755             : {
    2756           0 :         struct auth_session_info_transport *object = pytalloc_get_ptr(py_obj);
    2757           0 :         talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->session_info));
    2758           0 :         if (value == NULL) {
    2759           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->session_info");
    2760           0 :                 return -1;
    2761             :         }
    2762           0 :         if (value == Py_None) {
    2763           0 :                 object->session_info = NULL;
    2764             :         } else {
    2765           0 :                 object->session_info = NULL;
    2766           0 :                 PY_CHECK_TYPE(&auth_session_info_Type, value, return -1;);
    2767           0 :                 if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
    2768           0 :                         PyErr_NoMemory();
    2769           0 :                         return -1;
    2770             :                 }
    2771           0 :                 object->session_info = (struct auth_session_info *)pytalloc_get_ptr(value);
    2772             :         }
    2773           0 :         return 0;
    2774             : }
    2775             : 
    2776           0 : static PyObject *py_auth_session_info_transport_get_exported_gssapi_credentials(PyObject *obj, void *closure)
    2777             : {
    2778           0 :         struct auth_session_info_transport *object = pytalloc_get_ptr(obj);
    2779           0 :         PyObject *py_exported_gssapi_credentials;
    2780           0 :         py_exported_gssapi_credentials = PyBytes_FromStringAndSize((char *)(object->exported_gssapi_credentials).data, (object->exported_gssapi_credentials).length);
    2781           0 :         return py_exported_gssapi_credentials;
    2782             : }
    2783             : 
    2784           0 : static int py_auth_session_info_transport_set_exported_gssapi_credentials(PyObject *py_obj, PyObject *value, void *closure)
    2785             : {
    2786           0 :         struct auth_session_info_transport *object = pytalloc_get_ptr(py_obj);
    2787           0 :         if (value == NULL) {
    2788           0 :                 PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->exported_gssapi_credentials");
    2789           0 :                 return -1;
    2790             :         }
    2791           0 :         object->exported_gssapi_credentials = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
    2792           0 :         return 0;
    2793             : }
    2794             : 
    2795             : static PyGetSetDef py_auth_session_info_transport_getsetters[] = {
    2796             :         {
    2797             :                 .name = discard_const_p(char, "session_info"),
    2798             :                 .get = py_auth_session_info_transport_get_session_info,
    2799             :                 .set = py_auth_session_info_transport_set_session_info,
    2800             :                 .doc = discard_const_p(char, "PIDL-generated element of base type auth_session_info")
    2801             :         },
    2802             :         {
    2803             :                 .name = discard_const_p(char, "exported_gssapi_credentials"),
    2804             :                 .get = py_auth_session_info_transport_get_exported_gssapi_credentials,
    2805             :                 .set = py_auth_session_info_transport_set_exported_gssapi_credentials,
    2806             :                 .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
    2807             :         },
    2808             :         { .name = NULL }
    2809             : };
    2810             : 
    2811           0 : static PyObject *py_auth_session_info_transport_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
    2812             : {
    2813           0 :         return pytalloc_new(struct auth_session_info_transport, type);
    2814             : }
    2815             : 
    2816           0 : static PyObject *py_auth_session_info_transport_ndr_pack(PyObject *py_obj,  PyObject *Py_UNUSED(ignored))
    2817             : {
    2818           0 :         struct auth_session_info_transport *object = pytalloc_get_ptr(py_obj);
    2819           0 :         PyObject *ret = NULL;
    2820           0 :         DATA_BLOB blob;
    2821           0 :         enum ndr_err_code err;
    2822           0 :         TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
    2823           0 :         if (tmp_ctx == NULL) {
    2824           0 :                 PyErr_SetNdrError(NDR_ERR_ALLOC);
    2825           0 :                 return NULL;
    2826             :         }
    2827           0 :         err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_auth_session_info_transport);
    2828           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    2829           0 :                 TALLOC_FREE(tmp_ctx);
    2830           0 :                 PyErr_SetNdrError(err);
    2831           0 :                 return NULL;
    2832             :         }
    2833             : 
    2834           0 :         ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
    2835           0 :         TALLOC_FREE(tmp_ctx);
    2836           0 :         return ret;
    2837             : }
    2838             : 
    2839           0 : static PyObject *py_auth_session_info_transport_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
    2840             : {
    2841           0 :         struct auth_session_info_transport *object = pytalloc_get_ptr(py_obj);
    2842           0 :         DATA_BLOB blob = {.data = NULL, .length = 0};
    2843           0 :         Py_ssize_t blob_length = 0;
    2844           0 :         enum ndr_err_code err;
    2845           0 :         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
    2846           0 :         PyObject *allow_remaining_obj = NULL;
    2847           0 :         bool allow_remaining = false;
    2848             : 
    2849           0 :         if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
    2850             :                 discard_const_p(char *, kwnames),
    2851             :                 &blob.data, &blob_length,
    2852             :                 &allow_remaining_obj)) {
    2853           0 :                 return NULL;
    2854             :         }
    2855           0 :         blob.length = blob_length;
    2856             : 
    2857           0 :         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
    2858           0 :                 allow_remaining = true;
    2859             :         }
    2860             : 
    2861           0 :         if (allow_remaining) {
    2862           0 :                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_auth_session_info_transport);
    2863             :         } else {
    2864           0 :                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_auth_session_info_transport);
    2865             :         }
    2866           0 :         if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
    2867           0 :                 PyErr_SetNdrError(err);
    2868           0 :                 return NULL;
    2869             :         }
    2870             : 
    2871           0 :         Py_RETURN_NONE;
    2872             : }
    2873             : 
    2874           0 : static PyObject *py_auth_session_info_transport_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
    2875             : {
    2876           0 :         struct auth_session_info_transport *object = pytalloc_get_ptr(py_obj);
    2877           0 :         PyObject *ret;
    2878           0 :         char *retstr;
    2879             : 
    2880           0 :         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_auth_session_info_transport, "auth_session_info_transport", object);
    2881           0 :         ret = PyUnicode_FromString(retstr);
    2882           0 :         talloc_free(retstr);
    2883             : 
    2884           0 :         return ret;
    2885             : }
    2886             : 
    2887             : static PyMethodDef py_auth_session_info_transport_methods[] = {
    2888             :         { "__ndr_pack__", (PyCFunction)py_auth_session_info_transport_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
    2889             :         { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_auth_session_info_transport_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
    2890             :         { "__ndr_print__", (PyCFunction)py_auth_session_info_transport_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
    2891             :         { NULL, NULL, 0, NULL }
    2892             : };
    2893             : 
    2894             : 
    2895             : static PyTypeObject auth_session_info_transport_Type = {
    2896             :         PyVarObject_HEAD_INIT(NULL, 0)
    2897             :         .tp_name = "auth.session_info_transport",
    2898             :         .tp_getset = py_auth_session_info_transport_getsetters,
    2899             :         .tp_methods = py_auth_session_info_transport_methods,
    2900             :         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
    2901             :         .tp_new = py_auth_session_info_transport_new,
    2902             : };
    2903             : 
    2904             : static PyMethodDef auth_methods[] = {
    2905             :         { NULL, NULL, 0, NULL }
    2906             : };
    2907             : 
    2908             : static struct PyModuleDef moduledef = {
    2909             :         PyModuleDef_HEAD_INIT,
    2910             :         .m_name = "auth",
    2911             :         .m_doc = "auth DCE/RPC",
    2912             :         .m_size = -1,
    2913             :         .m_methods = auth_methods,
    2914             : };
    2915        3610 : MODULE_INIT_FUNC(auth)
    2916             : {
    2917        3610 :         PyObject *m = NULL;
    2918        3610 :         PyObject *dep_samba_dcerpc_misc = NULL;
    2919        3610 :         PyObject *dep_samba_dcerpc_security = NULL;
    2920        3610 :         PyObject *dep_samba_dcerpc_lsa = NULL;
    2921        3610 :         PyObject *dep_samba_dcerpc_krb5pac = NULL;
    2922        3610 :         PyObject *dep_talloc = NULL;
    2923             : 
    2924        3610 :         dep_samba_dcerpc_misc = PyImport_ImportModule("samba.dcerpc.misc");
    2925        3610 :         if (dep_samba_dcerpc_misc == NULL)
    2926           0 :                 goto out;
    2927             : 
    2928        3610 :         dep_samba_dcerpc_security = PyImport_ImportModule("samba.dcerpc.security");
    2929        3610 :         if (dep_samba_dcerpc_security == NULL)
    2930           0 :                 goto out;
    2931             : 
    2932        3610 :         dep_samba_dcerpc_lsa = PyImport_ImportModule("samba.dcerpc.lsa");
    2933        3610 :         if (dep_samba_dcerpc_lsa == NULL)
    2934           0 :                 goto out;
    2935             : 
    2936        3610 :         dep_samba_dcerpc_krb5pac = PyImport_ImportModule("samba.dcerpc.krb5pac");
    2937        3610 :         if (dep_samba_dcerpc_krb5pac == NULL)
    2938           0 :                 goto out;
    2939             : 
    2940        3610 :         dep_talloc = PyImport_ImportModule("talloc");
    2941        3610 :         if (dep_talloc == NULL)
    2942           0 :                 goto out;
    2943             : 
    2944        3610 :         BaseObject_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "BaseObject");
    2945        3610 :         if (BaseObject_Type == NULL)
    2946           0 :                 goto out;
    2947             : 
    2948        3610 :         dom_sid_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_security, "dom_sid");
    2949        3610 :         if (dom_sid_Type == NULL)
    2950           0 :                 goto out;
    2951             : 
    2952        3610 :         security_token_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_security, "token");
    2953        3610 :         if (security_token_Type == NULL)
    2954           0 :                 goto out;
    2955             : 
    2956        3610 :         security_unix_token_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_security, "unix_token");
    2957        3610 :         if (security_unix_token_Type == NULL)
    2958           0 :                 goto out;
    2959             : 
    2960        3610 :         GUID_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_misc, "GUID");
    2961        3610 :         if (GUID_Type == NULL)
    2962           0 :                 goto out;
    2963             : 
    2964        3610 :         auth_user_info_Type.tp_base = BaseObject_Type;
    2965        3610 :         auth_user_info_Type.tp_basicsize = pytalloc_BaseObject_size();
    2966             : 
    2967        3610 :         auth_user_info_torture_Type.tp_base = BaseObject_Type;
    2968        3610 :         auth_user_info_torture_Type.tp_basicsize = pytalloc_BaseObject_size();
    2969             : 
    2970        3610 :         auth_user_info_unix_Type.tp_base = BaseObject_Type;
    2971        3610 :         auth_user_info_unix_Type.tp_basicsize = pytalloc_BaseObject_size();
    2972             : 
    2973        3610 :         auth_SidAttr_Type.tp_base = BaseObject_Type;
    2974        3610 :         auth_SidAttr_Type.tp_basicsize = pytalloc_BaseObject_size();
    2975             : 
    2976        3610 :         auth_user_info_dc_Type.tp_base = BaseObject_Type;
    2977        3610 :         auth_user_info_dc_Type.tp_basicsize = pytalloc_BaseObject_size();
    2978             : 
    2979        3610 :         auth_session_info_Type.tp_base = BaseObject_Type;
    2980        3610 :         auth_session_info_Type.tp_basicsize = pytalloc_BaseObject_size();
    2981             : 
    2982        3610 :         auth_session_info_transport_Type.tp_base = BaseObject_Type;
    2983        3610 :         auth_session_info_transport_Type.tp_basicsize = pytalloc_BaseObject_size();
    2984             : 
    2985        3610 :         if (PyType_Ready(&auth_user_info_Type) < 0)
    2986           0 :                 goto out;
    2987        3610 :         if (PyType_Ready(&auth_user_info_torture_Type) < 0)
    2988           0 :                 goto out;
    2989        3610 :         if (PyType_Ready(&auth_user_info_unix_Type) < 0)
    2990           0 :                 goto out;
    2991        3610 :         if (PyType_Ready(&auth_SidAttr_Type) < 0)
    2992           0 :                 goto out;
    2993        3610 :         if (PyType_Ready(&auth_user_info_dc_Type) < 0)
    2994           0 :                 goto out;
    2995        3610 :         if (PyType_Ready(&auth_session_info_Type) < 0)
    2996           0 :                 goto out;
    2997        3610 :         if (PyType_Ready(&auth_session_info_transport_Type) < 0)
    2998           0 :                 goto out;
    2999             : #ifdef PY_USER_INFO_PATCH
    3000             :         PY_USER_INFO_PATCH(&auth_user_info_Type);
    3001             : #endif
    3002             : #ifdef PY_USER_INFO_TORTURE_PATCH
    3003             :         PY_USER_INFO_TORTURE_PATCH(&auth_user_info_torture_Type);
    3004             : #endif
    3005             : #ifdef PY_USER_INFO_UNIX_PATCH
    3006             :         PY_USER_INFO_UNIX_PATCH(&auth_user_info_unix_Type);
    3007             : #endif
    3008             : #ifdef PY_SIDATTR_PATCH
    3009             :         PY_SIDATTR_PATCH(&auth_SidAttr_Type);
    3010             : #endif
    3011             : #ifdef PY_USER_INFO_DC_PATCH
    3012             :         PY_USER_INFO_DC_PATCH(&auth_user_info_dc_Type);
    3013             : #endif
    3014             : #ifdef PY_SESSION_INFO_PATCH
    3015        3610 :         PY_SESSION_INFO_PATCH(&auth_session_info_Type);
    3016             : #endif
    3017             : #ifdef PY_SESSION_INFO_TRANSPORT_PATCH
    3018             :         PY_SESSION_INFO_TRANSPORT_PATCH(&auth_session_info_transport_Type);
    3019             : #endif
    3020             : 
    3021        3610 :         m = PyModule_Create(&moduledef);
    3022        3610 :         if (m == NULL)
    3023           0 :                 goto out;
    3024             : 
    3025        3610 :         PyModule_AddObject(m, "SEC_AUTH_METHOD_UNAUTHENTICATED", PyLong_FromLong((uint16_t)(SEC_AUTH_METHOD_UNAUTHENTICATED)));
    3026        3610 :         PyModule_AddObject(m, "SEC_AUTH_METHOD_NTLM", PyLong_FromLong((uint16_t)(SEC_AUTH_METHOD_NTLM)));
    3027        3610 :         PyModule_AddObject(m, "SEC_AUTH_METHOD_KERBEROS", PyLong_FromLong((uint16_t)(SEC_AUTH_METHOD_KERBEROS)));
    3028        3610 :         PyModule_AddObject(m, "TICKET_TYPE_UNKNOWN", PyLong_FromLong((uint16_t)(TICKET_TYPE_UNKNOWN)));
    3029        3610 :         PyModule_AddObject(m, "TICKET_TYPE_TGT", PyLong_FromLong((uint16_t)(TICKET_TYPE_TGT)));
    3030        3610 :         PyModule_AddObject(m, "TICKET_TYPE_NON_TGT", PyLong_FromLong((uint16_t)(TICKET_TYPE_NON_TGT)));
    3031        3610 :         PyModule_AddObject(m, "AUTH_GROUP_INCLUSION_INVALID", PyLong_FromLong((uint16_t)(AUTH_GROUP_INCLUSION_INVALID)));
    3032        3610 :         PyModule_AddObject(m, "AUTH_INCLUDE_RESOURCE_GROUPS", PyLong_FromLong((uint16_t)(AUTH_INCLUDE_RESOURCE_GROUPS)));
    3033        3610 :         PyModule_AddObject(m, "AUTH_INCLUDE_RESOURCE_GROUPS_COMPRESSED", PyLong_FromLong((uint16_t)(AUTH_INCLUDE_RESOURCE_GROUPS_COMPRESSED)));
    3034        3610 :         PyModule_AddObject(m, "AUTH_EXCLUDE_RESOURCE_GROUPS", PyLong_FromLong((uint16_t)(AUTH_EXCLUDE_RESOURCE_GROUPS)));
    3035        2615 :         Py_INCREF((PyObject *)(void *)&auth_user_info_Type);
    3036        3610 :         PyModule_AddObject(m, "user_info", (PyObject *)(void *)&auth_user_info_Type);
    3037        2615 :         Py_INCREF((PyObject *)(void *)&auth_user_info_torture_Type);
    3038        3610 :         PyModule_AddObject(m, "user_info_torture", (PyObject *)(void *)&auth_user_info_torture_Type);
    3039        2615 :         Py_INCREF((PyObject *)(void *)&auth_user_info_unix_Type);
    3040        3610 :         PyModule_AddObject(m, "user_info_unix", (PyObject *)(void *)&auth_user_info_unix_Type);
    3041        2615 :         Py_INCREF((PyObject *)(void *)&auth_SidAttr_Type);
    3042        3610 :         PyModule_AddObject(m, "SidAttr", (PyObject *)(void *)&auth_SidAttr_Type);
    3043        2615 :         Py_INCREF((PyObject *)(void *)&auth_user_info_dc_Type);
    3044        3610 :         PyModule_AddObject(m, "user_info_dc", (PyObject *)(void *)&auth_user_info_dc_Type);
    3045        2615 :         Py_INCREF((PyObject *)(void *)&auth_session_info_Type);
    3046        3610 :         PyModule_AddObject(m, "session_info", (PyObject *)(void *)&auth_session_info_Type);
    3047        2615 :         Py_INCREF((PyObject *)(void *)&auth_session_info_transport_Type);
    3048        3610 :         PyModule_AddObject(m, "session_info_transport", (PyObject *)(void *)&auth_session_info_transport_Type);
    3049             : #ifdef PY_MOD_AUTH_PATCH
    3050             :         PY_MOD_AUTH_PATCH(m);
    3051             : #endif
    3052        3610 :         out:
    3053        3610 :         Py_XDECREF(dep_samba_dcerpc_misc);
    3054        3610 :         Py_XDECREF(dep_samba_dcerpc_security);
    3055        3610 :         Py_XDECREF(dep_samba_dcerpc_lsa);
    3056        3610 :         Py_XDECREF(dep_samba_dcerpc_krb5pac);
    3057        3610 :         Py_XDECREF(dep_talloc);
    3058        3610 :         return m;
    3059             : 
    3060             : }

Generated by: LCOV version 1.14