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_krb5pac.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 4390 : static inline unsigned long long ndr_sizeof2uintmax(size_t var_size)
33 : {
34 4390 : switch (var_size) {
35 16 : case 8:
36 16 : return UINT64_MAX;
37 4374 : case 4:
38 4374 : 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 0 : static inline _MAYBE_UNUSED_ long long ndr_sizeof2intmax(size_t var_size)
49 : {
50 0 : switch (var_size) {
51 0 : case 8:
52 0 : return INT64_MAX;
53 0 : case 4:
54 0 : return INT32_MAX;
55 0 : case 2:
56 0 : return INT16_MAX;
57 0 : case 1:
58 0 : return INT8_MAX;
59 : }
60 :
61 0 : return 0;
62 : }
63 :
64 : #include "librpc/gen_ndr/security.h"
65 : #include "librpc/gen_ndr/lsa.h"
66 : #include "librpc/gen_ndr/netlogon.h"
67 : #include "librpc/gen_ndr/samr.h"
68 : static PyTypeObject PAC_LOGON_NAME_Type;
69 : static PyTypeObject PAC_SIGNATURE_DATA_Type;
70 : static PyTypeObject PAC_DOMAIN_GROUP_MEMBERSHIP_Type;
71 : static PyTypeObject PAC_LOGON_INFO_Type;
72 : static PyTypeObject PAC_CREDENTIAL_NTLM_SECPKG_Type;
73 : static PyTypeObject PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_Type;
74 : static PyTypeObject PAC_CREDENTIAL_DATA_Type;
75 : static PyTypeObject PAC_CREDENTIAL_DATA_CTR_Type;
76 : static PyTypeObject PAC_CREDENTIAL_DATA_NDR_Type;
77 : static PyTypeObject PAC_CREDENTIAL_INFO_Type;
78 : static PyTypeObject PAC_CONSTRAINED_DELEGATION_Type;
79 : static PyTypeObject PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_Type;
80 : static PyTypeObject PAC_UPN_DNS_INFO_EX_Type;
81 : static PyTypeObject PAC_UPN_DNS_INFO_Type;
82 : static PyTypeObject PAC_ATTRIBUTES_INFO_Type;
83 : static PyTypeObject PAC_REQUESTER_SID_Type;
84 : static PyTypeObject PAC_LOGON_INFO_CTR_Type;
85 : static PyTypeObject PAC_CONSTRAINED_DELEGATION_CTR_Type;
86 : static PyTypeObject PAC_DEVICE_INFO_Type;
87 : static PyTypeObject PAC_DEVICE_INFO_CTR_Type;
88 : static PyTypeObject DATA_BLOB_REM_Type;
89 : static PyTypeObject PAC_INFO_Type;
90 : static PyTypeObject PAC_BUFFER_Type;
91 : static PyTypeObject PAC_DATA_Type;
92 : static PyTypeObject PAC_BUFFER_RAW_Type;
93 : static PyTypeObject PAC_DATA_RAW_Type;
94 : static PyTypeObject PAC_Validate_Type;
95 : static PyTypeObject netsamlogoncache_entry_Type;
96 : static PyTypeObject krb5pac_InterfaceType;
97 :
98 : static PyTypeObject *BaseObject_Type;
99 : static PyTypeObject *dom_sid_Type;
100 : static PyTypeObject *samr_RidWithAttributeArray_Type;
101 : static PyTypeObject *netr_SamInfo3_Type;
102 : static PyTypeObject *samr_Password_Type;
103 : static PyTypeObject *lsa_String_Type;
104 : static PyTypeObject *netr_SidAttr_Type;
105 : static PyTypeObject *ClientConnection_Type;
106 : static PyTypeObject *ndr_syntax_id_Type;
107 :
108 0 : static PyObject *py_PAC_LOGON_NAME_get_logon_time(PyObject *obj, void *closure)
109 : {
110 0 : struct PAC_LOGON_NAME *object = pytalloc_get_ptr(obj);
111 0 : PyObject *py_logon_time;
112 0 : py_logon_time = PyLong_FromUnsignedLongLong(object->logon_time);
113 0 : return py_logon_time;
114 : }
115 :
116 16 : static int py_PAC_LOGON_NAME_set_logon_time(PyObject *py_obj, PyObject *value, void *closure)
117 : {
118 16 : struct PAC_LOGON_NAME *object = pytalloc_get_ptr(py_obj);
119 16 : if (value == NULL) {
120 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->logon_time");
121 0 : return -1;
122 : }
123 : {
124 16 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->logon_time));
125 16 : if (PyLong_Check(value)) {
126 0 : unsigned long long test_var;
127 16 : test_var = PyLong_AsUnsignedLongLong(value);
128 16 : if (PyErr_Occurred() != NULL) {
129 0 : return -1;
130 : }
131 16 : if (test_var > uint_max) {
132 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
133 : PyLong_Type.tp_name, uint_max, test_var);
134 0 : return -1;
135 : }
136 16 : object->logon_time = test_var;
137 : } else {
138 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
139 : PyLong_Type.tp_name);
140 0 : return -1;
141 : }
142 : }
143 16 : return 0;
144 : }
145 :
146 0 : static PyObject *py_PAC_LOGON_NAME_get_size(PyObject *obj, void *closure)
147 : {
148 0 : struct PAC_LOGON_NAME *object = pytalloc_get_ptr(obj);
149 0 : PyObject *py_size;
150 0 : py_size = PyLong_FromLong((uint16_t)(object->size));
151 0 : return py_size;
152 : }
153 :
154 0 : static int py_PAC_LOGON_NAME_set_size(PyObject *py_obj, PyObject *value, void *closure)
155 : {
156 0 : struct PAC_LOGON_NAME *object = pytalloc_get_ptr(py_obj);
157 0 : if (value == NULL) {
158 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->size");
159 0 : return -1;
160 : }
161 : {
162 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->size));
163 0 : if (PyLong_Check(value)) {
164 0 : unsigned long long test_var;
165 0 : test_var = PyLong_AsUnsignedLongLong(value);
166 0 : if (PyErr_Occurred() != NULL) {
167 0 : return -1;
168 : }
169 0 : if (test_var > uint_max) {
170 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
171 : PyLong_Type.tp_name, uint_max, test_var);
172 0 : return -1;
173 : }
174 0 : object->size = test_var;
175 : } else {
176 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
177 : PyLong_Type.tp_name);
178 0 : return -1;
179 : }
180 : }
181 0 : return 0;
182 : }
183 :
184 8474 : static PyObject *py_PAC_LOGON_NAME_get_account_name(PyObject *obj, void *closure)
185 : {
186 8474 : struct PAC_LOGON_NAME *object = pytalloc_get_ptr(obj);
187 0 : PyObject *py_account_name;
188 8474 : if (object->account_name == NULL) {
189 0 : py_account_name = Py_None;
190 0 : Py_INCREF(py_account_name);
191 : } else {
192 8474 : py_account_name = PyUnicode_Decode(object->account_name, strlen(object->account_name), "utf-8", "ignore");
193 : }
194 8474 : return py_account_name;
195 : }
196 :
197 6 : static int py_PAC_LOGON_NAME_set_account_name(PyObject *py_obj, PyObject *value, void *closure)
198 : {
199 6 : struct PAC_LOGON_NAME *object = pytalloc_get_ptr(py_obj);
200 6 : if (value == NULL) {
201 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->account_name");
202 0 : return -1;
203 : }
204 : {
205 0 : const char *test_str;
206 0 : const char *talloc_str;
207 6 : PyObject *unicode = NULL;
208 6 : if (PyUnicode_Check(value)) {
209 6 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
210 6 : if (unicode == NULL) {
211 0 : return -1;
212 : }
213 6 : test_str = PyBytes_AS_STRING(unicode);
214 0 : } else if (PyBytes_Check(value)) {
215 0 : test_str = PyBytes_AS_STRING(value);
216 : } else {
217 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
218 0 : return -1;
219 : }
220 6 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
221 6 : if (unicode != NULL) {
222 3 : Py_DECREF(unicode);
223 : }
224 6 : if (talloc_str == NULL) {
225 0 : PyErr_NoMemory();
226 0 : return -1;
227 : }
228 6 : object->account_name = talloc_str;
229 : }
230 6 : return 0;
231 : }
232 :
233 : static PyGetSetDef py_PAC_LOGON_NAME_getsetters[] = {
234 : {
235 : .name = discard_const_p(char, "logon_time"),
236 : .get = py_PAC_LOGON_NAME_get_logon_time,
237 : .set = py_PAC_LOGON_NAME_set_logon_time,
238 : .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
239 : },
240 : {
241 : .name = discard_const_p(char, "size"),
242 : .get = py_PAC_LOGON_NAME_get_size,
243 : .set = py_PAC_LOGON_NAME_set_size,
244 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
245 : },
246 : {
247 : .name = discard_const_p(char, "account_name"),
248 : .get = py_PAC_LOGON_NAME_get_account_name,
249 : .set = py_PAC_LOGON_NAME_set_account_name,
250 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
251 : },
252 : { .name = NULL }
253 : };
254 :
255 0 : static PyObject *py_PAC_LOGON_NAME_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
256 : {
257 0 : return pytalloc_new(struct PAC_LOGON_NAME, type);
258 : }
259 :
260 :
261 : static PyTypeObject PAC_LOGON_NAME_Type = {
262 : PyVarObject_HEAD_INIT(NULL, 0)
263 : .tp_name = "krb5pac.PAC_LOGON_NAME",
264 : .tp_getset = py_PAC_LOGON_NAME_getsetters,
265 : .tp_methods = NULL,
266 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
267 : .tp_new = py_PAC_LOGON_NAME_new,
268 : };
269 :
270 :
271 24588 : static PyObject *py_PAC_SIGNATURE_DATA_get_type(PyObject *obj, void *closure)
272 : {
273 24588 : struct PAC_SIGNATURE_DATA *object = pytalloc_get_ptr(obj);
274 0 : PyObject *py_type;
275 24588 : py_type = PyLong_FromUnsignedLongLong((uint32_t)(object->type));
276 24588 : return py_type;
277 : }
278 :
279 3489 : static int py_PAC_SIGNATURE_DATA_set_type(PyObject *py_obj, PyObject *value, void *closure)
280 : {
281 3489 : struct PAC_SIGNATURE_DATA *object = pytalloc_get_ptr(py_obj);
282 3489 : if (value == NULL) {
283 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->type");
284 0 : return -1;
285 : }
286 : {
287 3489 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->type));
288 3489 : if (PyLong_Check(value)) {
289 0 : unsigned long long test_var;
290 3489 : test_var = PyLong_AsUnsignedLongLong(value);
291 3489 : if (PyErr_Occurred() != NULL) {
292 0 : return -1;
293 : }
294 3489 : if (test_var > uint_max) {
295 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
296 : PyLong_Type.tp_name, uint_max, test_var);
297 0 : return -1;
298 : }
299 3489 : object->type = test_var;
300 : } else {
301 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
302 : PyLong_Type.tp_name);
303 0 : return -1;
304 : }
305 : }
306 3489 : return 0;
307 : }
308 :
309 24588 : static PyObject *py_PAC_SIGNATURE_DATA_get_signature(PyObject *obj, void *closure)
310 : {
311 24588 : struct PAC_SIGNATURE_DATA *object = pytalloc_get_ptr(obj);
312 0 : PyObject *py_signature;
313 24588 : py_signature = PyBytes_FromStringAndSize((char *)(object->signature).data, (object->signature).length);
314 24588 : return py_signature;
315 : }
316 :
317 27203 : static int py_PAC_SIGNATURE_DATA_set_signature(PyObject *py_obj, PyObject *value, void *closure)
318 : {
319 27203 : struct PAC_SIGNATURE_DATA *object = pytalloc_get_ptr(py_obj);
320 27203 : if (value == NULL) {
321 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->signature");
322 0 : return -1;
323 : }
324 27203 : object->signature = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
325 27203 : return 0;
326 : }
327 :
328 : static PyGetSetDef py_PAC_SIGNATURE_DATA_getsetters[] = {
329 : {
330 : .name = discard_const_p(char, "type"),
331 : .get = py_PAC_SIGNATURE_DATA_get_type,
332 : .set = py_PAC_SIGNATURE_DATA_set_type,
333 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
334 : },
335 : {
336 : .name = discard_const_p(char, "signature"),
337 : .get = py_PAC_SIGNATURE_DATA_get_signature,
338 : .set = py_PAC_SIGNATURE_DATA_set_signature,
339 : .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
340 : },
341 : { .name = NULL }
342 : };
343 :
344 20457 : static PyObject *py_PAC_SIGNATURE_DATA_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
345 : {
346 20457 : return pytalloc_new(struct PAC_SIGNATURE_DATA, type);
347 : }
348 :
349 20425 : static PyObject *py_PAC_SIGNATURE_DATA_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
350 : {
351 20425 : struct PAC_SIGNATURE_DATA *object = pytalloc_get_ptr(py_obj);
352 20425 : PyObject *ret = NULL;
353 0 : DATA_BLOB blob;
354 0 : enum ndr_err_code err;
355 20425 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
356 20425 : if (tmp_ctx == NULL) {
357 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
358 0 : return NULL;
359 : }
360 20425 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_PAC_SIGNATURE_DATA);
361 20425 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
362 0 : TALLOC_FREE(tmp_ctx);
363 0 : PyErr_SetNdrError(err);
364 0 : return NULL;
365 : }
366 :
367 20425 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
368 20425 : TALLOC_FREE(tmp_ctx);
369 20425 : return ret;
370 : }
371 :
372 20425 : static PyObject *py_PAC_SIGNATURE_DATA_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
373 : {
374 20425 : struct PAC_SIGNATURE_DATA *object = pytalloc_get_ptr(py_obj);
375 20425 : DATA_BLOB blob = {.data = NULL, .length = 0};
376 20425 : Py_ssize_t blob_length = 0;
377 0 : enum ndr_err_code err;
378 20425 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
379 20425 : PyObject *allow_remaining_obj = NULL;
380 20425 : bool allow_remaining = false;
381 :
382 20425 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
383 : discard_const_p(char *, kwnames),
384 : &blob.data, &blob_length,
385 : &allow_remaining_obj)) {
386 0 : return NULL;
387 : }
388 20425 : blob.length = blob_length;
389 :
390 20425 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
391 0 : allow_remaining = true;
392 : }
393 :
394 20425 : if (allow_remaining) {
395 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_SIGNATURE_DATA);
396 : } else {
397 20425 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_SIGNATURE_DATA);
398 : }
399 20425 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
400 0 : PyErr_SetNdrError(err);
401 0 : return NULL;
402 : }
403 :
404 20425 : Py_RETURN_NONE;
405 : }
406 :
407 0 : static PyObject *py_PAC_SIGNATURE_DATA_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
408 : {
409 0 : struct PAC_SIGNATURE_DATA *object = pytalloc_get_ptr(py_obj);
410 0 : PyObject *ret;
411 0 : char *retstr;
412 :
413 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_PAC_SIGNATURE_DATA, "PAC_SIGNATURE_DATA", object);
414 0 : ret = PyUnicode_FromString(retstr);
415 0 : talloc_free(retstr);
416 :
417 0 : return ret;
418 : }
419 :
420 : static PyMethodDef py_PAC_SIGNATURE_DATA_methods[] = {
421 : { "__ndr_pack__", (PyCFunction)py_PAC_SIGNATURE_DATA_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
422 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PAC_SIGNATURE_DATA_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
423 : { "__ndr_print__", (PyCFunction)py_PAC_SIGNATURE_DATA_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
424 : { NULL, NULL, 0, NULL }
425 : };
426 :
427 :
428 : static PyTypeObject PAC_SIGNATURE_DATA_Type = {
429 : PyVarObject_HEAD_INIT(NULL, 0)
430 : .tp_name = "krb5pac.PAC_SIGNATURE_DATA",
431 : .tp_getset = py_PAC_SIGNATURE_DATA_getsetters,
432 : .tp_methods = py_PAC_SIGNATURE_DATA_methods,
433 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
434 : .tp_new = py_PAC_SIGNATURE_DATA_new,
435 : };
436 :
437 :
438 99 : static PyObject *py_PAC_DOMAIN_GROUP_MEMBERSHIP_get_domain_sid(PyObject *obj, void *closure)
439 : {
440 99 : struct PAC_DOMAIN_GROUP_MEMBERSHIP *object = pytalloc_get_ptr(obj);
441 0 : PyObject *py_domain_sid;
442 99 : if (object->domain_sid == NULL) {
443 0 : Py_RETURN_NONE;
444 : }
445 99 : if (object->domain_sid == NULL) {
446 0 : py_domain_sid = Py_None;
447 0 : Py_INCREF(py_domain_sid);
448 : } else {
449 99 : py_domain_sid = pytalloc_reference_ex(dom_sid_Type, object->domain_sid, object->domain_sid);
450 : }
451 99 : return py_domain_sid;
452 : }
453 :
454 499 : static int py_PAC_DOMAIN_GROUP_MEMBERSHIP_set_domain_sid(PyObject *py_obj, PyObject *value, void *closure)
455 : {
456 499 : struct PAC_DOMAIN_GROUP_MEMBERSHIP *object = pytalloc_get_ptr(py_obj);
457 499 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->domain_sid));
458 499 : if (value == NULL) {
459 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->domain_sid");
460 0 : return -1;
461 : }
462 499 : if (value == Py_None) {
463 449 : object->domain_sid = NULL;
464 : } else {
465 50 : object->domain_sid = NULL;
466 50 : PY_CHECK_TYPE(dom_sid_Type, value, return -1;);
467 50 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
468 0 : PyErr_NoMemory();
469 0 : return -1;
470 : }
471 50 : object->domain_sid = (struct dom_sid *)pytalloc_get_ptr(value);
472 : }
473 499 : return 0;
474 : }
475 :
476 1839 : static PyObject *py_PAC_DOMAIN_GROUP_MEMBERSHIP_get_groups(PyObject *obj, void *closure)
477 : {
478 1839 : struct PAC_DOMAIN_GROUP_MEMBERSHIP *object = pytalloc_get_ptr(obj);
479 0 : PyObject *py_groups;
480 1839 : py_groups = pytalloc_reference_ex(samr_RidWithAttributeArray_Type, pytalloc_get_mem_ctx(obj), &object->groups);
481 1839 : return py_groups;
482 : }
483 :
484 0 : static int py_PAC_DOMAIN_GROUP_MEMBERSHIP_set_groups(PyObject *py_obj, PyObject *value, void *closure)
485 : {
486 0 : struct PAC_DOMAIN_GROUP_MEMBERSHIP *object = pytalloc_get_ptr(py_obj);
487 0 : if (value == NULL) {
488 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->groups");
489 0 : return -1;
490 : }
491 0 : PY_CHECK_TYPE(samr_RidWithAttributeArray_Type, value, return -1;);
492 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
493 0 : PyErr_NoMemory();
494 0 : return -1;
495 : }
496 0 : object->groups = *(struct samr_RidWithAttributeArray *)pytalloc_get_ptr(value);
497 0 : return 0;
498 : }
499 :
500 : static PyGetSetDef py_PAC_DOMAIN_GROUP_MEMBERSHIP_getsetters[] = {
501 : {
502 : .name = discard_const_p(char, "domain_sid"),
503 : .get = py_PAC_DOMAIN_GROUP_MEMBERSHIP_get_domain_sid,
504 : .set = py_PAC_DOMAIN_GROUP_MEMBERSHIP_set_domain_sid,
505 : .doc = discard_const_p(char, "PIDL-generated element of base type dom_sid2")
506 : },
507 : {
508 : .name = discard_const_p(char, "groups"),
509 : .get = py_PAC_DOMAIN_GROUP_MEMBERSHIP_get_groups,
510 : .set = py_PAC_DOMAIN_GROUP_MEMBERSHIP_set_groups,
511 : .doc = discard_const_p(char, "PIDL-generated element of base type samr_RidWithAttributeArray")
512 : },
513 : { .name = NULL }
514 : };
515 :
516 0 : static PyObject *py_PAC_DOMAIN_GROUP_MEMBERSHIP_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
517 : {
518 0 : return pytalloc_new(struct PAC_DOMAIN_GROUP_MEMBERSHIP, type);
519 : }
520 :
521 :
522 : static PyTypeObject PAC_DOMAIN_GROUP_MEMBERSHIP_Type = {
523 : PyVarObject_HEAD_INIT(NULL, 0)
524 : .tp_name = "krb5pac.PAC_DOMAIN_GROUP_MEMBERSHIP",
525 : .tp_getset = py_PAC_DOMAIN_GROUP_MEMBERSHIP_getsetters,
526 : .tp_methods = NULL,
527 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
528 : .tp_new = py_PAC_DOMAIN_GROUP_MEMBERSHIP_new,
529 : };
530 :
531 :
532 21313 : static PyObject *py_PAC_LOGON_INFO_get_info3(PyObject *obj, void *closure)
533 : {
534 21313 : struct PAC_LOGON_INFO *object = pytalloc_get_ptr(obj);
535 2 : PyObject *py_info3;
536 21313 : py_info3 = pytalloc_reference_ex(netr_SamInfo3_Type, pytalloc_get_mem_ctx(obj), &object->info3);
537 21313 : return py_info3;
538 : }
539 :
540 0 : static int py_PAC_LOGON_INFO_set_info3(PyObject *py_obj, PyObject *value, void *closure)
541 : {
542 0 : struct PAC_LOGON_INFO *object = pytalloc_get_ptr(py_obj);
543 0 : if (value == NULL) {
544 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->info3");
545 0 : return -1;
546 : }
547 0 : PY_CHECK_TYPE(netr_SamInfo3_Type, value, return -1;);
548 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
549 0 : PyErr_NoMemory();
550 0 : return -1;
551 : }
552 0 : object->info3 = *(struct netr_SamInfo3 *)pytalloc_get_ptr(value);
553 0 : return 0;
554 : }
555 :
556 9529 : static PyObject *py_PAC_LOGON_INFO_get_resource_groups(PyObject *obj, void *closure)
557 : {
558 9529 : struct PAC_LOGON_INFO *object = pytalloc_get_ptr(obj);
559 0 : PyObject *py_resource_groups;
560 9529 : py_resource_groups = pytalloc_reference_ex(&PAC_DOMAIN_GROUP_MEMBERSHIP_Type, pytalloc_get_mem_ctx(obj), &object->resource_groups);
561 9529 : return py_resource_groups;
562 : }
563 :
564 0 : static int py_PAC_LOGON_INFO_set_resource_groups(PyObject *py_obj, PyObject *value, void *closure)
565 : {
566 0 : struct PAC_LOGON_INFO *object = pytalloc_get_ptr(py_obj);
567 0 : if (value == NULL) {
568 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->resource_groups");
569 0 : return -1;
570 : }
571 0 : PY_CHECK_TYPE(&PAC_DOMAIN_GROUP_MEMBERSHIP_Type, value, return -1;);
572 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
573 0 : PyErr_NoMemory();
574 0 : return -1;
575 : }
576 0 : object->resource_groups = *(struct PAC_DOMAIN_GROUP_MEMBERSHIP *)pytalloc_get_ptr(value);
577 0 : return 0;
578 : }
579 :
580 : static PyGetSetDef py_PAC_LOGON_INFO_getsetters[] = {
581 : {
582 : .name = discard_const_p(char, "info3"),
583 : .get = py_PAC_LOGON_INFO_get_info3,
584 : .set = py_PAC_LOGON_INFO_set_info3,
585 : .doc = discard_const_p(char, "PIDL-generated element of base type netr_SamInfo3")
586 : },
587 : {
588 : .name = discard_const_p(char, "resource_groups"),
589 : .get = py_PAC_LOGON_INFO_get_resource_groups,
590 : .set = py_PAC_LOGON_INFO_set_resource_groups,
591 : .doc = discard_const_p(char, "PIDL-generated element of base type PAC_DOMAIN_GROUP_MEMBERSHIP")
592 : },
593 : { .name = NULL }
594 : };
595 :
596 0 : static PyObject *py_PAC_LOGON_INFO_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
597 : {
598 0 : return pytalloc_new(struct PAC_LOGON_INFO, type);
599 : }
600 :
601 :
602 : static PyTypeObject PAC_LOGON_INFO_Type = {
603 : PyVarObject_HEAD_INIT(NULL, 0)
604 : .tp_name = "krb5pac.PAC_LOGON_INFO",
605 : .tp_getset = py_PAC_LOGON_INFO_getsetters,
606 : .tp_methods = NULL,
607 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
608 : .tp_new = py_PAC_LOGON_INFO_new,
609 : };
610 :
611 :
612 27 : static PyObject *py_PAC_CREDENTIAL_NTLM_SECPKG_get_version(PyObject *obj, void *closure)
613 : {
614 27 : struct PAC_CREDENTIAL_NTLM_SECPKG *object = pytalloc_get_ptr(obj);
615 0 : PyObject *py_version;
616 27 : py_version = PyLong_FromUnsignedLongLong((uint32_t)(object->version));
617 27 : return py_version;
618 : }
619 :
620 0 : static int py_PAC_CREDENTIAL_NTLM_SECPKG_set_version(PyObject *py_obj, PyObject *value, void *closure)
621 : {
622 0 : struct PAC_CREDENTIAL_NTLM_SECPKG *object = pytalloc_get_ptr(py_obj);
623 0 : if (value == NULL) {
624 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->version");
625 0 : return -1;
626 : }
627 : {
628 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->version));
629 0 : if (PyLong_Check(value)) {
630 0 : unsigned long long test_var;
631 0 : test_var = PyLong_AsUnsignedLongLong(value);
632 0 : if (PyErr_Occurred() != NULL) {
633 0 : return -1;
634 : }
635 0 : if (test_var > uint_max) {
636 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
637 : PyLong_Type.tp_name, uint_max, test_var);
638 0 : return -1;
639 : }
640 0 : object->version = test_var;
641 : } else {
642 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
643 : PyLong_Type.tp_name);
644 0 : return -1;
645 : }
646 : }
647 0 : return 0;
648 : }
649 :
650 27 : static PyObject *py_PAC_CREDENTIAL_NTLM_SECPKG_get_flags(PyObject *obj, void *closure)
651 : {
652 27 : struct PAC_CREDENTIAL_NTLM_SECPKG *object = pytalloc_get_ptr(obj);
653 0 : PyObject *py_flags;
654 27 : py_flags = PyLong_FromUnsignedLongLong((uint32_t)(object->flags));
655 27 : return py_flags;
656 : }
657 :
658 0 : static int py_PAC_CREDENTIAL_NTLM_SECPKG_set_flags(PyObject *py_obj, PyObject *value, void *closure)
659 : {
660 0 : struct PAC_CREDENTIAL_NTLM_SECPKG *object = pytalloc_get_ptr(py_obj);
661 0 : if (value == NULL) {
662 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->flags");
663 0 : return -1;
664 : }
665 : {
666 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->flags));
667 0 : if (PyLong_Check(value)) {
668 0 : unsigned long long test_var;
669 0 : test_var = PyLong_AsUnsignedLongLong(value);
670 0 : if (PyErr_Occurred() != NULL) {
671 0 : return -1;
672 : }
673 0 : if (test_var > uint_max) {
674 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
675 : PyLong_Type.tp_name, uint_max, test_var);
676 0 : return -1;
677 : }
678 0 : object->flags = test_var;
679 : } else {
680 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
681 : PyLong_Type.tp_name);
682 0 : return -1;
683 : }
684 : }
685 0 : return 0;
686 : }
687 :
688 27 : static PyObject *py_PAC_CREDENTIAL_NTLM_SECPKG_get_lm_password(PyObject *obj, void *closure)
689 : {
690 27 : struct PAC_CREDENTIAL_NTLM_SECPKG *object = pytalloc_get_ptr(obj);
691 0 : PyObject *py_lm_password;
692 27 : py_lm_password = pytalloc_reference_ex(samr_Password_Type, pytalloc_get_mem_ctx(obj), &object->lm_password);
693 27 : return py_lm_password;
694 : }
695 :
696 0 : static int py_PAC_CREDENTIAL_NTLM_SECPKG_set_lm_password(PyObject *py_obj, PyObject *value, void *closure)
697 : {
698 0 : struct PAC_CREDENTIAL_NTLM_SECPKG *object = pytalloc_get_ptr(py_obj);
699 0 : if (value == NULL) {
700 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->lm_password");
701 0 : return -1;
702 : }
703 0 : PY_CHECK_TYPE(samr_Password_Type, value, return -1;);
704 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
705 0 : PyErr_NoMemory();
706 0 : return -1;
707 : }
708 0 : object->lm_password = *(struct samr_Password *)pytalloc_get_ptr(value);
709 0 : return 0;
710 : }
711 :
712 54 : static PyObject *py_PAC_CREDENTIAL_NTLM_SECPKG_get_nt_password(PyObject *obj, void *closure)
713 : {
714 54 : struct PAC_CREDENTIAL_NTLM_SECPKG *object = pytalloc_get_ptr(obj);
715 0 : PyObject *py_nt_password;
716 54 : py_nt_password = pytalloc_reference_ex(samr_Password_Type, pytalloc_get_mem_ctx(obj), &object->nt_password);
717 54 : return py_nt_password;
718 : }
719 :
720 0 : static int py_PAC_CREDENTIAL_NTLM_SECPKG_set_nt_password(PyObject *py_obj, PyObject *value, void *closure)
721 : {
722 0 : struct PAC_CREDENTIAL_NTLM_SECPKG *object = pytalloc_get_ptr(py_obj);
723 0 : if (value == NULL) {
724 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->nt_password");
725 0 : return -1;
726 : }
727 0 : PY_CHECK_TYPE(samr_Password_Type, value, return -1;);
728 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
729 0 : PyErr_NoMemory();
730 0 : return -1;
731 : }
732 0 : object->nt_password = *(struct samr_Password *)pytalloc_get_ptr(value);
733 0 : return 0;
734 : }
735 :
736 : static PyGetSetDef py_PAC_CREDENTIAL_NTLM_SECPKG_getsetters[] = {
737 : {
738 : .name = discard_const_p(char, "version"),
739 : .get = py_PAC_CREDENTIAL_NTLM_SECPKG_get_version,
740 : .set = py_PAC_CREDENTIAL_NTLM_SECPKG_set_version,
741 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
742 : },
743 : {
744 : .name = discard_const_p(char, "flags"),
745 : .get = py_PAC_CREDENTIAL_NTLM_SECPKG_get_flags,
746 : .set = py_PAC_CREDENTIAL_NTLM_SECPKG_set_flags,
747 : .doc = discard_const_p(char, "PIDL-generated element of base type PAC_CREDENTIAL_NTLM_FLAGS")
748 : },
749 : {
750 : .name = discard_const_p(char, "lm_password"),
751 : .get = py_PAC_CREDENTIAL_NTLM_SECPKG_get_lm_password,
752 : .set = py_PAC_CREDENTIAL_NTLM_SECPKG_set_lm_password,
753 : .doc = discard_const_p(char, "PIDL-generated element of base type samr_Password")
754 : },
755 : {
756 : .name = discard_const_p(char, "nt_password"),
757 : .get = py_PAC_CREDENTIAL_NTLM_SECPKG_get_nt_password,
758 : .set = py_PAC_CREDENTIAL_NTLM_SECPKG_set_nt_password,
759 : .doc = discard_const_p(char, "PIDL-generated element of base type samr_Password")
760 : },
761 : { .name = NULL }
762 : };
763 :
764 27 : static PyObject *py_PAC_CREDENTIAL_NTLM_SECPKG_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
765 : {
766 27 : return pytalloc_new(struct PAC_CREDENTIAL_NTLM_SECPKG, type);
767 : }
768 :
769 0 : static PyObject *py_PAC_CREDENTIAL_NTLM_SECPKG_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
770 : {
771 0 : struct PAC_CREDENTIAL_NTLM_SECPKG *object = pytalloc_get_ptr(py_obj);
772 0 : PyObject *ret = NULL;
773 0 : DATA_BLOB blob;
774 0 : enum ndr_err_code err;
775 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
776 0 : if (tmp_ctx == NULL) {
777 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
778 0 : return NULL;
779 : }
780 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_PAC_CREDENTIAL_NTLM_SECPKG);
781 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
782 0 : TALLOC_FREE(tmp_ctx);
783 0 : PyErr_SetNdrError(err);
784 0 : return NULL;
785 : }
786 :
787 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
788 0 : TALLOC_FREE(tmp_ctx);
789 0 : return ret;
790 : }
791 :
792 27 : static PyObject *py_PAC_CREDENTIAL_NTLM_SECPKG_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
793 : {
794 27 : struct PAC_CREDENTIAL_NTLM_SECPKG *object = pytalloc_get_ptr(py_obj);
795 27 : DATA_BLOB blob = {.data = NULL, .length = 0};
796 27 : Py_ssize_t blob_length = 0;
797 0 : enum ndr_err_code err;
798 27 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
799 27 : PyObject *allow_remaining_obj = NULL;
800 27 : bool allow_remaining = false;
801 :
802 27 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
803 : discard_const_p(char *, kwnames),
804 : &blob.data, &blob_length,
805 : &allow_remaining_obj)) {
806 0 : return NULL;
807 : }
808 27 : blob.length = blob_length;
809 :
810 27 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
811 0 : allow_remaining = true;
812 : }
813 :
814 27 : if (allow_remaining) {
815 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_CREDENTIAL_NTLM_SECPKG);
816 : } else {
817 27 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_CREDENTIAL_NTLM_SECPKG);
818 : }
819 27 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
820 0 : PyErr_SetNdrError(err);
821 0 : return NULL;
822 : }
823 :
824 27 : Py_RETURN_NONE;
825 : }
826 :
827 0 : static PyObject *py_PAC_CREDENTIAL_NTLM_SECPKG_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
828 : {
829 0 : struct PAC_CREDENTIAL_NTLM_SECPKG *object = pytalloc_get_ptr(py_obj);
830 0 : PyObject *ret;
831 0 : char *retstr;
832 :
833 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_PAC_CREDENTIAL_NTLM_SECPKG, "PAC_CREDENTIAL_NTLM_SECPKG", object);
834 0 : ret = PyUnicode_FromString(retstr);
835 0 : talloc_free(retstr);
836 :
837 0 : return ret;
838 : }
839 :
840 : static PyMethodDef py_PAC_CREDENTIAL_NTLM_SECPKG_methods[] = {
841 : { "__ndr_pack__", (PyCFunction)py_PAC_CREDENTIAL_NTLM_SECPKG_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
842 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PAC_CREDENTIAL_NTLM_SECPKG_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
843 : { "__ndr_print__", (PyCFunction)py_PAC_CREDENTIAL_NTLM_SECPKG_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
844 : { NULL, NULL, 0, NULL }
845 : };
846 :
847 :
848 : static PyTypeObject PAC_CREDENTIAL_NTLM_SECPKG_Type = {
849 : PyVarObject_HEAD_INIT(NULL, 0)
850 : .tp_name = "krb5pac.PAC_CREDENTIAL_NTLM_SECPKG",
851 : .tp_getset = py_PAC_CREDENTIAL_NTLM_SECPKG_getsetters,
852 : .tp_methods = py_PAC_CREDENTIAL_NTLM_SECPKG_methods,
853 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
854 : .tp_new = py_PAC_CREDENTIAL_NTLM_SECPKG_new,
855 : };
856 :
857 :
858 27 : static PyObject *py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_get_package_name(PyObject *obj, void *closure)
859 : {
860 27 : struct PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG *object = pytalloc_get_ptr(obj);
861 0 : PyObject *py_package_name;
862 27 : py_package_name = pytalloc_reference_ex(lsa_String_Type, pytalloc_get_mem_ctx(obj), &object->package_name);
863 27 : return py_package_name;
864 : }
865 :
866 0 : static int py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_set_package_name(PyObject *py_obj, PyObject *value, void *closure)
867 : {
868 0 : struct PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG *object = pytalloc_get_ptr(py_obj);
869 0 : if (value == NULL) {
870 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->package_name");
871 0 : return -1;
872 : }
873 0 : PY_CHECK_TYPE(lsa_String_Type, value, return -1;);
874 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
875 0 : PyErr_NoMemory();
876 0 : return -1;
877 : }
878 0 : object->package_name = *(struct lsa_String *)pytalloc_get_ptr(value);
879 0 : return 0;
880 : }
881 :
882 0 : static PyObject *py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_get_credential_size(PyObject *obj, void *closure)
883 : {
884 0 : struct PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG *object = pytalloc_get_ptr(obj);
885 0 : PyObject *py_credential_size;
886 0 : py_credential_size = PyLong_FromUnsignedLongLong((uint32_t)(object->credential_size));
887 0 : return py_credential_size;
888 : }
889 :
890 0 : static int py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_set_credential_size(PyObject *py_obj, PyObject *value, void *closure)
891 : {
892 0 : struct PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG *object = pytalloc_get_ptr(py_obj);
893 0 : if (value == NULL) {
894 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->credential_size");
895 0 : return -1;
896 : }
897 : {
898 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->credential_size));
899 0 : if (PyLong_Check(value)) {
900 0 : unsigned long long test_var;
901 0 : test_var = PyLong_AsUnsignedLongLong(value);
902 0 : if (PyErr_Occurred() != NULL) {
903 0 : return -1;
904 : }
905 0 : if (test_var > uint_max) {
906 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
907 : PyLong_Type.tp_name, uint_max, test_var);
908 0 : return -1;
909 : }
910 0 : object->credential_size = test_var;
911 : } else {
912 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
913 : PyLong_Type.tp_name);
914 0 : return -1;
915 : }
916 : }
917 0 : return 0;
918 : }
919 :
920 27 : static PyObject *py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_get_credential(PyObject *obj, void *closure)
921 : {
922 27 : struct PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG *object = pytalloc_get_ptr(obj);
923 0 : PyObject *py_credential;
924 27 : if (object->credential == NULL) {
925 0 : Py_RETURN_NONE;
926 : }
927 27 : if (object->credential == NULL) {
928 0 : py_credential = Py_None;
929 0 : Py_INCREF(py_credential);
930 : } else {
931 27 : py_credential = PyList_New(object->credential_size);
932 27 : if (py_credential == NULL) {
933 0 : return NULL;
934 : }
935 : {
936 : int credential_cntr_1;
937 1107 : for (credential_cntr_1 = 0; credential_cntr_1 < (object->credential_size); credential_cntr_1++) {
938 0 : PyObject *py_credential_1;
939 1080 : py_credential_1 = PyLong_FromLong((uint16_t)((object->credential)[credential_cntr_1]));
940 1080 : PyList_SetItem(py_credential, credential_cntr_1, py_credential_1);
941 : }
942 : }
943 : }
944 27 : return py_credential;
945 : }
946 :
947 0 : static int py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_set_credential(PyObject *py_obj, PyObject *value, void *closure)
948 : {
949 0 : struct PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG *object = pytalloc_get_ptr(py_obj);
950 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->credential));
951 0 : if (value == NULL) {
952 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->credential");
953 0 : return -1;
954 : }
955 0 : if (value == Py_None) {
956 0 : object->credential = NULL;
957 : } else {
958 0 : object->credential = NULL;
959 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
960 : {
961 0 : int credential_cntr_1;
962 0 : object->credential = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->credential, PyList_GET_SIZE(value));
963 0 : if (!object->credential) { return -1; }
964 0 : talloc_set_name_const(object->credential, "ARRAY: object->credential");
965 0 : for (credential_cntr_1 = 0; credential_cntr_1 < PyList_GET_SIZE(value); credential_cntr_1++) {
966 0 : if (PyList_GET_ITEM(value, credential_cntr_1) == NULL) {
967 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->credential)[credential_cntr_1]");
968 0 : return -1;
969 : }
970 : {
971 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((object->credential)[credential_cntr_1]));
972 0 : if (PyLong_Check(PyList_GET_ITEM(value, credential_cntr_1))) {
973 0 : unsigned long long test_var;
974 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, credential_cntr_1));
975 0 : if (PyErr_Occurred() != NULL) {
976 0 : return -1;
977 : }
978 0 : if (test_var > uint_max) {
979 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
980 : PyLong_Type.tp_name, uint_max, test_var);
981 0 : return -1;
982 : }
983 0 : (object->credential)[credential_cntr_1] = test_var;
984 : } else {
985 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
986 : PyLong_Type.tp_name);
987 0 : return -1;
988 : }
989 : }
990 : }
991 : }
992 : }
993 0 : return 0;
994 : }
995 :
996 : static PyGetSetDef py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_getsetters[] = {
997 : {
998 : .name = discard_const_p(char, "package_name"),
999 : .get = py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_get_package_name,
1000 : .set = py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_set_package_name,
1001 : .doc = discard_const_p(char, "PIDL-generated element of base type lsa_String")
1002 : },
1003 : {
1004 : .name = discard_const_p(char, "credential_size"),
1005 : .get = py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_get_credential_size,
1006 : .set = py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_set_credential_size,
1007 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
1008 : },
1009 : {
1010 : .name = discard_const_p(char, "credential"),
1011 : .get = py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_get_credential,
1012 : .set = py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_set_credential,
1013 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
1014 : },
1015 : { .name = NULL }
1016 : };
1017 :
1018 0 : static PyObject *py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1019 : {
1020 0 : return pytalloc_new(struct PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG, type);
1021 : }
1022 :
1023 0 : static PyObject *py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
1024 : {
1025 0 : struct PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG *object = pytalloc_get_ptr(py_obj);
1026 0 : PyObject *ret = NULL;
1027 0 : DATA_BLOB blob;
1028 0 : enum ndr_err_code err;
1029 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
1030 0 : if (tmp_ctx == NULL) {
1031 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
1032 0 : return NULL;
1033 : }
1034 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG);
1035 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
1036 0 : TALLOC_FREE(tmp_ctx);
1037 0 : PyErr_SetNdrError(err);
1038 0 : return NULL;
1039 : }
1040 :
1041 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
1042 0 : TALLOC_FREE(tmp_ctx);
1043 0 : return ret;
1044 : }
1045 :
1046 0 : static PyObject *py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
1047 : {
1048 0 : struct PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG *object = pytalloc_get_ptr(py_obj);
1049 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
1050 0 : Py_ssize_t blob_length = 0;
1051 0 : enum ndr_err_code err;
1052 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
1053 0 : PyObject *allow_remaining_obj = NULL;
1054 0 : bool allow_remaining = false;
1055 :
1056 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
1057 : discard_const_p(char *, kwnames),
1058 : &blob.data, &blob_length,
1059 : &allow_remaining_obj)) {
1060 0 : return NULL;
1061 : }
1062 0 : blob.length = blob_length;
1063 :
1064 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
1065 0 : allow_remaining = true;
1066 : }
1067 :
1068 0 : if (allow_remaining) {
1069 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG);
1070 : } else {
1071 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG);
1072 : }
1073 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
1074 0 : PyErr_SetNdrError(err);
1075 0 : return NULL;
1076 : }
1077 :
1078 0 : Py_RETURN_NONE;
1079 : }
1080 :
1081 0 : static PyObject *py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
1082 : {
1083 0 : struct PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG *object = pytalloc_get_ptr(py_obj);
1084 0 : PyObject *ret;
1085 0 : char *retstr;
1086 :
1087 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG, "PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG", object);
1088 0 : ret = PyUnicode_FromString(retstr);
1089 0 : talloc_free(retstr);
1090 :
1091 0 : return ret;
1092 : }
1093 :
1094 : static PyMethodDef py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_methods[] = {
1095 : { "__ndr_pack__", (PyCFunction)py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
1096 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
1097 : { "__ndr_print__", (PyCFunction)py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
1098 : { NULL, NULL, 0, NULL }
1099 : };
1100 :
1101 :
1102 : static PyTypeObject PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_Type = {
1103 : PyVarObject_HEAD_INIT(NULL, 0)
1104 : .tp_name = "krb5pac.PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG",
1105 : .tp_getset = py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_getsetters,
1106 : .tp_methods = py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_methods,
1107 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1108 : .tp_new = py_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_new,
1109 : };
1110 :
1111 :
1112 54 : static PyObject *py_PAC_CREDENTIAL_DATA_get_credential_count(PyObject *obj, void *closure)
1113 : {
1114 54 : struct PAC_CREDENTIAL_DATA *object = pytalloc_get_ptr(obj);
1115 0 : PyObject *py_credential_count;
1116 54 : py_credential_count = PyLong_FromUnsignedLongLong((uint32_t)(object->credential_count));
1117 54 : return py_credential_count;
1118 : }
1119 :
1120 0 : static int py_PAC_CREDENTIAL_DATA_set_credential_count(PyObject *py_obj, PyObject *value, void *closure)
1121 : {
1122 0 : struct PAC_CREDENTIAL_DATA *object = pytalloc_get_ptr(py_obj);
1123 0 : if (value == NULL) {
1124 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->credential_count");
1125 0 : return -1;
1126 : }
1127 : {
1128 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->credential_count));
1129 0 : if (PyLong_Check(value)) {
1130 0 : unsigned long long test_var;
1131 0 : test_var = PyLong_AsUnsignedLongLong(value);
1132 0 : if (PyErr_Occurred() != NULL) {
1133 0 : return -1;
1134 : }
1135 0 : if (test_var > uint_max) {
1136 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1137 : PyLong_Type.tp_name, uint_max, test_var);
1138 0 : return -1;
1139 : }
1140 0 : object->credential_count = test_var;
1141 : } else {
1142 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1143 : PyLong_Type.tp_name);
1144 0 : return -1;
1145 : }
1146 : }
1147 0 : return 0;
1148 : }
1149 :
1150 54 : static PyObject *py_PAC_CREDENTIAL_DATA_get_credentials(PyObject *obj, void *closure)
1151 : {
1152 54 : struct PAC_CREDENTIAL_DATA *object = pytalloc_get_ptr(obj);
1153 0 : PyObject *py_credentials;
1154 54 : py_credentials = PyList_New(object->credential_count);
1155 54 : if (py_credentials == NULL) {
1156 0 : return NULL;
1157 : }
1158 : {
1159 : int credentials_cntr_0;
1160 108 : for (credentials_cntr_0 = 0; credentials_cntr_0 < (object->credential_count); credentials_cntr_0++) {
1161 0 : PyObject *py_credentials_0;
1162 54 : py_credentials_0 = pytalloc_reference_ex(&PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_Type, object->credentials, &(object->credentials)[credentials_cntr_0]);
1163 54 : PyList_SetItem(py_credentials, credentials_cntr_0, py_credentials_0);
1164 : }
1165 : }
1166 54 : return py_credentials;
1167 : }
1168 :
1169 0 : static int py_PAC_CREDENTIAL_DATA_set_credentials(PyObject *py_obj, PyObject *value, void *closure)
1170 : {
1171 0 : struct PAC_CREDENTIAL_DATA *object = pytalloc_get_ptr(py_obj);
1172 0 : if (value == NULL) {
1173 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->credentials");
1174 0 : return -1;
1175 : }
1176 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
1177 : {
1178 0 : int credentials_cntr_0;
1179 0 : object->credentials = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->credentials, PyList_GET_SIZE(value));
1180 0 : if (!object->credentials) { return -1; }
1181 0 : talloc_set_name_const(object->credentials, "ARRAY: object->credentials");
1182 0 : for (credentials_cntr_0 = 0; credentials_cntr_0 < PyList_GET_SIZE(value); credentials_cntr_0++) {
1183 0 : if (PyList_GET_ITEM(value, credentials_cntr_0) == NULL) {
1184 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->credentials)[credentials_cntr_0]");
1185 0 : return -1;
1186 : }
1187 0 : PY_CHECK_TYPE(&PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_Type, PyList_GET_ITEM(value, credentials_cntr_0), return -1;);
1188 0 : if (talloc_reference(object->credentials, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, credentials_cntr_0))) == NULL) {
1189 0 : PyErr_NoMemory();
1190 0 : return -1;
1191 : }
1192 0 : (object->credentials)[credentials_cntr_0] = *(struct PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG *)pytalloc_get_ptr(PyList_GET_ITEM(value, credentials_cntr_0));
1193 : }
1194 : }
1195 0 : return 0;
1196 : }
1197 :
1198 : static PyGetSetDef py_PAC_CREDENTIAL_DATA_getsetters[] = {
1199 : {
1200 : .name = discard_const_p(char, "credential_count"),
1201 : .get = py_PAC_CREDENTIAL_DATA_get_credential_count,
1202 : .set = py_PAC_CREDENTIAL_DATA_set_credential_count,
1203 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
1204 : },
1205 : {
1206 : .name = discard_const_p(char, "credentials"),
1207 : .get = py_PAC_CREDENTIAL_DATA_get_credentials,
1208 : .set = py_PAC_CREDENTIAL_DATA_set_credentials,
1209 : .doc = discard_const_p(char, "PIDL-generated element of base type PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG")
1210 : },
1211 : { .name = NULL }
1212 : };
1213 :
1214 0 : static PyObject *py_PAC_CREDENTIAL_DATA_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1215 : {
1216 0 : return pytalloc_new(struct PAC_CREDENTIAL_DATA, type);
1217 : }
1218 :
1219 0 : static PyObject *py_PAC_CREDENTIAL_DATA_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
1220 : {
1221 0 : struct PAC_CREDENTIAL_DATA *object = pytalloc_get_ptr(py_obj);
1222 0 : PyObject *ret = NULL;
1223 0 : DATA_BLOB blob;
1224 0 : enum ndr_err_code err;
1225 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
1226 0 : if (tmp_ctx == NULL) {
1227 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
1228 0 : return NULL;
1229 : }
1230 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_PAC_CREDENTIAL_DATA);
1231 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
1232 0 : TALLOC_FREE(tmp_ctx);
1233 0 : PyErr_SetNdrError(err);
1234 0 : return NULL;
1235 : }
1236 :
1237 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
1238 0 : TALLOC_FREE(tmp_ctx);
1239 0 : return ret;
1240 : }
1241 :
1242 0 : static PyObject *py_PAC_CREDENTIAL_DATA_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
1243 : {
1244 0 : struct PAC_CREDENTIAL_DATA *object = pytalloc_get_ptr(py_obj);
1245 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
1246 0 : Py_ssize_t blob_length = 0;
1247 0 : enum ndr_err_code err;
1248 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
1249 0 : PyObject *allow_remaining_obj = NULL;
1250 0 : bool allow_remaining = false;
1251 :
1252 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
1253 : discard_const_p(char *, kwnames),
1254 : &blob.data, &blob_length,
1255 : &allow_remaining_obj)) {
1256 0 : return NULL;
1257 : }
1258 0 : blob.length = blob_length;
1259 :
1260 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
1261 0 : allow_remaining = true;
1262 : }
1263 :
1264 0 : if (allow_remaining) {
1265 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_CREDENTIAL_DATA);
1266 : } else {
1267 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_CREDENTIAL_DATA);
1268 : }
1269 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
1270 0 : PyErr_SetNdrError(err);
1271 0 : return NULL;
1272 : }
1273 :
1274 0 : Py_RETURN_NONE;
1275 : }
1276 :
1277 0 : static PyObject *py_PAC_CREDENTIAL_DATA_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
1278 : {
1279 0 : struct PAC_CREDENTIAL_DATA *object = pytalloc_get_ptr(py_obj);
1280 0 : PyObject *ret;
1281 0 : char *retstr;
1282 :
1283 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_PAC_CREDENTIAL_DATA, "PAC_CREDENTIAL_DATA", object);
1284 0 : ret = PyUnicode_FromString(retstr);
1285 0 : talloc_free(retstr);
1286 :
1287 0 : return ret;
1288 : }
1289 :
1290 : static PyMethodDef py_PAC_CREDENTIAL_DATA_methods[] = {
1291 : { "__ndr_pack__", (PyCFunction)py_PAC_CREDENTIAL_DATA_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
1292 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PAC_CREDENTIAL_DATA_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
1293 : { "__ndr_print__", (PyCFunction)py_PAC_CREDENTIAL_DATA_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
1294 : { NULL, NULL, 0, NULL }
1295 : };
1296 :
1297 :
1298 : static PyTypeObject PAC_CREDENTIAL_DATA_Type = {
1299 : PyVarObject_HEAD_INIT(NULL, 0)
1300 : .tp_name = "krb5pac.PAC_CREDENTIAL_DATA",
1301 : .tp_getset = py_PAC_CREDENTIAL_DATA_getsetters,
1302 : .tp_methods = py_PAC_CREDENTIAL_DATA_methods,
1303 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1304 : .tp_new = py_PAC_CREDENTIAL_DATA_new,
1305 : };
1306 :
1307 :
1308 27 : static PyObject *py_PAC_CREDENTIAL_DATA_CTR_get_data(PyObject *obj, void *closure)
1309 : {
1310 27 : struct PAC_CREDENTIAL_DATA_CTR *object = pytalloc_get_ptr(obj);
1311 0 : PyObject *py_data;
1312 27 : if (object->data == NULL) {
1313 0 : Py_RETURN_NONE;
1314 : }
1315 27 : if (object->data == NULL) {
1316 0 : py_data = Py_None;
1317 0 : Py_INCREF(py_data);
1318 : } else {
1319 27 : py_data = pytalloc_reference_ex(&PAC_CREDENTIAL_DATA_Type, object->data, object->data);
1320 : }
1321 27 : return py_data;
1322 : }
1323 :
1324 0 : static int py_PAC_CREDENTIAL_DATA_CTR_set_data(PyObject *py_obj, PyObject *value, void *closure)
1325 : {
1326 0 : struct PAC_CREDENTIAL_DATA_CTR *object = pytalloc_get_ptr(py_obj);
1327 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->data));
1328 0 : if (value == NULL) {
1329 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->data");
1330 0 : return -1;
1331 : }
1332 0 : if (value == Py_None) {
1333 0 : object->data = NULL;
1334 : } else {
1335 0 : object->data = NULL;
1336 0 : PY_CHECK_TYPE(&PAC_CREDENTIAL_DATA_Type, value, return -1;);
1337 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
1338 0 : PyErr_NoMemory();
1339 0 : return -1;
1340 : }
1341 0 : object->data = (struct PAC_CREDENTIAL_DATA *)pytalloc_get_ptr(value);
1342 : }
1343 0 : return 0;
1344 : }
1345 :
1346 : static PyGetSetDef py_PAC_CREDENTIAL_DATA_CTR_getsetters[] = {
1347 : {
1348 : .name = discard_const_p(char, "data"),
1349 : .get = py_PAC_CREDENTIAL_DATA_CTR_get_data,
1350 : .set = py_PAC_CREDENTIAL_DATA_CTR_set_data,
1351 : .doc = discard_const_p(char, "PIDL-generated element of base type PAC_CREDENTIAL_DATA")
1352 : },
1353 : { .name = NULL }
1354 : };
1355 :
1356 0 : static PyObject *py_PAC_CREDENTIAL_DATA_CTR_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1357 : {
1358 0 : return pytalloc_new(struct PAC_CREDENTIAL_DATA_CTR, type);
1359 : }
1360 :
1361 0 : static PyObject *py_PAC_CREDENTIAL_DATA_CTR_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
1362 : {
1363 0 : struct PAC_CREDENTIAL_DATA_CTR *object = pytalloc_get_ptr(py_obj);
1364 0 : PyObject *ret = NULL;
1365 0 : DATA_BLOB blob;
1366 0 : enum ndr_err_code err;
1367 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
1368 0 : if (tmp_ctx == NULL) {
1369 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
1370 0 : return NULL;
1371 : }
1372 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_PAC_CREDENTIAL_DATA_CTR);
1373 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
1374 0 : TALLOC_FREE(tmp_ctx);
1375 0 : PyErr_SetNdrError(err);
1376 0 : return NULL;
1377 : }
1378 :
1379 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
1380 0 : TALLOC_FREE(tmp_ctx);
1381 0 : return ret;
1382 : }
1383 :
1384 0 : static PyObject *py_PAC_CREDENTIAL_DATA_CTR_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
1385 : {
1386 0 : struct PAC_CREDENTIAL_DATA_CTR *object = pytalloc_get_ptr(py_obj);
1387 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
1388 0 : Py_ssize_t blob_length = 0;
1389 0 : enum ndr_err_code err;
1390 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
1391 0 : PyObject *allow_remaining_obj = NULL;
1392 0 : bool allow_remaining = false;
1393 :
1394 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
1395 : discard_const_p(char *, kwnames),
1396 : &blob.data, &blob_length,
1397 : &allow_remaining_obj)) {
1398 0 : return NULL;
1399 : }
1400 0 : blob.length = blob_length;
1401 :
1402 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
1403 0 : allow_remaining = true;
1404 : }
1405 :
1406 0 : if (allow_remaining) {
1407 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_CREDENTIAL_DATA_CTR);
1408 : } else {
1409 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_CREDENTIAL_DATA_CTR);
1410 : }
1411 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
1412 0 : PyErr_SetNdrError(err);
1413 0 : return NULL;
1414 : }
1415 :
1416 0 : Py_RETURN_NONE;
1417 : }
1418 :
1419 0 : static PyObject *py_PAC_CREDENTIAL_DATA_CTR_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
1420 : {
1421 0 : struct PAC_CREDENTIAL_DATA_CTR *object = pytalloc_get_ptr(py_obj);
1422 0 : PyObject *ret;
1423 0 : char *retstr;
1424 :
1425 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_PAC_CREDENTIAL_DATA_CTR, "PAC_CREDENTIAL_DATA_CTR", object);
1426 0 : ret = PyUnicode_FromString(retstr);
1427 0 : talloc_free(retstr);
1428 :
1429 0 : return ret;
1430 : }
1431 :
1432 : static PyMethodDef py_PAC_CREDENTIAL_DATA_CTR_methods[] = {
1433 : { "__ndr_pack__", (PyCFunction)py_PAC_CREDENTIAL_DATA_CTR_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
1434 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PAC_CREDENTIAL_DATA_CTR_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
1435 : { "__ndr_print__", (PyCFunction)py_PAC_CREDENTIAL_DATA_CTR_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
1436 : { NULL, NULL, 0, NULL }
1437 : };
1438 :
1439 :
1440 : static PyTypeObject PAC_CREDENTIAL_DATA_CTR_Type = {
1441 : PyVarObject_HEAD_INIT(NULL, 0)
1442 : .tp_name = "krb5pac.PAC_CREDENTIAL_DATA_CTR",
1443 : .tp_getset = py_PAC_CREDENTIAL_DATA_CTR_getsetters,
1444 : .tp_methods = py_PAC_CREDENTIAL_DATA_CTR_methods,
1445 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1446 : .tp_new = py_PAC_CREDENTIAL_DATA_CTR_new,
1447 : };
1448 :
1449 :
1450 27 : static PyObject *py_PAC_CREDENTIAL_DATA_NDR_get_ctr(PyObject *obj, void *closure)
1451 : {
1452 27 : struct PAC_CREDENTIAL_DATA_NDR *object = pytalloc_get_ptr(obj);
1453 0 : PyObject *py_ctr;
1454 27 : py_ctr = pytalloc_reference_ex(&PAC_CREDENTIAL_DATA_CTR_Type, pytalloc_get_mem_ctx(obj), &object->ctr);
1455 27 : return py_ctr;
1456 : }
1457 :
1458 0 : static int py_PAC_CREDENTIAL_DATA_NDR_set_ctr(PyObject *py_obj, PyObject *value, void *closure)
1459 : {
1460 0 : struct PAC_CREDENTIAL_DATA_NDR *object = pytalloc_get_ptr(py_obj);
1461 0 : if (value == NULL) {
1462 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->ctr");
1463 0 : return -1;
1464 : }
1465 0 : PY_CHECK_TYPE(&PAC_CREDENTIAL_DATA_CTR_Type, value, return -1;);
1466 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
1467 0 : PyErr_NoMemory();
1468 0 : return -1;
1469 : }
1470 0 : object->ctr = *(struct PAC_CREDENTIAL_DATA_CTR *)pytalloc_get_ptr(value);
1471 0 : return 0;
1472 : }
1473 :
1474 : static PyGetSetDef py_PAC_CREDENTIAL_DATA_NDR_getsetters[] = {
1475 : {
1476 : .name = discard_const_p(char, "ctr"),
1477 : .get = py_PAC_CREDENTIAL_DATA_NDR_get_ctr,
1478 : .set = py_PAC_CREDENTIAL_DATA_NDR_set_ctr,
1479 : .doc = discard_const_p(char, "PIDL-generated element of base type PAC_CREDENTIAL_DATA_CTR")
1480 : },
1481 : { .name = NULL }
1482 : };
1483 :
1484 27 : static PyObject *py_PAC_CREDENTIAL_DATA_NDR_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1485 : {
1486 27 : return pytalloc_new(struct PAC_CREDENTIAL_DATA_NDR, type);
1487 : }
1488 :
1489 0 : static PyObject *py_PAC_CREDENTIAL_DATA_NDR_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
1490 : {
1491 0 : struct PAC_CREDENTIAL_DATA_NDR *object = pytalloc_get_ptr(py_obj);
1492 0 : PyObject *ret = NULL;
1493 0 : DATA_BLOB blob;
1494 0 : enum ndr_err_code err;
1495 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
1496 0 : if (tmp_ctx == NULL) {
1497 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
1498 0 : return NULL;
1499 : }
1500 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_PAC_CREDENTIAL_DATA_NDR);
1501 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
1502 0 : TALLOC_FREE(tmp_ctx);
1503 0 : PyErr_SetNdrError(err);
1504 0 : return NULL;
1505 : }
1506 :
1507 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
1508 0 : TALLOC_FREE(tmp_ctx);
1509 0 : return ret;
1510 : }
1511 :
1512 27 : static PyObject *py_PAC_CREDENTIAL_DATA_NDR_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
1513 : {
1514 27 : struct PAC_CREDENTIAL_DATA_NDR *object = pytalloc_get_ptr(py_obj);
1515 27 : DATA_BLOB blob = {.data = NULL, .length = 0};
1516 27 : Py_ssize_t blob_length = 0;
1517 0 : enum ndr_err_code err;
1518 27 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
1519 27 : PyObject *allow_remaining_obj = NULL;
1520 27 : bool allow_remaining = false;
1521 :
1522 27 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
1523 : discard_const_p(char *, kwnames),
1524 : &blob.data, &blob_length,
1525 : &allow_remaining_obj)) {
1526 0 : return NULL;
1527 : }
1528 27 : blob.length = blob_length;
1529 :
1530 27 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
1531 0 : allow_remaining = true;
1532 : }
1533 :
1534 27 : if (allow_remaining) {
1535 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_CREDENTIAL_DATA_NDR);
1536 : } else {
1537 27 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_CREDENTIAL_DATA_NDR);
1538 : }
1539 27 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
1540 0 : PyErr_SetNdrError(err);
1541 0 : return NULL;
1542 : }
1543 :
1544 27 : Py_RETURN_NONE;
1545 : }
1546 :
1547 0 : static PyObject *py_PAC_CREDENTIAL_DATA_NDR_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
1548 : {
1549 0 : struct PAC_CREDENTIAL_DATA_NDR *object = pytalloc_get_ptr(py_obj);
1550 0 : PyObject *ret;
1551 0 : char *retstr;
1552 :
1553 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_PAC_CREDENTIAL_DATA_NDR, "PAC_CREDENTIAL_DATA_NDR", object);
1554 0 : ret = PyUnicode_FromString(retstr);
1555 0 : talloc_free(retstr);
1556 :
1557 0 : return ret;
1558 : }
1559 :
1560 : static PyMethodDef py_PAC_CREDENTIAL_DATA_NDR_methods[] = {
1561 : { "__ndr_pack__", (PyCFunction)py_PAC_CREDENTIAL_DATA_NDR_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
1562 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PAC_CREDENTIAL_DATA_NDR_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
1563 : { "__ndr_print__", (PyCFunction)py_PAC_CREDENTIAL_DATA_NDR_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
1564 : { NULL, NULL, 0, NULL }
1565 : };
1566 :
1567 :
1568 : static PyTypeObject PAC_CREDENTIAL_DATA_NDR_Type = {
1569 : PyVarObject_HEAD_INIT(NULL, 0)
1570 : .tp_name = "krb5pac.PAC_CREDENTIAL_DATA_NDR",
1571 : .tp_getset = py_PAC_CREDENTIAL_DATA_NDR_getsetters,
1572 : .tp_methods = py_PAC_CREDENTIAL_DATA_NDR_methods,
1573 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1574 : .tp_new = py_PAC_CREDENTIAL_DATA_NDR_new,
1575 : };
1576 :
1577 :
1578 27 : static PyObject *py_PAC_CREDENTIAL_INFO_get_version(PyObject *obj, void *closure)
1579 : {
1580 27 : struct PAC_CREDENTIAL_INFO *object = pytalloc_get_ptr(obj);
1581 0 : PyObject *py_version;
1582 27 : py_version = PyLong_FromUnsignedLongLong((uint32_t)(object->version));
1583 27 : return py_version;
1584 : }
1585 :
1586 0 : static int py_PAC_CREDENTIAL_INFO_set_version(PyObject *py_obj, PyObject *value, void *closure)
1587 : {
1588 0 : struct PAC_CREDENTIAL_INFO *object = pytalloc_get_ptr(py_obj);
1589 0 : if (value == NULL) {
1590 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->version");
1591 0 : return -1;
1592 : }
1593 : {
1594 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->version));
1595 0 : if (PyLong_Check(value)) {
1596 0 : unsigned long long test_var;
1597 0 : test_var = PyLong_AsUnsignedLongLong(value);
1598 0 : if (PyErr_Occurred() != NULL) {
1599 0 : return -1;
1600 : }
1601 0 : if (test_var > uint_max) {
1602 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1603 : PyLong_Type.tp_name, uint_max, test_var);
1604 0 : return -1;
1605 : }
1606 0 : object->version = test_var;
1607 : } else {
1608 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1609 : PyLong_Type.tp_name);
1610 0 : return -1;
1611 : }
1612 : }
1613 0 : return 0;
1614 : }
1615 :
1616 27 : static PyObject *py_PAC_CREDENTIAL_INFO_get_encryption_type(PyObject *obj, void *closure)
1617 : {
1618 27 : struct PAC_CREDENTIAL_INFO *object = pytalloc_get_ptr(obj);
1619 0 : PyObject *py_encryption_type;
1620 27 : py_encryption_type = PyLong_FromUnsignedLongLong((uint32_t)(object->encryption_type));
1621 27 : return py_encryption_type;
1622 : }
1623 :
1624 0 : static int py_PAC_CREDENTIAL_INFO_set_encryption_type(PyObject *py_obj, PyObject *value, void *closure)
1625 : {
1626 0 : struct PAC_CREDENTIAL_INFO *object = pytalloc_get_ptr(py_obj);
1627 0 : if (value == NULL) {
1628 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->encryption_type");
1629 0 : return -1;
1630 : }
1631 : {
1632 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->encryption_type));
1633 0 : if (PyLong_Check(value)) {
1634 0 : unsigned long long test_var;
1635 0 : test_var = PyLong_AsUnsignedLongLong(value);
1636 0 : if (PyErr_Occurred() != NULL) {
1637 0 : return -1;
1638 : }
1639 0 : if (test_var > uint_max) {
1640 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1641 : PyLong_Type.tp_name, uint_max, test_var);
1642 0 : return -1;
1643 : }
1644 0 : object->encryption_type = test_var;
1645 : } else {
1646 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1647 : PyLong_Type.tp_name);
1648 0 : return -1;
1649 : }
1650 : }
1651 0 : return 0;
1652 : }
1653 :
1654 27 : static PyObject *py_PAC_CREDENTIAL_INFO_get_encrypted_data(PyObject *obj, void *closure)
1655 : {
1656 27 : struct PAC_CREDENTIAL_INFO *object = pytalloc_get_ptr(obj);
1657 0 : PyObject *py_encrypted_data;
1658 27 : py_encrypted_data = PyBytes_FromStringAndSize((char *)(object->encrypted_data).data, (object->encrypted_data).length);
1659 27 : return py_encrypted_data;
1660 : }
1661 :
1662 0 : static int py_PAC_CREDENTIAL_INFO_set_encrypted_data(PyObject *py_obj, PyObject *value, void *closure)
1663 : {
1664 0 : struct PAC_CREDENTIAL_INFO *object = pytalloc_get_ptr(py_obj);
1665 0 : if (value == NULL) {
1666 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->encrypted_data");
1667 0 : return -1;
1668 : }
1669 0 : object->encrypted_data = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
1670 0 : return 0;
1671 : }
1672 :
1673 : static PyGetSetDef py_PAC_CREDENTIAL_INFO_getsetters[] = {
1674 : {
1675 : .name = discard_const_p(char, "version"),
1676 : .get = py_PAC_CREDENTIAL_INFO_get_version,
1677 : .set = py_PAC_CREDENTIAL_INFO_set_version,
1678 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
1679 : },
1680 : {
1681 : .name = discard_const_p(char, "encryption_type"),
1682 : .get = py_PAC_CREDENTIAL_INFO_get_encryption_type,
1683 : .set = py_PAC_CREDENTIAL_INFO_set_encryption_type,
1684 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
1685 : },
1686 : {
1687 : .name = discard_const_p(char, "encrypted_data"),
1688 : .get = py_PAC_CREDENTIAL_INFO_get_encrypted_data,
1689 : .set = py_PAC_CREDENTIAL_INFO_set_encrypted_data,
1690 : .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
1691 : },
1692 : { .name = NULL }
1693 : };
1694 :
1695 0 : static PyObject *py_PAC_CREDENTIAL_INFO_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1696 : {
1697 0 : return pytalloc_new(struct PAC_CREDENTIAL_INFO, type);
1698 : }
1699 :
1700 0 : static PyObject *py_PAC_CREDENTIAL_INFO_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
1701 : {
1702 0 : struct PAC_CREDENTIAL_INFO *object = pytalloc_get_ptr(py_obj);
1703 0 : PyObject *ret = NULL;
1704 0 : DATA_BLOB blob;
1705 0 : enum ndr_err_code err;
1706 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
1707 0 : if (tmp_ctx == NULL) {
1708 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
1709 0 : return NULL;
1710 : }
1711 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_PAC_CREDENTIAL_INFO);
1712 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
1713 0 : TALLOC_FREE(tmp_ctx);
1714 0 : PyErr_SetNdrError(err);
1715 0 : return NULL;
1716 : }
1717 :
1718 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
1719 0 : TALLOC_FREE(tmp_ctx);
1720 0 : return ret;
1721 : }
1722 :
1723 0 : static PyObject *py_PAC_CREDENTIAL_INFO_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
1724 : {
1725 0 : struct PAC_CREDENTIAL_INFO *object = pytalloc_get_ptr(py_obj);
1726 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
1727 0 : Py_ssize_t blob_length = 0;
1728 0 : enum ndr_err_code err;
1729 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
1730 0 : PyObject *allow_remaining_obj = NULL;
1731 0 : bool allow_remaining = false;
1732 :
1733 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
1734 : discard_const_p(char *, kwnames),
1735 : &blob.data, &blob_length,
1736 : &allow_remaining_obj)) {
1737 0 : return NULL;
1738 : }
1739 0 : blob.length = blob_length;
1740 :
1741 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
1742 0 : allow_remaining = true;
1743 : }
1744 :
1745 0 : if (allow_remaining) {
1746 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_CREDENTIAL_INFO);
1747 : } else {
1748 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_CREDENTIAL_INFO);
1749 : }
1750 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
1751 0 : PyErr_SetNdrError(err);
1752 0 : return NULL;
1753 : }
1754 :
1755 0 : Py_RETURN_NONE;
1756 : }
1757 :
1758 0 : static PyObject *py_PAC_CREDENTIAL_INFO_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
1759 : {
1760 0 : struct PAC_CREDENTIAL_INFO *object = pytalloc_get_ptr(py_obj);
1761 0 : PyObject *ret;
1762 0 : char *retstr;
1763 :
1764 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_PAC_CREDENTIAL_INFO, "PAC_CREDENTIAL_INFO", object);
1765 0 : ret = PyUnicode_FromString(retstr);
1766 0 : talloc_free(retstr);
1767 :
1768 0 : return ret;
1769 : }
1770 :
1771 : static PyMethodDef py_PAC_CREDENTIAL_INFO_methods[] = {
1772 : { "__ndr_pack__", (PyCFunction)py_PAC_CREDENTIAL_INFO_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
1773 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PAC_CREDENTIAL_INFO_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
1774 : { "__ndr_print__", (PyCFunction)py_PAC_CREDENTIAL_INFO_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
1775 : { NULL, NULL, 0, NULL }
1776 : };
1777 :
1778 :
1779 : static PyTypeObject PAC_CREDENTIAL_INFO_Type = {
1780 : PyVarObject_HEAD_INIT(NULL, 0)
1781 : .tp_name = "krb5pac.PAC_CREDENTIAL_INFO",
1782 : .tp_getset = py_PAC_CREDENTIAL_INFO_getsetters,
1783 : .tp_methods = py_PAC_CREDENTIAL_INFO_methods,
1784 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1785 : .tp_new = py_PAC_CREDENTIAL_INFO_new,
1786 : };
1787 :
1788 :
1789 141 : static PyObject *py_PAC_CONSTRAINED_DELEGATION_get_proxy_target(PyObject *obj, void *closure)
1790 : {
1791 141 : struct PAC_CONSTRAINED_DELEGATION *object = pytalloc_get_ptr(obj);
1792 0 : PyObject *py_proxy_target;
1793 141 : py_proxy_target = pytalloc_reference_ex(lsa_String_Type, pytalloc_get_mem_ctx(obj), &object->proxy_target);
1794 141 : return py_proxy_target;
1795 : }
1796 :
1797 4 : static int py_PAC_CONSTRAINED_DELEGATION_set_proxy_target(PyObject *py_obj, PyObject *value, void *closure)
1798 : {
1799 4 : struct PAC_CONSTRAINED_DELEGATION *object = pytalloc_get_ptr(py_obj);
1800 4 : if (value == NULL) {
1801 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->proxy_target");
1802 0 : return -1;
1803 : }
1804 4 : PY_CHECK_TYPE(lsa_String_Type, value, return -1;);
1805 4 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
1806 0 : PyErr_NoMemory();
1807 0 : return -1;
1808 : }
1809 4 : object->proxy_target = *(struct lsa_String *)pytalloc_get_ptr(value);
1810 4 : return 0;
1811 : }
1812 :
1813 0 : static PyObject *py_PAC_CONSTRAINED_DELEGATION_get_num_transited_services(PyObject *obj, void *closure)
1814 : {
1815 0 : struct PAC_CONSTRAINED_DELEGATION *object = pytalloc_get_ptr(obj);
1816 0 : PyObject *py_num_transited_services;
1817 0 : py_num_transited_services = PyLong_FromUnsignedLongLong((uint32_t)(object->num_transited_services));
1818 0 : return py_num_transited_services;
1819 : }
1820 :
1821 4 : static int py_PAC_CONSTRAINED_DELEGATION_set_num_transited_services(PyObject *py_obj, PyObject *value, void *closure)
1822 : {
1823 4 : struct PAC_CONSTRAINED_DELEGATION *object = pytalloc_get_ptr(py_obj);
1824 4 : if (value == NULL) {
1825 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->num_transited_services");
1826 0 : return -1;
1827 : }
1828 : {
1829 4 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->num_transited_services));
1830 4 : if (PyLong_Check(value)) {
1831 0 : unsigned long long test_var;
1832 4 : test_var = PyLong_AsUnsignedLongLong(value);
1833 4 : if (PyErr_Occurred() != NULL) {
1834 0 : return -1;
1835 : }
1836 4 : if (test_var > uint_max) {
1837 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1838 : PyLong_Type.tp_name, uint_max, test_var);
1839 0 : return -1;
1840 : }
1841 4 : object->num_transited_services = test_var;
1842 : } else {
1843 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1844 : PyLong_Type.tp_name);
1845 0 : return -1;
1846 : }
1847 : }
1848 4 : return 0;
1849 : }
1850 :
1851 141 : static PyObject *py_PAC_CONSTRAINED_DELEGATION_get_transited_services(PyObject *obj, void *closure)
1852 : {
1853 141 : struct PAC_CONSTRAINED_DELEGATION *object = pytalloc_get_ptr(obj);
1854 0 : PyObject *py_transited_services;
1855 141 : if (object->transited_services == NULL) {
1856 0 : Py_RETURN_NONE;
1857 : }
1858 141 : if (object->transited_services == NULL) {
1859 0 : py_transited_services = Py_None;
1860 0 : Py_INCREF(py_transited_services);
1861 : } else {
1862 141 : py_transited_services = PyList_New(object->num_transited_services);
1863 141 : if (py_transited_services == NULL) {
1864 0 : return NULL;
1865 : }
1866 : {
1867 : int transited_services_cntr_1;
1868 291 : for (transited_services_cntr_1 = 0; transited_services_cntr_1 < (object->num_transited_services); transited_services_cntr_1++) {
1869 0 : PyObject *py_transited_services_1;
1870 150 : py_transited_services_1 = pytalloc_reference_ex(lsa_String_Type, object->transited_services, &(object->transited_services)[transited_services_cntr_1]);
1871 150 : PyList_SetItem(py_transited_services, transited_services_cntr_1, py_transited_services_1);
1872 : }
1873 : }
1874 : }
1875 141 : return py_transited_services;
1876 : }
1877 :
1878 4 : static int py_PAC_CONSTRAINED_DELEGATION_set_transited_services(PyObject *py_obj, PyObject *value, void *closure)
1879 : {
1880 4 : struct PAC_CONSTRAINED_DELEGATION *object = pytalloc_get_ptr(py_obj);
1881 4 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->transited_services));
1882 4 : if (value == NULL) {
1883 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->transited_services");
1884 0 : return -1;
1885 : }
1886 4 : if (value == Py_None) {
1887 0 : object->transited_services = NULL;
1888 : } else {
1889 4 : object->transited_services = NULL;
1890 4 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
1891 : {
1892 0 : int transited_services_cntr_1;
1893 4 : object->transited_services = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->transited_services, PyList_GET_SIZE(value));
1894 4 : if (!object->transited_services) { return -1; }
1895 4 : talloc_set_name_const(object->transited_services, "ARRAY: object->transited_services");
1896 16 : for (transited_services_cntr_1 = 0; transited_services_cntr_1 < PyList_GET_SIZE(value); transited_services_cntr_1++) {
1897 12 : if (PyList_GET_ITEM(value, transited_services_cntr_1) == NULL) {
1898 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->transited_services)[transited_services_cntr_1]");
1899 0 : return -1;
1900 : }
1901 12 : PY_CHECK_TYPE(lsa_String_Type, PyList_GET_ITEM(value, transited_services_cntr_1), return -1;);
1902 12 : if (talloc_reference(object->transited_services, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, transited_services_cntr_1))) == NULL) {
1903 0 : PyErr_NoMemory();
1904 0 : return -1;
1905 : }
1906 12 : (object->transited_services)[transited_services_cntr_1] = *(struct lsa_String *)pytalloc_get_ptr(PyList_GET_ITEM(value, transited_services_cntr_1));
1907 : }
1908 : }
1909 : }
1910 4 : return 0;
1911 : }
1912 :
1913 : static PyGetSetDef py_PAC_CONSTRAINED_DELEGATION_getsetters[] = {
1914 : {
1915 : .name = discard_const_p(char, "proxy_target"),
1916 : .get = py_PAC_CONSTRAINED_DELEGATION_get_proxy_target,
1917 : .set = py_PAC_CONSTRAINED_DELEGATION_set_proxy_target,
1918 : .doc = discard_const_p(char, "PIDL-generated element of base type lsa_String")
1919 : },
1920 : {
1921 : .name = discard_const_p(char, "num_transited_services"),
1922 : .get = py_PAC_CONSTRAINED_DELEGATION_get_num_transited_services,
1923 : .set = py_PAC_CONSTRAINED_DELEGATION_set_num_transited_services,
1924 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
1925 : },
1926 : {
1927 : .name = discard_const_p(char, "transited_services"),
1928 : .get = py_PAC_CONSTRAINED_DELEGATION_get_transited_services,
1929 : .set = py_PAC_CONSTRAINED_DELEGATION_set_transited_services,
1930 : .doc = discard_const_p(char, "PIDL-generated element of base type lsa_String")
1931 : },
1932 : { .name = NULL }
1933 : };
1934 :
1935 4 : static PyObject *py_PAC_CONSTRAINED_DELEGATION_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1936 : {
1937 4 : return pytalloc_new(struct PAC_CONSTRAINED_DELEGATION, type);
1938 : }
1939 :
1940 :
1941 : static PyTypeObject PAC_CONSTRAINED_DELEGATION_Type = {
1942 : PyVarObject_HEAD_INIT(NULL, 0)
1943 : .tp_name = "krb5pac.PAC_CONSTRAINED_DELEGATION",
1944 : .tp_getset = py_PAC_CONSTRAINED_DELEGATION_getsetters,
1945 : .tp_methods = NULL,
1946 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1947 : .tp_new = py_PAC_CONSTRAINED_DELEGATION_new,
1948 : };
1949 :
1950 :
1951 0 : static PyObject *py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_get_samaccountname_size(PyObject *obj, void *closure)
1952 : {
1953 0 : struct PAC_UPN_DNS_INFO_SAM_NAME_AND_SID *object = pytalloc_get_ptr(obj);
1954 0 : PyObject *py_samaccountname_size;
1955 0 : py_samaccountname_size = PyLong_FromLong((uint16_t)(object->samaccountname_size));
1956 0 : return py_samaccountname_size;
1957 : }
1958 :
1959 0 : static int py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_set_samaccountname_size(PyObject *py_obj, PyObject *value, void *closure)
1960 : {
1961 0 : struct PAC_UPN_DNS_INFO_SAM_NAME_AND_SID *object = pytalloc_get_ptr(py_obj);
1962 0 : if (value == NULL) {
1963 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->samaccountname_size");
1964 0 : return -1;
1965 : }
1966 : {
1967 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->samaccountname_size));
1968 0 : if (PyLong_Check(value)) {
1969 0 : unsigned long long test_var;
1970 0 : test_var = PyLong_AsUnsignedLongLong(value);
1971 0 : if (PyErr_Occurred() != NULL) {
1972 0 : return -1;
1973 : }
1974 0 : if (test_var > uint_max) {
1975 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1976 : PyLong_Type.tp_name, uint_max, test_var);
1977 0 : return -1;
1978 : }
1979 0 : object->samaccountname_size = test_var;
1980 : } else {
1981 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1982 : PyLong_Type.tp_name);
1983 0 : return -1;
1984 : }
1985 : }
1986 0 : return 0;
1987 : }
1988 :
1989 670 : static PyObject *py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_get_samaccountname(PyObject *obj, void *closure)
1990 : {
1991 670 : struct PAC_UPN_DNS_INFO_SAM_NAME_AND_SID *object = pytalloc_get_ptr(obj);
1992 0 : PyObject *py_samaccountname;
1993 670 : if (object->samaccountname == NULL) {
1994 0 : Py_RETURN_NONE;
1995 : }
1996 670 : if (object->samaccountname == NULL) {
1997 0 : py_samaccountname = Py_None;
1998 0 : Py_INCREF(py_samaccountname);
1999 : } else {
2000 670 : py_samaccountname = PyString_FromStringOrNULL(object->samaccountname);
2001 : }
2002 670 : return py_samaccountname;
2003 : }
2004 :
2005 0 : static int py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_set_samaccountname(PyObject *py_obj, PyObject *value, void *closure)
2006 : {
2007 0 : struct PAC_UPN_DNS_INFO_SAM_NAME_AND_SID *object = pytalloc_get_ptr(py_obj);
2008 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->samaccountname));
2009 0 : if (value == NULL) {
2010 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->samaccountname");
2011 0 : return -1;
2012 : }
2013 0 : if (value == Py_None) {
2014 0 : object->samaccountname = NULL;
2015 : } else {
2016 0 : object->samaccountname = NULL;
2017 : {
2018 0 : const char *test_str;
2019 0 : const char *talloc_str;
2020 0 : PyObject *unicode = NULL;
2021 0 : if (PyUnicode_Check(value)) {
2022 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
2023 0 : if (unicode == NULL) {
2024 0 : return -1;
2025 : }
2026 0 : test_str = PyBytes_AS_STRING(unicode);
2027 0 : } else if (PyBytes_Check(value)) {
2028 0 : test_str = PyBytes_AS_STRING(value);
2029 : } else {
2030 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
2031 0 : return -1;
2032 : }
2033 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
2034 0 : if (unicode != NULL) {
2035 0 : Py_DECREF(unicode);
2036 : }
2037 0 : if (talloc_str == NULL) {
2038 0 : PyErr_NoMemory();
2039 0 : return -1;
2040 : }
2041 0 : object->samaccountname = talloc_str;
2042 : }
2043 : }
2044 0 : return 0;
2045 : }
2046 :
2047 0 : static PyObject *py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_get_objectsid_size(PyObject *obj, void *closure)
2048 : {
2049 0 : struct PAC_UPN_DNS_INFO_SAM_NAME_AND_SID *object = pytalloc_get_ptr(obj);
2050 0 : PyObject *py_objectsid_size;
2051 0 : py_objectsid_size = PyLong_FromLong((uint16_t)(object->objectsid_size));
2052 0 : return py_objectsid_size;
2053 : }
2054 :
2055 0 : static int py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_set_objectsid_size(PyObject *py_obj, PyObject *value, void *closure)
2056 : {
2057 0 : struct PAC_UPN_DNS_INFO_SAM_NAME_AND_SID *object = pytalloc_get_ptr(py_obj);
2058 0 : if (value == NULL) {
2059 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->objectsid_size");
2060 0 : return -1;
2061 : }
2062 : {
2063 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->objectsid_size));
2064 0 : if (PyLong_Check(value)) {
2065 0 : unsigned long long test_var;
2066 0 : test_var = PyLong_AsUnsignedLongLong(value);
2067 0 : if (PyErr_Occurred() != NULL) {
2068 0 : return -1;
2069 : }
2070 0 : if (test_var > uint_max) {
2071 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2072 : PyLong_Type.tp_name, uint_max, test_var);
2073 0 : return -1;
2074 : }
2075 0 : object->objectsid_size = test_var;
2076 : } else {
2077 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2078 : PyLong_Type.tp_name);
2079 0 : return -1;
2080 : }
2081 : }
2082 0 : return 0;
2083 : }
2084 :
2085 445 : static PyObject *py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_get_objectsid(PyObject *obj, void *closure)
2086 : {
2087 445 : struct PAC_UPN_DNS_INFO_SAM_NAME_AND_SID *object = pytalloc_get_ptr(obj);
2088 0 : PyObject *py_objectsid;
2089 445 : if (object->objectsid == NULL) {
2090 0 : Py_RETURN_NONE;
2091 : }
2092 445 : if (object->objectsid == NULL) {
2093 0 : py_objectsid = Py_None;
2094 0 : Py_INCREF(py_objectsid);
2095 : } else {
2096 445 : py_objectsid = pytalloc_reference_ex(dom_sid_Type, object->objectsid, object->objectsid);
2097 : }
2098 445 : return py_objectsid;
2099 : }
2100 :
2101 142 : static int py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_set_objectsid(PyObject *py_obj, PyObject *value, void *closure)
2102 : {
2103 142 : struct PAC_UPN_DNS_INFO_SAM_NAME_AND_SID *object = pytalloc_get_ptr(py_obj);
2104 142 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->objectsid));
2105 142 : if (value == NULL) {
2106 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->objectsid");
2107 0 : return -1;
2108 : }
2109 142 : if (value == Py_None) {
2110 0 : object->objectsid = NULL;
2111 : } else {
2112 142 : object->objectsid = NULL;
2113 142 : PY_CHECK_TYPE(dom_sid_Type, value, return -1;);
2114 142 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
2115 0 : PyErr_NoMemory();
2116 0 : return -1;
2117 : }
2118 142 : object->objectsid = (struct dom_sid *)pytalloc_get_ptr(value);
2119 : }
2120 142 : return 0;
2121 : }
2122 :
2123 : static PyGetSetDef py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_getsetters[] = {
2124 : {
2125 : .name = discard_const_p(char, "samaccountname_size"),
2126 : .get = py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_get_samaccountname_size,
2127 : .set = py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_set_samaccountname_size,
2128 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
2129 : },
2130 : {
2131 : .name = discard_const_p(char, "samaccountname"),
2132 : .get = py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_get_samaccountname,
2133 : .set = py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_set_samaccountname,
2134 : .doc = discard_const_p(char, "PIDL-generated element of base type string")
2135 : },
2136 : {
2137 : .name = discard_const_p(char, "objectsid_size"),
2138 : .get = py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_get_objectsid_size,
2139 : .set = py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_set_objectsid_size,
2140 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
2141 : },
2142 : {
2143 : .name = discard_const_p(char, "objectsid"),
2144 : .get = py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_get_objectsid,
2145 : .set = py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_set_objectsid,
2146 : .doc = discard_const_p(char, "PIDL-generated element of base type dom_sid")
2147 : },
2148 : { .name = NULL }
2149 : };
2150 :
2151 0 : static PyObject *py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2152 : {
2153 0 : return pytalloc_new(struct PAC_UPN_DNS_INFO_SAM_NAME_AND_SID, type);
2154 : }
2155 :
2156 :
2157 : static PyTypeObject PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_Type = {
2158 : PyVarObject_HEAD_INIT(NULL, 0)
2159 : .tp_name = "krb5pac.PAC_UPN_DNS_INFO_SAM_NAME_AND_SID",
2160 : .tp_getset = py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_getsetters,
2161 : .tp_methods = NULL,
2162 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
2163 : .tp_new = py_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_new,
2164 : };
2165 :
2166 8513 : static PyObject *py_import_PAC_UPN_DNS_INFO_EX(TALLOC_CTX *mem_ctx, int level, union PAC_UPN_DNS_INFO_EX *in)
2167 : {
2168 0 : PyObject *ret;
2169 :
2170 8513 : switch (level) {
2171 8513 : case PAC_UPN_DNS_FLAG_HAS_SAM_NAME_AND_SID:
2172 8513 : ret = pytalloc_reference_ex(&PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_Type, mem_ctx, &in->sam_name_and_sid);
2173 8513 : return ret;
2174 :
2175 0 : default:
2176 0 : ret = Py_None;
2177 0 : Py_INCREF(ret);
2178 0 : return ret;
2179 :
2180 : }
2181 : PyErr_SetString(PyExc_TypeError, "unknown union level");
2182 : return NULL;
2183 : }
2184 :
2185 0 : static union PAC_UPN_DNS_INFO_EX *py_export_PAC_UPN_DNS_INFO_EX(TALLOC_CTX *mem_ctx, int level, PyObject *in)
2186 : {
2187 0 : union PAC_UPN_DNS_INFO_EX *ret = talloc_zero(mem_ctx, union PAC_UPN_DNS_INFO_EX);
2188 0 : switch (level) {
2189 0 : case PAC_UPN_DNS_FLAG_HAS_SAM_NAME_AND_SID:
2190 0 : if (in == NULL) {
2191 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->sam_name_and_sid");
2192 0 : talloc_free(ret); return NULL;
2193 : }
2194 0 : PY_CHECK_TYPE(&PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_Type, in, talloc_free(ret); return NULL;);
2195 0 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
2196 0 : PyErr_NoMemory();
2197 0 : talloc_free(ret); return NULL;
2198 : }
2199 0 : ret->sam_name_and_sid = *(struct PAC_UPN_DNS_INFO_SAM_NAME_AND_SID *)pytalloc_get_ptr(in);
2200 0 : break;
2201 :
2202 0 : default:
2203 0 : break;
2204 :
2205 : }
2206 :
2207 0 : return ret;
2208 : }
2209 :
2210 8513 : static PyObject *py_PAC_UPN_DNS_INFO_EX_import(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2211 : {
2212 8513 : const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
2213 8513 : PyObject *mem_ctx_obj = NULL;
2214 8513 : TALLOC_CTX *mem_ctx = NULL;
2215 8513 : int level = 0;
2216 8513 : PyObject *in_obj = NULL;
2217 8513 : union PAC_UPN_DNS_INFO_EX *in = NULL;
2218 :
2219 8513 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:import",
2220 : discard_const_p(char *, kwnames),
2221 : &mem_ctx_obj,
2222 : &level,
2223 : &in_obj)) {
2224 0 : return NULL;
2225 : }
2226 8513 : mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
2227 8513 : if (mem_ctx == NULL) {
2228 0 : PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
2229 0 : return NULL;
2230 : }
2231 8513 : in = (union PAC_UPN_DNS_INFO_EX *)pytalloc_get_ptr(in_obj);
2232 8513 : if (in == NULL) {
2233 0 : PyErr_Format(PyExc_TypeError, "in needs to be a pointer to union PAC_UPN_DNS_INFO_EX!");
2234 0 : return NULL;
2235 : }
2236 :
2237 8513 : return py_import_PAC_UPN_DNS_INFO_EX(mem_ctx, level, in);
2238 : }
2239 :
2240 0 : static PyObject *py_PAC_UPN_DNS_INFO_EX_export(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2241 : {
2242 0 : const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
2243 0 : PyObject *mem_ctx_obj = NULL;
2244 0 : TALLOC_CTX *mem_ctx = NULL;
2245 0 : int level = 0;
2246 0 : PyObject *in = NULL;
2247 0 : union PAC_UPN_DNS_INFO_EX *out = NULL;
2248 :
2249 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:export",
2250 : discard_const_p(char *, kwnames),
2251 : &mem_ctx_obj,
2252 : &level,
2253 : &in)) {
2254 0 : return NULL;
2255 : }
2256 0 : mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
2257 0 : if (mem_ctx == NULL) {
2258 0 : PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
2259 0 : return NULL;
2260 : }
2261 :
2262 0 : out = py_export_PAC_UPN_DNS_INFO_EX(mem_ctx, level, in);
2263 0 : if (out == NULL) {
2264 0 : return NULL;
2265 : }
2266 :
2267 0 : return pytalloc_GenericObject_reference(out);
2268 : }
2269 :
2270 : static PyMethodDef py_PAC_UPN_DNS_INFO_EX_methods[] = {
2271 : { "__import__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PAC_UPN_DNS_INFO_EX_import),
2272 : METH_VARARGS|METH_KEYWORDS|METH_CLASS,
2273 : "T.__import__(mem_ctx, level, in) => ret." },
2274 : { "__export__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PAC_UPN_DNS_INFO_EX_export),
2275 : METH_VARARGS|METH_KEYWORDS|METH_CLASS,
2276 : "T.__export__(mem_ctx, level, in) => ret." },
2277 : { NULL, NULL, 0, NULL }
2278 : };
2279 :
2280 0 : static PyObject *py_PAC_UPN_DNS_INFO_EX_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2281 : {
2282 0 : PyErr_Format(PyExc_TypeError, "New %s Objects are not supported", type->tp_name);
2283 0 : return NULL;
2284 : }
2285 :
2286 :
2287 : static PyTypeObject PAC_UPN_DNS_INFO_EX_Type = {
2288 : PyVarObject_HEAD_INIT(NULL, 0)
2289 : .tp_name = "krb5pac.PAC_UPN_DNS_INFO_EX",
2290 : .tp_getset = NULL,
2291 : .tp_methods = py_PAC_UPN_DNS_INFO_EX_methods,
2292 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
2293 : .tp_new = py_PAC_UPN_DNS_INFO_EX_new,
2294 : };
2295 :
2296 :
2297 0 : static PyObject *py_PAC_UPN_DNS_INFO_get_upn_name_size(PyObject *obj, void *closure)
2298 : {
2299 0 : struct PAC_UPN_DNS_INFO *object = pytalloc_get_ptr(obj);
2300 0 : PyObject *py_upn_name_size;
2301 0 : py_upn_name_size = PyLong_FromLong((uint16_t)(object->upn_name_size));
2302 0 : return py_upn_name_size;
2303 : }
2304 :
2305 0 : static int py_PAC_UPN_DNS_INFO_set_upn_name_size(PyObject *py_obj, PyObject *value, void *closure)
2306 : {
2307 0 : struct PAC_UPN_DNS_INFO *object = pytalloc_get_ptr(py_obj);
2308 0 : if (value == NULL) {
2309 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->upn_name_size");
2310 0 : return -1;
2311 : }
2312 : {
2313 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->upn_name_size));
2314 0 : if (PyLong_Check(value)) {
2315 0 : unsigned long long test_var;
2316 0 : test_var = PyLong_AsUnsignedLongLong(value);
2317 0 : if (PyErr_Occurred() != NULL) {
2318 0 : return -1;
2319 : }
2320 0 : if (test_var > uint_max) {
2321 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2322 : PyLong_Type.tp_name, uint_max, test_var);
2323 0 : return -1;
2324 : }
2325 0 : object->upn_name_size = test_var;
2326 : } else {
2327 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2328 : PyLong_Type.tp_name);
2329 0 : return -1;
2330 : }
2331 : }
2332 0 : return 0;
2333 : }
2334 :
2335 31 : static PyObject *py_PAC_UPN_DNS_INFO_get_upn_name(PyObject *obj, void *closure)
2336 : {
2337 31 : struct PAC_UPN_DNS_INFO *object = pytalloc_get_ptr(obj);
2338 0 : PyObject *py_upn_name;
2339 31 : if (object->upn_name == NULL) {
2340 0 : Py_RETURN_NONE;
2341 : }
2342 31 : if (object->upn_name == NULL) {
2343 0 : py_upn_name = Py_None;
2344 0 : Py_INCREF(py_upn_name);
2345 : } else {
2346 31 : py_upn_name = PyString_FromStringOrNULL(object->upn_name);
2347 : }
2348 31 : return py_upn_name;
2349 : }
2350 :
2351 0 : static int py_PAC_UPN_DNS_INFO_set_upn_name(PyObject *py_obj, PyObject *value, void *closure)
2352 : {
2353 0 : struct PAC_UPN_DNS_INFO *object = pytalloc_get_ptr(py_obj);
2354 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->upn_name));
2355 0 : if (value == NULL) {
2356 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->upn_name");
2357 0 : return -1;
2358 : }
2359 0 : if (value == Py_None) {
2360 0 : object->upn_name = NULL;
2361 : } else {
2362 0 : object->upn_name = NULL;
2363 : {
2364 0 : const char *test_str;
2365 0 : const char *talloc_str;
2366 0 : PyObject *unicode = NULL;
2367 0 : if (PyUnicode_Check(value)) {
2368 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
2369 0 : if (unicode == NULL) {
2370 0 : return -1;
2371 : }
2372 0 : test_str = PyBytes_AS_STRING(unicode);
2373 0 : } else if (PyBytes_Check(value)) {
2374 0 : test_str = PyBytes_AS_STRING(value);
2375 : } else {
2376 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
2377 0 : return -1;
2378 : }
2379 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
2380 0 : if (unicode != NULL) {
2381 0 : Py_DECREF(unicode);
2382 : }
2383 0 : if (talloc_str == NULL) {
2384 0 : PyErr_NoMemory();
2385 0 : return -1;
2386 : }
2387 0 : object->upn_name = talloc_str;
2388 : }
2389 : }
2390 0 : return 0;
2391 : }
2392 :
2393 0 : static PyObject *py_PAC_UPN_DNS_INFO_get_dns_domain_name_size(PyObject *obj, void *closure)
2394 : {
2395 0 : struct PAC_UPN_DNS_INFO *object = pytalloc_get_ptr(obj);
2396 0 : PyObject *py_dns_domain_name_size;
2397 0 : py_dns_domain_name_size = PyLong_FromLong((uint16_t)(object->dns_domain_name_size));
2398 0 : return py_dns_domain_name_size;
2399 : }
2400 :
2401 0 : static int py_PAC_UPN_DNS_INFO_set_dns_domain_name_size(PyObject *py_obj, PyObject *value, void *closure)
2402 : {
2403 0 : struct PAC_UPN_DNS_INFO *object = pytalloc_get_ptr(py_obj);
2404 0 : if (value == NULL) {
2405 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->dns_domain_name_size");
2406 0 : return -1;
2407 : }
2408 : {
2409 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->dns_domain_name_size));
2410 0 : if (PyLong_Check(value)) {
2411 0 : unsigned long long test_var;
2412 0 : test_var = PyLong_AsUnsignedLongLong(value);
2413 0 : if (PyErr_Occurred() != NULL) {
2414 0 : return -1;
2415 : }
2416 0 : if (test_var > uint_max) {
2417 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2418 : PyLong_Type.tp_name, uint_max, test_var);
2419 0 : return -1;
2420 : }
2421 0 : object->dns_domain_name_size = test_var;
2422 : } else {
2423 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2424 : PyLong_Type.tp_name);
2425 0 : return -1;
2426 : }
2427 : }
2428 0 : return 0;
2429 : }
2430 :
2431 8029 : static PyObject *py_PAC_UPN_DNS_INFO_get_dns_domain_name(PyObject *obj, void *closure)
2432 : {
2433 8029 : struct PAC_UPN_DNS_INFO *object = pytalloc_get_ptr(obj);
2434 0 : PyObject *py_dns_domain_name;
2435 8029 : if (object->dns_domain_name == NULL) {
2436 0 : Py_RETURN_NONE;
2437 : }
2438 8029 : if (object->dns_domain_name == NULL) {
2439 0 : py_dns_domain_name = Py_None;
2440 0 : Py_INCREF(py_dns_domain_name);
2441 : } else {
2442 8029 : py_dns_domain_name = PyString_FromStringOrNULL(object->dns_domain_name);
2443 : }
2444 8029 : return py_dns_domain_name;
2445 : }
2446 :
2447 0 : static int py_PAC_UPN_DNS_INFO_set_dns_domain_name(PyObject *py_obj, PyObject *value, void *closure)
2448 : {
2449 0 : struct PAC_UPN_DNS_INFO *object = pytalloc_get_ptr(py_obj);
2450 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->dns_domain_name));
2451 0 : if (value == NULL) {
2452 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->dns_domain_name");
2453 0 : return -1;
2454 : }
2455 0 : if (value == Py_None) {
2456 0 : object->dns_domain_name = NULL;
2457 : } else {
2458 0 : object->dns_domain_name = NULL;
2459 : {
2460 0 : const char *test_str;
2461 0 : const char *talloc_str;
2462 0 : PyObject *unicode = NULL;
2463 0 : if (PyUnicode_Check(value)) {
2464 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
2465 0 : if (unicode == NULL) {
2466 0 : return -1;
2467 : }
2468 0 : test_str = PyBytes_AS_STRING(unicode);
2469 0 : } else if (PyBytes_Check(value)) {
2470 0 : test_str = PyBytes_AS_STRING(value);
2471 : } else {
2472 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
2473 0 : return -1;
2474 : }
2475 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
2476 0 : if (unicode != NULL) {
2477 0 : Py_DECREF(unicode);
2478 : }
2479 0 : if (talloc_str == NULL) {
2480 0 : PyErr_NoMemory();
2481 0 : return -1;
2482 : }
2483 0 : object->dns_domain_name = talloc_str;
2484 : }
2485 : }
2486 0 : return 0;
2487 : }
2488 :
2489 0 : static PyObject *py_PAC_UPN_DNS_INFO_get_flags(PyObject *obj, void *closure)
2490 : {
2491 0 : struct PAC_UPN_DNS_INFO *object = pytalloc_get_ptr(obj);
2492 0 : PyObject *py_flags;
2493 0 : py_flags = PyLong_FromUnsignedLongLong((uint32_t)(object->flags));
2494 0 : return py_flags;
2495 : }
2496 :
2497 0 : static int py_PAC_UPN_DNS_INFO_set_flags(PyObject *py_obj, PyObject *value, void *closure)
2498 : {
2499 0 : struct PAC_UPN_DNS_INFO *object = pytalloc_get_ptr(py_obj);
2500 0 : if (value == NULL) {
2501 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->flags");
2502 0 : return -1;
2503 : }
2504 : {
2505 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->flags));
2506 0 : if (PyLong_Check(value)) {
2507 0 : unsigned long long test_var;
2508 0 : test_var = PyLong_AsUnsignedLongLong(value);
2509 0 : if (PyErr_Occurred() != NULL) {
2510 0 : return -1;
2511 : }
2512 0 : if (test_var > uint_max) {
2513 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2514 : PyLong_Type.tp_name, uint_max, test_var);
2515 0 : return -1;
2516 : }
2517 0 : object->flags = test_var;
2518 : } else {
2519 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2520 : PyLong_Type.tp_name);
2521 0 : return -1;
2522 : }
2523 : }
2524 0 : return 0;
2525 : }
2526 :
2527 8513 : static PyObject *py_PAC_UPN_DNS_INFO_get_ex(PyObject *obj, void *closure)
2528 : {
2529 8513 : struct PAC_UPN_DNS_INFO *object = pytalloc_get_ptr(obj);
2530 0 : PyObject *py_ex;
2531 8513 : py_ex = pyrpc_import_union(&PAC_UPN_DNS_INFO_EX_Type, pytalloc_get_mem_ctx(obj), object->flags & PAC_UPN_DNS_FLAG_HAS_SAM_NAME_AND_SID, &object->ex, "union PAC_UPN_DNS_INFO_EX");
2532 8513 : if (py_ex == NULL) {
2533 0 : return NULL;
2534 : }
2535 8513 : return py_ex;
2536 : }
2537 :
2538 0 : static int py_PAC_UPN_DNS_INFO_set_ex(PyObject *py_obj, PyObject *value, void *closure)
2539 : {
2540 0 : struct PAC_UPN_DNS_INFO *object = pytalloc_get_ptr(py_obj);
2541 0 : if (value == NULL) {
2542 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->ex");
2543 0 : return -1;
2544 : }
2545 : {
2546 0 : union PAC_UPN_DNS_INFO_EX *ex_switch_0;
2547 0 : ex_switch_0 = (union PAC_UPN_DNS_INFO_EX *)pyrpc_export_union(&PAC_UPN_DNS_INFO_EX_Type, pytalloc_get_mem_ctx(py_obj), object->flags & PAC_UPN_DNS_FLAG_HAS_SAM_NAME_AND_SID, value, "union PAC_UPN_DNS_INFO_EX");
2548 0 : if (ex_switch_0 == NULL) {
2549 0 : return -1;
2550 : }
2551 0 : object->ex = *ex_switch_0;
2552 : }
2553 0 : return 0;
2554 : }
2555 :
2556 : static PyGetSetDef py_PAC_UPN_DNS_INFO_getsetters[] = {
2557 : {
2558 : .name = discard_const_p(char, "upn_name_size"),
2559 : .get = py_PAC_UPN_DNS_INFO_get_upn_name_size,
2560 : .set = py_PAC_UPN_DNS_INFO_set_upn_name_size,
2561 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
2562 : },
2563 : {
2564 : .name = discard_const_p(char, "upn_name"),
2565 : .get = py_PAC_UPN_DNS_INFO_get_upn_name,
2566 : .set = py_PAC_UPN_DNS_INFO_set_upn_name,
2567 : .doc = discard_const_p(char, "PIDL-generated element of base type string")
2568 : },
2569 : {
2570 : .name = discard_const_p(char, "dns_domain_name_size"),
2571 : .get = py_PAC_UPN_DNS_INFO_get_dns_domain_name_size,
2572 : .set = py_PAC_UPN_DNS_INFO_set_dns_domain_name_size,
2573 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
2574 : },
2575 : {
2576 : .name = discard_const_p(char, "dns_domain_name"),
2577 : .get = py_PAC_UPN_DNS_INFO_get_dns_domain_name,
2578 : .set = py_PAC_UPN_DNS_INFO_set_dns_domain_name,
2579 : .doc = discard_const_p(char, "PIDL-generated element of base type string")
2580 : },
2581 : {
2582 : .name = discard_const_p(char, "flags"),
2583 : .get = py_PAC_UPN_DNS_INFO_get_flags,
2584 : .set = py_PAC_UPN_DNS_INFO_set_flags,
2585 : .doc = discard_const_p(char, "PIDL-generated element of base type PAC_UPN_DNS_FLAGS")
2586 : },
2587 : {
2588 : .name = discard_const_p(char, "ex"),
2589 : .get = py_PAC_UPN_DNS_INFO_get_ex,
2590 : .set = py_PAC_UPN_DNS_INFO_set_ex,
2591 : .doc = discard_const_p(char, "PIDL-generated element of base type PAC_UPN_DNS_INFO_EX")
2592 : },
2593 : { .name = NULL }
2594 : };
2595 :
2596 0 : static PyObject *py_PAC_UPN_DNS_INFO_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2597 : {
2598 0 : return pytalloc_new(struct PAC_UPN_DNS_INFO, type);
2599 : }
2600 :
2601 :
2602 : static PyTypeObject PAC_UPN_DNS_INFO_Type = {
2603 : PyVarObject_HEAD_INIT(NULL, 0)
2604 : .tp_name = "krb5pac.PAC_UPN_DNS_INFO",
2605 : .tp_getset = py_PAC_UPN_DNS_INFO_getsetters,
2606 : .tp_methods = NULL,
2607 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
2608 : .tp_new = py_PAC_UPN_DNS_INFO_new,
2609 : };
2610 :
2611 :
2612 820 : static PyObject *py_PAC_ATTRIBUTES_INFO_get_flags_length(PyObject *obj, void *closure)
2613 : {
2614 820 : struct PAC_ATTRIBUTES_INFO *object = pytalloc_get_ptr(obj);
2615 0 : PyObject *py_flags_length;
2616 820 : py_flags_length = PyLong_FromUnsignedLongLong((uint32_t)(object->flags_length));
2617 820 : return py_flags_length;
2618 : }
2619 :
2620 0 : static int py_PAC_ATTRIBUTES_INFO_set_flags_length(PyObject *py_obj, PyObject *value, void *closure)
2621 : {
2622 0 : struct PAC_ATTRIBUTES_INFO *object = pytalloc_get_ptr(py_obj);
2623 0 : if (value == NULL) {
2624 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->flags_length");
2625 0 : return -1;
2626 : }
2627 : {
2628 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->flags_length));
2629 0 : if (PyLong_Check(value)) {
2630 0 : unsigned long long test_var;
2631 0 : test_var = PyLong_AsUnsignedLongLong(value);
2632 0 : if (PyErr_Occurred() != NULL) {
2633 0 : return -1;
2634 : }
2635 0 : if (test_var > uint_max) {
2636 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2637 : PyLong_Type.tp_name, uint_max, test_var);
2638 0 : return -1;
2639 : }
2640 0 : object->flags_length = test_var;
2641 : } else {
2642 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2643 : PyLong_Type.tp_name);
2644 0 : return -1;
2645 : }
2646 : }
2647 0 : return 0;
2648 : }
2649 :
2650 820 : static PyObject *py_PAC_ATTRIBUTES_INFO_get_flags(PyObject *obj, void *closure)
2651 : {
2652 820 : struct PAC_ATTRIBUTES_INFO *object = pytalloc_get_ptr(obj);
2653 0 : PyObject *py_flags;
2654 820 : py_flags = PyLong_FromUnsignedLongLong((uint32_t)(object->flags));
2655 820 : return py_flags;
2656 : }
2657 :
2658 0 : static int py_PAC_ATTRIBUTES_INFO_set_flags(PyObject *py_obj, PyObject *value, void *closure)
2659 : {
2660 0 : struct PAC_ATTRIBUTES_INFO *object = pytalloc_get_ptr(py_obj);
2661 0 : if (value == NULL) {
2662 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->flags");
2663 0 : return -1;
2664 : }
2665 : {
2666 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->flags));
2667 0 : if (PyLong_Check(value)) {
2668 0 : unsigned long long test_var;
2669 0 : test_var = PyLong_AsUnsignedLongLong(value);
2670 0 : if (PyErr_Occurred() != NULL) {
2671 0 : return -1;
2672 : }
2673 0 : if (test_var > uint_max) {
2674 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2675 : PyLong_Type.tp_name, uint_max, test_var);
2676 0 : return -1;
2677 : }
2678 0 : object->flags = test_var;
2679 : } else {
2680 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2681 : PyLong_Type.tp_name);
2682 0 : return -1;
2683 : }
2684 : }
2685 0 : return 0;
2686 : }
2687 :
2688 : static PyGetSetDef py_PAC_ATTRIBUTES_INFO_getsetters[] = {
2689 : {
2690 : .name = discard_const_p(char, "flags_length"),
2691 : .get = py_PAC_ATTRIBUTES_INFO_get_flags_length,
2692 : .set = py_PAC_ATTRIBUTES_INFO_set_flags_length,
2693 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
2694 : },
2695 : {
2696 : .name = discard_const_p(char, "flags"),
2697 : .get = py_PAC_ATTRIBUTES_INFO_get_flags,
2698 : .set = py_PAC_ATTRIBUTES_INFO_set_flags,
2699 : .doc = discard_const_p(char, "PIDL-generated element of base type PAC_ATTRIBUTE_INFO_FLAGS")
2700 : },
2701 : { .name = NULL }
2702 : };
2703 :
2704 0 : static PyObject *py_PAC_ATTRIBUTES_INFO_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2705 : {
2706 0 : return pytalloc_new(struct PAC_ATTRIBUTES_INFO, type);
2707 : }
2708 :
2709 :
2710 : static PyTypeObject PAC_ATTRIBUTES_INFO_Type = {
2711 : PyVarObject_HEAD_INIT(NULL, 0)
2712 : .tp_name = "krb5pac.PAC_ATTRIBUTES_INFO",
2713 : .tp_getset = py_PAC_ATTRIBUTES_INFO_getsetters,
2714 : .tp_methods = NULL,
2715 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
2716 : .tp_new = py_PAC_ATTRIBUTES_INFO_new,
2717 : };
2718 :
2719 :
2720 843 : static PyObject *py_PAC_REQUESTER_SID_get_sid(PyObject *obj, void *closure)
2721 : {
2722 843 : struct PAC_REQUESTER_SID *object = pytalloc_get_ptr(obj);
2723 0 : PyObject *py_sid;
2724 843 : py_sid = pytalloc_reference_ex(dom_sid_Type, pytalloc_get_mem_ctx(obj), &object->sid);
2725 843 : return py_sid;
2726 : }
2727 :
2728 64 : static int py_PAC_REQUESTER_SID_set_sid(PyObject *py_obj, PyObject *value, void *closure)
2729 : {
2730 64 : struct PAC_REQUESTER_SID *object = pytalloc_get_ptr(py_obj);
2731 64 : if (value == NULL) {
2732 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->sid");
2733 0 : return -1;
2734 : }
2735 64 : PY_CHECK_TYPE(dom_sid_Type, value, return -1;);
2736 64 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
2737 0 : PyErr_NoMemory();
2738 0 : return -1;
2739 : }
2740 64 : object->sid = *(struct dom_sid *)pytalloc_get_ptr(value);
2741 64 : return 0;
2742 : }
2743 :
2744 : static PyGetSetDef py_PAC_REQUESTER_SID_getsetters[] = {
2745 : {
2746 : .name = discard_const_p(char, "sid"),
2747 : .get = py_PAC_REQUESTER_SID_get_sid,
2748 : .set = py_PAC_REQUESTER_SID_set_sid,
2749 : .doc = discard_const_p(char, "PIDL-generated element of base type dom_sid")
2750 : },
2751 : { .name = NULL }
2752 : };
2753 :
2754 4 : static PyObject *py_PAC_REQUESTER_SID_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2755 : {
2756 4 : return pytalloc_new(struct PAC_REQUESTER_SID, type);
2757 : }
2758 :
2759 :
2760 : static PyTypeObject PAC_REQUESTER_SID_Type = {
2761 : PyVarObject_HEAD_INIT(NULL, 0)
2762 : .tp_name = "krb5pac.PAC_REQUESTER_SID",
2763 : .tp_getset = py_PAC_REQUESTER_SID_getsetters,
2764 : .tp_methods = NULL,
2765 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
2766 : .tp_new = py_PAC_REQUESTER_SID_new,
2767 : };
2768 :
2769 :
2770 24768 : static PyObject *py_PAC_LOGON_INFO_CTR_get_info(PyObject *obj, void *closure)
2771 : {
2772 24768 : struct PAC_LOGON_INFO_CTR *object = pytalloc_get_ptr(obj);
2773 2 : PyObject *py_info;
2774 24768 : if (object->info == NULL) {
2775 0 : Py_RETURN_NONE;
2776 : }
2777 24768 : if (object->info == NULL) {
2778 0 : py_info = Py_None;
2779 0 : Py_INCREF(py_info);
2780 : } else {
2781 24768 : py_info = pytalloc_reference_ex(&PAC_LOGON_INFO_Type, object->info, object->info);
2782 : }
2783 24768 : return py_info;
2784 : }
2785 :
2786 0 : static int py_PAC_LOGON_INFO_CTR_set_info(PyObject *py_obj, PyObject *value, void *closure)
2787 : {
2788 0 : struct PAC_LOGON_INFO_CTR *object = pytalloc_get_ptr(py_obj);
2789 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->info));
2790 0 : if (value == NULL) {
2791 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->info");
2792 0 : return -1;
2793 : }
2794 0 : if (value == Py_None) {
2795 0 : object->info = NULL;
2796 : } else {
2797 0 : object->info = NULL;
2798 0 : PY_CHECK_TYPE(&PAC_LOGON_INFO_Type, value, return -1;);
2799 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
2800 0 : PyErr_NoMemory();
2801 0 : return -1;
2802 : }
2803 0 : object->info = (struct PAC_LOGON_INFO *)pytalloc_get_ptr(value);
2804 : }
2805 0 : return 0;
2806 : }
2807 :
2808 : static PyGetSetDef py_PAC_LOGON_INFO_CTR_getsetters[] = {
2809 : {
2810 : .name = discard_const_p(char, "info"),
2811 : .get = py_PAC_LOGON_INFO_CTR_get_info,
2812 : .set = py_PAC_LOGON_INFO_CTR_set_info,
2813 : .doc = discard_const_p(char, "PIDL-generated element of base type PAC_LOGON_INFO")
2814 : },
2815 : { .name = NULL }
2816 : };
2817 :
2818 0 : static PyObject *py_PAC_LOGON_INFO_CTR_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2819 : {
2820 0 : return pytalloc_new(struct PAC_LOGON_INFO_CTR, type);
2821 : }
2822 :
2823 0 : static PyObject *py_PAC_LOGON_INFO_CTR_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2824 : {
2825 0 : struct PAC_LOGON_INFO_CTR *object = pytalloc_get_ptr(py_obj);
2826 0 : PyObject *ret = NULL;
2827 0 : DATA_BLOB blob;
2828 0 : enum ndr_err_code err;
2829 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
2830 0 : if (tmp_ctx == NULL) {
2831 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
2832 0 : return NULL;
2833 : }
2834 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_PAC_LOGON_INFO_CTR);
2835 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2836 0 : TALLOC_FREE(tmp_ctx);
2837 0 : PyErr_SetNdrError(err);
2838 0 : return NULL;
2839 : }
2840 :
2841 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
2842 0 : TALLOC_FREE(tmp_ctx);
2843 0 : return ret;
2844 : }
2845 :
2846 0 : static PyObject *py_PAC_LOGON_INFO_CTR_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
2847 : {
2848 0 : struct PAC_LOGON_INFO_CTR *object = pytalloc_get_ptr(py_obj);
2849 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
2850 0 : Py_ssize_t blob_length = 0;
2851 0 : enum ndr_err_code err;
2852 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
2853 0 : PyObject *allow_remaining_obj = NULL;
2854 0 : bool allow_remaining = false;
2855 :
2856 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
2857 : discard_const_p(char *, kwnames),
2858 : &blob.data, &blob_length,
2859 : &allow_remaining_obj)) {
2860 0 : return NULL;
2861 : }
2862 0 : blob.length = blob_length;
2863 :
2864 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
2865 0 : allow_remaining = true;
2866 : }
2867 :
2868 0 : if (allow_remaining) {
2869 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_LOGON_INFO_CTR);
2870 : } else {
2871 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_LOGON_INFO_CTR);
2872 : }
2873 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2874 0 : PyErr_SetNdrError(err);
2875 0 : return NULL;
2876 : }
2877 :
2878 0 : Py_RETURN_NONE;
2879 : }
2880 :
2881 0 : static PyObject *py_PAC_LOGON_INFO_CTR_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2882 : {
2883 0 : struct PAC_LOGON_INFO_CTR *object = pytalloc_get_ptr(py_obj);
2884 0 : PyObject *ret;
2885 0 : char *retstr;
2886 :
2887 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_PAC_LOGON_INFO_CTR, "PAC_LOGON_INFO_CTR", object);
2888 0 : ret = PyUnicode_FromString(retstr);
2889 0 : talloc_free(retstr);
2890 :
2891 0 : return ret;
2892 : }
2893 :
2894 : static PyMethodDef py_PAC_LOGON_INFO_CTR_methods[] = {
2895 : { "__ndr_pack__", (PyCFunction)py_PAC_LOGON_INFO_CTR_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
2896 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PAC_LOGON_INFO_CTR_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
2897 : { "__ndr_print__", (PyCFunction)py_PAC_LOGON_INFO_CTR_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
2898 : { NULL, NULL, 0, NULL }
2899 : };
2900 :
2901 :
2902 : static PyTypeObject PAC_LOGON_INFO_CTR_Type = {
2903 : PyVarObject_HEAD_INIT(NULL, 0)
2904 : .tp_name = "krb5pac.PAC_LOGON_INFO_CTR",
2905 : .tp_getset = py_PAC_LOGON_INFO_CTR_getsetters,
2906 : .tp_methods = py_PAC_LOGON_INFO_CTR_methods,
2907 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
2908 : .tp_new = py_PAC_LOGON_INFO_CTR_new,
2909 : };
2910 :
2911 :
2912 141 : static PyObject *py_PAC_CONSTRAINED_DELEGATION_CTR_get_info(PyObject *obj, void *closure)
2913 : {
2914 141 : struct PAC_CONSTRAINED_DELEGATION_CTR *object = pytalloc_get_ptr(obj);
2915 0 : PyObject *py_info;
2916 141 : if (object->info == NULL) {
2917 0 : Py_RETURN_NONE;
2918 : }
2919 141 : if (object->info == NULL) {
2920 0 : py_info = Py_None;
2921 0 : Py_INCREF(py_info);
2922 : } else {
2923 141 : py_info = pytalloc_reference_ex(&PAC_CONSTRAINED_DELEGATION_Type, object->info, object->info);
2924 : }
2925 141 : return py_info;
2926 : }
2927 :
2928 4 : static int py_PAC_CONSTRAINED_DELEGATION_CTR_set_info(PyObject *py_obj, PyObject *value, void *closure)
2929 : {
2930 4 : struct PAC_CONSTRAINED_DELEGATION_CTR *object = pytalloc_get_ptr(py_obj);
2931 4 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->info));
2932 4 : if (value == NULL) {
2933 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->info");
2934 0 : return -1;
2935 : }
2936 4 : if (value == Py_None) {
2937 0 : object->info = NULL;
2938 : } else {
2939 4 : object->info = NULL;
2940 4 : PY_CHECK_TYPE(&PAC_CONSTRAINED_DELEGATION_Type, value, return -1;);
2941 4 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
2942 0 : PyErr_NoMemory();
2943 0 : return -1;
2944 : }
2945 4 : object->info = (struct PAC_CONSTRAINED_DELEGATION *)pytalloc_get_ptr(value);
2946 : }
2947 4 : return 0;
2948 : }
2949 :
2950 : static PyGetSetDef py_PAC_CONSTRAINED_DELEGATION_CTR_getsetters[] = {
2951 : {
2952 : .name = discard_const_p(char, "info"),
2953 : .get = py_PAC_CONSTRAINED_DELEGATION_CTR_get_info,
2954 : .set = py_PAC_CONSTRAINED_DELEGATION_CTR_set_info,
2955 : .doc = discard_const_p(char, "PIDL-generated element of base type PAC_CONSTRAINED_DELEGATION")
2956 : },
2957 : { .name = NULL }
2958 : };
2959 :
2960 4 : static PyObject *py_PAC_CONSTRAINED_DELEGATION_CTR_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2961 : {
2962 4 : return pytalloc_new(struct PAC_CONSTRAINED_DELEGATION_CTR, type);
2963 : }
2964 :
2965 0 : static PyObject *py_PAC_CONSTRAINED_DELEGATION_CTR_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2966 : {
2967 0 : struct PAC_CONSTRAINED_DELEGATION_CTR *object = pytalloc_get_ptr(py_obj);
2968 0 : PyObject *ret = NULL;
2969 0 : DATA_BLOB blob;
2970 0 : enum ndr_err_code err;
2971 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
2972 0 : if (tmp_ctx == NULL) {
2973 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
2974 0 : return NULL;
2975 : }
2976 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_PAC_CONSTRAINED_DELEGATION_CTR);
2977 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2978 0 : TALLOC_FREE(tmp_ctx);
2979 0 : PyErr_SetNdrError(err);
2980 0 : return NULL;
2981 : }
2982 :
2983 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
2984 0 : TALLOC_FREE(tmp_ctx);
2985 0 : return ret;
2986 : }
2987 :
2988 0 : static PyObject *py_PAC_CONSTRAINED_DELEGATION_CTR_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
2989 : {
2990 0 : struct PAC_CONSTRAINED_DELEGATION_CTR *object = pytalloc_get_ptr(py_obj);
2991 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
2992 0 : Py_ssize_t blob_length = 0;
2993 0 : enum ndr_err_code err;
2994 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
2995 0 : PyObject *allow_remaining_obj = NULL;
2996 0 : bool allow_remaining = false;
2997 :
2998 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
2999 : discard_const_p(char *, kwnames),
3000 : &blob.data, &blob_length,
3001 : &allow_remaining_obj)) {
3002 0 : return NULL;
3003 : }
3004 0 : blob.length = blob_length;
3005 :
3006 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
3007 0 : allow_remaining = true;
3008 : }
3009 :
3010 0 : if (allow_remaining) {
3011 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_CONSTRAINED_DELEGATION_CTR);
3012 : } else {
3013 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_CONSTRAINED_DELEGATION_CTR);
3014 : }
3015 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
3016 0 : PyErr_SetNdrError(err);
3017 0 : return NULL;
3018 : }
3019 :
3020 0 : Py_RETURN_NONE;
3021 : }
3022 :
3023 0 : static PyObject *py_PAC_CONSTRAINED_DELEGATION_CTR_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
3024 : {
3025 0 : struct PAC_CONSTRAINED_DELEGATION_CTR *object = pytalloc_get_ptr(py_obj);
3026 0 : PyObject *ret;
3027 0 : char *retstr;
3028 :
3029 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_PAC_CONSTRAINED_DELEGATION_CTR, "PAC_CONSTRAINED_DELEGATION_CTR", object);
3030 0 : ret = PyUnicode_FromString(retstr);
3031 0 : talloc_free(retstr);
3032 :
3033 0 : return ret;
3034 : }
3035 :
3036 : static PyMethodDef py_PAC_CONSTRAINED_DELEGATION_CTR_methods[] = {
3037 : { "__ndr_pack__", (PyCFunction)py_PAC_CONSTRAINED_DELEGATION_CTR_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
3038 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PAC_CONSTRAINED_DELEGATION_CTR_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
3039 : { "__ndr_print__", (PyCFunction)py_PAC_CONSTRAINED_DELEGATION_CTR_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
3040 : { NULL, NULL, 0, NULL }
3041 : };
3042 :
3043 :
3044 : static PyTypeObject PAC_CONSTRAINED_DELEGATION_CTR_Type = {
3045 : PyVarObject_HEAD_INIT(NULL, 0)
3046 : .tp_name = "krb5pac.PAC_CONSTRAINED_DELEGATION_CTR",
3047 : .tp_getset = py_PAC_CONSTRAINED_DELEGATION_CTR_getsetters,
3048 : .tp_methods = py_PAC_CONSTRAINED_DELEGATION_CTR_methods,
3049 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
3050 : .tp_new = py_PAC_CONSTRAINED_DELEGATION_CTR_new,
3051 : };
3052 :
3053 :
3054 58 : static PyObject *py_PAC_DEVICE_INFO_get_rid(PyObject *obj, void *closure)
3055 : {
3056 58 : struct PAC_DEVICE_INFO *object = pytalloc_get_ptr(obj);
3057 0 : PyObject *py_rid;
3058 58 : py_rid = PyLong_FromUnsignedLongLong((uint32_t)(object->rid));
3059 58 : return py_rid;
3060 : }
3061 :
3062 48 : static int py_PAC_DEVICE_INFO_set_rid(PyObject *py_obj, PyObject *value, void *closure)
3063 : {
3064 48 : struct PAC_DEVICE_INFO *object = pytalloc_get_ptr(py_obj);
3065 48 : if (value == NULL) {
3066 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->rid");
3067 0 : return -1;
3068 : }
3069 : {
3070 48 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->rid));
3071 48 : if (PyLong_Check(value)) {
3072 0 : unsigned long long test_var;
3073 48 : test_var = PyLong_AsUnsignedLongLong(value);
3074 48 : if (PyErr_Occurred() != NULL) {
3075 0 : return -1;
3076 : }
3077 48 : if (test_var > uint_max) {
3078 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3079 : PyLong_Type.tp_name, uint_max, test_var);
3080 0 : return -1;
3081 : }
3082 48 : object->rid = test_var;
3083 : } else {
3084 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3085 : PyLong_Type.tp_name);
3086 0 : return -1;
3087 : }
3088 : }
3089 48 : return 0;
3090 : }
3091 :
3092 58 : static PyObject *py_PAC_DEVICE_INFO_get_primary_gid(PyObject *obj, void *closure)
3093 : {
3094 58 : struct PAC_DEVICE_INFO *object = pytalloc_get_ptr(obj);
3095 0 : PyObject *py_primary_gid;
3096 58 : py_primary_gid = PyLong_FromUnsignedLongLong((uint32_t)(object->primary_gid));
3097 58 : return py_primary_gid;
3098 : }
3099 :
3100 48 : static int py_PAC_DEVICE_INFO_set_primary_gid(PyObject *py_obj, PyObject *value, void *closure)
3101 : {
3102 48 : struct PAC_DEVICE_INFO *object = pytalloc_get_ptr(py_obj);
3103 48 : if (value == NULL) {
3104 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->primary_gid");
3105 0 : return -1;
3106 : }
3107 : {
3108 48 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->primary_gid));
3109 48 : if (PyLong_Check(value)) {
3110 0 : unsigned long long test_var;
3111 48 : test_var = PyLong_AsUnsignedLongLong(value);
3112 48 : if (PyErr_Occurred() != NULL) {
3113 0 : return -1;
3114 : }
3115 48 : if (test_var > uint_max) {
3116 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3117 : PyLong_Type.tp_name, uint_max, test_var);
3118 0 : return -1;
3119 : }
3120 48 : object->primary_gid = test_var;
3121 : } else {
3122 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3123 : PyLong_Type.tp_name);
3124 0 : return -1;
3125 : }
3126 : }
3127 48 : return 0;
3128 : }
3129 :
3130 58 : static PyObject *py_PAC_DEVICE_INFO_get_domain_sid(PyObject *obj, void *closure)
3131 : {
3132 58 : struct PAC_DEVICE_INFO *object = pytalloc_get_ptr(obj);
3133 0 : PyObject *py_domain_sid;
3134 58 : if (object->domain_sid == NULL) {
3135 0 : Py_RETURN_NONE;
3136 : }
3137 58 : if (object->domain_sid == NULL) {
3138 0 : py_domain_sid = Py_None;
3139 0 : Py_INCREF(py_domain_sid);
3140 : } else {
3141 58 : py_domain_sid = pytalloc_reference_ex(dom_sid_Type, object->domain_sid, object->domain_sid);
3142 : }
3143 58 : return py_domain_sid;
3144 : }
3145 :
3146 48 : static int py_PAC_DEVICE_INFO_set_domain_sid(PyObject *py_obj, PyObject *value, void *closure)
3147 : {
3148 48 : struct PAC_DEVICE_INFO *object = pytalloc_get_ptr(py_obj);
3149 48 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->domain_sid));
3150 48 : if (value == NULL) {
3151 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->domain_sid");
3152 0 : return -1;
3153 : }
3154 48 : if (value == Py_None) {
3155 0 : object->domain_sid = NULL;
3156 : } else {
3157 48 : object->domain_sid = NULL;
3158 48 : PY_CHECK_TYPE(dom_sid_Type, value, return -1;);
3159 48 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
3160 0 : PyErr_NoMemory();
3161 0 : return -1;
3162 : }
3163 48 : object->domain_sid = (struct dom_sid *)pytalloc_get_ptr(value);
3164 : }
3165 48 : return 0;
3166 : }
3167 :
3168 270 : static PyObject *py_PAC_DEVICE_INFO_get_groups(PyObject *obj, void *closure)
3169 : {
3170 270 : struct PAC_DEVICE_INFO *object = pytalloc_get_ptr(obj);
3171 0 : PyObject *py_groups;
3172 270 : py_groups = pytalloc_reference_ex(samr_RidWithAttributeArray_Type, pytalloc_get_mem_ctx(obj), &object->groups);
3173 270 : return py_groups;
3174 : }
3175 :
3176 0 : static int py_PAC_DEVICE_INFO_set_groups(PyObject *py_obj, PyObject *value, void *closure)
3177 : {
3178 0 : struct PAC_DEVICE_INFO *object = pytalloc_get_ptr(py_obj);
3179 0 : if (value == NULL) {
3180 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->groups");
3181 0 : return -1;
3182 : }
3183 0 : PY_CHECK_TYPE(samr_RidWithAttributeArray_Type, value, return -1;);
3184 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
3185 0 : PyErr_NoMemory();
3186 0 : return -1;
3187 : }
3188 0 : object->groups = *(struct samr_RidWithAttributeArray *)pytalloc_get_ptr(value);
3189 0 : return 0;
3190 : }
3191 :
3192 0 : static PyObject *py_PAC_DEVICE_INFO_get_sid_count(PyObject *obj, void *closure)
3193 : {
3194 0 : struct PAC_DEVICE_INFO *object = pytalloc_get_ptr(obj);
3195 0 : PyObject *py_sid_count;
3196 0 : py_sid_count = PyLong_FromUnsignedLongLong((uint32_t)(object->sid_count));
3197 0 : return py_sid_count;
3198 : }
3199 :
3200 48 : static int py_PAC_DEVICE_INFO_set_sid_count(PyObject *py_obj, PyObject *value, void *closure)
3201 : {
3202 48 : struct PAC_DEVICE_INFO *object = pytalloc_get_ptr(py_obj);
3203 48 : if (value == NULL) {
3204 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->sid_count");
3205 0 : return -1;
3206 : }
3207 : {
3208 48 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->sid_count));
3209 48 : if (PyLong_Check(value)) {
3210 0 : unsigned long long test_var;
3211 48 : test_var = PyLong_AsUnsignedLongLong(value);
3212 48 : if (PyErr_Occurred() != NULL) {
3213 0 : return -1;
3214 : }
3215 48 : if (test_var > uint_max) {
3216 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3217 : PyLong_Type.tp_name, uint_max, test_var);
3218 0 : return -1;
3219 : }
3220 48 : object->sid_count = test_var;
3221 : } else {
3222 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3223 : PyLong_Type.tp_name);
3224 0 : return -1;
3225 : }
3226 : }
3227 48 : return 0;
3228 : }
3229 :
3230 170 : static PyObject *py_PAC_DEVICE_INFO_get_sids(PyObject *obj, void *closure)
3231 : {
3232 170 : struct PAC_DEVICE_INFO *object = pytalloc_get_ptr(obj);
3233 0 : PyObject *py_sids;
3234 170 : if (object->sids == NULL) {
3235 2 : Py_RETURN_NONE;
3236 : }
3237 168 : if (object->sids == NULL) {
3238 0 : py_sids = Py_None;
3239 0 : Py_INCREF(py_sids);
3240 : } else {
3241 168 : py_sids = PyList_New(object->sid_count);
3242 168 : if (py_sids == NULL) {
3243 0 : return NULL;
3244 : }
3245 : {
3246 : int sids_cntr_1;
3247 399 : for (sids_cntr_1 = 0; sids_cntr_1 < (object->sid_count); sids_cntr_1++) {
3248 0 : PyObject *py_sids_1;
3249 231 : py_sids_1 = pytalloc_reference_ex(netr_SidAttr_Type, object->sids, &(object->sids)[sids_cntr_1]);
3250 231 : PyList_SetItem(py_sids, sids_cntr_1, py_sids_1);
3251 : }
3252 : }
3253 : }
3254 168 : return py_sids;
3255 : }
3256 :
3257 48 : static int py_PAC_DEVICE_INFO_set_sids(PyObject *py_obj, PyObject *value, void *closure)
3258 : {
3259 48 : struct PAC_DEVICE_INFO *object = pytalloc_get_ptr(py_obj);
3260 48 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->sids));
3261 48 : if (value == NULL) {
3262 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->sids");
3263 0 : return -1;
3264 : }
3265 48 : if (value == Py_None) {
3266 0 : object->sids = NULL;
3267 : } else {
3268 48 : object->sids = NULL;
3269 48 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
3270 : {
3271 0 : int sids_cntr_1;
3272 48 : object->sids = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->sids, PyList_GET_SIZE(value));
3273 48 : if (!object->sids) { return -1; }
3274 48 : talloc_set_name_const(object->sids, "ARRAY: object->sids");
3275 144 : for (sids_cntr_1 = 0; sids_cntr_1 < PyList_GET_SIZE(value); sids_cntr_1++) {
3276 96 : if (PyList_GET_ITEM(value, sids_cntr_1) == NULL) {
3277 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->sids)[sids_cntr_1]");
3278 0 : return -1;
3279 : }
3280 96 : PY_CHECK_TYPE(netr_SidAttr_Type, PyList_GET_ITEM(value, sids_cntr_1), return -1;);
3281 96 : if (talloc_reference(object->sids, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, sids_cntr_1))) == NULL) {
3282 0 : PyErr_NoMemory();
3283 0 : return -1;
3284 : }
3285 96 : (object->sids)[sids_cntr_1] = *(struct netr_SidAttr *)pytalloc_get_ptr(PyList_GET_ITEM(value, sids_cntr_1));
3286 : }
3287 : }
3288 : }
3289 48 : return 0;
3290 : }
3291 :
3292 0 : static PyObject *py_PAC_DEVICE_INFO_get_domain_group_count(PyObject *obj, void *closure)
3293 : {
3294 0 : struct PAC_DEVICE_INFO *object = pytalloc_get_ptr(obj);
3295 0 : PyObject *py_domain_group_count;
3296 0 : py_domain_group_count = PyLong_FromUnsignedLongLong((uint32_t)(object->domain_group_count));
3297 0 : return py_domain_group_count;
3298 : }
3299 :
3300 48 : static int py_PAC_DEVICE_INFO_set_domain_group_count(PyObject *py_obj, PyObject *value, void *closure)
3301 : {
3302 48 : struct PAC_DEVICE_INFO *object = pytalloc_get_ptr(py_obj);
3303 48 : if (value == NULL) {
3304 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->domain_group_count");
3305 0 : return -1;
3306 : }
3307 : {
3308 48 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->domain_group_count));
3309 48 : if (PyLong_Check(value)) {
3310 0 : unsigned long long test_var;
3311 48 : test_var = PyLong_AsUnsignedLongLong(value);
3312 48 : if (PyErr_Occurred() != NULL) {
3313 0 : return -1;
3314 : }
3315 48 : if (test_var > uint_max) {
3316 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3317 : PyLong_Type.tp_name, uint_max, test_var);
3318 0 : return -1;
3319 : }
3320 48 : object->domain_group_count = test_var;
3321 : } else {
3322 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3323 : PyLong_Type.tp_name);
3324 0 : return -1;
3325 : }
3326 : }
3327 48 : return 0;
3328 : }
3329 :
3330 152 : static PyObject *py_PAC_DEVICE_INFO_get_domain_groups(PyObject *obj, void *closure)
3331 : {
3332 152 : struct PAC_DEVICE_INFO *object = pytalloc_get_ptr(obj);
3333 0 : PyObject *py_domain_groups;
3334 152 : if (object->domain_groups == NULL) {
3335 11 : Py_RETURN_NONE;
3336 : }
3337 141 : if (object->domain_groups == NULL) {
3338 0 : py_domain_groups = Py_None;
3339 0 : Py_INCREF(py_domain_groups);
3340 : } else {
3341 141 : py_domain_groups = PyList_New(object->domain_group_count);
3342 141 : if (py_domain_groups == NULL) {
3343 0 : return NULL;
3344 : }
3345 : {
3346 : int domain_groups_cntr_1;
3347 342 : for (domain_groups_cntr_1 = 0; domain_groups_cntr_1 < (object->domain_group_count); domain_groups_cntr_1++) {
3348 0 : PyObject *py_domain_groups_1;
3349 201 : py_domain_groups_1 = pytalloc_reference_ex(&PAC_DOMAIN_GROUP_MEMBERSHIP_Type, object->domain_groups, &(object->domain_groups)[domain_groups_cntr_1]);
3350 201 : PyList_SetItem(py_domain_groups, domain_groups_cntr_1, py_domain_groups_1);
3351 : }
3352 : }
3353 : }
3354 141 : return py_domain_groups;
3355 : }
3356 :
3357 48 : static int py_PAC_DEVICE_INFO_set_domain_groups(PyObject *py_obj, PyObject *value, void *closure)
3358 : {
3359 48 : struct PAC_DEVICE_INFO *object = pytalloc_get_ptr(py_obj);
3360 48 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->domain_groups));
3361 48 : if (value == NULL) {
3362 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->domain_groups");
3363 0 : return -1;
3364 : }
3365 48 : if (value == Py_None) {
3366 48 : object->domain_groups = NULL;
3367 : } else {
3368 0 : object->domain_groups = NULL;
3369 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
3370 : {
3371 0 : int domain_groups_cntr_1;
3372 0 : object->domain_groups = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->domain_groups, PyList_GET_SIZE(value));
3373 0 : if (!object->domain_groups) { return -1; }
3374 0 : talloc_set_name_const(object->domain_groups, "ARRAY: object->domain_groups");
3375 0 : for (domain_groups_cntr_1 = 0; domain_groups_cntr_1 < PyList_GET_SIZE(value); domain_groups_cntr_1++) {
3376 0 : if (PyList_GET_ITEM(value, domain_groups_cntr_1) == NULL) {
3377 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->domain_groups)[domain_groups_cntr_1]");
3378 0 : return -1;
3379 : }
3380 0 : PY_CHECK_TYPE(&PAC_DOMAIN_GROUP_MEMBERSHIP_Type, PyList_GET_ITEM(value, domain_groups_cntr_1), return -1;);
3381 0 : if (talloc_reference(object->domain_groups, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, domain_groups_cntr_1))) == NULL) {
3382 0 : PyErr_NoMemory();
3383 0 : return -1;
3384 : }
3385 0 : (object->domain_groups)[domain_groups_cntr_1] = *(struct PAC_DOMAIN_GROUP_MEMBERSHIP *)pytalloc_get_ptr(PyList_GET_ITEM(value, domain_groups_cntr_1));
3386 : }
3387 : }
3388 : }
3389 48 : return 0;
3390 : }
3391 :
3392 : static PyGetSetDef py_PAC_DEVICE_INFO_getsetters[] = {
3393 : {
3394 : .name = discard_const_p(char, "rid"),
3395 : .get = py_PAC_DEVICE_INFO_get_rid,
3396 : .set = py_PAC_DEVICE_INFO_set_rid,
3397 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
3398 : },
3399 : {
3400 : .name = discard_const_p(char, "primary_gid"),
3401 : .get = py_PAC_DEVICE_INFO_get_primary_gid,
3402 : .set = py_PAC_DEVICE_INFO_set_primary_gid,
3403 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
3404 : },
3405 : {
3406 : .name = discard_const_p(char, "domain_sid"),
3407 : .get = py_PAC_DEVICE_INFO_get_domain_sid,
3408 : .set = py_PAC_DEVICE_INFO_set_domain_sid,
3409 : .doc = discard_const_p(char, "PIDL-generated element of base type dom_sid2")
3410 : },
3411 : {
3412 : .name = discard_const_p(char, "groups"),
3413 : .get = py_PAC_DEVICE_INFO_get_groups,
3414 : .set = py_PAC_DEVICE_INFO_set_groups,
3415 : .doc = discard_const_p(char, "PIDL-generated element of base type samr_RidWithAttributeArray")
3416 : },
3417 : {
3418 : .name = discard_const_p(char, "sid_count"),
3419 : .get = py_PAC_DEVICE_INFO_get_sid_count,
3420 : .set = py_PAC_DEVICE_INFO_set_sid_count,
3421 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
3422 : },
3423 : {
3424 : .name = discard_const_p(char, "sids"),
3425 : .get = py_PAC_DEVICE_INFO_get_sids,
3426 : .set = py_PAC_DEVICE_INFO_set_sids,
3427 : .doc = discard_const_p(char, "PIDL-generated element of base type netr_SidAttr")
3428 : },
3429 : {
3430 : .name = discard_const_p(char, "domain_group_count"),
3431 : .get = py_PAC_DEVICE_INFO_get_domain_group_count,
3432 : .set = py_PAC_DEVICE_INFO_set_domain_group_count,
3433 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
3434 : },
3435 : {
3436 : .name = discard_const_p(char, "domain_groups"),
3437 : .get = py_PAC_DEVICE_INFO_get_domain_groups,
3438 : .set = py_PAC_DEVICE_INFO_set_domain_groups,
3439 : .doc = discard_const_p(char, "PIDL-generated element of base type PAC_DOMAIN_GROUP_MEMBERSHIP")
3440 : },
3441 : { .name = NULL }
3442 : };
3443 :
3444 48 : static PyObject *py_PAC_DEVICE_INFO_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
3445 : {
3446 48 : return pytalloc_new(struct PAC_DEVICE_INFO, type);
3447 : }
3448 :
3449 :
3450 : static PyTypeObject PAC_DEVICE_INFO_Type = {
3451 : PyVarObject_HEAD_INIT(NULL, 0)
3452 : .tp_name = "krb5pac.PAC_DEVICE_INFO",
3453 : .tp_getset = py_PAC_DEVICE_INFO_getsetters,
3454 : .tp_methods = NULL,
3455 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
3456 : .tp_new = py_PAC_DEVICE_INFO_new,
3457 : };
3458 :
3459 :
3460 58 : static PyObject *py_PAC_DEVICE_INFO_CTR_get_info(PyObject *obj, void *closure)
3461 : {
3462 58 : struct PAC_DEVICE_INFO_CTR *object = pytalloc_get_ptr(obj);
3463 0 : PyObject *py_info;
3464 58 : if (object->info == NULL) {
3465 0 : Py_RETURN_NONE;
3466 : }
3467 58 : if (object->info == NULL) {
3468 0 : py_info = Py_None;
3469 0 : Py_INCREF(py_info);
3470 : } else {
3471 58 : py_info = pytalloc_reference_ex(&PAC_DEVICE_INFO_Type, object->info, object->info);
3472 : }
3473 58 : return py_info;
3474 : }
3475 :
3476 48 : static int py_PAC_DEVICE_INFO_CTR_set_info(PyObject *py_obj, PyObject *value, void *closure)
3477 : {
3478 48 : struct PAC_DEVICE_INFO_CTR *object = pytalloc_get_ptr(py_obj);
3479 48 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->info));
3480 48 : if (value == NULL) {
3481 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->info");
3482 0 : return -1;
3483 : }
3484 48 : if (value == Py_None) {
3485 0 : object->info = NULL;
3486 : } else {
3487 48 : object->info = NULL;
3488 48 : PY_CHECK_TYPE(&PAC_DEVICE_INFO_Type, value, return -1;);
3489 48 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
3490 0 : PyErr_NoMemory();
3491 0 : return -1;
3492 : }
3493 48 : object->info = (struct PAC_DEVICE_INFO *)pytalloc_get_ptr(value);
3494 : }
3495 48 : return 0;
3496 : }
3497 :
3498 : static PyGetSetDef py_PAC_DEVICE_INFO_CTR_getsetters[] = {
3499 : {
3500 : .name = discard_const_p(char, "info"),
3501 : .get = py_PAC_DEVICE_INFO_CTR_get_info,
3502 : .set = py_PAC_DEVICE_INFO_CTR_set_info,
3503 : .doc = discard_const_p(char, "PIDL-generated element of base type PAC_DEVICE_INFO")
3504 : },
3505 : { .name = NULL }
3506 : };
3507 :
3508 48 : static PyObject *py_PAC_DEVICE_INFO_CTR_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
3509 : {
3510 48 : return pytalloc_new(struct PAC_DEVICE_INFO_CTR, type);
3511 : }
3512 :
3513 :
3514 : static PyTypeObject PAC_DEVICE_INFO_CTR_Type = {
3515 : PyVarObject_HEAD_INIT(NULL, 0)
3516 : .tp_name = "krb5pac.PAC_DEVICE_INFO_CTR",
3517 : .tp_getset = py_PAC_DEVICE_INFO_CTR_getsetters,
3518 : .tp_methods = NULL,
3519 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
3520 : .tp_new = py_PAC_DEVICE_INFO_CTR_new,
3521 : };
3522 :
3523 :
3524 28736 : static PyObject *py_DATA_BLOB_REM_get_remaining(PyObject *obj, void *closure)
3525 : {
3526 28736 : struct DATA_BLOB_REM *object = pytalloc_get_ptr(obj);
3527 11 : PyObject *py_remaining;
3528 28736 : py_remaining = PyBytes_FromStringAndSize((char *)(object->remaining).data, (object->remaining).length);
3529 28736 : return py_remaining;
3530 : }
3531 :
3532 20817 : static int py_DATA_BLOB_REM_set_remaining(PyObject *py_obj, PyObject *value, void *closure)
3533 : {
3534 20817 : struct DATA_BLOB_REM *object = pytalloc_get_ptr(py_obj);
3535 20817 : if (value == NULL) {
3536 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->remaining");
3537 0 : return -1;
3538 : }
3539 20817 : object->remaining = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
3540 20817 : return 0;
3541 : }
3542 :
3543 : static PyGetSetDef py_DATA_BLOB_REM_getsetters[] = {
3544 : {
3545 : .name = discard_const_p(char, "remaining"),
3546 : .get = py_DATA_BLOB_REM_get_remaining,
3547 : .set = py_DATA_BLOB_REM_set_remaining,
3548 : .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
3549 : },
3550 : { .name = NULL }
3551 : };
3552 :
3553 60 : static PyObject *py_DATA_BLOB_REM_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
3554 : {
3555 60 : return pytalloc_new(struct DATA_BLOB_REM, type);
3556 : }
3557 :
3558 :
3559 : static PyTypeObject DATA_BLOB_REM_Type = {
3560 : PyVarObject_HEAD_INIT(NULL, 0)
3561 : .tp_name = "krb5pac.DATA_BLOB_REM",
3562 : .tp_getset = py_DATA_BLOB_REM_getsetters,
3563 : .tp_methods = NULL,
3564 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
3565 : .tp_new = py_DATA_BLOB_REM_new,
3566 : };
3567 :
3568 111650 : static PyObject *py_import_PAC_INFO(TALLOC_CTX *mem_ctx, int level, union PAC_INFO *in)
3569 : {
3570 13 : PyObject *ret;
3571 :
3572 111650 : switch (level) {
3573 24768 : case PAC_TYPE_LOGON_INFO:
3574 24768 : ret = pytalloc_reference_ex(&PAC_LOGON_INFO_CTR_Type, mem_ctx, &in->logon_info);
3575 24768 : return ret;
3576 :
3577 27 : case PAC_TYPE_CREDENTIAL_INFO:
3578 27 : ret = pytalloc_reference_ex(&PAC_CREDENTIAL_INFO_Type, mem_ctx, &in->credential_info);
3579 27 : return ret;
3580 :
3581 20894 : case PAC_TYPE_SRV_CHECKSUM:
3582 20894 : ret = pytalloc_reference_ex(&PAC_SIGNATURE_DATA_Type, mem_ctx, &in->srv_cksum);
3583 20894 : return ret;
3584 :
3585 20894 : case PAC_TYPE_KDC_CHECKSUM:
3586 20894 : ret = pytalloc_reference_ex(&PAC_SIGNATURE_DATA_Type, mem_ctx, &in->kdc_cksum);
3587 20894 : return ret;
3588 :
3589 8496 : case PAC_TYPE_LOGON_NAME:
3590 8496 : ret = pytalloc_reference_ex(&PAC_LOGON_NAME_Type, mem_ctx, &in->logon_name);
3591 8496 : return ret;
3592 :
3593 141 : case PAC_TYPE_CONSTRAINED_DELEGATION:
3594 141 : ret = pytalloc_reference_ex(&PAC_CONSTRAINED_DELEGATION_CTR_Type, mem_ctx, &in->constrained_delegation);
3595 141 : return ret;
3596 :
3597 8543 : case PAC_TYPE_UPN_DNS_INFO:
3598 8543 : ret = pytalloc_reference_ex(&PAC_UPN_DNS_INFO_Type, mem_ctx, &in->upn_dns_info);
3599 8543 : return ret;
3600 :
3601 8726 : case PAC_TYPE_TICKET_CHECKSUM:
3602 8726 : ret = pytalloc_reference_ex(&PAC_SIGNATURE_DATA_Type, mem_ctx, &in->ticket_checksum);
3603 8726 : return ret;
3604 :
3605 820 : case PAC_TYPE_ATTRIBUTES_INFO:
3606 820 : ret = pytalloc_reference_ex(&PAC_ATTRIBUTES_INFO_Type, mem_ctx, &in->attributes_info);
3607 820 : return ret;
3608 :
3609 903 : case PAC_TYPE_REQUESTER_SID:
3610 903 : ret = pytalloc_reference_ex(&PAC_REQUESTER_SID_Type, mem_ctx, &in->requester_sid);
3611 903 : return ret;
3612 :
3613 8351 : case PAC_TYPE_CLIENT_CLAIMS_INFO:
3614 8351 : ret = pytalloc_reference_ex(&DATA_BLOB_REM_Type, mem_ctx, &in->client_claims_info);
3615 8351 : return ret;
3616 :
3617 58 : case PAC_TYPE_DEVICE_INFO:
3618 58 : ret = pytalloc_reference_ex(&PAC_DEVICE_INFO_CTR_Type, mem_ctx, &in->device_info);
3619 58 : return ret;
3620 :
3621 100 : case PAC_TYPE_DEVICE_CLAIMS_INFO:
3622 100 : ret = pytalloc_reference_ex(&DATA_BLOB_REM_Type, mem_ctx, &in->device_claims_info);
3623 100 : return ret;
3624 :
3625 8929 : case PAC_TYPE_FULL_CHECKSUM:
3626 8929 : ret = pytalloc_reference_ex(&PAC_SIGNATURE_DATA_Type, mem_ctx, &in->full_checksum);
3627 8929 : return ret;
3628 :
3629 0 : default:
3630 0 : ret = pytalloc_reference_ex(&DATA_BLOB_REM_Type, mem_ctx, &in->unknown);
3631 0 : return ret;
3632 :
3633 : }
3634 : PyErr_SetString(PyExc_TypeError, "unknown union level");
3635 : return NULL;
3636 : }
3637 :
3638 148 : static union PAC_INFO *py_export_PAC_INFO(TALLOC_CTX *mem_ctx, int level, PyObject *in)
3639 : {
3640 148 : union PAC_INFO *ret = talloc_zero(mem_ctx, union PAC_INFO);
3641 148 : switch (level) {
3642 0 : case PAC_TYPE_LOGON_INFO:
3643 0 : if (in == NULL) {
3644 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->logon_info");
3645 0 : talloc_free(ret); return NULL;
3646 : }
3647 0 : PY_CHECK_TYPE(&PAC_LOGON_INFO_CTR_Type, in, talloc_free(ret); return NULL;);
3648 0 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
3649 0 : PyErr_NoMemory();
3650 0 : talloc_free(ret); return NULL;
3651 : }
3652 0 : ret->logon_info = *(struct PAC_LOGON_INFO_CTR *)pytalloc_get_ptr(in);
3653 0 : break;
3654 :
3655 0 : case PAC_TYPE_CREDENTIAL_INFO:
3656 0 : if (in == NULL) {
3657 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->credential_info");
3658 0 : talloc_free(ret); return NULL;
3659 : }
3660 0 : PY_CHECK_TYPE(&PAC_CREDENTIAL_INFO_Type, in, talloc_free(ret); return NULL;);
3661 0 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
3662 0 : PyErr_NoMemory();
3663 0 : talloc_free(ret); return NULL;
3664 : }
3665 0 : ret->credential_info = *(struct PAC_CREDENTIAL_INFO *)pytalloc_get_ptr(in);
3666 0 : break;
3667 :
3668 0 : case PAC_TYPE_SRV_CHECKSUM:
3669 0 : if (in == NULL) {
3670 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->srv_cksum");
3671 0 : talloc_free(ret); return NULL;
3672 : }
3673 0 : PY_CHECK_TYPE(&PAC_SIGNATURE_DATA_Type, in, talloc_free(ret); return NULL;);
3674 0 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
3675 0 : PyErr_NoMemory();
3676 0 : talloc_free(ret); return NULL;
3677 : }
3678 0 : ret->srv_cksum = *(struct PAC_SIGNATURE_DATA *)pytalloc_get_ptr(in);
3679 0 : break;
3680 :
3681 0 : case PAC_TYPE_KDC_CHECKSUM:
3682 0 : if (in == NULL) {
3683 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->kdc_cksum");
3684 0 : talloc_free(ret); return NULL;
3685 : }
3686 0 : PY_CHECK_TYPE(&PAC_SIGNATURE_DATA_Type, in, talloc_free(ret); return NULL;);
3687 0 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
3688 0 : PyErr_NoMemory();
3689 0 : talloc_free(ret); return NULL;
3690 : }
3691 0 : ret->kdc_cksum = *(struct PAC_SIGNATURE_DATA *)pytalloc_get_ptr(in);
3692 0 : break;
3693 :
3694 0 : case PAC_TYPE_LOGON_NAME:
3695 0 : if (in == NULL) {
3696 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->logon_name");
3697 0 : talloc_free(ret); return NULL;
3698 : }
3699 0 : PY_CHECK_TYPE(&PAC_LOGON_NAME_Type, in, talloc_free(ret); return NULL;);
3700 0 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
3701 0 : PyErr_NoMemory();
3702 0 : talloc_free(ret); return NULL;
3703 : }
3704 0 : ret->logon_name = *(struct PAC_LOGON_NAME *)pytalloc_get_ptr(in);
3705 0 : break;
3706 :
3707 4 : case PAC_TYPE_CONSTRAINED_DELEGATION:
3708 4 : if (in == NULL) {
3709 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->constrained_delegation");
3710 0 : talloc_free(ret); return NULL;
3711 : }
3712 4 : PY_CHECK_TYPE(&PAC_CONSTRAINED_DELEGATION_CTR_Type, in, talloc_free(ret); return NULL;);
3713 4 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
3714 0 : PyErr_NoMemory();
3715 0 : talloc_free(ret); return NULL;
3716 : }
3717 4 : ret->constrained_delegation = *(struct PAC_CONSTRAINED_DELEGATION_CTR *)pytalloc_get_ptr(in);
3718 4 : break;
3719 :
3720 0 : case PAC_TYPE_UPN_DNS_INFO:
3721 0 : if (in == NULL) {
3722 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->upn_dns_info");
3723 0 : talloc_free(ret); return NULL;
3724 : }
3725 0 : PY_CHECK_TYPE(&PAC_UPN_DNS_INFO_Type, in, talloc_free(ret); return NULL;);
3726 0 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
3727 0 : PyErr_NoMemory();
3728 0 : talloc_free(ret); return NULL;
3729 : }
3730 0 : ret->upn_dns_info = *(struct PAC_UPN_DNS_INFO *)pytalloc_get_ptr(in);
3731 0 : break;
3732 :
3733 16 : case PAC_TYPE_TICKET_CHECKSUM:
3734 16 : if (in == NULL) {
3735 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->ticket_checksum");
3736 0 : talloc_free(ret); return NULL;
3737 : }
3738 16 : PY_CHECK_TYPE(&PAC_SIGNATURE_DATA_Type, in, talloc_free(ret); return NULL;);
3739 16 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
3740 0 : PyErr_NoMemory();
3741 0 : talloc_free(ret); return NULL;
3742 : }
3743 16 : ret->ticket_checksum = *(struct PAC_SIGNATURE_DATA *)pytalloc_get_ptr(in);
3744 16 : break;
3745 :
3746 0 : case PAC_TYPE_ATTRIBUTES_INFO:
3747 0 : if (in == NULL) {
3748 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->attributes_info");
3749 0 : talloc_free(ret); return NULL;
3750 : }
3751 0 : PY_CHECK_TYPE(&PAC_ATTRIBUTES_INFO_Type, in, talloc_free(ret); return NULL;);
3752 0 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
3753 0 : PyErr_NoMemory();
3754 0 : talloc_free(ret); return NULL;
3755 : }
3756 0 : ret->attributes_info = *(struct PAC_ATTRIBUTES_INFO *)pytalloc_get_ptr(in);
3757 0 : break;
3758 :
3759 4 : case PAC_TYPE_REQUESTER_SID:
3760 4 : if (in == NULL) {
3761 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->requester_sid");
3762 0 : talloc_free(ret); return NULL;
3763 : }
3764 4 : PY_CHECK_TYPE(&PAC_REQUESTER_SID_Type, in, talloc_free(ret); return NULL;);
3765 4 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
3766 0 : PyErr_NoMemory();
3767 0 : talloc_free(ret); return NULL;
3768 : }
3769 4 : ret->requester_sid = *(struct PAC_REQUESTER_SID *)pytalloc_get_ptr(in);
3770 4 : break;
3771 :
3772 0 : case PAC_TYPE_CLIENT_CLAIMS_INFO:
3773 0 : if (in == NULL) {
3774 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->client_claims_info");
3775 0 : talloc_free(ret); return NULL;
3776 : }
3777 0 : PY_CHECK_TYPE(&DATA_BLOB_REM_Type, in, talloc_free(ret); return NULL;);
3778 0 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
3779 0 : PyErr_NoMemory();
3780 0 : talloc_free(ret); return NULL;
3781 : }
3782 0 : ret->client_claims_info = *(struct DATA_BLOB_REM *)pytalloc_get_ptr(in);
3783 0 : break;
3784 :
3785 48 : case PAC_TYPE_DEVICE_INFO:
3786 48 : if (in == NULL) {
3787 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->device_info");
3788 0 : talloc_free(ret); return NULL;
3789 : }
3790 48 : PY_CHECK_TYPE(&PAC_DEVICE_INFO_CTR_Type, in, talloc_free(ret); return NULL;);
3791 48 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
3792 0 : PyErr_NoMemory();
3793 0 : talloc_free(ret); return NULL;
3794 : }
3795 48 : ret->device_info = *(struct PAC_DEVICE_INFO_CTR *)pytalloc_get_ptr(in);
3796 48 : break;
3797 :
3798 48 : case PAC_TYPE_DEVICE_CLAIMS_INFO:
3799 48 : if (in == NULL) {
3800 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->device_claims_info");
3801 0 : talloc_free(ret); return NULL;
3802 : }
3803 48 : PY_CHECK_TYPE(&DATA_BLOB_REM_Type, in, talloc_free(ret); return NULL;);
3804 48 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
3805 0 : PyErr_NoMemory();
3806 0 : talloc_free(ret); return NULL;
3807 : }
3808 48 : ret->device_claims_info = *(struct DATA_BLOB_REM *)pytalloc_get_ptr(in);
3809 48 : break;
3810 :
3811 16 : case PAC_TYPE_FULL_CHECKSUM:
3812 16 : if (in == NULL) {
3813 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->full_checksum");
3814 0 : talloc_free(ret); return NULL;
3815 : }
3816 16 : PY_CHECK_TYPE(&PAC_SIGNATURE_DATA_Type, in, talloc_free(ret); return NULL;);
3817 16 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
3818 0 : PyErr_NoMemory();
3819 0 : talloc_free(ret); return NULL;
3820 : }
3821 16 : ret->full_checksum = *(struct PAC_SIGNATURE_DATA *)pytalloc_get_ptr(in);
3822 16 : break;
3823 :
3824 12 : default:
3825 12 : if (in == NULL) {
3826 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->unknown");
3827 0 : talloc_free(ret); return NULL;
3828 : }
3829 12 : PY_CHECK_TYPE(&DATA_BLOB_REM_Type, in, talloc_free(ret); return NULL;);
3830 12 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
3831 0 : PyErr_NoMemory();
3832 0 : talloc_free(ret); return NULL;
3833 : }
3834 12 : ret->unknown = *(struct DATA_BLOB_REM *)pytalloc_get_ptr(in);
3835 12 : break;
3836 :
3837 : }
3838 :
3839 148 : return ret;
3840 : }
3841 :
3842 111650 : static PyObject *py_PAC_INFO_import(PyTypeObject *type, PyObject *args, PyObject *kwargs)
3843 : {
3844 111650 : const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
3845 111650 : PyObject *mem_ctx_obj = NULL;
3846 111650 : TALLOC_CTX *mem_ctx = NULL;
3847 111650 : int level = 0;
3848 111650 : PyObject *in_obj = NULL;
3849 111650 : union PAC_INFO *in = NULL;
3850 :
3851 111650 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:import",
3852 : discard_const_p(char *, kwnames),
3853 : &mem_ctx_obj,
3854 : &level,
3855 : &in_obj)) {
3856 0 : return NULL;
3857 : }
3858 111650 : mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
3859 111650 : if (mem_ctx == NULL) {
3860 0 : PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
3861 0 : return NULL;
3862 : }
3863 111650 : in = (union PAC_INFO *)pytalloc_get_ptr(in_obj);
3864 111650 : if (in == NULL) {
3865 0 : PyErr_Format(PyExc_TypeError, "in needs to be a pointer to union PAC_INFO!");
3866 0 : return NULL;
3867 : }
3868 :
3869 111650 : return py_import_PAC_INFO(mem_ctx, level, in);
3870 : }
3871 :
3872 148 : static PyObject *py_PAC_INFO_export(PyTypeObject *type, PyObject *args, PyObject *kwargs)
3873 : {
3874 148 : const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
3875 148 : PyObject *mem_ctx_obj = NULL;
3876 148 : TALLOC_CTX *mem_ctx = NULL;
3877 148 : int level = 0;
3878 148 : PyObject *in = NULL;
3879 148 : union PAC_INFO *out = NULL;
3880 :
3881 148 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:export",
3882 : discard_const_p(char *, kwnames),
3883 : &mem_ctx_obj,
3884 : &level,
3885 : &in)) {
3886 0 : return NULL;
3887 : }
3888 148 : mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
3889 148 : if (mem_ctx == NULL) {
3890 0 : PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
3891 0 : return NULL;
3892 : }
3893 :
3894 148 : out = py_export_PAC_INFO(mem_ctx, level, in);
3895 148 : if (out == NULL) {
3896 0 : return NULL;
3897 : }
3898 :
3899 148 : return pytalloc_GenericObject_reference(out);
3900 : }
3901 :
3902 : static PyMethodDef py_PAC_INFO_methods[] = {
3903 : { "__import__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PAC_INFO_import),
3904 : METH_VARARGS|METH_KEYWORDS|METH_CLASS,
3905 : "T.__import__(mem_ctx, level, in) => ret." },
3906 : { "__export__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PAC_INFO_export),
3907 : METH_VARARGS|METH_KEYWORDS|METH_CLASS,
3908 : "T.__export__(mem_ctx, level, in) => ret." },
3909 : { NULL, NULL, 0, NULL }
3910 : };
3911 :
3912 0 : static PyObject *py_PAC_INFO_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
3913 : {
3914 0 : PyErr_Format(PyExc_TypeError, "New %s Objects are not supported", type->tp_name);
3915 0 : return NULL;
3916 : }
3917 :
3918 :
3919 : static PyTypeObject PAC_INFO_Type = {
3920 : PyVarObject_HEAD_INIT(NULL, 0)
3921 : .tp_name = "krb5pac.PAC_INFO",
3922 : .tp_getset = NULL,
3923 : .tp_methods = py_PAC_INFO_methods,
3924 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
3925 : .tp_new = py_PAC_INFO_new,
3926 : };
3927 :
3928 :
3929 522691 : static PyObject *py_PAC_BUFFER_get_type(PyObject *obj, void *closure)
3930 : {
3931 522691 : struct PAC_BUFFER *object = pytalloc_get_ptr(obj);
3932 9 : PyObject *py_type;
3933 522691 : py_type = PyLong_FromUnsignedLongLong((uint32_t)(object->type));
3934 522691 : return py_type;
3935 : }
3936 :
3937 148 : static int py_PAC_BUFFER_set_type(PyObject *py_obj, PyObject *value, void *closure)
3938 : {
3939 148 : struct PAC_BUFFER *object = pytalloc_get_ptr(py_obj);
3940 148 : if (value == NULL) {
3941 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->type");
3942 0 : return -1;
3943 : }
3944 : {
3945 148 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->type));
3946 148 : if (PyLong_Check(value)) {
3947 0 : unsigned long long test_var;
3948 148 : test_var = PyLong_AsUnsignedLongLong(value);
3949 148 : if (PyErr_Occurred() != NULL) {
3950 0 : return -1;
3951 : }
3952 148 : if (test_var > uint_max) {
3953 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3954 : PyLong_Type.tp_name, uint_max, test_var);
3955 0 : return -1;
3956 : }
3957 148 : object->type = test_var;
3958 : } else {
3959 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3960 : PyLong_Type.tp_name);
3961 0 : return -1;
3962 : }
3963 : }
3964 148 : return 0;
3965 : }
3966 :
3967 0 : static PyObject *py_PAC_BUFFER_get__ndr_size(PyObject *obj, void *closure)
3968 : {
3969 0 : struct PAC_BUFFER *object = pytalloc_get_ptr(obj);
3970 0 : PyObject *py__ndr_size;
3971 0 : py__ndr_size = PyLong_FromUnsignedLongLong((uint32_t)(object->_ndr_size));
3972 0 : return py__ndr_size;
3973 : }
3974 :
3975 0 : static int py_PAC_BUFFER_set__ndr_size(PyObject *py_obj, PyObject *value, void *closure)
3976 : {
3977 0 : struct PAC_BUFFER *object = pytalloc_get_ptr(py_obj);
3978 0 : if (value == NULL) {
3979 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->_ndr_size");
3980 0 : return -1;
3981 : }
3982 : {
3983 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->_ndr_size));
3984 0 : if (PyLong_Check(value)) {
3985 0 : unsigned long long test_var;
3986 0 : test_var = PyLong_AsUnsignedLongLong(value);
3987 0 : if (PyErr_Occurred() != NULL) {
3988 0 : return -1;
3989 : }
3990 0 : if (test_var > uint_max) {
3991 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3992 : PyLong_Type.tp_name, uint_max, test_var);
3993 0 : return -1;
3994 : }
3995 0 : object->_ndr_size = test_var;
3996 : } else {
3997 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3998 : PyLong_Type.tp_name);
3999 0 : return -1;
4000 : }
4001 : }
4002 0 : return 0;
4003 : }
4004 :
4005 111650 : static PyObject *py_PAC_BUFFER_get_info(PyObject *obj, void *closure)
4006 : {
4007 111650 : struct PAC_BUFFER *object = pytalloc_get_ptr(obj);
4008 13 : PyObject *py_info;
4009 111650 : if (object->info == NULL) {
4010 0 : Py_RETURN_NONE;
4011 : }
4012 111650 : if (object->info == NULL) {
4013 0 : py_info = Py_None;
4014 0 : Py_INCREF(py_info);
4015 : } else {
4016 111650 : py_info = pyrpc_import_union(&PAC_INFO_Type, object->info, object->type, object->info, "union PAC_INFO");
4017 111650 : if (py_info == NULL) {
4018 0 : return NULL;
4019 : }
4020 : }
4021 111637 : return py_info;
4022 : }
4023 :
4024 148 : static int py_PAC_BUFFER_set_info(PyObject *py_obj, PyObject *value, void *closure)
4025 : {
4026 148 : struct PAC_BUFFER *object = pytalloc_get_ptr(py_obj);
4027 148 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->info));
4028 148 : if (value == NULL) {
4029 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->info");
4030 0 : return -1;
4031 : }
4032 148 : if (value == Py_None) {
4033 0 : object->info = NULL;
4034 : } else {
4035 148 : object->info = NULL;
4036 : {
4037 0 : union PAC_INFO *info_switch_2;
4038 148 : info_switch_2 = (union PAC_INFO *)pyrpc_export_union(&PAC_INFO_Type, pytalloc_get_mem_ctx(py_obj), object->type, value, "union PAC_INFO");
4039 148 : if (info_switch_2 == NULL) {
4040 0 : return -1;
4041 : }
4042 148 : object->info = info_switch_2;
4043 : }
4044 : }
4045 148 : return 0;
4046 : }
4047 :
4048 0 : static PyObject *py_PAC_BUFFER_get__pad(PyObject *obj, void *closure)
4049 : {
4050 0 : struct PAC_BUFFER *object = pytalloc_get_ptr(obj);
4051 0 : PyObject *py__pad;
4052 0 : py__pad = PyLong_FromUnsignedLongLong((uint32_t)(object->_pad));
4053 0 : return py__pad;
4054 : }
4055 :
4056 0 : static int py_PAC_BUFFER_set__pad(PyObject *py_obj, PyObject *value, void *closure)
4057 : {
4058 0 : struct PAC_BUFFER *object = pytalloc_get_ptr(py_obj);
4059 0 : if (value == NULL) {
4060 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->_pad");
4061 0 : return -1;
4062 : }
4063 : {
4064 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->_pad));
4065 0 : if (PyLong_Check(value)) {
4066 0 : unsigned long long test_var;
4067 0 : test_var = PyLong_AsUnsignedLongLong(value);
4068 0 : if (PyErr_Occurred() != NULL) {
4069 0 : return -1;
4070 : }
4071 0 : if (test_var > uint_max) {
4072 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4073 : PyLong_Type.tp_name, uint_max, test_var);
4074 0 : return -1;
4075 : }
4076 0 : object->_pad = test_var;
4077 : } else {
4078 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4079 : PyLong_Type.tp_name);
4080 0 : return -1;
4081 : }
4082 : }
4083 0 : return 0;
4084 : }
4085 :
4086 : static PyGetSetDef py_PAC_BUFFER_getsetters[] = {
4087 : {
4088 : .name = discard_const_p(char, "type"),
4089 : .get = py_PAC_BUFFER_get_type,
4090 : .set = py_PAC_BUFFER_set_type,
4091 : .doc = discard_const_p(char, "PIDL-generated element of base type PAC_TYPE")
4092 : },
4093 : {
4094 : .name = discard_const_p(char, "_ndr_size"),
4095 : .get = py_PAC_BUFFER_get__ndr_size,
4096 : .set = py_PAC_BUFFER_set__ndr_size,
4097 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
4098 : },
4099 : {
4100 : .name = discard_const_p(char, "info"),
4101 : .get = py_PAC_BUFFER_get_info,
4102 : .set = py_PAC_BUFFER_set_info,
4103 : .doc = discard_const_p(char, "PIDL-generated element of base type PAC_INFO")
4104 : },
4105 : {
4106 : .name = discard_const_p(char, "_pad"),
4107 : .get = py_PAC_BUFFER_get__pad,
4108 : .set = py_PAC_BUFFER_set__pad,
4109 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
4110 : },
4111 : { .name = NULL }
4112 : };
4113 :
4114 148 : static PyObject *py_PAC_BUFFER_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
4115 : {
4116 148 : return pytalloc_new(struct PAC_BUFFER, type);
4117 : }
4118 :
4119 0 : static PyObject *py_PAC_BUFFER_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
4120 : {
4121 0 : struct PAC_BUFFER *object = pytalloc_get_ptr(py_obj);
4122 0 : PyObject *ret = NULL;
4123 0 : DATA_BLOB blob;
4124 0 : enum ndr_err_code err;
4125 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
4126 0 : if (tmp_ctx == NULL) {
4127 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
4128 0 : return NULL;
4129 : }
4130 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_PAC_BUFFER);
4131 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
4132 0 : TALLOC_FREE(tmp_ctx);
4133 0 : PyErr_SetNdrError(err);
4134 0 : return NULL;
4135 : }
4136 :
4137 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
4138 0 : TALLOC_FREE(tmp_ctx);
4139 0 : return ret;
4140 : }
4141 :
4142 0 : static PyObject *py_PAC_BUFFER_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
4143 : {
4144 0 : struct PAC_BUFFER *object = pytalloc_get_ptr(py_obj);
4145 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
4146 0 : Py_ssize_t blob_length = 0;
4147 0 : enum ndr_err_code err;
4148 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
4149 0 : PyObject *allow_remaining_obj = NULL;
4150 0 : bool allow_remaining = false;
4151 :
4152 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
4153 : discard_const_p(char *, kwnames),
4154 : &blob.data, &blob_length,
4155 : &allow_remaining_obj)) {
4156 0 : return NULL;
4157 : }
4158 0 : blob.length = blob_length;
4159 :
4160 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
4161 0 : allow_remaining = true;
4162 : }
4163 :
4164 0 : if (allow_remaining) {
4165 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_BUFFER);
4166 : } else {
4167 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_BUFFER);
4168 : }
4169 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
4170 0 : PyErr_SetNdrError(err);
4171 0 : return NULL;
4172 : }
4173 :
4174 0 : Py_RETURN_NONE;
4175 : }
4176 :
4177 0 : static PyObject *py_PAC_BUFFER_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
4178 : {
4179 0 : struct PAC_BUFFER *object = pytalloc_get_ptr(py_obj);
4180 0 : PyObject *ret;
4181 0 : char *retstr;
4182 :
4183 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_PAC_BUFFER, "PAC_BUFFER", object);
4184 0 : ret = PyUnicode_FromString(retstr);
4185 0 : talloc_free(retstr);
4186 :
4187 0 : return ret;
4188 : }
4189 :
4190 : static PyMethodDef py_PAC_BUFFER_methods[] = {
4191 : { "__ndr_pack__", (PyCFunction)py_PAC_BUFFER_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
4192 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PAC_BUFFER_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
4193 : { "__ndr_print__", (PyCFunction)py_PAC_BUFFER_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
4194 : { NULL, NULL, 0, NULL }
4195 : };
4196 :
4197 :
4198 : static PyTypeObject PAC_BUFFER_Type = {
4199 : PyVarObject_HEAD_INIT(NULL, 0)
4200 : .tp_name = "krb5pac.PAC_BUFFER",
4201 : .tp_getset = py_PAC_BUFFER_getsetters,
4202 : .tp_methods = py_PAC_BUFFER_methods,
4203 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
4204 : .tp_new = py_PAC_BUFFER_new,
4205 : };
4206 :
4207 :
4208 112 : static PyObject *py_PAC_DATA_get_num_buffers(PyObject *obj, void *closure)
4209 : {
4210 112 : struct PAC_DATA *object = pytalloc_get_ptr(obj);
4211 3 : PyObject *py_num_buffers;
4212 112 : py_num_buffers = PyLong_FromUnsignedLongLong((uint32_t)(object->num_buffers));
4213 112 : return py_num_buffers;
4214 : }
4215 :
4216 541 : static int py_PAC_DATA_set_num_buffers(PyObject *py_obj, PyObject *value, void *closure)
4217 : {
4218 541 : struct PAC_DATA *object = pytalloc_get_ptr(py_obj);
4219 541 : if (value == NULL) {
4220 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->num_buffers");
4221 0 : return -1;
4222 : }
4223 : {
4224 541 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->num_buffers));
4225 541 : if (PyLong_Check(value)) {
4226 0 : unsigned long long test_var;
4227 541 : test_var = PyLong_AsUnsignedLongLong(value);
4228 541 : if (PyErr_Occurred() != NULL) {
4229 0 : return -1;
4230 : }
4231 541 : if (test_var > uint_max) {
4232 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4233 : PyLong_Type.tp_name, uint_max, test_var);
4234 0 : return -1;
4235 : }
4236 541 : object->num_buffers = test_var;
4237 : } else {
4238 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4239 : PyLong_Type.tp_name);
4240 0 : return -1;
4241 : }
4242 : }
4243 541 : return 0;
4244 : }
4245 :
4246 2 : static PyObject *py_PAC_DATA_get_version(PyObject *obj, void *closure)
4247 : {
4248 2 : struct PAC_DATA *object = pytalloc_get_ptr(obj);
4249 2 : PyObject *py_version;
4250 2 : py_version = PyLong_FromUnsignedLongLong((uint32_t)(object->version));
4251 2 : return py_version;
4252 : }
4253 :
4254 0 : static int py_PAC_DATA_set_version(PyObject *py_obj, PyObject *value, void *closure)
4255 : {
4256 0 : struct PAC_DATA *object = pytalloc_get_ptr(py_obj);
4257 0 : if (value == NULL) {
4258 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->version");
4259 0 : return -1;
4260 : }
4261 : {
4262 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->version));
4263 0 : if (PyLong_Check(value)) {
4264 0 : unsigned long long test_var;
4265 0 : test_var = PyLong_AsUnsignedLongLong(value);
4266 0 : if (PyErr_Occurred() != NULL) {
4267 0 : return -1;
4268 : }
4269 0 : if (test_var > uint_max) {
4270 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4271 : PyLong_Type.tp_name, uint_max, test_var);
4272 0 : return -1;
4273 : }
4274 0 : object->version = test_var;
4275 : } else {
4276 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4277 : PyLong_Type.tp_name);
4278 0 : return -1;
4279 : }
4280 : }
4281 0 : return 0;
4282 : }
4283 :
4284 27459 : static PyObject *py_PAC_DATA_get_buffers(PyObject *obj, void *closure)
4285 : {
4286 27459 : struct PAC_DATA *object = pytalloc_get_ptr(obj);
4287 21 : PyObject *py_buffers;
4288 27459 : py_buffers = PyList_New(object->num_buffers);
4289 27459 : if (py_buffers == NULL) {
4290 0 : return NULL;
4291 : }
4292 : {
4293 : int buffers_cntr_0;
4294 233223 : for (buffers_cntr_0 = 0; buffers_cntr_0 < (object->num_buffers); buffers_cntr_0++) {
4295 168 : PyObject *py_buffers_0;
4296 205764 : py_buffers_0 = pytalloc_reference_ex(&PAC_BUFFER_Type, object->buffers, &(object->buffers)[buffers_cntr_0]);
4297 205764 : PyList_SetItem(py_buffers, buffers_cntr_0, py_buffers_0);
4298 : }
4299 : }
4300 27438 : return py_buffers;
4301 : }
4302 :
4303 2622 : static int py_PAC_DATA_set_buffers(PyObject *py_obj, PyObject *value, void *closure)
4304 : {
4305 2622 : struct PAC_DATA *object = pytalloc_get_ptr(py_obj);
4306 2622 : if (value == NULL) {
4307 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->buffers");
4308 0 : return -1;
4309 : }
4310 2622 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
4311 : {
4312 0 : int buffers_cntr_0;
4313 2622 : object->buffers = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->buffers, PyList_GET_SIZE(value));
4314 2622 : if (!object->buffers) { return -1; }
4315 2622 : talloc_set_name_const(object->buffers, "ARRAY: object->buffers");
4316 23729 : for (buffers_cntr_0 = 0; buffers_cntr_0 < PyList_GET_SIZE(value); buffers_cntr_0++) {
4317 21107 : if (PyList_GET_ITEM(value, buffers_cntr_0) == NULL) {
4318 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->buffers)[buffers_cntr_0]");
4319 0 : return -1;
4320 : }
4321 21107 : PY_CHECK_TYPE(&PAC_BUFFER_Type, PyList_GET_ITEM(value, buffers_cntr_0), return -1;);
4322 21107 : if (talloc_reference(object->buffers, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, buffers_cntr_0))) == NULL) {
4323 0 : PyErr_NoMemory();
4324 0 : return -1;
4325 : }
4326 21107 : (object->buffers)[buffers_cntr_0] = *(struct PAC_BUFFER *)pytalloc_get_ptr(PyList_GET_ITEM(value, buffers_cntr_0));
4327 : }
4328 : }
4329 2622 : return 0;
4330 : }
4331 :
4332 : static PyGetSetDef py_PAC_DATA_getsetters[] = {
4333 : {
4334 : .name = discard_const_p(char, "num_buffers"),
4335 : .get = py_PAC_DATA_get_num_buffers,
4336 : .set = py_PAC_DATA_set_num_buffers,
4337 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
4338 : },
4339 : {
4340 : .name = discard_const_p(char, "version"),
4341 : .get = py_PAC_DATA_get_version,
4342 : .set = py_PAC_DATA_set_version,
4343 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
4344 : },
4345 : {
4346 : .name = discard_const_p(char, "buffers"),
4347 : .get = py_PAC_DATA_get_buffers,
4348 : .set = py_PAC_DATA_set_buffers,
4349 : .doc = discard_const_p(char, "PIDL-generated element of base type PAC_BUFFER")
4350 : },
4351 : { .name = NULL }
4352 : };
4353 :
4354 18338 : static PyObject *py_PAC_DATA_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
4355 : {
4356 18338 : return pytalloc_new(struct PAC_DATA, type);
4357 : }
4358 :
4359 3296 : static PyObject *py_PAC_DATA_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
4360 : {
4361 3296 : struct PAC_DATA *object = pytalloc_get_ptr(py_obj);
4362 3296 : PyObject *ret = NULL;
4363 0 : DATA_BLOB blob;
4364 0 : enum ndr_err_code err;
4365 3296 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
4366 3296 : if (tmp_ctx == NULL) {
4367 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
4368 0 : return NULL;
4369 : }
4370 3296 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_PAC_DATA);
4371 3296 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
4372 0 : TALLOC_FREE(tmp_ctx);
4373 0 : PyErr_SetNdrError(err);
4374 0 : return NULL;
4375 : }
4376 :
4377 3296 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
4378 3296 : TALLOC_FREE(tmp_ctx);
4379 3296 : return ret;
4380 : }
4381 :
4382 18338 : static PyObject *py_PAC_DATA_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
4383 : {
4384 18338 : struct PAC_DATA *object = pytalloc_get_ptr(py_obj);
4385 18338 : DATA_BLOB blob = {.data = NULL, .length = 0};
4386 18338 : Py_ssize_t blob_length = 0;
4387 9 : enum ndr_err_code err;
4388 18338 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
4389 18338 : PyObject *allow_remaining_obj = NULL;
4390 18338 : bool allow_remaining = false;
4391 :
4392 18338 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
4393 : discard_const_p(char *, kwnames),
4394 : &blob.data, &blob_length,
4395 : &allow_remaining_obj)) {
4396 0 : return NULL;
4397 : }
4398 18338 : blob.length = blob_length;
4399 :
4400 18338 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
4401 0 : allow_remaining = true;
4402 : }
4403 :
4404 18329 : if (allow_remaining) {
4405 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_DATA);
4406 : } else {
4407 18338 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_DATA);
4408 : }
4409 18338 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
4410 0 : PyErr_SetNdrError(err);
4411 0 : return NULL;
4412 : }
4413 :
4414 18338 : Py_RETURN_NONE;
4415 : }
4416 :
4417 0 : static PyObject *py_PAC_DATA_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
4418 : {
4419 0 : struct PAC_DATA *object = pytalloc_get_ptr(py_obj);
4420 0 : PyObject *ret;
4421 0 : char *retstr;
4422 :
4423 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_PAC_DATA, "PAC_DATA", object);
4424 0 : ret = PyUnicode_FromString(retstr);
4425 0 : talloc_free(retstr);
4426 :
4427 0 : return ret;
4428 : }
4429 :
4430 : static PyMethodDef py_PAC_DATA_methods[] = {
4431 : { "__ndr_pack__", (PyCFunction)py_PAC_DATA_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
4432 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PAC_DATA_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
4433 : { "__ndr_print__", (PyCFunction)py_PAC_DATA_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
4434 : { NULL, NULL, 0, NULL }
4435 : };
4436 :
4437 :
4438 : static PyTypeObject PAC_DATA_Type = {
4439 : PyVarObject_HEAD_INIT(NULL, 0)
4440 : .tp_name = "krb5pac.PAC_DATA",
4441 : .tp_getset = py_PAC_DATA_getsetters,
4442 : .tp_methods = py_PAC_DATA_methods,
4443 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
4444 : .tp_new = py_PAC_DATA_new,
4445 : };
4446 :
4447 :
4448 240 : static PyObject *py_PAC_BUFFER_RAW_get_type(PyObject *obj, void *closure)
4449 : {
4450 240 : struct PAC_BUFFER_RAW *object = pytalloc_get_ptr(obj);
4451 0 : PyObject *py_type;
4452 240 : py_type = PyLong_FromUnsignedLongLong((uint32_t)(object->type));
4453 240 : return py_type;
4454 : }
4455 :
4456 0 : static int py_PAC_BUFFER_RAW_set_type(PyObject *py_obj, PyObject *value, void *closure)
4457 : {
4458 0 : struct PAC_BUFFER_RAW *object = pytalloc_get_ptr(py_obj);
4459 0 : if (value == NULL) {
4460 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->type");
4461 0 : return -1;
4462 : }
4463 : {
4464 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->type));
4465 0 : if (PyLong_Check(value)) {
4466 0 : unsigned long long test_var;
4467 0 : test_var = PyLong_AsUnsignedLongLong(value);
4468 0 : if (PyErr_Occurred() != NULL) {
4469 0 : return -1;
4470 : }
4471 0 : if (test_var > uint_max) {
4472 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4473 : PyLong_Type.tp_name, uint_max, test_var);
4474 0 : return -1;
4475 : }
4476 0 : object->type = test_var;
4477 : } else {
4478 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4479 : PyLong_Type.tp_name);
4480 0 : return -1;
4481 : }
4482 : }
4483 0 : return 0;
4484 : }
4485 :
4486 240 : static PyObject *py_PAC_BUFFER_RAW_get_ndr_size(PyObject *obj, void *closure)
4487 : {
4488 240 : struct PAC_BUFFER_RAW *object = pytalloc_get_ptr(obj);
4489 0 : PyObject *py_ndr_size;
4490 240 : py_ndr_size = PyLong_FromUnsignedLongLong((uint32_t)(object->ndr_size));
4491 240 : return py_ndr_size;
4492 : }
4493 :
4494 0 : static int py_PAC_BUFFER_RAW_set_ndr_size(PyObject *py_obj, PyObject *value, void *closure)
4495 : {
4496 0 : struct PAC_BUFFER_RAW *object = pytalloc_get_ptr(py_obj);
4497 0 : if (value == NULL) {
4498 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->ndr_size");
4499 0 : return -1;
4500 : }
4501 : {
4502 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->ndr_size));
4503 0 : if (PyLong_Check(value)) {
4504 0 : unsigned long long test_var;
4505 0 : test_var = PyLong_AsUnsignedLongLong(value);
4506 0 : if (PyErr_Occurred() != NULL) {
4507 0 : return -1;
4508 : }
4509 0 : if (test_var > uint_max) {
4510 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4511 : PyLong_Type.tp_name, uint_max, test_var);
4512 0 : return -1;
4513 : }
4514 0 : object->ndr_size = test_var;
4515 : } else {
4516 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4517 : PyLong_Type.tp_name);
4518 0 : return -1;
4519 : }
4520 : }
4521 0 : return 0;
4522 : }
4523 :
4524 41090 : static PyObject *py_PAC_BUFFER_RAW_get_info(PyObject *obj, void *closure)
4525 : {
4526 41090 : struct PAC_BUFFER_RAW *object = pytalloc_get_ptr(obj);
4527 0 : PyObject *py_info;
4528 41090 : if (object->info == NULL) {
4529 0 : Py_RETURN_NONE;
4530 : }
4531 41090 : if (object->info == NULL) {
4532 0 : py_info = Py_None;
4533 0 : Py_INCREF(py_info);
4534 : } else {
4535 41090 : py_info = pytalloc_reference_ex(&DATA_BLOB_REM_Type, object->info, object->info);
4536 : }
4537 41090 : return py_info;
4538 : }
4539 :
4540 0 : static int py_PAC_BUFFER_RAW_set_info(PyObject *py_obj, PyObject *value, void *closure)
4541 : {
4542 0 : struct PAC_BUFFER_RAW *object = pytalloc_get_ptr(py_obj);
4543 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->info));
4544 0 : if (value == NULL) {
4545 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->info");
4546 0 : return -1;
4547 : }
4548 0 : if (value == Py_None) {
4549 0 : object->info = NULL;
4550 : } else {
4551 0 : object->info = NULL;
4552 0 : PY_CHECK_TYPE(&DATA_BLOB_REM_Type, value, return -1;);
4553 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
4554 0 : PyErr_NoMemory();
4555 0 : return -1;
4556 : }
4557 0 : object->info = (struct DATA_BLOB_REM *)pytalloc_get_ptr(value);
4558 : }
4559 0 : return 0;
4560 : }
4561 :
4562 0 : static PyObject *py_PAC_BUFFER_RAW_get__pad(PyObject *obj, void *closure)
4563 : {
4564 0 : struct PAC_BUFFER_RAW *object = pytalloc_get_ptr(obj);
4565 0 : PyObject *py__pad;
4566 0 : py__pad = PyLong_FromUnsignedLongLong((uint32_t)(object->_pad));
4567 0 : return py__pad;
4568 : }
4569 :
4570 0 : static int py_PAC_BUFFER_RAW_set__pad(PyObject *py_obj, PyObject *value, void *closure)
4571 : {
4572 0 : struct PAC_BUFFER_RAW *object = pytalloc_get_ptr(py_obj);
4573 0 : if (value == NULL) {
4574 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->_pad");
4575 0 : return -1;
4576 : }
4577 : {
4578 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->_pad));
4579 0 : if (PyLong_Check(value)) {
4580 0 : unsigned long long test_var;
4581 0 : test_var = PyLong_AsUnsignedLongLong(value);
4582 0 : if (PyErr_Occurred() != NULL) {
4583 0 : return -1;
4584 : }
4585 0 : if (test_var > uint_max) {
4586 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4587 : PyLong_Type.tp_name, uint_max, test_var);
4588 0 : return -1;
4589 : }
4590 0 : object->_pad = test_var;
4591 : } else {
4592 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4593 : PyLong_Type.tp_name);
4594 0 : return -1;
4595 : }
4596 : }
4597 0 : return 0;
4598 : }
4599 :
4600 : static PyGetSetDef py_PAC_BUFFER_RAW_getsetters[] = {
4601 : {
4602 : .name = discard_const_p(char, "type"),
4603 : .get = py_PAC_BUFFER_RAW_get_type,
4604 : .set = py_PAC_BUFFER_RAW_set_type,
4605 : .doc = discard_const_p(char, "PIDL-generated element of base type PAC_TYPE")
4606 : },
4607 : {
4608 : .name = discard_const_p(char, "ndr_size"),
4609 : .get = py_PAC_BUFFER_RAW_get_ndr_size,
4610 : .set = py_PAC_BUFFER_RAW_set_ndr_size,
4611 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
4612 : },
4613 : {
4614 : .name = discard_const_p(char, "info"),
4615 : .get = py_PAC_BUFFER_RAW_get_info,
4616 : .set = py_PAC_BUFFER_RAW_set_info,
4617 : .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB_REM")
4618 : },
4619 : {
4620 : .name = discard_const_p(char, "_pad"),
4621 : .get = py_PAC_BUFFER_RAW_get__pad,
4622 : .set = py_PAC_BUFFER_RAW_set__pad,
4623 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
4624 : },
4625 : { .name = NULL }
4626 : };
4627 :
4628 0 : static PyObject *py_PAC_BUFFER_RAW_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
4629 : {
4630 0 : return pytalloc_new(struct PAC_BUFFER_RAW, type);
4631 : }
4632 :
4633 0 : static PyObject *py_PAC_BUFFER_RAW_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
4634 : {
4635 0 : struct PAC_BUFFER_RAW *object = pytalloc_get_ptr(py_obj);
4636 0 : PyObject *ret = NULL;
4637 0 : DATA_BLOB blob;
4638 0 : enum ndr_err_code err;
4639 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
4640 0 : if (tmp_ctx == NULL) {
4641 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
4642 0 : return NULL;
4643 : }
4644 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_PAC_BUFFER_RAW);
4645 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
4646 0 : TALLOC_FREE(tmp_ctx);
4647 0 : PyErr_SetNdrError(err);
4648 0 : return NULL;
4649 : }
4650 :
4651 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
4652 0 : TALLOC_FREE(tmp_ctx);
4653 0 : return ret;
4654 : }
4655 :
4656 0 : static PyObject *py_PAC_BUFFER_RAW_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
4657 : {
4658 0 : struct PAC_BUFFER_RAW *object = pytalloc_get_ptr(py_obj);
4659 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
4660 0 : Py_ssize_t blob_length = 0;
4661 0 : enum ndr_err_code err;
4662 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
4663 0 : PyObject *allow_remaining_obj = NULL;
4664 0 : bool allow_remaining = false;
4665 :
4666 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
4667 : discard_const_p(char *, kwnames),
4668 : &blob.data, &blob_length,
4669 : &allow_remaining_obj)) {
4670 0 : return NULL;
4671 : }
4672 0 : blob.length = blob_length;
4673 :
4674 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
4675 0 : allow_remaining = true;
4676 : }
4677 :
4678 0 : if (allow_remaining) {
4679 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_BUFFER_RAW);
4680 : } else {
4681 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_BUFFER_RAW);
4682 : }
4683 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
4684 0 : PyErr_SetNdrError(err);
4685 0 : return NULL;
4686 : }
4687 :
4688 0 : Py_RETURN_NONE;
4689 : }
4690 :
4691 0 : static PyObject *py_PAC_BUFFER_RAW_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
4692 : {
4693 0 : struct PAC_BUFFER_RAW *object = pytalloc_get_ptr(py_obj);
4694 0 : PyObject *ret;
4695 0 : char *retstr;
4696 :
4697 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_PAC_BUFFER_RAW, "PAC_BUFFER_RAW", object);
4698 0 : ret = PyUnicode_FromString(retstr);
4699 0 : talloc_free(retstr);
4700 :
4701 0 : return ret;
4702 : }
4703 :
4704 : static PyMethodDef py_PAC_BUFFER_RAW_methods[] = {
4705 : { "__ndr_pack__", (PyCFunction)py_PAC_BUFFER_RAW_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
4706 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PAC_BUFFER_RAW_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
4707 : { "__ndr_print__", (PyCFunction)py_PAC_BUFFER_RAW_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
4708 : { NULL, NULL, 0, NULL }
4709 : };
4710 :
4711 :
4712 : static PyTypeObject PAC_BUFFER_RAW_Type = {
4713 : PyVarObject_HEAD_INIT(NULL, 0)
4714 : .tp_name = "krb5pac.PAC_BUFFER_RAW",
4715 : .tp_getset = py_PAC_BUFFER_RAW_getsetters,
4716 : .tp_methods = py_PAC_BUFFER_RAW_methods,
4717 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
4718 : .tp_new = py_PAC_BUFFER_RAW_new,
4719 : };
4720 :
4721 :
4722 1 : static PyObject *py_PAC_DATA_RAW_get_num_buffers(PyObject *obj, void *closure)
4723 : {
4724 1 : struct PAC_DATA_RAW *object = pytalloc_get_ptr(obj);
4725 1 : PyObject *py_num_buffers;
4726 1 : py_num_buffers = PyLong_FromUnsignedLongLong((uint32_t)(object->num_buffers));
4727 1 : return py_num_buffers;
4728 : }
4729 :
4730 0 : static int py_PAC_DATA_RAW_set_num_buffers(PyObject *py_obj, PyObject *value, void *closure)
4731 : {
4732 0 : struct PAC_DATA_RAW *object = pytalloc_get_ptr(py_obj);
4733 0 : if (value == NULL) {
4734 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->num_buffers");
4735 0 : return -1;
4736 : }
4737 : {
4738 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->num_buffers));
4739 0 : if (PyLong_Check(value)) {
4740 0 : unsigned long long test_var;
4741 0 : test_var = PyLong_AsUnsignedLongLong(value);
4742 0 : if (PyErr_Occurred() != NULL) {
4743 0 : return -1;
4744 : }
4745 0 : if (test_var > uint_max) {
4746 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4747 : PyLong_Type.tp_name, uint_max, test_var);
4748 0 : return -1;
4749 : }
4750 0 : object->num_buffers = test_var;
4751 : } else {
4752 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4753 : PyLong_Type.tp_name);
4754 0 : return -1;
4755 : }
4756 : }
4757 0 : return 0;
4758 : }
4759 :
4760 1 : static PyObject *py_PAC_DATA_RAW_get_version(PyObject *obj, void *closure)
4761 : {
4762 1 : struct PAC_DATA_RAW *object = pytalloc_get_ptr(obj);
4763 1 : PyObject *py_version;
4764 1 : py_version = PyLong_FromUnsignedLongLong((uint32_t)(object->version));
4765 1 : return py_version;
4766 : }
4767 :
4768 0 : static int py_PAC_DATA_RAW_set_version(PyObject *py_obj, PyObject *value, void *closure)
4769 : {
4770 0 : struct PAC_DATA_RAW *object = pytalloc_get_ptr(py_obj);
4771 0 : if (value == NULL) {
4772 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->version");
4773 0 : return -1;
4774 : }
4775 : {
4776 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->version));
4777 0 : if (PyLong_Check(value)) {
4778 0 : unsigned long long test_var;
4779 0 : test_var = PyLong_AsUnsignedLongLong(value);
4780 0 : if (PyErr_Occurred() != NULL) {
4781 0 : return -1;
4782 : }
4783 0 : if (test_var > uint_max) {
4784 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4785 : PyLong_Type.tp_name, uint_max, test_var);
4786 0 : return -1;
4787 : }
4788 0 : object->version = test_var;
4789 : } else {
4790 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4791 : PyLong_Type.tp_name);
4792 0 : return -1;
4793 : }
4794 : }
4795 0 : return 0;
4796 : }
4797 :
4798 8161 : static PyObject *py_PAC_DATA_RAW_get_buffers(PyObject *obj, void *closure)
4799 : {
4800 8161 : struct PAC_DATA_RAW *object = pytalloc_get_ptr(obj);
4801 0 : PyObject *py_buffers;
4802 8161 : py_buffers = PyList_New(object->num_buffers);
4803 8161 : if (py_buffers == NULL) {
4804 0 : return NULL;
4805 : }
4806 : {
4807 : int buffers_cntr_0;
4808 68851 : for (buffers_cntr_0 = 0; buffers_cntr_0 < (object->num_buffers); buffers_cntr_0++) {
4809 0 : PyObject *py_buffers_0;
4810 60690 : py_buffers_0 = pytalloc_reference_ex(&PAC_BUFFER_RAW_Type, object->buffers, &(object->buffers)[buffers_cntr_0]);
4811 60690 : PyList_SetItem(py_buffers, buffers_cntr_0, py_buffers_0);
4812 : }
4813 : }
4814 8161 : return py_buffers;
4815 : }
4816 :
4817 0 : static int py_PAC_DATA_RAW_set_buffers(PyObject *py_obj, PyObject *value, void *closure)
4818 : {
4819 0 : struct PAC_DATA_RAW *object = pytalloc_get_ptr(py_obj);
4820 0 : if (value == NULL) {
4821 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->buffers");
4822 0 : return -1;
4823 : }
4824 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
4825 : {
4826 0 : int buffers_cntr_0;
4827 0 : object->buffers = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->buffers, PyList_GET_SIZE(value));
4828 0 : if (!object->buffers) { return -1; }
4829 0 : talloc_set_name_const(object->buffers, "ARRAY: object->buffers");
4830 0 : for (buffers_cntr_0 = 0; buffers_cntr_0 < PyList_GET_SIZE(value); buffers_cntr_0++) {
4831 0 : if (PyList_GET_ITEM(value, buffers_cntr_0) == NULL) {
4832 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->buffers)[buffers_cntr_0]");
4833 0 : return -1;
4834 : }
4835 0 : PY_CHECK_TYPE(&PAC_BUFFER_RAW_Type, PyList_GET_ITEM(value, buffers_cntr_0), return -1;);
4836 0 : if (talloc_reference(object->buffers, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, buffers_cntr_0))) == NULL) {
4837 0 : PyErr_NoMemory();
4838 0 : return -1;
4839 : }
4840 0 : (object->buffers)[buffers_cntr_0] = *(struct PAC_BUFFER_RAW *)pytalloc_get_ptr(PyList_GET_ITEM(value, buffers_cntr_0));
4841 : }
4842 : }
4843 0 : return 0;
4844 : }
4845 :
4846 : static PyGetSetDef py_PAC_DATA_RAW_getsetters[] = {
4847 : {
4848 : .name = discard_const_p(char, "num_buffers"),
4849 : .get = py_PAC_DATA_RAW_get_num_buffers,
4850 : .set = py_PAC_DATA_RAW_set_num_buffers,
4851 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
4852 : },
4853 : {
4854 : .name = discard_const_p(char, "version"),
4855 : .get = py_PAC_DATA_RAW_get_version,
4856 : .set = py_PAC_DATA_RAW_set_version,
4857 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
4858 : },
4859 : {
4860 : .name = discard_const_p(char, "buffers"),
4861 : .get = py_PAC_DATA_RAW_get_buffers,
4862 : .set = py_PAC_DATA_RAW_set_buffers,
4863 : .doc = discard_const_p(char, "PIDL-generated element of base type PAC_BUFFER_RAW")
4864 : },
4865 : { .name = NULL }
4866 : };
4867 :
4868 8162 : static PyObject *py_PAC_DATA_RAW_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
4869 : {
4870 8162 : return pytalloc_new(struct PAC_DATA_RAW, type);
4871 : }
4872 :
4873 12294 : static PyObject *py_PAC_DATA_RAW_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
4874 : {
4875 12294 : struct PAC_DATA_RAW *object = pytalloc_get_ptr(py_obj);
4876 12294 : PyObject *ret = NULL;
4877 0 : DATA_BLOB blob;
4878 0 : enum ndr_err_code err;
4879 12294 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
4880 12294 : if (tmp_ctx == NULL) {
4881 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
4882 0 : return NULL;
4883 : }
4884 12294 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_PAC_DATA_RAW);
4885 12294 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
4886 0 : TALLOC_FREE(tmp_ctx);
4887 0 : PyErr_SetNdrError(err);
4888 0 : return NULL;
4889 : }
4890 :
4891 12294 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
4892 12294 : TALLOC_FREE(tmp_ctx);
4893 12294 : return ret;
4894 : }
4895 :
4896 8162 : static PyObject *py_PAC_DATA_RAW_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
4897 : {
4898 8162 : struct PAC_DATA_RAW *object = pytalloc_get_ptr(py_obj);
4899 8162 : DATA_BLOB blob = {.data = NULL, .length = 0};
4900 8162 : Py_ssize_t blob_length = 0;
4901 1 : enum ndr_err_code err;
4902 8162 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
4903 8162 : PyObject *allow_remaining_obj = NULL;
4904 8162 : bool allow_remaining = false;
4905 :
4906 8162 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
4907 : discard_const_p(char *, kwnames),
4908 : &blob.data, &blob_length,
4909 : &allow_remaining_obj)) {
4910 0 : return NULL;
4911 : }
4912 8162 : blob.length = blob_length;
4913 :
4914 8162 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
4915 0 : allow_remaining = true;
4916 : }
4917 :
4918 8161 : if (allow_remaining) {
4919 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_DATA_RAW);
4920 : } else {
4921 8162 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_DATA_RAW);
4922 : }
4923 8162 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
4924 0 : PyErr_SetNdrError(err);
4925 0 : return NULL;
4926 : }
4927 :
4928 8162 : Py_RETURN_NONE;
4929 : }
4930 :
4931 0 : static PyObject *py_PAC_DATA_RAW_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
4932 : {
4933 0 : struct PAC_DATA_RAW *object = pytalloc_get_ptr(py_obj);
4934 0 : PyObject *ret;
4935 0 : char *retstr;
4936 :
4937 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_PAC_DATA_RAW, "PAC_DATA_RAW", object);
4938 0 : ret = PyUnicode_FromString(retstr);
4939 0 : talloc_free(retstr);
4940 :
4941 0 : return ret;
4942 : }
4943 :
4944 : static PyMethodDef py_PAC_DATA_RAW_methods[] = {
4945 : { "__ndr_pack__", (PyCFunction)py_PAC_DATA_RAW_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
4946 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PAC_DATA_RAW_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
4947 : { "__ndr_print__", (PyCFunction)py_PAC_DATA_RAW_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
4948 : { NULL, NULL, 0, NULL }
4949 : };
4950 :
4951 :
4952 : static PyTypeObject PAC_DATA_RAW_Type = {
4953 : PyVarObject_HEAD_INIT(NULL, 0)
4954 : .tp_name = "krb5pac.PAC_DATA_RAW",
4955 : .tp_getset = py_PAC_DATA_RAW_getsetters,
4956 : .tp_methods = py_PAC_DATA_RAW_methods,
4957 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
4958 : .tp_new = py_PAC_DATA_RAW_new,
4959 : };
4960 :
4961 :
4962 0 : static PyObject *py_PAC_Validate_get_MessageType(PyObject *obj, void *closure)
4963 : {
4964 0 : struct PAC_Validate *object = pytalloc_get_ptr(obj);
4965 0 : PyObject *py_MessageType;
4966 0 : py_MessageType = PyLong_FromUnsignedLongLong((uint32_t)(object->MessageType));
4967 0 : return py_MessageType;
4968 : }
4969 :
4970 0 : static int py_PAC_Validate_set_MessageType(PyObject *py_obj, PyObject *value, void *closure)
4971 : {
4972 0 : struct PAC_Validate *object = pytalloc_get_ptr(py_obj);
4973 0 : if (value == NULL) {
4974 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->MessageType");
4975 0 : return -1;
4976 : }
4977 : {
4978 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->MessageType));
4979 0 : if (PyLong_Check(value)) {
4980 0 : unsigned long long test_var;
4981 0 : test_var = PyLong_AsUnsignedLongLong(value);
4982 0 : if (PyErr_Occurred() != NULL) {
4983 0 : return -1;
4984 : }
4985 0 : if (test_var > uint_max) {
4986 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4987 : PyLong_Type.tp_name, uint_max, test_var);
4988 0 : return -1;
4989 : }
4990 0 : object->MessageType = test_var;
4991 : } else {
4992 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4993 : PyLong_Type.tp_name);
4994 0 : return -1;
4995 : }
4996 : }
4997 0 : return 0;
4998 : }
4999 :
5000 0 : static PyObject *py_PAC_Validate_get_ChecksumLength(PyObject *obj, void *closure)
5001 : {
5002 0 : struct PAC_Validate *object = pytalloc_get_ptr(obj);
5003 0 : PyObject *py_ChecksumLength;
5004 0 : py_ChecksumLength = PyLong_FromUnsignedLongLong((uint32_t)(object->ChecksumLength));
5005 0 : return py_ChecksumLength;
5006 : }
5007 :
5008 0 : static int py_PAC_Validate_set_ChecksumLength(PyObject *py_obj, PyObject *value, void *closure)
5009 : {
5010 0 : struct PAC_Validate *object = pytalloc_get_ptr(py_obj);
5011 0 : if (value == NULL) {
5012 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->ChecksumLength");
5013 0 : return -1;
5014 : }
5015 : {
5016 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->ChecksumLength));
5017 0 : if (PyLong_Check(value)) {
5018 0 : unsigned long long test_var;
5019 0 : test_var = PyLong_AsUnsignedLongLong(value);
5020 0 : if (PyErr_Occurred() != NULL) {
5021 0 : return -1;
5022 : }
5023 0 : if (test_var > uint_max) {
5024 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
5025 : PyLong_Type.tp_name, uint_max, test_var);
5026 0 : return -1;
5027 : }
5028 0 : object->ChecksumLength = test_var;
5029 : } else {
5030 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
5031 : PyLong_Type.tp_name);
5032 0 : return -1;
5033 : }
5034 : }
5035 0 : return 0;
5036 : }
5037 :
5038 0 : static PyObject *py_PAC_Validate_get_SignatureType(PyObject *obj, void *closure)
5039 : {
5040 0 : struct PAC_Validate *object = pytalloc_get_ptr(obj);
5041 0 : PyObject *py_SignatureType;
5042 0 : py_SignatureType = PyLong_FromLong(object->SignatureType);
5043 0 : return py_SignatureType;
5044 : }
5045 :
5046 0 : static int py_PAC_Validate_set_SignatureType(PyObject *py_obj, PyObject *value, void *closure)
5047 : {
5048 0 : struct PAC_Validate *object = pytalloc_get_ptr(py_obj);
5049 0 : if (value == NULL) {
5050 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->SignatureType");
5051 0 : return -1;
5052 : }
5053 : {
5054 0 : const long long int_max = ndr_sizeof2intmax(sizeof(object->SignatureType));
5055 0 : const long long int_min = -int_max - 1;
5056 0 : if (PyLong_Check(value)) {
5057 0 : long long test_var;
5058 0 : test_var = PyLong_AsLongLong(value);
5059 0 : if (PyErr_Occurred() != NULL) {
5060 0 : return -1;
5061 : }
5062 0 : if (test_var < int_min || test_var > int_max) {
5063 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range %lld - %lld, got %lld",
5064 : PyLong_Type.tp_name, int_min, int_max, test_var);
5065 0 : return -1;
5066 : }
5067 0 : object->SignatureType = test_var;
5068 : } else {
5069 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
5070 : PyLong_Type.tp_name);
5071 0 : return -1;
5072 : }
5073 : }
5074 0 : return 0;
5075 : }
5076 :
5077 0 : static PyObject *py_PAC_Validate_get_SignatureLength(PyObject *obj, void *closure)
5078 : {
5079 0 : struct PAC_Validate *object = pytalloc_get_ptr(obj);
5080 0 : PyObject *py_SignatureLength;
5081 0 : py_SignatureLength = PyLong_FromUnsignedLongLong((uint32_t)(object->SignatureLength));
5082 0 : return py_SignatureLength;
5083 : }
5084 :
5085 0 : static int py_PAC_Validate_set_SignatureLength(PyObject *py_obj, PyObject *value, void *closure)
5086 : {
5087 0 : struct PAC_Validate *object = pytalloc_get_ptr(py_obj);
5088 0 : if (value == NULL) {
5089 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->SignatureLength");
5090 0 : return -1;
5091 : }
5092 : {
5093 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->SignatureLength));
5094 0 : if (PyLong_Check(value)) {
5095 0 : unsigned long long test_var;
5096 0 : test_var = PyLong_AsUnsignedLongLong(value);
5097 0 : if (PyErr_Occurred() != NULL) {
5098 0 : return -1;
5099 : }
5100 0 : if (test_var > uint_max) {
5101 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
5102 : PyLong_Type.tp_name, uint_max, test_var);
5103 0 : return -1;
5104 : }
5105 0 : object->SignatureLength = test_var;
5106 : } else {
5107 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
5108 : PyLong_Type.tp_name);
5109 0 : return -1;
5110 : }
5111 : }
5112 0 : return 0;
5113 : }
5114 :
5115 0 : static PyObject *py_PAC_Validate_get_ChecksumAndSignature(PyObject *obj, void *closure)
5116 : {
5117 0 : struct PAC_Validate *object = pytalloc_get_ptr(obj);
5118 0 : PyObject *py_ChecksumAndSignature;
5119 0 : py_ChecksumAndSignature = PyBytes_FromStringAndSize((char *)(object->ChecksumAndSignature).data, (object->ChecksumAndSignature).length);
5120 0 : return py_ChecksumAndSignature;
5121 : }
5122 :
5123 0 : static int py_PAC_Validate_set_ChecksumAndSignature(PyObject *py_obj, PyObject *value, void *closure)
5124 : {
5125 0 : struct PAC_Validate *object = pytalloc_get_ptr(py_obj);
5126 0 : if (value == NULL) {
5127 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->ChecksumAndSignature");
5128 0 : return -1;
5129 : }
5130 0 : object->ChecksumAndSignature = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
5131 0 : return 0;
5132 : }
5133 :
5134 : static PyGetSetDef py_PAC_Validate_getsetters[] = {
5135 : {
5136 : .name = discard_const_p(char, "MessageType"),
5137 : .get = py_PAC_Validate_get_MessageType,
5138 : .set = py_PAC_Validate_set_MessageType,
5139 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
5140 : },
5141 : {
5142 : .name = discard_const_p(char, "ChecksumLength"),
5143 : .get = py_PAC_Validate_get_ChecksumLength,
5144 : .set = py_PAC_Validate_set_ChecksumLength,
5145 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
5146 : },
5147 : {
5148 : .name = discard_const_p(char, "SignatureType"),
5149 : .get = py_PAC_Validate_get_SignatureType,
5150 : .set = py_PAC_Validate_set_SignatureType,
5151 : .doc = discard_const_p(char, "PIDL-generated element of base type int32")
5152 : },
5153 : {
5154 : .name = discard_const_p(char, "SignatureLength"),
5155 : .get = py_PAC_Validate_get_SignatureLength,
5156 : .set = py_PAC_Validate_set_SignatureLength,
5157 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
5158 : },
5159 : {
5160 : .name = discard_const_p(char, "ChecksumAndSignature"),
5161 : .get = py_PAC_Validate_get_ChecksumAndSignature,
5162 : .set = py_PAC_Validate_set_ChecksumAndSignature,
5163 : .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
5164 : },
5165 : { .name = NULL }
5166 : };
5167 :
5168 0 : static PyObject *py_PAC_Validate_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
5169 : {
5170 0 : return pytalloc_new(struct PAC_Validate, type);
5171 : }
5172 :
5173 0 : static PyObject *py_PAC_Validate_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
5174 : {
5175 0 : struct PAC_Validate *object = pytalloc_get_ptr(py_obj);
5176 0 : PyObject *ret = NULL;
5177 0 : DATA_BLOB blob;
5178 0 : enum ndr_err_code err;
5179 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
5180 0 : if (tmp_ctx == NULL) {
5181 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
5182 0 : return NULL;
5183 : }
5184 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_PAC_Validate);
5185 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
5186 0 : TALLOC_FREE(tmp_ctx);
5187 0 : PyErr_SetNdrError(err);
5188 0 : return NULL;
5189 : }
5190 :
5191 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
5192 0 : TALLOC_FREE(tmp_ctx);
5193 0 : return ret;
5194 : }
5195 :
5196 0 : static PyObject *py_PAC_Validate_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
5197 : {
5198 0 : struct PAC_Validate *object = pytalloc_get_ptr(py_obj);
5199 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
5200 0 : Py_ssize_t blob_length = 0;
5201 0 : enum ndr_err_code err;
5202 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
5203 0 : PyObject *allow_remaining_obj = NULL;
5204 0 : bool allow_remaining = false;
5205 :
5206 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
5207 : discard_const_p(char *, kwnames),
5208 : &blob.data, &blob_length,
5209 : &allow_remaining_obj)) {
5210 0 : return NULL;
5211 : }
5212 0 : blob.length = blob_length;
5213 :
5214 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
5215 0 : allow_remaining = true;
5216 : }
5217 :
5218 0 : if (allow_remaining) {
5219 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_Validate);
5220 : } else {
5221 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_Validate);
5222 : }
5223 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
5224 0 : PyErr_SetNdrError(err);
5225 0 : return NULL;
5226 : }
5227 :
5228 0 : Py_RETURN_NONE;
5229 : }
5230 :
5231 0 : static PyObject *py_PAC_Validate_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
5232 : {
5233 0 : struct PAC_Validate *object = pytalloc_get_ptr(py_obj);
5234 0 : PyObject *ret;
5235 0 : char *retstr;
5236 :
5237 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_PAC_Validate, "PAC_Validate", object);
5238 0 : ret = PyUnicode_FromString(retstr);
5239 0 : talloc_free(retstr);
5240 :
5241 0 : return ret;
5242 : }
5243 :
5244 : static PyMethodDef py_PAC_Validate_methods[] = {
5245 : { "__ndr_pack__", (PyCFunction)py_PAC_Validate_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
5246 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_PAC_Validate_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
5247 : { "__ndr_print__", (PyCFunction)py_PAC_Validate_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
5248 : { NULL, NULL, 0, NULL }
5249 : };
5250 :
5251 :
5252 : static PyTypeObject PAC_Validate_Type = {
5253 : PyVarObject_HEAD_INIT(NULL, 0)
5254 : .tp_name = "krb5pac.PAC_Validate",
5255 : .tp_getset = py_PAC_Validate_getsetters,
5256 : .tp_methods = py_PAC_Validate_methods,
5257 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
5258 : .tp_new = py_PAC_Validate_new,
5259 : };
5260 :
5261 :
5262 0 : static PyObject *py_netsamlogoncache_entry_get_timestamp(PyObject *obj, void *closure)
5263 : {
5264 0 : struct netsamlogoncache_entry *object = pytalloc_get_ptr(obj);
5265 0 : PyObject *py_timestamp;
5266 0 : py_timestamp = PyLong_FromLong(object->timestamp);
5267 0 : return py_timestamp;
5268 : }
5269 :
5270 0 : static int py_netsamlogoncache_entry_set_timestamp(PyObject *py_obj, PyObject *value, void *closure)
5271 : {
5272 0 : struct netsamlogoncache_entry *object = pytalloc_get_ptr(py_obj);
5273 0 : if (value == NULL) {
5274 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->timestamp");
5275 0 : return -1;
5276 : }
5277 : {
5278 0 : const long long int_max = ndr_sizeof2intmax(sizeof(object->timestamp));
5279 0 : const long long int_min = -int_max - 1;
5280 0 : if (PyLong_Check(value)) {
5281 0 : long long test_var;
5282 0 : test_var = PyLong_AsLongLong(value);
5283 0 : if (PyErr_Occurred() != NULL) {
5284 0 : return -1;
5285 : }
5286 0 : if (test_var < int_min || test_var > int_max) {
5287 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range %lld - %lld, got %lld",
5288 : PyLong_Type.tp_name, int_min, int_max, test_var);
5289 0 : return -1;
5290 : }
5291 0 : object->timestamp = test_var;
5292 : } else {
5293 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
5294 : PyLong_Type.tp_name);
5295 0 : return -1;
5296 : }
5297 : }
5298 0 : return 0;
5299 : }
5300 :
5301 0 : static PyObject *py_netsamlogoncache_entry_get_info3(PyObject *obj, void *closure)
5302 : {
5303 0 : struct netsamlogoncache_entry *object = pytalloc_get_ptr(obj);
5304 0 : PyObject *py_info3;
5305 0 : py_info3 = pytalloc_reference_ex(netr_SamInfo3_Type, pytalloc_get_mem_ctx(obj), &object->info3);
5306 0 : return py_info3;
5307 : }
5308 :
5309 0 : static int py_netsamlogoncache_entry_set_info3(PyObject *py_obj, PyObject *value, void *closure)
5310 : {
5311 0 : struct netsamlogoncache_entry *object = pytalloc_get_ptr(py_obj);
5312 0 : if (value == NULL) {
5313 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->info3");
5314 0 : return -1;
5315 : }
5316 0 : PY_CHECK_TYPE(netr_SamInfo3_Type, value, return -1;);
5317 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
5318 0 : PyErr_NoMemory();
5319 0 : return -1;
5320 : }
5321 0 : object->info3 = *(struct netr_SamInfo3 *)pytalloc_get_ptr(value);
5322 0 : return 0;
5323 : }
5324 :
5325 : static PyGetSetDef py_netsamlogoncache_entry_getsetters[] = {
5326 : {
5327 : .name = discard_const_p(char, "timestamp"),
5328 : .get = py_netsamlogoncache_entry_get_timestamp,
5329 : .set = py_netsamlogoncache_entry_set_timestamp,
5330 : .doc = discard_const_p(char, "PIDL-generated element of base type time_t")
5331 : },
5332 : {
5333 : .name = discard_const_p(char, "info3"),
5334 : .get = py_netsamlogoncache_entry_get_info3,
5335 : .set = py_netsamlogoncache_entry_set_info3,
5336 : .doc = discard_const_p(char, "PIDL-generated element of base type netr_SamInfo3")
5337 : },
5338 : { .name = NULL }
5339 : };
5340 :
5341 0 : static PyObject *py_netsamlogoncache_entry_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
5342 : {
5343 0 : return pytalloc_new(struct netsamlogoncache_entry, type);
5344 : }
5345 :
5346 0 : static PyObject *py_netsamlogoncache_entry_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
5347 : {
5348 0 : struct netsamlogoncache_entry *object = pytalloc_get_ptr(py_obj);
5349 0 : PyObject *ret = NULL;
5350 0 : DATA_BLOB blob;
5351 0 : enum ndr_err_code err;
5352 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
5353 0 : if (tmp_ctx == NULL) {
5354 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
5355 0 : return NULL;
5356 : }
5357 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_netsamlogoncache_entry);
5358 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
5359 0 : TALLOC_FREE(tmp_ctx);
5360 0 : PyErr_SetNdrError(err);
5361 0 : return NULL;
5362 : }
5363 :
5364 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
5365 0 : TALLOC_FREE(tmp_ctx);
5366 0 : return ret;
5367 : }
5368 :
5369 0 : static PyObject *py_netsamlogoncache_entry_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
5370 : {
5371 0 : struct netsamlogoncache_entry *object = pytalloc_get_ptr(py_obj);
5372 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
5373 0 : Py_ssize_t blob_length = 0;
5374 0 : enum ndr_err_code err;
5375 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
5376 0 : PyObject *allow_remaining_obj = NULL;
5377 0 : bool allow_remaining = false;
5378 :
5379 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
5380 : discard_const_p(char *, kwnames),
5381 : &blob.data, &blob_length,
5382 : &allow_remaining_obj)) {
5383 0 : return NULL;
5384 : }
5385 0 : blob.length = blob_length;
5386 :
5387 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
5388 0 : allow_remaining = true;
5389 : }
5390 :
5391 0 : if (allow_remaining) {
5392 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_netsamlogoncache_entry);
5393 : } else {
5394 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_netsamlogoncache_entry);
5395 : }
5396 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
5397 0 : PyErr_SetNdrError(err);
5398 0 : return NULL;
5399 : }
5400 :
5401 0 : Py_RETURN_NONE;
5402 : }
5403 :
5404 0 : static PyObject *py_netsamlogoncache_entry_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
5405 : {
5406 0 : struct netsamlogoncache_entry *object = pytalloc_get_ptr(py_obj);
5407 0 : PyObject *ret;
5408 0 : char *retstr;
5409 :
5410 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_netsamlogoncache_entry, "netsamlogoncache_entry", object);
5411 0 : ret = PyUnicode_FromString(retstr);
5412 0 : talloc_free(retstr);
5413 :
5414 0 : return ret;
5415 : }
5416 :
5417 : static PyMethodDef py_netsamlogoncache_entry_methods[] = {
5418 : { "__ndr_pack__", (PyCFunction)py_netsamlogoncache_entry_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
5419 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_netsamlogoncache_entry_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
5420 : { "__ndr_print__", (PyCFunction)py_netsamlogoncache_entry_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
5421 : { NULL, NULL, 0, NULL }
5422 : };
5423 :
5424 :
5425 : static PyTypeObject netsamlogoncache_entry_Type = {
5426 : PyVarObject_HEAD_INIT(NULL, 0)
5427 : .tp_name = "krb5pac.netsamlogoncache_entry",
5428 : .tp_getset = py_netsamlogoncache_entry_getsetters,
5429 : .tp_methods = py_netsamlogoncache_entry_methods,
5430 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
5431 : .tp_new = py_netsamlogoncache_entry_new,
5432 : };
5433 :
5434 :
5435 : const struct PyNdrRpcMethodDef py_ndr_krb5pac_methods[] = {
5436 : {0}
5437 : };
5438 :
5439 0 : static PyObject *interface_krb5pac_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
5440 : {
5441 0 : return py_dcerpc_interface_init_helper(type, args, kwargs, &ndr_table_krb5pac);
5442 : }
5443 :
5444 : #define PY_DOC_KRB5PAC "Active Directory KRB5 PAC"
5445 : static PyTypeObject krb5pac_InterfaceType = {
5446 : PyVarObject_HEAD_INIT(NULL, 0)
5447 : .tp_name = "krb5pac.krb5pac",
5448 : .tp_basicsize = sizeof(dcerpc_InterfaceObject),
5449 : .tp_doc = "krb5pac(binding, lp_ctx=None, credentials=None) -> connection\n"
5450 : "\n"
5451 : "binding should be a DCE/RPC binding string (for example: ncacn_ip_tcp:127.0.0.1)\n"
5452 : "lp_ctx should be a path to a smb.conf file or a param.LoadParm object\n"
5453 : "credentials should be a credentials.Credentials object.\n\n"PY_DOC_KRB5PAC,
5454 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
5455 : .tp_new = interface_krb5pac_new,
5456 : };
5457 :
5458 0 : static PyObject *syntax_krb5pac_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
5459 : {
5460 0 : return py_dcerpc_syntax_init_helper(type, args, kwargs, &ndr_table_krb5pac.syntax_id);
5461 : }
5462 :
5463 : #define PY_DOC_KRB5PAC_SYNTAX "Active Directory KRB5 PAC"
5464 : static PyTypeObject krb5pac_SyntaxType = {
5465 : PyVarObject_HEAD_INIT(NULL, 0)
5466 : .tp_name = "krb5pac.krb5pac_abstract_syntax",
5467 : .tp_doc = "krb5pac_abstract_syntax()\n"PY_DOC_KRB5PAC_SYNTAX,
5468 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
5469 : .tp_new = syntax_krb5pac_new,
5470 : };
5471 :
5472 : static PyMethodDef krb5pac_methods[] = {
5473 : { NULL, NULL, 0, NULL }
5474 : };
5475 :
5476 : static struct PyModuleDef moduledef = {
5477 : PyModuleDef_HEAD_INIT,
5478 : .m_name = "krb5pac",
5479 : .m_doc = "krb5pac DCE/RPC",
5480 : .m_size = -1,
5481 : .m_methods = krb5pac_methods,
5482 : };
5483 3620 : MODULE_INIT_FUNC(krb5pac)
5484 : {
5485 3620 : PyObject *m = NULL;
5486 3620 : PyObject *dep_samba_dcerpc_security = NULL;
5487 3620 : PyObject *dep_samba_dcerpc_lsa = NULL;
5488 3620 : PyObject *dep_samba_dcerpc_netlogon = NULL;
5489 3620 : PyObject *dep_samba_dcerpc_samr = NULL;
5490 3620 : PyObject *dep_talloc = NULL;
5491 3620 : PyObject *dep_samba_dcerpc_base = NULL;
5492 3620 : PyObject *dep_samba_dcerpc_misc = NULL;
5493 :
5494 3620 : dep_samba_dcerpc_security = PyImport_ImportModule("samba.dcerpc.security");
5495 3620 : if (dep_samba_dcerpc_security == NULL)
5496 0 : goto out;
5497 :
5498 3620 : dep_samba_dcerpc_lsa = PyImport_ImportModule("samba.dcerpc.lsa");
5499 3620 : if (dep_samba_dcerpc_lsa == NULL)
5500 0 : goto out;
5501 :
5502 3620 : dep_samba_dcerpc_netlogon = PyImport_ImportModule("samba.dcerpc.netlogon");
5503 3620 : if (dep_samba_dcerpc_netlogon == NULL)
5504 0 : goto out;
5505 :
5506 3620 : dep_samba_dcerpc_samr = PyImport_ImportModule("samba.dcerpc.samr");
5507 3620 : if (dep_samba_dcerpc_samr == NULL)
5508 0 : goto out;
5509 :
5510 3620 : dep_talloc = PyImport_ImportModule("talloc");
5511 3620 : if (dep_talloc == NULL)
5512 0 : goto out;
5513 :
5514 3620 : dep_samba_dcerpc_base = PyImport_ImportModule("samba.dcerpc.base");
5515 3620 : if (dep_samba_dcerpc_base == NULL)
5516 0 : goto out;
5517 :
5518 3620 : dep_samba_dcerpc_misc = PyImport_ImportModule("samba.dcerpc.misc");
5519 3620 : if (dep_samba_dcerpc_misc == NULL)
5520 0 : goto out;
5521 :
5522 3620 : BaseObject_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "BaseObject");
5523 3620 : if (BaseObject_Type == NULL)
5524 0 : goto out;
5525 :
5526 3620 : dom_sid_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_security, "dom_sid");
5527 3620 : if (dom_sid_Type == NULL)
5528 0 : goto out;
5529 :
5530 3620 : samr_RidWithAttributeArray_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_samr, "RidWithAttributeArray");
5531 3620 : if (samr_RidWithAttributeArray_Type == NULL)
5532 0 : goto out;
5533 :
5534 3620 : netr_SamInfo3_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_netlogon, "netr_SamInfo3");
5535 3620 : if (netr_SamInfo3_Type == NULL)
5536 0 : goto out;
5537 :
5538 3620 : samr_Password_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_samr, "Password");
5539 3620 : if (samr_Password_Type == NULL)
5540 0 : goto out;
5541 :
5542 3620 : lsa_String_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_lsa, "String");
5543 3620 : if (lsa_String_Type == NULL)
5544 0 : goto out;
5545 :
5546 3620 : netr_SidAttr_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_netlogon, "netr_SidAttr");
5547 3620 : if (netr_SidAttr_Type == NULL)
5548 0 : goto out;
5549 :
5550 3620 : ClientConnection_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_base, "ClientConnection");
5551 3620 : if (ClientConnection_Type == NULL)
5552 0 : goto out;
5553 :
5554 3620 : ndr_syntax_id_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_misc, "ndr_syntax_id");
5555 3620 : if (ndr_syntax_id_Type == NULL)
5556 0 : goto out;
5557 :
5558 3620 : PAC_LOGON_NAME_Type.tp_base = BaseObject_Type;
5559 3620 : PAC_LOGON_NAME_Type.tp_basicsize = pytalloc_BaseObject_size();
5560 :
5561 3620 : PAC_SIGNATURE_DATA_Type.tp_base = BaseObject_Type;
5562 3620 : PAC_SIGNATURE_DATA_Type.tp_basicsize = pytalloc_BaseObject_size();
5563 :
5564 3620 : PAC_DOMAIN_GROUP_MEMBERSHIP_Type.tp_base = BaseObject_Type;
5565 3620 : PAC_DOMAIN_GROUP_MEMBERSHIP_Type.tp_basicsize = pytalloc_BaseObject_size();
5566 :
5567 3620 : PAC_LOGON_INFO_Type.tp_base = BaseObject_Type;
5568 3620 : PAC_LOGON_INFO_Type.tp_basicsize = pytalloc_BaseObject_size();
5569 :
5570 3620 : PAC_CREDENTIAL_NTLM_SECPKG_Type.tp_base = BaseObject_Type;
5571 3620 : PAC_CREDENTIAL_NTLM_SECPKG_Type.tp_basicsize = pytalloc_BaseObject_size();
5572 :
5573 3620 : PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_Type.tp_base = BaseObject_Type;
5574 3620 : PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_Type.tp_basicsize = pytalloc_BaseObject_size();
5575 :
5576 3620 : PAC_CREDENTIAL_DATA_Type.tp_base = BaseObject_Type;
5577 3620 : PAC_CREDENTIAL_DATA_Type.tp_basicsize = pytalloc_BaseObject_size();
5578 :
5579 3620 : PAC_CREDENTIAL_DATA_CTR_Type.tp_base = BaseObject_Type;
5580 3620 : PAC_CREDENTIAL_DATA_CTR_Type.tp_basicsize = pytalloc_BaseObject_size();
5581 :
5582 3620 : PAC_CREDENTIAL_DATA_NDR_Type.tp_base = BaseObject_Type;
5583 3620 : PAC_CREDENTIAL_DATA_NDR_Type.tp_basicsize = pytalloc_BaseObject_size();
5584 :
5585 3620 : PAC_CREDENTIAL_INFO_Type.tp_base = BaseObject_Type;
5586 3620 : PAC_CREDENTIAL_INFO_Type.tp_basicsize = pytalloc_BaseObject_size();
5587 :
5588 3620 : PAC_CONSTRAINED_DELEGATION_Type.tp_base = BaseObject_Type;
5589 3620 : PAC_CONSTRAINED_DELEGATION_Type.tp_basicsize = pytalloc_BaseObject_size();
5590 :
5591 3620 : PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_Type.tp_base = BaseObject_Type;
5592 3620 : PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_Type.tp_basicsize = pytalloc_BaseObject_size();
5593 :
5594 3620 : PAC_UPN_DNS_INFO_EX_Type.tp_base = BaseObject_Type;
5595 3620 : PAC_UPN_DNS_INFO_EX_Type.tp_basicsize = pytalloc_BaseObject_size();
5596 :
5597 3620 : PAC_UPN_DNS_INFO_Type.tp_base = BaseObject_Type;
5598 3620 : PAC_UPN_DNS_INFO_Type.tp_basicsize = pytalloc_BaseObject_size();
5599 :
5600 3620 : PAC_ATTRIBUTES_INFO_Type.tp_base = BaseObject_Type;
5601 3620 : PAC_ATTRIBUTES_INFO_Type.tp_basicsize = pytalloc_BaseObject_size();
5602 :
5603 3620 : PAC_REQUESTER_SID_Type.tp_base = BaseObject_Type;
5604 3620 : PAC_REQUESTER_SID_Type.tp_basicsize = pytalloc_BaseObject_size();
5605 :
5606 3620 : PAC_LOGON_INFO_CTR_Type.tp_base = BaseObject_Type;
5607 3620 : PAC_LOGON_INFO_CTR_Type.tp_basicsize = pytalloc_BaseObject_size();
5608 :
5609 3620 : PAC_CONSTRAINED_DELEGATION_CTR_Type.tp_base = BaseObject_Type;
5610 3620 : PAC_CONSTRAINED_DELEGATION_CTR_Type.tp_basicsize = pytalloc_BaseObject_size();
5611 :
5612 3620 : PAC_DEVICE_INFO_Type.tp_base = BaseObject_Type;
5613 3620 : PAC_DEVICE_INFO_Type.tp_basicsize = pytalloc_BaseObject_size();
5614 :
5615 3620 : PAC_DEVICE_INFO_CTR_Type.tp_base = BaseObject_Type;
5616 3620 : PAC_DEVICE_INFO_CTR_Type.tp_basicsize = pytalloc_BaseObject_size();
5617 :
5618 3620 : DATA_BLOB_REM_Type.tp_base = BaseObject_Type;
5619 3620 : DATA_BLOB_REM_Type.tp_basicsize = pytalloc_BaseObject_size();
5620 :
5621 3620 : PAC_INFO_Type.tp_base = BaseObject_Type;
5622 3620 : PAC_INFO_Type.tp_basicsize = pytalloc_BaseObject_size();
5623 :
5624 3620 : PAC_BUFFER_Type.tp_base = BaseObject_Type;
5625 3620 : PAC_BUFFER_Type.tp_basicsize = pytalloc_BaseObject_size();
5626 :
5627 3620 : PAC_DATA_Type.tp_base = BaseObject_Type;
5628 3620 : PAC_DATA_Type.tp_basicsize = pytalloc_BaseObject_size();
5629 :
5630 3620 : PAC_BUFFER_RAW_Type.tp_base = BaseObject_Type;
5631 3620 : PAC_BUFFER_RAW_Type.tp_basicsize = pytalloc_BaseObject_size();
5632 :
5633 3620 : PAC_DATA_RAW_Type.tp_base = BaseObject_Type;
5634 3620 : PAC_DATA_RAW_Type.tp_basicsize = pytalloc_BaseObject_size();
5635 :
5636 3620 : PAC_Validate_Type.tp_base = BaseObject_Type;
5637 3620 : PAC_Validate_Type.tp_basicsize = pytalloc_BaseObject_size();
5638 :
5639 3620 : netsamlogoncache_entry_Type.tp_base = BaseObject_Type;
5640 3620 : netsamlogoncache_entry_Type.tp_basicsize = pytalloc_BaseObject_size();
5641 :
5642 3620 : krb5pac_InterfaceType.tp_base = ClientConnection_Type;
5643 :
5644 3620 : krb5pac_SyntaxType.tp_base = ndr_syntax_id_Type;
5645 3620 : krb5pac_SyntaxType.tp_basicsize = pytalloc_BaseObject_size();
5646 :
5647 3620 : if (PyType_Ready(&PAC_LOGON_NAME_Type) < 0)
5648 0 : goto out;
5649 3620 : if (PyType_Ready(&PAC_SIGNATURE_DATA_Type) < 0)
5650 0 : goto out;
5651 3620 : if (PyType_Ready(&PAC_DOMAIN_GROUP_MEMBERSHIP_Type) < 0)
5652 0 : goto out;
5653 3620 : if (PyType_Ready(&PAC_LOGON_INFO_Type) < 0)
5654 0 : goto out;
5655 3620 : if (PyType_Ready(&PAC_CREDENTIAL_NTLM_SECPKG_Type) < 0)
5656 0 : goto out;
5657 3620 : if (PyType_Ready(&PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_Type) < 0)
5658 0 : goto out;
5659 3620 : if (PyType_Ready(&PAC_CREDENTIAL_DATA_Type) < 0)
5660 0 : goto out;
5661 3620 : if (PyType_Ready(&PAC_CREDENTIAL_DATA_CTR_Type) < 0)
5662 0 : goto out;
5663 3620 : if (PyType_Ready(&PAC_CREDENTIAL_DATA_NDR_Type) < 0)
5664 0 : goto out;
5665 3620 : if (PyType_Ready(&PAC_CREDENTIAL_INFO_Type) < 0)
5666 0 : goto out;
5667 3620 : if (PyType_Ready(&PAC_CONSTRAINED_DELEGATION_Type) < 0)
5668 0 : goto out;
5669 3620 : if (PyType_Ready(&PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_Type) < 0)
5670 0 : goto out;
5671 3620 : if (PyType_Ready(&PAC_UPN_DNS_INFO_EX_Type) < 0)
5672 0 : goto out;
5673 3620 : if (PyType_Ready(&PAC_UPN_DNS_INFO_Type) < 0)
5674 0 : goto out;
5675 3620 : if (PyType_Ready(&PAC_ATTRIBUTES_INFO_Type) < 0)
5676 0 : goto out;
5677 3620 : if (PyType_Ready(&PAC_REQUESTER_SID_Type) < 0)
5678 0 : goto out;
5679 3620 : if (PyType_Ready(&PAC_LOGON_INFO_CTR_Type) < 0)
5680 0 : goto out;
5681 3620 : if (PyType_Ready(&PAC_CONSTRAINED_DELEGATION_CTR_Type) < 0)
5682 0 : goto out;
5683 3620 : if (PyType_Ready(&PAC_DEVICE_INFO_Type) < 0)
5684 0 : goto out;
5685 3620 : if (PyType_Ready(&PAC_DEVICE_INFO_CTR_Type) < 0)
5686 0 : goto out;
5687 3620 : if (PyType_Ready(&DATA_BLOB_REM_Type) < 0)
5688 0 : goto out;
5689 3620 : if (PyType_Ready(&PAC_INFO_Type) < 0)
5690 0 : goto out;
5691 3620 : if (PyType_Ready(&PAC_BUFFER_Type) < 0)
5692 0 : goto out;
5693 3620 : if (PyType_Ready(&PAC_DATA_Type) < 0)
5694 0 : goto out;
5695 3620 : if (PyType_Ready(&PAC_BUFFER_RAW_Type) < 0)
5696 0 : goto out;
5697 3620 : if (PyType_Ready(&PAC_DATA_RAW_Type) < 0)
5698 0 : goto out;
5699 3620 : if (PyType_Ready(&PAC_Validate_Type) < 0)
5700 0 : goto out;
5701 3620 : if (PyType_Ready(&netsamlogoncache_entry_Type) < 0)
5702 0 : goto out;
5703 3620 : if (PyType_Ready(&krb5pac_InterfaceType) < 0)
5704 0 : goto out;
5705 3620 : if (PyType_Ready(&krb5pac_SyntaxType) < 0)
5706 0 : goto out;
5707 3620 : if (!PyInterface_AddNdrRpcMethods(&krb5pac_InterfaceType, py_ndr_krb5pac_methods))
5708 0 : return NULL;
5709 :
5710 : #ifdef PY_PAC_LOGON_NAME_PATCH
5711 : PY_PAC_LOGON_NAME_PATCH(&PAC_LOGON_NAME_Type);
5712 : #endif
5713 : #ifdef PY_PAC_SIGNATURE_DATA_PATCH
5714 : PY_PAC_SIGNATURE_DATA_PATCH(&PAC_SIGNATURE_DATA_Type);
5715 : #endif
5716 : #ifdef PY_PAC_DOMAIN_GROUP_MEMBERSHIP_PATCH
5717 : PY_PAC_DOMAIN_GROUP_MEMBERSHIP_PATCH(&PAC_DOMAIN_GROUP_MEMBERSHIP_Type);
5718 : #endif
5719 : #ifdef PY_PAC_LOGON_INFO_PATCH
5720 : PY_PAC_LOGON_INFO_PATCH(&PAC_LOGON_INFO_Type);
5721 : #endif
5722 : #ifdef PY_PAC_CREDENTIAL_NTLM_SECPKG_PATCH
5723 : PY_PAC_CREDENTIAL_NTLM_SECPKG_PATCH(&PAC_CREDENTIAL_NTLM_SECPKG_Type);
5724 : #endif
5725 : #ifdef PY_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_PATCH
5726 : PY_PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_PATCH(&PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_Type);
5727 : #endif
5728 : #ifdef PY_PAC_CREDENTIAL_DATA_PATCH
5729 : PY_PAC_CREDENTIAL_DATA_PATCH(&PAC_CREDENTIAL_DATA_Type);
5730 : #endif
5731 : #ifdef PY_PAC_CREDENTIAL_DATA_CTR_PATCH
5732 : PY_PAC_CREDENTIAL_DATA_CTR_PATCH(&PAC_CREDENTIAL_DATA_CTR_Type);
5733 : #endif
5734 : #ifdef PY_PAC_CREDENTIAL_DATA_NDR_PATCH
5735 : PY_PAC_CREDENTIAL_DATA_NDR_PATCH(&PAC_CREDENTIAL_DATA_NDR_Type);
5736 : #endif
5737 : #ifdef PY_PAC_CREDENTIAL_INFO_PATCH
5738 : PY_PAC_CREDENTIAL_INFO_PATCH(&PAC_CREDENTIAL_INFO_Type);
5739 : #endif
5740 : #ifdef PY_PAC_CONSTRAINED_DELEGATION_PATCH
5741 : PY_PAC_CONSTRAINED_DELEGATION_PATCH(&PAC_CONSTRAINED_DELEGATION_Type);
5742 : #endif
5743 : #ifdef PY_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_PATCH
5744 : PY_PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_PATCH(&PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_Type);
5745 : #endif
5746 : #ifdef PY_PAC_UPN_DNS_INFO_EX_PATCH
5747 : PY_PAC_UPN_DNS_INFO_EX_PATCH(&PAC_UPN_DNS_INFO_EX_Type);
5748 : #endif
5749 : #ifdef PY_PAC_UPN_DNS_INFO_PATCH
5750 : PY_PAC_UPN_DNS_INFO_PATCH(&PAC_UPN_DNS_INFO_Type);
5751 : #endif
5752 : #ifdef PY_PAC_ATTRIBUTES_INFO_PATCH
5753 : PY_PAC_ATTRIBUTES_INFO_PATCH(&PAC_ATTRIBUTES_INFO_Type);
5754 : #endif
5755 : #ifdef PY_PAC_REQUESTER_SID_PATCH
5756 : PY_PAC_REQUESTER_SID_PATCH(&PAC_REQUESTER_SID_Type);
5757 : #endif
5758 : #ifdef PY_PAC_LOGON_INFO_CTR_PATCH
5759 : PY_PAC_LOGON_INFO_CTR_PATCH(&PAC_LOGON_INFO_CTR_Type);
5760 : #endif
5761 : #ifdef PY_PAC_CONSTRAINED_DELEGATION_CTR_PATCH
5762 : PY_PAC_CONSTRAINED_DELEGATION_CTR_PATCH(&PAC_CONSTRAINED_DELEGATION_CTR_Type);
5763 : #endif
5764 : #ifdef PY_PAC_DEVICE_INFO_PATCH
5765 : PY_PAC_DEVICE_INFO_PATCH(&PAC_DEVICE_INFO_Type);
5766 : #endif
5767 : #ifdef PY_PAC_DEVICE_INFO_CTR_PATCH
5768 : PY_PAC_DEVICE_INFO_CTR_PATCH(&PAC_DEVICE_INFO_CTR_Type);
5769 : #endif
5770 : #ifdef PY_DATA_BLOB_REM_PATCH
5771 : PY_DATA_BLOB_REM_PATCH(&DATA_BLOB_REM_Type);
5772 : #endif
5773 : #ifdef PY_PAC_INFO_PATCH
5774 : PY_PAC_INFO_PATCH(&PAC_INFO_Type);
5775 : #endif
5776 : #ifdef PY_PAC_BUFFER_PATCH
5777 : PY_PAC_BUFFER_PATCH(&PAC_BUFFER_Type);
5778 : #endif
5779 : #ifdef PY_PAC_DATA_PATCH
5780 : PY_PAC_DATA_PATCH(&PAC_DATA_Type);
5781 : #endif
5782 : #ifdef PY_PAC_BUFFER_RAW_PATCH
5783 : PY_PAC_BUFFER_RAW_PATCH(&PAC_BUFFER_RAW_Type);
5784 : #endif
5785 : #ifdef PY_PAC_DATA_RAW_PATCH
5786 : PY_PAC_DATA_RAW_PATCH(&PAC_DATA_RAW_Type);
5787 : #endif
5788 : #ifdef PY_PAC_VALIDATE_PATCH
5789 : PY_PAC_VALIDATE_PATCH(&PAC_Validate_Type);
5790 : #endif
5791 : #ifdef PY_NETSAMLOGONCACHE_ENTRY_PATCH
5792 : PY_NETSAMLOGONCACHE_ENTRY_PATCH(&netsamlogoncache_entry_Type);
5793 : #endif
5794 : #ifdef PY_KRB5PAC_PATCH
5795 : PY_KRB5PAC_PATCH(&krb5pac_InterfaceType);
5796 : #endif
5797 : #ifdef PY_KRB5PAC_ABSTRACT_SYNTAX_PATCH
5798 : PY_KRB5PAC_ABSTRACT_SYNTAX_PATCH(&krb5pac_SyntaxType);
5799 : #endif
5800 : #ifdef PY_ABSTRACT_SYNTAX_PATCH
5801 : PY_ABSTRACT_SYNTAX_PATCH(&krb5pac_SyntaxType);
5802 : #endif
5803 :
5804 3620 : m = PyModule_Create(&moduledef);
5805 3620 : if (m == NULL)
5806 0 : goto out;
5807 :
5808 3620 : PyModule_AddObject(m, "PAC_TYPE_BEGIN", PyLong_FromUnsignedLongLong(1));
5809 3620 : PyModule_AddObject(m, "PAC_TYPE_END", PyLong_FromUnsignedLongLong(20));
5810 3620 : PyModule_AddObject(m, "PAC_TYPE_COUNT", PyLong_FromUnsignedLongLong((uint32_t)(PAC_TYPE_END-PAC_TYPE_BEGIN)));
5811 3620 : PyModule_AddObject(m, "NETLOGON_GENERIC_KRB5_PAC_VALIDATE", PyLong_FromUnsignedLongLong(3));
5812 3620 : PyModule_AddObject(m, "PAC_CREDENTIAL_NTLM_HAS_LM_HASH", PyLong_FromUnsignedLongLong((uint32_t)(PAC_CREDENTIAL_NTLM_HAS_LM_HASH)));
5813 3620 : PyModule_AddObject(m, "PAC_CREDENTIAL_NTLM_HAS_NT_HASH", PyLong_FromUnsignedLongLong((uint32_t)(PAC_CREDENTIAL_NTLM_HAS_NT_HASH)));
5814 3620 : PyModule_AddObject(m, "PAC_UPN_DNS_FLAG_CONSTRUCTED", PyLong_FromUnsignedLongLong((uint32_t)(PAC_UPN_DNS_FLAG_CONSTRUCTED)));
5815 3620 : PyModule_AddObject(m, "PAC_UPN_DNS_FLAG_HAS_SAM_NAME_AND_SID", PyLong_FromUnsignedLongLong((uint32_t)(PAC_UPN_DNS_FLAG_HAS_SAM_NAME_AND_SID)));
5816 3620 : PyModule_AddObject(m, "PAC_ATTRIBUTE_FLAG_PAC_WAS_REQUESTED", PyLong_FromUnsignedLongLong((uint32_t)(PAC_ATTRIBUTE_FLAG_PAC_WAS_REQUESTED)));
5817 3620 : PyModule_AddObject(m, "PAC_ATTRIBUTE_FLAG_PAC_WAS_GIVEN_IMPLICITLY", PyLong_FromUnsignedLongLong((uint32_t)(PAC_ATTRIBUTE_FLAG_PAC_WAS_GIVEN_IMPLICITLY)));
5818 3620 : PyModule_AddObject(m, "PAC_TYPE_LOGON_INFO", PyLong_FromUnsignedLongLong((uint32_t)(PAC_TYPE_LOGON_INFO)));
5819 3620 : PyModule_AddObject(m, "PAC_TYPE_CREDENTIAL_INFO", PyLong_FromUnsignedLongLong((uint32_t)(PAC_TYPE_CREDENTIAL_INFO)));
5820 3620 : PyModule_AddObject(m, "PAC_TYPE_SRV_CHECKSUM", PyLong_FromUnsignedLongLong((uint32_t)(PAC_TYPE_SRV_CHECKSUM)));
5821 3620 : PyModule_AddObject(m, "PAC_TYPE_KDC_CHECKSUM", PyLong_FromUnsignedLongLong((uint32_t)(PAC_TYPE_KDC_CHECKSUM)));
5822 3620 : PyModule_AddObject(m, "PAC_TYPE_LOGON_NAME", PyLong_FromUnsignedLongLong((uint32_t)(PAC_TYPE_LOGON_NAME)));
5823 3620 : PyModule_AddObject(m, "PAC_TYPE_CONSTRAINED_DELEGATION", PyLong_FromUnsignedLongLong((uint32_t)(PAC_TYPE_CONSTRAINED_DELEGATION)));
5824 3620 : PyModule_AddObject(m, "PAC_TYPE_UPN_DNS_INFO", PyLong_FromUnsignedLongLong((uint32_t)(PAC_TYPE_UPN_DNS_INFO)));
5825 3620 : PyModule_AddObject(m, "PAC_TYPE_CLIENT_CLAIMS_INFO", PyLong_FromUnsignedLongLong((uint32_t)(PAC_TYPE_CLIENT_CLAIMS_INFO)));
5826 3620 : PyModule_AddObject(m, "PAC_TYPE_DEVICE_INFO", PyLong_FromUnsignedLongLong((uint32_t)(PAC_TYPE_DEVICE_INFO)));
5827 3620 : PyModule_AddObject(m, "PAC_TYPE_DEVICE_CLAIMS_INFO", PyLong_FromUnsignedLongLong((uint32_t)(PAC_TYPE_DEVICE_CLAIMS_INFO)));
5828 3620 : PyModule_AddObject(m, "PAC_TYPE_TICKET_CHECKSUM", PyLong_FromUnsignedLongLong((uint32_t)(PAC_TYPE_TICKET_CHECKSUM)));
5829 3620 : PyModule_AddObject(m, "PAC_TYPE_ATTRIBUTES_INFO", PyLong_FromUnsignedLongLong((uint32_t)(PAC_TYPE_ATTRIBUTES_INFO)));
5830 3620 : PyModule_AddObject(m, "PAC_TYPE_REQUESTER_SID", PyLong_FromUnsignedLongLong((uint32_t)(PAC_TYPE_REQUESTER_SID)));
5831 3620 : PyModule_AddObject(m, "PAC_TYPE_FULL_CHECKSUM", PyLong_FromUnsignedLongLong((uint32_t)(PAC_TYPE_FULL_CHECKSUM)));
5832 2621 : Py_INCREF((PyObject *)(void *)&PAC_LOGON_NAME_Type);
5833 3620 : PyModule_AddObject(m, "PAC_LOGON_NAME", (PyObject *)(void *)&PAC_LOGON_NAME_Type);
5834 2621 : Py_INCREF((PyObject *)(void *)&PAC_SIGNATURE_DATA_Type);
5835 3620 : PyModule_AddObject(m, "PAC_SIGNATURE_DATA", (PyObject *)(void *)&PAC_SIGNATURE_DATA_Type);
5836 2621 : Py_INCREF((PyObject *)(void *)&PAC_DOMAIN_GROUP_MEMBERSHIP_Type);
5837 3620 : PyModule_AddObject(m, "PAC_DOMAIN_GROUP_MEMBERSHIP", (PyObject *)(void *)&PAC_DOMAIN_GROUP_MEMBERSHIP_Type);
5838 2621 : Py_INCREF((PyObject *)(void *)&PAC_LOGON_INFO_Type);
5839 3620 : PyModule_AddObject(m, "PAC_LOGON_INFO", (PyObject *)(void *)&PAC_LOGON_INFO_Type);
5840 2621 : Py_INCREF((PyObject *)(void *)&PAC_CREDENTIAL_NTLM_SECPKG_Type);
5841 3620 : PyModule_AddObject(m, "PAC_CREDENTIAL_NTLM_SECPKG", (PyObject *)(void *)&PAC_CREDENTIAL_NTLM_SECPKG_Type);
5842 2621 : Py_INCREF((PyObject *)(void *)&PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_Type);
5843 3620 : PyModule_AddObject(m, "PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG", (PyObject *)(void *)&PAC_CREDENTIAL_SUPPLEMENTAL_SECPKG_Type);
5844 2621 : Py_INCREF((PyObject *)(void *)&PAC_CREDENTIAL_DATA_Type);
5845 3620 : PyModule_AddObject(m, "PAC_CREDENTIAL_DATA", (PyObject *)(void *)&PAC_CREDENTIAL_DATA_Type);
5846 2621 : Py_INCREF((PyObject *)(void *)&PAC_CREDENTIAL_DATA_CTR_Type);
5847 3620 : PyModule_AddObject(m, "PAC_CREDENTIAL_DATA_CTR", (PyObject *)(void *)&PAC_CREDENTIAL_DATA_CTR_Type);
5848 2621 : Py_INCREF((PyObject *)(void *)&PAC_CREDENTIAL_DATA_NDR_Type);
5849 3620 : PyModule_AddObject(m, "PAC_CREDENTIAL_DATA_NDR", (PyObject *)(void *)&PAC_CREDENTIAL_DATA_NDR_Type);
5850 2621 : Py_INCREF((PyObject *)(void *)&PAC_CREDENTIAL_INFO_Type);
5851 3620 : PyModule_AddObject(m, "PAC_CREDENTIAL_INFO", (PyObject *)(void *)&PAC_CREDENTIAL_INFO_Type);
5852 2621 : Py_INCREF((PyObject *)(void *)&PAC_CONSTRAINED_DELEGATION_Type);
5853 3620 : PyModule_AddObject(m, "PAC_CONSTRAINED_DELEGATION", (PyObject *)(void *)&PAC_CONSTRAINED_DELEGATION_Type);
5854 2621 : Py_INCREF((PyObject *)(void *)&PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_Type);
5855 3620 : PyModule_AddObject(m, "PAC_UPN_DNS_INFO_SAM_NAME_AND_SID", (PyObject *)(void *)&PAC_UPN_DNS_INFO_SAM_NAME_AND_SID_Type);
5856 2621 : Py_INCREF((PyObject *)(void *)&PAC_UPN_DNS_INFO_EX_Type);
5857 3620 : PyModule_AddObject(m, "PAC_UPN_DNS_INFO_EX", (PyObject *)(void *)&PAC_UPN_DNS_INFO_EX_Type);
5858 2621 : Py_INCREF((PyObject *)(void *)&PAC_UPN_DNS_INFO_Type);
5859 3620 : PyModule_AddObject(m, "PAC_UPN_DNS_INFO", (PyObject *)(void *)&PAC_UPN_DNS_INFO_Type);
5860 2621 : Py_INCREF((PyObject *)(void *)&PAC_ATTRIBUTES_INFO_Type);
5861 3620 : PyModule_AddObject(m, "PAC_ATTRIBUTES_INFO", (PyObject *)(void *)&PAC_ATTRIBUTES_INFO_Type);
5862 2621 : Py_INCREF((PyObject *)(void *)&PAC_REQUESTER_SID_Type);
5863 3620 : PyModule_AddObject(m, "PAC_REQUESTER_SID", (PyObject *)(void *)&PAC_REQUESTER_SID_Type);
5864 2621 : Py_INCREF((PyObject *)(void *)&PAC_LOGON_INFO_CTR_Type);
5865 3620 : PyModule_AddObject(m, "PAC_LOGON_INFO_CTR", (PyObject *)(void *)&PAC_LOGON_INFO_CTR_Type);
5866 2621 : Py_INCREF((PyObject *)(void *)&PAC_CONSTRAINED_DELEGATION_CTR_Type);
5867 3620 : PyModule_AddObject(m, "PAC_CONSTRAINED_DELEGATION_CTR", (PyObject *)(void *)&PAC_CONSTRAINED_DELEGATION_CTR_Type);
5868 2621 : Py_INCREF((PyObject *)(void *)&PAC_DEVICE_INFO_Type);
5869 3620 : PyModule_AddObject(m, "PAC_DEVICE_INFO", (PyObject *)(void *)&PAC_DEVICE_INFO_Type);
5870 2621 : Py_INCREF((PyObject *)(void *)&PAC_DEVICE_INFO_CTR_Type);
5871 3620 : PyModule_AddObject(m, "PAC_DEVICE_INFO_CTR", (PyObject *)(void *)&PAC_DEVICE_INFO_CTR_Type);
5872 2621 : Py_INCREF((PyObject *)(void *)&DATA_BLOB_REM_Type);
5873 3620 : PyModule_AddObject(m, "DATA_BLOB_REM", (PyObject *)(void *)&DATA_BLOB_REM_Type);
5874 2621 : Py_INCREF((PyObject *)(void *)&PAC_INFO_Type);
5875 3620 : PyModule_AddObject(m, "PAC_INFO", (PyObject *)(void *)&PAC_INFO_Type);
5876 2621 : Py_INCREF((PyObject *)(void *)&PAC_BUFFER_Type);
5877 3620 : PyModule_AddObject(m, "PAC_BUFFER", (PyObject *)(void *)&PAC_BUFFER_Type);
5878 2621 : Py_INCREF((PyObject *)(void *)&PAC_DATA_Type);
5879 3620 : PyModule_AddObject(m, "PAC_DATA", (PyObject *)(void *)&PAC_DATA_Type);
5880 2621 : Py_INCREF((PyObject *)(void *)&PAC_BUFFER_RAW_Type);
5881 3620 : PyModule_AddObject(m, "PAC_BUFFER_RAW", (PyObject *)(void *)&PAC_BUFFER_RAW_Type);
5882 2621 : Py_INCREF((PyObject *)(void *)&PAC_DATA_RAW_Type);
5883 3620 : PyModule_AddObject(m, "PAC_DATA_RAW", (PyObject *)(void *)&PAC_DATA_RAW_Type);
5884 2621 : Py_INCREF((PyObject *)(void *)&PAC_Validate_Type);
5885 3620 : PyModule_AddObject(m, "PAC_Validate", (PyObject *)(void *)&PAC_Validate_Type);
5886 2621 : Py_INCREF((PyObject *)(void *)&netsamlogoncache_entry_Type);
5887 3620 : PyModule_AddObject(m, "netsamlogoncache_entry", (PyObject *)(void *)&netsamlogoncache_entry_Type);
5888 2621 : Py_INCREF((PyObject *)(void *)&krb5pac_InterfaceType);
5889 3620 : PyModule_AddObject(m, "krb5pac", (PyObject *)(void *)&krb5pac_InterfaceType);
5890 2621 : Py_INCREF((PyObject *)(void *)&krb5pac_SyntaxType);
5891 3620 : PyModule_AddObject(m, "krb5pac_abstract_syntax", (PyObject *)(void *)&krb5pac_SyntaxType);
5892 2621 : Py_INCREF((PyObject *)(void *)&krb5pac_SyntaxType);
5893 3620 : PyModule_AddObject(m, "abstract_syntax", (PyObject *)(void *)&krb5pac_SyntaxType);
5894 : #ifdef PY_MOD_KRB5PAC_PATCH
5895 : PY_MOD_KRB5PAC_PATCH(m);
5896 : #endif
5897 3620 : out:
5898 3620 : Py_XDECREF(dep_samba_dcerpc_security);
5899 3620 : Py_XDECREF(dep_samba_dcerpc_lsa);
5900 3620 : Py_XDECREF(dep_samba_dcerpc_netlogon);
5901 3620 : Py_XDECREF(dep_samba_dcerpc_samr);
5902 3620 : Py_XDECREF(dep_talloc);
5903 3620 : Py_XDECREF(dep_samba_dcerpc_base);
5904 3620 : Py_XDECREF(dep_samba_dcerpc_misc);
5905 3496 : return m;
5906 :
5907 : }
|