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_krb5ccache.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 528 : static inline unsigned long long ndr_sizeof2uintmax(size_t var_size)
33 : {
34 528 : switch (var_size) {
35 0 : case 8:
36 0 : return UINT64_MAX;
37 363 : case 4:
38 363 : return UINT32_MAX;
39 66 : case 2:
40 66 : return UINT16_MAX;
41 99 : case 1:
42 99 : return UINT8_MAX;
43 : }
44 :
45 0 : return 0;
46 : }
47 :
48 66 : static inline _MAYBE_UNUSED_ long long ndr_sizeof2intmax(size_t var_size)
49 : {
50 66 : switch (var_size) {
51 0 : case 8:
52 0 : return INT64_MAX;
53 66 : case 4:
54 66 : 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 : static PyTypeObject PRINCIPAL_Type;
65 : static PyTypeObject KEYBLOCK_Type;
66 : static PyTypeObject ADDRESS_Type;
67 : static PyTypeObject ADDRESSES_Type;
68 : static PyTypeObject AUTHDATUM_Type;
69 : static PyTypeObject AUTHDATA_Type;
70 : static PyTypeObject CREDENTIAL_Type;
71 : static PyTypeObject DELTATIME_TAG_Type;
72 : static PyTypeObject FIELD_Type;
73 : static PyTypeObject V4TAG_Type;
74 : static PyTypeObject V4TAGS_Type;
75 : static PyTypeObject V4HEADER_Type;
76 : static PyTypeObject OPTIONAL_HEADER_Type;
77 : static PyTypeObject CCACHE_Type;
78 : static PyTypeObject MULTIPLE_CREDENTIALS_Type;
79 : static PyTypeObject KEYTAB_KEYBLOCK_Type;
80 : static PyTypeObject KEYTAB_PRINCIPAL_Type;
81 : static PyTypeObject KEYTAB_ENTRY_Type;
82 : static PyTypeObject KEYTAB_Type;
83 : static PyTypeObject MULTIPLE_KEYTAB_ENTRIES_Type;
84 : static PyTypeObject krb5ccache_InterfaceType;
85 :
86 : static PyTypeObject *BaseObject_Type;
87 : static PyTypeObject *ClientConnection_Type;
88 : static PyTypeObject *ndr_syntax_id_Type;
89 :
90 0 : static PyObject *py_PRINCIPAL_get_name_type(PyObject *obj, void *closure)
91 : {
92 0 : struct PRINCIPAL *object = pytalloc_get_ptr(obj);
93 : PyObject *py_name_type;
94 0 : py_name_type = PyLong_FromUnsignedLongLong((uint32_t)(object->name_type));
95 0 : return py_name_type;
96 : }
97 :
98 66 : static int py_PRINCIPAL_set_name_type(PyObject *py_obj, PyObject *value, void *closure)
99 : {
100 66 : struct PRINCIPAL *object = pytalloc_get_ptr(py_obj);
101 66 : if (value == NULL) {
102 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->name_type");
103 0 : return -1;
104 : }
105 : {
106 66 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->name_type));
107 66 : if (PyLong_Check(value)) {
108 : unsigned long long test_var;
109 66 : test_var = PyLong_AsUnsignedLongLong(value);
110 66 : if (PyErr_Occurred() != NULL) {
111 0 : return -1;
112 : }
113 66 : if (test_var > uint_max) {
114 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
115 : PyLong_Type.tp_name, uint_max, test_var);
116 0 : return -1;
117 : }
118 66 : object->name_type = test_var;
119 : } else {
120 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
121 : PyLong_Type.tp_name);
122 0 : return -1;
123 : }
124 : }
125 66 : return 0;
126 : }
127 :
128 0 : static PyObject *py_PRINCIPAL_get_component_count(PyObject *obj, void *closure)
129 : {
130 0 : struct PRINCIPAL *object = pytalloc_get_ptr(obj);
131 : PyObject *py_component_count;
132 0 : py_component_count = PyLong_FromUnsignedLongLong((uint32_t)(object->component_count));
133 0 : return py_component_count;
134 : }
135 :
136 66 : static int py_PRINCIPAL_set_component_count(PyObject *py_obj, PyObject *value, void *closure)
137 : {
138 66 : struct PRINCIPAL *object = pytalloc_get_ptr(py_obj);
139 66 : if (value == NULL) {
140 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->component_count");
141 0 : return -1;
142 : }
143 : {
144 66 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->component_count));
145 66 : if (PyLong_Check(value)) {
146 : unsigned long long test_var;
147 66 : test_var = PyLong_AsUnsignedLongLong(value);
148 66 : if (PyErr_Occurred() != NULL) {
149 0 : return -1;
150 : }
151 66 : if (test_var > uint_max) {
152 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
153 : PyLong_Type.tp_name, uint_max, test_var);
154 0 : return -1;
155 : }
156 66 : object->component_count = test_var;
157 : } else {
158 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
159 : PyLong_Type.tp_name);
160 0 : return -1;
161 : }
162 : }
163 66 : return 0;
164 : }
165 :
166 0 : static PyObject *py_PRINCIPAL_get_realm(PyObject *obj, void *closure)
167 : {
168 0 : struct PRINCIPAL *object = pytalloc_get_ptr(obj);
169 : PyObject *py_realm;
170 0 : py_realm = PyString_FromStringOrNULL(object->realm);
171 0 : return py_realm;
172 : }
173 :
174 66 : static int py_PRINCIPAL_set_realm(PyObject *py_obj, PyObject *value, void *closure)
175 : {
176 66 : struct PRINCIPAL *object = pytalloc_get_ptr(py_obj);
177 66 : if (value == NULL) {
178 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->realm");
179 0 : return -1;
180 : }
181 : {
182 : const char *test_str;
183 : const char *talloc_str;
184 66 : PyObject *unicode = NULL;
185 66 : if (PyUnicode_Check(value)) {
186 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
187 0 : if (unicode == NULL) {
188 0 : return -1;
189 : }
190 0 : test_str = PyBytes_AS_STRING(unicode);
191 66 : } else if (PyBytes_Check(value)) {
192 66 : test_str = PyBytes_AS_STRING(value);
193 : } else {
194 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
195 0 : return -1;
196 : }
197 66 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
198 66 : if (unicode != NULL) {
199 0 : Py_DECREF(unicode);
200 : }
201 66 : if (talloc_str == NULL) {
202 0 : PyErr_NoMemory();
203 0 : return -1;
204 : }
205 66 : object->realm = talloc_str;
206 : }
207 66 : return 0;
208 : }
209 :
210 0 : static PyObject *py_PRINCIPAL_get_components(PyObject *obj, void *closure)
211 : {
212 0 : struct PRINCIPAL *object = pytalloc_get_ptr(obj);
213 : PyObject *py_components;
214 0 : py_components = PyList_New(object->component_count);
215 0 : if (py_components == NULL) {
216 0 : return NULL;
217 : }
218 : {
219 : int components_cntr_0;
220 0 : for (components_cntr_0 = 0; components_cntr_0 < (object->component_count); components_cntr_0++) {
221 : PyObject *py_components_0;
222 0 : py_components_0 = PyString_FromStringOrNULL((object->components)[components_cntr_0]);
223 0 : PyList_SetItem(py_components, components_cntr_0, py_components_0);
224 : }
225 : }
226 0 : return py_components;
227 : }
228 :
229 66 : static int py_PRINCIPAL_set_components(PyObject *py_obj, PyObject *value, void *closure)
230 : {
231 66 : struct PRINCIPAL *object = pytalloc_get_ptr(py_obj);
232 66 : if (value == NULL) {
233 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->components");
234 0 : return -1;
235 : }
236 66 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
237 : {
238 : int components_cntr_0;
239 66 : object->components = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->components, PyList_GET_SIZE(value));
240 66 : if (!object->components) { return -1; }
241 66 : talloc_set_name_const(object->components, "ARRAY: object->components");
242 165 : for (components_cntr_0 = 0; components_cntr_0 < PyList_GET_SIZE(value); components_cntr_0++) {
243 99 : if (PyList_GET_ITEM(value, components_cntr_0) == NULL) {
244 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->components)[components_cntr_0]");
245 0 : return -1;
246 : }
247 : {
248 : const char *test_str;
249 : const char *talloc_str;
250 99 : PyObject *unicode = NULL;
251 99 : if (PyUnicode_Check(PyList_GET_ITEM(value, components_cntr_0))) {
252 33 : unicode = PyUnicode_AsEncodedString(PyList_GET_ITEM(value, components_cntr_0), "utf-8", "ignore");
253 33 : if (unicode == NULL) {
254 0 : return -1;
255 : }
256 33 : test_str = PyBytes_AS_STRING(unicode);
257 66 : } else if (PyBytes_Check(PyList_GET_ITEM(value, components_cntr_0))) {
258 66 : test_str = PyBytes_AS_STRING(PyList_GET_ITEM(value, components_cntr_0));
259 : } else {
260 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(PyList_GET_ITEM(value, components_cntr_0))->tp_name);
261 0 : return -1;
262 : }
263 99 : talloc_str = talloc_strdup(object->components, test_str);
264 99 : if (unicode != NULL) {
265 21 : Py_DECREF(unicode);
266 : }
267 99 : if (talloc_str == NULL) {
268 0 : PyErr_NoMemory();
269 0 : return -1;
270 : }
271 99 : (object->components)[components_cntr_0] = talloc_str;
272 : }
273 : }
274 : }
275 66 : return 0;
276 : }
277 :
278 : static PyGetSetDef py_PRINCIPAL_getsetters[] = {
279 : {
280 : .name = discard_const_p(char, "name_type"),
281 : .get = py_PRINCIPAL_get_name_type,
282 : .set = py_PRINCIPAL_set_name_type,
283 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
284 : },
285 : {
286 : .name = discard_const_p(char, "component_count"),
287 : .get = py_PRINCIPAL_get_component_count,
288 : .set = py_PRINCIPAL_set_component_count,
289 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
290 : },
291 : {
292 : .name = discard_const_p(char, "realm"),
293 : .get = py_PRINCIPAL_get_realm,
294 : .set = py_PRINCIPAL_set_realm,
295 : .doc = discard_const_p(char, "PIDL-generated element of base type string")
296 : },
297 : {
298 : .name = discard_const_p(char, "components"),
299 : .get = py_PRINCIPAL_get_components,
300 : .set = py_PRINCIPAL_set_components,
301 : .doc = discard_const_p(char, "PIDL-generated element of base type string")
302 : },
303 : { .name = NULL }
304 : };
305 :
306 66 : static PyObject *py_PRINCIPAL_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
307 : {
308 66 : return pytalloc_new(struct PRINCIPAL, type);
309 : }
310 :
311 :
312 : static PyTypeObject PRINCIPAL_Type = {
313 : PyVarObject_HEAD_INIT(NULL, 0)
314 : .tp_name = "krb5ccache.PRINCIPAL",
315 : .tp_getset = py_PRINCIPAL_getsetters,
316 : .tp_methods = NULL,
317 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
318 : .tp_new = py_PRINCIPAL_new,
319 : };
320 :
321 :
322 0 : static PyObject *py_KEYBLOCK_get_enctype(PyObject *obj, void *closure)
323 : {
324 0 : struct KEYBLOCK *object = pytalloc_get_ptr(obj);
325 : PyObject *py_enctype;
326 0 : py_enctype = PyLong_FromLong((uint16_t)(object->enctype));
327 0 : return py_enctype;
328 : }
329 :
330 33 : static int py_KEYBLOCK_set_enctype(PyObject *py_obj, PyObject *value, void *closure)
331 : {
332 33 : struct KEYBLOCK *object = pytalloc_get_ptr(py_obj);
333 33 : if (value == NULL) {
334 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->enctype");
335 0 : return -1;
336 : }
337 : {
338 33 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->enctype));
339 33 : if (PyLong_Check(value)) {
340 : unsigned long long test_var;
341 33 : test_var = PyLong_AsUnsignedLongLong(value);
342 33 : if (PyErr_Occurred() != NULL) {
343 0 : return -1;
344 : }
345 33 : if (test_var > uint_max) {
346 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
347 : PyLong_Type.tp_name, uint_max, test_var);
348 0 : return -1;
349 : }
350 33 : object->enctype = test_var;
351 : } else {
352 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
353 : PyLong_Type.tp_name);
354 0 : return -1;
355 : }
356 : }
357 33 : return 0;
358 : }
359 :
360 0 : static PyObject *py_KEYBLOCK_get_data(PyObject *obj, void *closure)
361 : {
362 0 : struct KEYBLOCK *object = pytalloc_get_ptr(obj);
363 : PyObject *py_data;
364 0 : py_data = PyBytes_FromStringAndSize((char *)(object->data).data, (object->data).length);
365 0 : return py_data;
366 : }
367 :
368 33 : static int py_KEYBLOCK_set_data(PyObject *py_obj, PyObject *value, void *closure)
369 : {
370 33 : struct KEYBLOCK *object = pytalloc_get_ptr(py_obj);
371 33 : if (value == NULL) {
372 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->data");
373 0 : return -1;
374 : }
375 33 : object->data = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
376 33 : return 0;
377 : }
378 :
379 : static PyGetSetDef py_KEYBLOCK_getsetters[] = {
380 : {
381 : .name = discard_const_p(char, "enctype"),
382 : .get = py_KEYBLOCK_get_enctype,
383 : .set = py_KEYBLOCK_set_enctype,
384 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
385 : },
386 : {
387 : .name = discard_const_p(char, "data"),
388 : .get = py_KEYBLOCK_get_data,
389 : .set = py_KEYBLOCK_set_data,
390 : .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
391 : },
392 : { .name = NULL }
393 : };
394 :
395 33 : static PyObject *py_KEYBLOCK_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
396 : {
397 33 : return pytalloc_new(struct KEYBLOCK, type);
398 : }
399 :
400 :
401 : static PyTypeObject KEYBLOCK_Type = {
402 : PyVarObject_HEAD_INIT(NULL, 0)
403 : .tp_name = "krb5ccache.KEYBLOCK",
404 : .tp_getset = py_KEYBLOCK_getsetters,
405 : .tp_methods = NULL,
406 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
407 : .tp_new = py_KEYBLOCK_new,
408 : };
409 :
410 :
411 0 : static PyObject *py_ADDRESS_get_addrtype(PyObject *obj, void *closure)
412 : {
413 0 : struct ADDRESS *object = pytalloc_get_ptr(obj);
414 : PyObject *py_addrtype;
415 0 : py_addrtype = PyLong_FromLong((uint16_t)(object->addrtype));
416 0 : return py_addrtype;
417 : }
418 :
419 0 : static int py_ADDRESS_set_addrtype(PyObject *py_obj, PyObject *value, void *closure)
420 : {
421 0 : struct ADDRESS *object = pytalloc_get_ptr(py_obj);
422 0 : if (value == NULL) {
423 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->addrtype");
424 0 : return -1;
425 : }
426 : {
427 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->addrtype));
428 0 : if (PyLong_Check(value)) {
429 : unsigned long long test_var;
430 0 : test_var = PyLong_AsUnsignedLongLong(value);
431 0 : if (PyErr_Occurred() != NULL) {
432 0 : return -1;
433 : }
434 0 : if (test_var > uint_max) {
435 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
436 : PyLong_Type.tp_name, uint_max, test_var);
437 0 : return -1;
438 : }
439 0 : object->addrtype = test_var;
440 : } else {
441 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
442 : PyLong_Type.tp_name);
443 0 : return -1;
444 : }
445 : }
446 0 : return 0;
447 : }
448 :
449 0 : static PyObject *py_ADDRESS_get_data(PyObject *obj, void *closure)
450 : {
451 0 : struct ADDRESS *object = pytalloc_get_ptr(obj);
452 : PyObject *py_data;
453 0 : py_data = PyBytes_FromStringAndSize((char *)(object->data).data, (object->data).length);
454 0 : return py_data;
455 : }
456 :
457 0 : static int py_ADDRESS_set_data(PyObject *py_obj, PyObject *value, void *closure)
458 : {
459 0 : struct ADDRESS *object = pytalloc_get_ptr(py_obj);
460 0 : if (value == NULL) {
461 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->data");
462 0 : return -1;
463 : }
464 0 : object->data = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
465 0 : return 0;
466 : }
467 :
468 : static PyGetSetDef py_ADDRESS_getsetters[] = {
469 : {
470 : .name = discard_const_p(char, "addrtype"),
471 : .get = py_ADDRESS_get_addrtype,
472 : .set = py_ADDRESS_set_addrtype,
473 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
474 : },
475 : {
476 : .name = discard_const_p(char, "data"),
477 : .get = py_ADDRESS_get_data,
478 : .set = py_ADDRESS_set_data,
479 : .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
480 : },
481 : { .name = NULL }
482 : };
483 :
484 0 : static PyObject *py_ADDRESS_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
485 : {
486 0 : return pytalloc_new(struct ADDRESS, type);
487 : }
488 :
489 :
490 : static PyTypeObject ADDRESS_Type = {
491 : PyVarObject_HEAD_INIT(NULL, 0)
492 : .tp_name = "krb5ccache.ADDRESS",
493 : .tp_getset = py_ADDRESS_getsetters,
494 : .tp_methods = NULL,
495 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
496 : .tp_new = py_ADDRESS_new,
497 : };
498 :
499 :
500 0 : static PyObject *py_ADDRESSES_get_count(PyObject *obj, void *closure)
501 : {
502 0 : struct ADDRESSES *object = pytalloc_get_ptr(obj);
503 : PyObject *py_count;
504 0 : py_count = PyLong_FromUnsignedLongLong((uint32_t)(object->count));
505 0 : return py_count;
506 : }
507 :
508 33 : static int py_ADDRESSES_set_count(PyObject *py_obj, PyObject *value, void *closure)
509 : {
510 33 : struct ADDRESSES *object = pytalloc_get_ptr(py_obj);
511 33 : if (value == NULL) {
512 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->count");
513 0 : return -1;
514 : }
515 : {
516 33 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->count));
517 33 : if (PyLong_Check(value)) {
518 : unsigned long long test_var;
519 33 : test_var = PyLong_AsUnsignedLongLong(value);
520 33 : if (PyErr_Occurred() != NULL) {
521 0 : return -1;
522 : }
523 33 : if (test_var > uint_max) {
524 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
525 : PyLong_Type.tp_name, uint_max, test_var);
526 0 : return -1;
527 : }
528 33 : object->count = test_var;
529 : } else {
530 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
531 : PyLong_Type.tp_name);
532 0 : return -1;
533 : }
534 : }
535 33 : return 0;
536 : }
537 :
538 0 : static PyObject *py_ADDRESSES_get_data(PyObject *obj, void *closure)
539 : {
540 0 : struct ADDRESSES *object = pytalloc_get_ptr(obj);
541 : PyObject *py_data;
542 0 : py_data = PyList_New(object->count);
543 0 : if (py_data == NULL) {
544 0 : return NULL;
545 : }
546 : {
547 : int data_cntr_0;
548 0 : for (data_cntr_0 = 0; data_cntr_0 < (object->count); data_cntr_0++) {
549 : PyObject *py_data_0;
550 0 : py_data_0 = pytalloc_reference_ex(&ADDRESS_Type, object->data, &(object->data)[data_cntr_0]);
551 0 : PyList_SetItem(py_data, data_cntr_0, py_data_0);
552 : }
553 : }
554 0 : return py_data;
555 : }
556 :
557 33 : static int py_ADDRESSES_set_data(PyObject *py_obj, PyObject *value, void *closure)
558 : {
559 33 : struct ADDRESSES *object = pytalloc_get_ptr(py_obj);
560 33 : if (value == NULL) {
561 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->data");
562 0 : return -1;
563 : }
564 33 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
565 : {
566 : int data_cntr_0;
567 33 : object->data = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->data, PyList_GET_SIZE(value));
568 33 : if (!object->data) { return -1; }
569 33 : talloc_set_name_const(object->data, "ARRAY: object->data");
570 33 : for (data_cntr_0 = 0; data_cntr_0 < PyList_GET_SIZE(value); data_cntr_0++) {
571 0 : if (PyList_GET_ITEM(value, data_cntr_0) == NULL) {
572 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->data)[data_cntr_0]");
573 0 : return -1;
574 : }
575 0 : PY_CHECK_TYPE(&ADDRESS_Type, PyList_GET_ITEM(value, data_cntr_0), return -1;);
576 0 : if (talloc_reference(object->data, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, data_cntr_0))) == NULL) {
577 0 : PyErr_NoMemory();
578 0 : return -1;
579 : }
580 0 : (object->data)[data_cntr_0] = *(struct ADDRESS *)pytalloc_get_ptr(PyList_GET_ITEM(value, data_cntr_0));
581 : }
582 : }
583 33 : return 0;
584 : }
585 :
586 : static PyGetSetDef py_ADDRESSES_getsetters[] = {
587 : {
588 : .name = discard_const_p(char, "count"),
589 : .get = py_ADDRESSES_get_count,
590 : .set = py_ADDRESSES_set_count,
591 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
592 : },
593 : {
594 : .name = discard_const_p(char, "data"),
595 : .get = py_ADDRESSES_get_data,
596 : .set = py_ADDRESSES_set_data,
597 : .doc = discard_const_p(char, "PIDL-generated element of base type ADDRESS")
598 : },
599 : { .name = NULL }
600 : };
601 :
602 33 : static PyObject *py_ADDRESSES_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
603 : {
604 33 : return pytalloc_new(struct ADDRESSES, type);
605 : }
606 :
607 :
608 : static PyTypeObject ADDRESSES_Type = {
609 : PyVarObject_HEAD_INIT(NULL, 0)
610 : .tp_name = "krb5ccache.ADDRESSES",
611 : .tp_getset = py_ADDRESSES_getsetters,
612 : .tp_methods = NULL,
613 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
614 : .tp_new = py_ADDRESSES_new,
615 : };
616 :
617 :
618 0 : static PyObject *py_AUTHDATUM_get_ad_type(PyObject *obj, void *closure)
619 : {
620 0 : struct AUTHDATUM *object = pytalloc_get_ptr(obj);
621 : PyObject *py_ad_type;
622 0 : py_ad_type = PyLong_FromLong((uint16_t)(object->ad_type));
623 0 : return py_ad_type;
624 : }
625 :
626 0 : static int py_AUTHDATUM_set_ad_type(PyObject *py_obj, PyObject *value, void *closure)
627 : {
628 0 : struct AUTHDATUM *object = pytalloc_get_ptr(py_obj);
629 0 : if (value == NULL) {
630 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->ad_type");
631 0 : return -1;
632 : }
633 : {
634 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->ad_type));
635 0 : if (PyLong_Check(value)) {
636 : unsigned long long test_var;
637 0 : test_var = PyLong_AsUnsignedLongLong(value);
638 0 : if (PyErr_Occurred() != NULL) {
639 0 : return -1;
640 : }
641 0 : if (test_var > uint_max) {
642 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
643 : PyLong_Type.tp_name, uint_max, test_var);
644 0 : return -1;
645 : }
646 0 : object->ad_type = test_var;
647 : } else {
648 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
649 : PyLong_Type.tp_name);
650 0 : return -1;
651 : }
652 : }
653 0 : return 0;
654 : }
655 :
656 0 : static PyObject *py_AUTHDATUM_get_data(PyObject *obj, void *closure)
657 : {
658 0 : struct AUTHDATUM *object = pytalloc_get_ptr(obj);
659 : PyObject *py_data;
660 0 : py_data = PyBytes_FromStringAndSize((char *)(object->data).data, (object->data).length);
661 0 : return py_data;
662 : }
663 :
664 0 : static int py_AUTHDATUM_set_data(PyObject *py_obj, PyObject *value, void *closure)
665 : {
666 0 : struct AUTHDATUM *object = pytalloc_get_ptr(py_obj);
667 0 : if (value == NULL) {
668 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->data");
669 0 : return -1;
670 : }
671 0 : object->data = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
672 0 : return 0;
673 : }
674 :
675 : static PyGetSetDef py_AUTHDATUM_getsetters[] = {
676 : {
677 : .name = discard_const_p(char, "ad_type"),
678 : .get = py_AUTHDATUM_get_ad_type,
679 : .set = py_AUTHDATUM_set_ad_type,
680 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
681 : },
682 : {
683 : .name = discard_const_p(char, "data"),
684 : .get = py_AUTHDATUM_get_data,
685 : .set = py_AUTHDATUM_set_data,
686 : .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
687 : },
688 : { .name = NULL }
689 : };
690 :
691 0 : static PyObject *py_AUTHDATUM_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
692 : {
693 0 : return pytalloc_new(struct AUTHDATUM, type);
694 : }
695 :
696 :
697 : static PyTypeObject AUTHDATUM_Type = {
698 : PyVarObject_HEAD_INIT(NULL, 0)
699 : .tp_name = "krb5ccache.AUTHDATUM",
700 : .tp_getset = py_AUTHDATUM_getsetters,
701 : .tp_methods = NULL,
702 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
703 : .tp_new = py_AUTHDATUM_new,
704 : };
705 :
706 :
707 0 : static PyObject *py_AUTHDATA_get_count(PyObject *obj, void *closure)
708 : {
709 0 : struct AUTHDATA *object = pytalloc_get_ptr(obj);
710 : PyObject *py_count;
711 0 : py_count = PyLong_FromUnsignedLongLong((uint32_t)(object->count));
712 0 : return py_count;
713 : }
714 :
715 33 : static int py_AUTHDATA_set_count(PyObject *py_obj, PyObject *value, void *closure)
716 : {
717 33 : struct AUTHDATA *object = pytalloc_get_ptr(py_obj);
718 33 : if (value == NULL) {
719 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->count");
720 0 : return -1;
721 : }
722 : {
723 33 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->count));
724 33 : if (PyLong_Check(value)) {
725 : unsigned long long test_var;
726 33 : test_var = PyLong_AsUnsignedLongLong(value);
727 33 : if (PyErr_Occurred() != NULL) {
728 0 : return -1;
729 : }
730 33 : if (test_var > uint_max) {
731 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
732 : PyLong_Type.tp_name, uint_max, test_var);
733 0 : return -1;
734 : }
735 33 : object->count = test_var;
736 : } else {
737 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
738 : PyLong_Type.tp_name);
739 0 : return -1;
740 : }
741 : }
742 33 : return 0;
743 : }
744 :
745 0 : static PyObject *py_AUTHDATA_get_data(PyObject *obj, void *closure)
746 : {
747 0 : struct AUTHDATA *object = pytalloc_get_ptr(obj);
748 : PyObject *py_data;
749 0 : py_data = PyList_New(object->count);
750 0 : if (py_data == NULL) {
751 0 : return NULL;
752 : }
753 : {
754 : int data_cntr_0;
755 0 : for (data_cntr_0 = 0; data_cntr_0 < (object->count); data_cntr_0++) {
756 : PyObject *py_data_0;
757 0 : py_data_0 = pytalloc_reference_ex(&AUTHDATUM_Type, object->data, &(object->data)[data_cntr_0]);
758 0 : PyList_SetItem(py_data, data_cntr_0, py_data_0);
759 : }
760 : }
761 0 : return py_data;
762 : }
763 :
764 33 : static int py_AUTHDATA_set_data(PyObject *py_obj, PyObject *value, void *closure)
765 : {
766 33 : struct AUTHDATA *object = pytalloc_get_ptr(py_obj);
767 33 : if (value == NULL) {
768 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->data");
769 0 : return -1;
770 : }
771 33 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
772 : {
773 : int data_cntr_0;
774 33 : object->data = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->data, PyList_GET_SIZE(value));
775 33 : if (!object->data) { return -1; }
776 33 : talloc_set_name_const(object->data, "ARRAY: object->data");
777 33 : for (data_cntr_0 = 0; data_cntr_0 < PyList_GET_SIZE(value); data_cntr_0++) {
778 0 : if (PyList_GET_ITEM(value, data_cntr_0) == NULL) {
779 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->data)[data_cntr_0]");
780 0 : return -1;
781 : }
782 0 : PY_CHECK_TYPE(&AUTHDATUM_Type, PyList_GET_ITEM(value, data_cntr_0), return -1;);
783 0 : if (talloc_reference(object->data, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, data_cntr_0))) == NULL) {
784 0 : PyErr_NoMemory();
785 0 : return -1;
786 : }
787 0 : (object->data)[data_cntr_0] = *(struct AUTHDATUM *)pytalloc_get_ptr(PyList_GET_ITEM(value, data_cntr_0));
788 : }
789 : }
790 33 : return 0;
791 : }
792 :
793 : static PyGetSetDef py_AUTHDATA_getsetters[] = {
794 : {
795 : .name = discard_const_p(char, "count"),
796 : .get = py_AUTHDATA_get_count,
797 : .set = py_AUTHDATA_set_count,
798 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
799 : },
800 : {
801 : .name = discard_const_p(char, "data"),
802 : .get = py_AUTHDATA_get_data,
803 : .set = py_AUTHDATA_set_data,
804 : .doc = discard_const_p(char, "PIDL-generated element of base type AUTHDATUM")
805 : },
806 : { .name = NULL }
807 : };
808 :
809 33 : static PyObject *py_AUTHDATA_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
810 : {
811 33 : return pytalloc_new(struct AUTHDATA, type);
812 : }
813 :
814 :
815 : static PyTypeObject AUTHDATA_Type = {
816 : PyVarObject_HEAD_INIT(NULL, 0)
817 : .tp_name = "krb5ccache.AUTHDATA",
818 : .tp_getset = py_AUTHDATA_getsetters,
819 : .tp_methods = NULL,
820 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
821 : .tp_new = py_AUTHDATA_new,
822 : };
823 :
824 :
825 0 : static PyObject *py_CREDENTIAL_get_client(PyObject *obj, void *closure)
826 : {
827 0 : struct CREDENTIAL *object = pytalloc_get_ptr(obj);
828 : PyObject *py_client;
829 0 : py_client = pytalloc_reference_ex(&PRINCIPAL_Type, pytalloc_get_mem_ctx(obj), &object->client);
830 0 : return py_client;
831 : }
832 :
833 33 : static int py_CREDENTIAL_set_client(PyObject *py_obj, PyObject *value, void *closure)
834 : {
835 33 : struct CREDENTIAL *object = pytalloc_get_ptr(py_obj);
836 33 : if (value == NULL) {
837 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->client");
838 0 : return -1;
839 : }
840 33 : PY_CHECK_TYPE(&PRINCIPAL_Type, value, return -1;);
841 33 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
842 0 : PyErr_NoMemory();
843 0 : return -1;
844 : }
845 33 : object->client = *(struct PRINCIPAL *)pytalloc_get_ptr(value);
846 33 : return 0;
847 : }
848 :
849 0 : static PyObject *py_CREDENTIAL_get_server(PyObject *obj, void *closure)
850 : {
851 0 : struct CREDENTIAL *object = pytalloc_get_ptr(obj);
852 : PyObject *py_server;
853 0 : py_server = pytalloc_reference_ex(&PRINCIPAL_Type, pytalloc_get_mem_ctx(obj), &object->server);
854 0 : return py_server;
855 : }
856 :
857 33 : static int py_CREDENTIAL_set_server(PyObject *py_obj, PyObject *value, void *closure)
858 : {
859 33 : struct CREDENTIAL *object = pytalloc_get_ptr(py_obj);
860 33 : if (value == NULL) {
861 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->server");
862 0 : return -1;
863 : }
864 33 : PY_CHECK_TYPE(&PRINCIPAL_Type, value, return -1;);
865 33 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
866 0 : PyErr_NoMemory();
867 0 : return -1;
868 : }
869 33 : object->server = *(struct PRINCIPAL *)pytalloc_get_ptr(value);
870 33 : return 0;
871 : }
872 :
873 0 : static PyObject *py_CREDENTIAL_get_keyblock(PyObject *obj, void *closure)
874 : {
875 0 : struct CREDENTIAL *object = pytalloc_get_ptr(obj);
876 : PyObject *py_keyblock;
877 0 : py_keyblock = pytalloc_reference_ex(&KEYBLOCK_Type, pytalloc_get_mem_ctx(obj), &object->keyblock);
878 0 : return py_keyblock;
879 : }
880 :
881 33 : static int py_CREDENTIAL_set_keyblock(PyObject *py_obj, PyObject *value, void *closure)
882 : {
883 33 : struct CREDENTIAL *object = pytalloc_get_ptr(py_obj);
884 33 : if (value == NULL) {
885 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->keyblock");
886 0 : return -1;
887 : }
888 33 : PY_CHECK_TYPE(&KEYBLOCK_Type, value, return -1;);
889 33 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
890 0 : PyErr_NoMemory();
891 0 : return -1;
892 : }
893 33 : object->keyblock = *(struct KEYBLOCK *)pytalloc_get_ptr(value);
894 33 : return 0;
895 : }
896 :
897 33 : static PyObject *py_CREDENTIAL_get_authtime(PyObject *obj, void *closure)
898 : {
899 33 : struct CREDENTIAL *object = pytalloc_get_ptr(obj);
900 : PyObject *py_authtime;
901 33 : py_authtime = PyLong_FromUnsignedLongLong((uint32_t)(object->authtime));
902 33 : return py_authtime;
903 : }
904 :
905 33 : static int py_CREDENTIAL_set_authtime(PyObject *py_obj, PyObject *value, void *closure)
906 : {
907 33 : struct CREDENTIAL *object = pytalloc_get_ptr(py_obj);
908 33 : if (value == NULL) {
909 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->authtime");
910 0 : return -1;
911 : }
912 : {
913 33 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->authtime));
914 33 : if (PyLong_Check(value)) {
915 : unsigned long long test_var;
916 33 : test_var = PyLong_AsUnsignedLongLong(value);
917 33 : if (PyErr_Occurred() != NULL) {
918 0 : return -1;
919 : }
920 33 : if (test_var > uint_max) {
921 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
922 : PyLong_Type.tp_name, uint_max, test_var);
923 0 : return -1;
924 : }
925 33 : object->authtime = test_var;
926 : } else {
927 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
928 : PyLong_Type.tp_name);
929 0 : return -1;
930 : }
931 : }
932 33 : return 0;
933 : }
934 :
935 33 : static PyObject *py_CREDENTIAL_get_starttime(PyObject *obj, void *closure)
936 : {
937 33 : struct CREDENTIAL *object = pytalloc_get_ptr(obj);
938 : PyObject *py_starttime;
939 33 : py_starttime = PyLong_FromUnsignedLongLong((uint32_t)(object->starttime));
940 33 : return py_starttime;
941 : }
942 :
943 33 : static int py_CREDENTIAL_set_starttime(PyObject *py_obj, PyObject *value, void *closure)
944 : {
945 33 : struct CREDENTIAL *object = pytalloc_get_ptr(py_obj);
946 33 : if (value == NULL) {
947 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->starttime");
948 0 : return -1;
949 : }
950 : {
951 33 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->starttime));
952 33 : if (PyLong_Check(value)) {
953 : unsigned long long test_var;
954 33 : test_var = PyLong_AsUnsignedLongLong(value);
955 33 : if (PyErr_Occurred() != NULL) {
956 0 : return -1;
957 : }
958 33 : if (test_var > uint_max) {
959 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
960 : PyLong_Type.tp_name, uint_max, test_var);
961 0 : return -1;
962 : }
963 33 : object->starttime = test_var;
964 : } else {
965 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
966 : PyLong_Type.tp_name);
967 0 : return -1;
968 : }
969 : }
970 33 : return 0;
971 : }
972 :
973 66 : static PyObject *py_CREDENTIAL_get_endtime(PyObject *obj, void *closure)
974 : {
975 66 : struct CREDENTIAL *object = pytalloc_get_ptr(obj);
976 : PyObject *py_endtime;
977 66 : py_endtime = PyLong_FromUnsignedLongLong((uint32_t)(object->endtime));
978 66 : return py_endtime;
979 : }
980 :
981 33 : static int py_CREDENTIAL_set_endtime(PyObject *py_obj, PyObject *value, void *closure)
982 : {
983 33 : struct CREDENTIAL *object = pytalloc_get_ptr(py_obj);
984 33 : if (value == NULL) {
985 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->endtime");
986 0 : return -1;
987 : }
988 : {
989 33 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->endtime));
990 33 : if (PyLong_Check(value)) {
991 : unsigned long long test_var;
992 33 : test_var = PyLong_AsUnsignedLongLong(value);
993 33 : if (PyErr_Occurred() != NULL) {
994 0 : return -1;
995 : }
996 33 : if (test_var > uint_max) {
997 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
998 : PyLong_Type.tp_name, uint_max, test_var);
999 0 : return -1;
1000 : }
1001 33 : object->endtime = test_var;
1002 : } else {
1003 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1004 : PyLong_Type.tp_name);
1005 0 : return -1;
1006 : }
1007 : }
1008 33 : return 0;
1009 : }
1010 :
1011 0 : static PyObject *py_CREDENTIAL_get_renew_till(PyObject *obj, void *closure)
1012 : {
1013 0 : struct CREDENTIAL *object = pytalloc_get_ptr(obj);
1014 : PyObject *py_renew_till;
1015 0 : py_renew_till = PyLong_FromUnsignedLongLong((uint32_t)(object->renew_till));
1016 0 : return py_renew_till;
1017 : }
1018 :
1019 33 : static int py_CREDENTIAL_set_renew_till(PyObject *py_obj, PyObject *value, void *closure)
1020 : {
1021 33 : struct CREDENTIAL *object = pytalloc_get_ptr(py_obj);
1022 33 : if (value == NULL) {
1023 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->renew_till");
1024 0 : return -1;
1025 : }
1026 : {
1027 33 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->renew_till));
1028 33 : if (PyLong_Check(value)) {
1029 : unsigned long long test_var;
1030 33 : test_var = PyLong_AsUnsignedLongLong(value);
1031 33 : if (PyErr_Occurred() != NULL) {
1032 0 : return -1;
1033 : }
1034 33 : if (test_var > uint_max) {
1035 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1036 : PyLong_Type.tp_name, uint_max, test_var);
1037 0 : return -1;
1038 : }
1039 33 : object->renew_till = test_var;
1040 : } else {
1041 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1042 : PyLong_Type.tp_name);
1043 0 : return -1;
1044 : }
1045 : }
1046 33 : return 0;
1047 : }
1048 :
1049 0 : static PyObject *py_CREDENTIAL_get_is_skey(PyObject *obj, void *closure)
1050 : {
1051 0 : struct CREDENTIAL *object = pytalloc_get_ptr(obj);
1052 : PyObject *py_is_skey;
1053 0 : py_is_skey = PyLong_FromLong((uint16_t)(object->is_skey));
1054 0 : return py_is_skey;
1055 : }
1056 :
1057 33 : static int py_CREDENTIAL_set_is_skey(PyObject *py_obj, PyObject *value, void *closure)
1058 : {
1059 33 : struct CREDENTIAL *object = pytalloc_get_ptr(py_obj);
1060 33 : if (value == NULL) {
1061 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->is_skey");
1062 0 : return -1;
1063 : }
1064 : {
1065 33 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->is_skey));
1066 33 : if (PyLong_Check(value)) {
1067 : unsigned long long test_var;
1068 33 : test_var = PyLong_AsUnsignedLongLong(value);
1069 33 : if (PyErr_Occurred() != NULL) {
1070 0 : return -1;
1071 : }
1072 33 : if (test_var > uint_max) {
1073 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1074 : PyLong_Type.tp_name, uint_max, test_var);
1075 0 : return -1;
1076 : }
1077 33 : object->is_skey = test_var;
1078 : } else {
1079 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1080 : PyLong_Type.tp_name);
1081 0 : return -1;
1082 : }
1083 : }
1084 33 : return 0;
1085 : }
1086 :
1087 0 : static PyObject *py_CREDENTIAL_get_ticket_flags(PyObject *obj, void *closure)
1088 : {
1089 0 : struct CREDENTIAL *object = pytalloc_get_ptr(obj);
1090 : PyObject *py_ticket_flags;
1091 0 : py_ticket_flags = PyLong_FromUnsignedLongLong((uint32_t)(object->ticket_flags));
1092 0 : return py_ticket_flags;
1093 : }
1094 :
1095 33 : static int py_CREDENTIAL_set_ticket_flags(PyObject *py_obj, PyObject *value, void *closure)
1096 : {
1097 33 : struct CREDENTIAL *object = pytalloc_get_ptr(py_obj);
1098 33 : if (value == NULL) {
1099 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->ticket_flags");
1100 0 : return -1;
1101 : }
1102 : {
1103 33 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->ticket_flags));
1104 33 : if (PyLong_Check(value)) {
1105 : unsigned long long test_var;
1106 33 : test_var = PyLong_AsUnsignedLongLong(value);
1107 33 : if (PyErr_Occurred() != NULL) {
1108 0 : return -1;
1109 : }
1110 33 : if (test_var > uint_max) {
1111 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1112 : PyLong_Type.tp_name, uint_max, test_var);
1113 0 : return -1;
1114 : }
1115 33 : object->ticket_flags = test_var;
1116 : } else {
1117 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1118 : PyLong_Type.tp_name);
1119 0 : return -1;
1120 : }
1121 : }
1122 33 : return 0;
1123 : }
1124 :
1125 0 : static PyObject *py_CREDENTIAL_get_addresses(PyObject *obj, void *closure)
1126 : {
1127 0 : struct CREDENTIAL *object = pytalloc_get_ptr(obj);
1128 : PyObject *py_addresses;
1129 0 : py_addresses = pytalloc_reference_ex(&ADDRESSES_Type, pytalloc_get_mem_ctx(obj), &object->addresses);
1130 0 : return py_addresses;
1131 : }
1132 :
1133 33 : static int py_CREDENTIAL_set_addresses(PyObject *py_obj, PyObject *value, void *closure)
1134 : {
1135 33 : struct CREDENTIAL *object = pytalloc_get_ptr(py_obj);
1136 33 : if (value == NULL) {
1137 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->addresses");
1138 0 : return -1;
1139 : }
1140 33 : PY_CHECK_TYPE(&ADDRESSES_Type, value, return -1;);
1141 33 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
1142 0 : PyErr_NoMemory();
1143 0 : return -1;
1144 : }
1145 33 : object->addresses = *(struct ADDRESSES *)pytalloc_get_ptr(value);
1146 33 : return 0;
1147 : }
1148 :
1149 0 : static PyObject *py_CREDENTIAL_get_authdata(PyObject *obj, void *closure)
1150 : {
1151 0 : struct CREDENTIAL *object = pytalloc_get_ptr(obj);
1152 : PyObject *py_authdata;
1153 0 : py_authdata = pytalloc_reference_ex(&AUTHDATA_Type, pytalloc_get_mem_ctx(obj), &object->authdata);
1154 0 : return py_authdata;
1155 : }
1156 :
1157 33 : static int py_CREDENTIAL_set_authdata(PyObject *py_obj, PyObject *value, void *closure)
1158 : {
1159 33 : struct CREDENTIAL *object = pytalloc_get_ptr(py_obj);
1160 33 : if (value == NULL) {
1161 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->authdata");
1162 0 : return -1;
1163 : }
1164 33 : PY_CHECK_TYPE(&AUTHDATA_Type, value, return -1;);
1165 33 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
1166 0 : PyErr_NoMemory();
1167 0 : return -1;
1168 : }
1169 33 : object->authdata = *(struct AUTHDATA *)pytalloc_get_ptr(value);
1170 33 : return 0;
1171 : }
1172 :
1173 0 : static PyObject *py_CREDENTIAL_get_ticket(PyObject *obj, void *closure)
1174 : {
1175 0 : struct CREDENTIAL *object = pytalloc_get_ptr(obj);
1176 : PyObject *py_ticket;
1177 0 : py_ticket = PyBytes_FromStringAndSize((char *)(object->ticket).data, (object->ticket).length);
1178 0 : return py_ticket;
1179 : }
1180 :
1181 33 : static int py_CREDENTIAL_set_ticket(PyObject *py_obj, PyObject *value, void *closure)
1182 : {
1183 33 : struct CREDENTIAL *object = pytalloc_get_ptr(py_obj);
1184 33 : if (value == NULL) {
1185 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->ticket");
1186 0 : return -1;
1187 : }
1188 33 : object->ticket = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
1189 33 : return 0;
1190 : }
1191 :
1192 0 : static PyObject *py_CREDENTIAL_get_second_ticket(PyObject *obj, void *closure)
1193 : {
1194 0 : struct CREDENTIAL *object = pytalloc_get_ptr(obj);
1195 : PyObject *py_second_ticket;
1196 0 : py_second_ticket = PyBytes_FromStringAndSize((char *)(object->second_ticket).data, (object->second_ticket).length);
1197 0 : return py_second_ticket;
1198 : }
1199 :
1200 33 : static int py_CREDENTIAL_set_second_ticket(PyObject *py_obj, PyObject *value, void *closure)
1201 : {
1202 33 : struct CREDENTIAL *object = pytalloc_get_ptr(py_obj);
1203 33 : if (value == NULL) {
1204 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->second_ticket");
1205 0 : return -1;
1206 : }
1207 33 : object->second_ticket = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
1208 33 : return 0;
1209 : }
1210 :
1211 : static PyGetSetDef py_CREDENTIAL_getsetters[] = {
1212 : {
1213 : .name = discard_const_p(char, "client"),
1214 : .get = py_CREDENTIAL_get_client,
1215 : .set = py_CREDENTIAL_set_client,
1216 : .doc = discard_const_p(char, "PIDL-generated element of base type PRINCIPAL")
1217 : },
1218 : {
1219 : .name = discard_const_p(char, "server"),
1220 : .get = py_CREDENTIAL_get_server,
1221 : .set = py_CREDENTIAL_set_server,
1222 : .doc = discard_const_p(char, "PIDL-generated element of base type PRINCIPAL")
1223 : },
1224 : {
1225 : .name = discard_const_p(char, "keyblock"),
1226 : .get = py_CREDENTIAL_get_keyblock,
1227 : .set = py_CREDENTIAL_set_keyblock,
1228 : .doc = discard_const_p(char, "PIDL-generated element of base type KEYBLOCK")
1229 : },
1230 : {
1231 : .name = discard_const_p(char, "authtime"),
1232 : .get = py_CREDENTIAL_get_authtime,
1233 : .set = py_CREDENTIAL_set_authtime,
1234 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
1235 : },
1236 : {
1237 : .name = discard_const_p(char, "starttime"),
1238 : .get = py_CREDENTIAL_get_starttime,
1239 : .set = py_CREDENTIAL_set_starttime,
1240 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
1241 : },
1242 : {
1243 : .name = discard_const_p(char, "endtime"),
1244 : .get = py_CREDENTIAL_get_endtime,
1245 : .set = py_CREDENTIAL_set_endtime,
1246 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
1247 : },
1248 : {
1249 : .name = discard_const_p(char, "renew_till"),
1250 : .get = py_CREDENTIAL_get_renew_till,
1251 : .set = py_CREDENTIAL_set_renew_till,
1252 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
1253 : },
1254 : {
1255 : .name = discard_const_p(char, "is_skey"),
1256 : .get = py_CREDENTIAL_get_is_skey,
1257 : .set = py_CREDENTIAL_set_is_skey,
1258 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
1259 : },
1260 : {
1261 : .name = discard_const_p(char, "ticket_flags"),
1262 : .get = py_CREDENTIAL_get_ticket_flags,
1263 : .set = py_CREDENTIAL_set_ticket_flags,
1264 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
1265 : },
1266 : {
1267 : .name = discard_const_p(char, "addresses"),
1268 : .get = py_CREDENTIAL_get_addresses,
1269 : .set = py_CREDENTIAL_set_addresses,
1270 : .doc = discard_const_p(char, "PIDL-generated element of base type ADDRESSES")
1271 : },
1272 : {
1273 : .name = discard_const_p(char, "authdata"),
1274 : .get = py_CREDENTIAL_get_authdata,
1275 : .set = py_CREDENTIAL_set_authdata,
1276 : .doc = discard_const_p(char, "PIDL-generated element of base type AUTHDATA")
1277 : },
1278 : {
1279 : .name = discard_const_p(char, "ticket"),
1280 : .get = py_CREDENTIAL_get_ticket,
1281 : .set = py_CREDENTIAL_set_ticket,
1282 : .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
1283 : },
1284 : {
1285 : .name = discard_const_p(char, "second_ticket"),
1286 : .get = py_CREDENTIAL_get_second_ticket,
1287 : .set = py_CREDENTIAL_set_second_ticket,
1288 : .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
1289 : },
1290 : { .name = NULL }
1291 : };
1292 :
1293 33 : static PyObject *py_CREDENTIAL_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1294 : {
1295 33 : return pytalloc_new(struct CREDENTIAL, type);
1296 : }
1297 :
1298 :
1299 : static PyTypeObject CREDENTIAL_Type = {
1300 : PyVarObject_HEAD_INIT(NULL, 0)
1301 : .tp_name = "krb5ccache.CREDENTIAL",
1302 : .tp_getset = py_CREDENTIAL_getsetters,
1303 : .tp_methods = NULL,
1304 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1305 : .tp_new = py_CREDENTIAL_new,
1306 : };
1307 :
1308 :
1309 0 : static PyObject *py_DELTATIME_TAG_get_kdc_sec_offset(PyObject *obj, void *closure)
1310 : {
1311 0 : struct DELTATIME_TAG *object = pytalloc_get_ptr(obj);
1312 : PyObject *py_kdc_sec_offset;
1313 0 : py_kdc_sec_offset = PyLong_FromLong(object->kdc_sec_offset);
1314 0 : return py_kdc_sec_offset;
1315 : }
1316 :
1317 33 : static int py_DELTATIME_TAG_set_kdc_sec_offset(PyObject *py_obj, PyObject *value, void *closure)
1318 : {
1319 33 : struct DELTATIME_TAG *object = pytalloc_get_ptr(py_obj);
1320 33 : if (value == NULL) {
1321 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->kdc_sec_offset");
1322 0 : return -1;
1323 : }
1324 : {
1325 33 : const long long int_max = ndr_sizeof2intmax(sizeof(object->kdc_sec_offset));
1326 33 : const long long int_min = -int_max - 1;
1327 33 : if (PyLong_Check(value)) {
1328 : long long test_var;
1329 33 : test_var = PyLong_AsLongLong(value);
1330 33 : if (PyErr_Occurred() != NULL) {
1331 0 : return -1;
1332 : }
1333 33 : if (test_var < int_min || test_var > int_max) {
1334 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range %lld - %lld, got %lld",
1335 : PyLong_Type.tp_name, int_min, int_max, test_var);
1336 0 : return -1;
1337 : }
1338 33 : object->kdc_sec_offset = test_var;
1339 : } else {
1340 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1341 : PyLong_Type.tp_name);
1342 0 : return -1;
1343 : }
1344 : }
1345 33 : return 0;
1346 : }
1347 :
1348 0 : static PyObject *py_DELTATIME_TAG_get_kdc_usec_offset(PyObject *obj, void *closure)
1349 : {
1350 0 : struct DELTATIME_TAG *object = pytalloc_get_ptr(obj);
1351 : PyObject *py_kdc_usec_offset;
1352 0 : py_kdc_usec_offset = PyLong_FromLong(object->kdc_usec_offset);
1353 0 : return py_kdc_usec_offset;
1354 : }
1355 :
1356 33 : static int py_DELTATIME_TAG_set_kdc_usec_offset(PyObject *py_obj, PyObject *value, void *closure)
1357 : {
1358 33 : struct DELTATIME_TAG *object = pytalloc_get_ptr(py_obj);
1359 33 : if (value == NULL) {
1360 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->kdc_usec_offset");
1361 0 : return -1;
1362 : }
1363 : {
1364 33 : const long long int_max = ndr_sizeof2intmax(sizeof(object->kdc_usec_offset));
1365 33 : const long long int_min = -int_max - 1;
1366 33 : if (PyLong_Check(value)) {
1367 : long long test_var;
1368 33 : test_var = PyLong_AsLongLong(value);
1369 33 : if (PyErr_Occurred() != NULL) {
1370 0 : return -1;
1371 : }
1372 33 : if (test_var < int_min || test_var > int_max) {
1373 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range %lld - %lld, got %lld",
1374 : PyLong_Type.tp_name, int_min, int_max, test_var);
1375 0 : return -1;
1376 : }
1377 33 : object->kdc_usec_offset = test_var;
1378 : } else {
1379 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1380 : PyLong_Type.tp_name);
1381 0 : return -1;
1382 : }
1383 : }
1384 33 : return 0;
1385 : }
1386 :
1387 : static PyGetSetDef py_DELTATIME_TAG_getsetters[] = {
1388 : {
1389 : .name = discard_const_p(char, "kdc_sec_offset"),
1390 : .get = py_DELTATIME_TAG_get_kdc_sec_offset,
1391 : .set = py_DELTATIME_TAG_set_kdc_sec_offset,
1392 : .doc = discard_const_p(char, "PIDL-generated element of base type int32")
1393 : },
1394 : {
1395 : .name = discard_const_p(char, "kdc_usec_offset"),
1396 : .get = py_DELTATIME_TAG_get_kdc_usec_offset,
1397 : .set = py_DELTATIME_TAG_set_kdc_usec_offset,
1398 : .doc = discard_const_p(char, "PIDL-generated element of base type int32")
1399 : },
1400 : { .name = NULL }
1401 : };
1402 :
1403 33 : static PyObject *py_DELTATIME_TAG_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1404 : {
1405 33 : return pytalloc_new(struct DELTATIME_TAG, type);
1406 : }
1407 :
1408 :
1409 : static PyTypeObject DELTATIME_TAG_Type = {
1410 : PyVarObject_HEAD_INIT(NULL, 0)
1411 : .tp_name = "krb5ccache.DELTATIME_TAG",
1412 : .tp_getset = py_DELTATIME_TAG_getsetters,
1413 : .tp_methods = NULL,
1414 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1415 : .tp_new = py_DELTATIME_TAG_new,
1416 : };
1417 :
1418 0 : static PyObject *py_import_FIELD(TALLOC_CTX *mem_ctx, int level, union FIELD *in)
1419 : {
1420 : PyObject *ret;
1421 :
1422 0 : switch (level) {
1423 0 : case 1:
1424 0 : ret = pytalloc_reference_ex(&DELTATIME_TAG_Type, mem_ctx, &in->deltatime_tag);
1425 0 : return ret;
1426 :
1427 : }
1428 0 : PyErr_SetString(PyExc_TypeError, "unknown union level");
1429 0 : return NULL;
1430 : }
1431 :
1432 33 : static union FIELD *py_export_FIELD(TALLOC_CTX *mem_ctx, int level, PyObject *in)
1433 : {
1434 33 : union FIELD *ret = talloc_zero(mem_ctx, union FIELD);
1435 33 : switch (level) {
1436 33 : case 1:
1437 33 : if (in == NULL) {
1438 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->deltatime_tag");
1439 0 : talloc_free(ret); return NULL;
1440 : }
1441 33 : PY_CHECK_TYPE(&DELTATIME_TAG_Type, in, talloc_free(ret); return NULL;);
1442 33 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
1443 0 : PyErr_NoMemory();
1444 0 : talloc_free(ret); return NULL;
1445 : }
1446 33 : ret->deltatime_tag = *(struct DELTATIME_TAG *)pytalloc_get_ptr(in);
1447 33 : break;
1448 :
1449 0 : default:
1450 0 : PyErr_SetString(PyExc_TypeError, "invalid union level value");
1451 0 : talloc_free(ret);
1452 0 : ret = NULL;
1453 : }
1454 :
1455 33 : return ret;
1456 : }
1457 :
1458 0 : static PyObject *py_FIELD_import(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1459 : {
1460 0 : const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
1461 0 : PyObject *mem_ctx_obj = NULL;
1462 0 : TALLOC_CTX *mem_ctx = NULL;
1463 0 : int level = 0;
1464 0 : PyObject *in_obj = NULL;
1465 0 : union FIELD *in = NULL;
1466 :
1467 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:import",
1468 : discard_const_p(char *, kwnames),
1469 : &mem_ctx_obj,
1470 : &level,
1471 : &in_obj)) {
1472 0 : return NULL;
1473 : }
1474 0 : mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
1475 0 : if (mem_ctx == NULL) {
1476 0 : PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
1477 0 : return NULL;
1478 : }
1479 0 : in = (union FIELD *)pytalloc_get_ptr(in_obj);
1480 0 : if (in == NULL) {
1481 0 : PyErr_Format(PyExc_TypeError, "in needs to be a pointer to union FIELD!");
1482 0 : return NULL;
1483 : }
1484 :
1485 0 : return py_import_FIELD(mem_ctx, level, in);
1486 : }
1487 :
1488 33 : static PyObject *py_FIELD_export(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1489 : {
1490 33 : const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
1491 33 : PyObject *mem_ctx_obj = NULL;
1492 33 : TALLOC_CTX *mem_ctx = NULL;
1493 33 : int level = 0;
1494 33 : PyObject *in = NULL;
1495 33 : union FIELD *out = NULL;
1496 :
1497 33 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:export",
1498 : discard_const_p(char *, kwnames),
1499 : &mem_ctx_obj,
1500 : &level,
1501 : &in)) {
1502 0 : return NULL;
1503 : }
1504 33 : mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
1505 33 : if (mem_ctx == NULL) {
1506 0 : PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
1507 0 : return NULL;
1508 : }
1509 :
1510 33 : out = py_export_FIELD(mem_ctx, level, in);
1511 33 : if (out == NULL) {
1512 0 : return NULL;
1513 : }
1514 :
1515 33 : return pytalloc_GenericObject_reference(out);
1516 : }
1517 :
1518 : static PyMethodDef py_FIELD_methods[] = {
1519 : { "__import__", PY_DISCARD_FUNC_SIG(PyCFunction,py_FIELD_import),
1520 : METH_VARARGS|METH_KEYWORDS|METH_CLASS,
1521 : "T.__import__(mem_ctx, level, in) => ret." },
1522 : { "__export__", PY_DISCARD_FUNC_SIG(PyCFunction,py_FIELD_export),
1523 : METH_VARARGS|METH_KEYWORDS|METH_CLASS,
1524 : "T.__export__(mem_ctx, level, in) => ret." },
1525 : { NULL, NULL, 0, NULL }
1526 : };
1527 :
1528 0 : static PyObject *py_FIELD_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1529 : {
1530 0 : PyErr_Format(PyExc_TypeError, "New %s Objects are not supported", type->tp_name);
1531 0 : return NULL;
1532 : }
1533 :
1534 :
1535 : static PyTypeObject FIELD_Type = {
1536 : PyVarObject_HEAD_INIT(NULL, 0)
1537 : .tp_name = "krb5ccache.FIELD",
1538 : .tp_getset = NULL,
1539 : .tp_methods = py_FIELD_methods,
1540 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1541 : .tp_new = py_FIELD_new,
1542 : };
1543 :
1544 :
1545 0 : static PyObject *py_V4TAG_get_tag(PyObject *obj, void *closure)
1546 : {
1547 0 : struct V4TAG *object = pytalloc_get_ptr(obj);
1548 : PyObject *py_tag;
1549 0 : py_tag = PyLong_FromLong((uint16_t)(object->tag));
1550 0 : return py_tag;
1551 : }
1552 :
1553 33 : static int py_V4TAG_set_tag(PyObject *py_obj, PyObject *value, void *closure)
1554 : {
1555 33 : struct V4TAG *object = pytalloc_get_ptr(py_obj);
1556 33 : if (value == NULL) {
1557 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->tag");
1558 0 : return -1;
1559 : }
1560 : {
1561 33 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->tag));
1562 33 : if (PyLong_Check(value)) {
1563 : unsigned long long test_var;
1564 33 : test_var = PyLong_AsUnsignedLongLong(value);
1565 33 : if (PyErr_Occurred() != NULL) {
1566 0 : return -1;
1567 : }
1568 33 : if (test_var > uint_max) {
1569 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1570 : PyLong_Type.tp_name, uint_max, test_var);
1571 0 : return -1;
1572 : }
1573 33 : object->tag = test_var;
1574 : } else {
1575 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1576 : PyLong_Type.tp_name);
1577 0 : return -1;
1578 : }
1579 : }
1580 33 : return 0;
1581 : }
1582 :
1583 0 : static PyObject *py_V4TAG_get_field(PyObject *obj, void *closure)
1584 : {
1585 0 : struct V4TAG *object = pytalloc_get_ptr(obj);
1586 : PyObject *py_field;
1587 0 : py_field = pyrpc_import_union(&FIELD_Type, pytalloc_get_mem_ctx(obj), object->tag, &object->field, "union FIELD");
1588 0 : if (py_field == NULL) {
1589 0 : return NULL;
1590 : }
1591 0 : return py_field;
1592 : }
1593 :
1594 33 : static int py_V4TAG_set_field(PyObject *py_obj, PyObject *value, void *closure)
1595 : {
1596 33 : struct V4TAG *object = pytalloc_get_ptr(py_obj);
1597 33 : if (value == NULL) {
1598 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->field");
1599 0 : return -1;
1600 : }
1601 : {
1602 : union FIELD *field_switch_1;
1603 33 : field_switch_1 = (union FIELD *)pyrpc_export_union(&FIELD_Type, pytalloc_get_mem_ctx(py_obj), object->tag, value, "union FIELD");
1604 33 : if (field_switch_1 == NULL) {
1605 0 : return -1;
1606 : }
1607 33 : object->field = *field_switch_1;
1608 : }
1609 33 : return 0;
1610 : }
1611 :
1612 : static PyGetSetDef py_V4TAG_getsetters[] = {
1613 : {
1614 : .name = discard_const_p(char, "tag"),
1615 : .get = py_V4TAG_get_tag,
1616 : .set = py_V4TAG_set_tag,
1617 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
1618 : },
1619 : {
1620 : .name = discard_const_p(char, "field"),
1621 : .get = py_V4TAG_get_field,
1622 : .set = py_V4TAG_set_field,
1623 : .doc = discard_const_p(char, "PIDL-generated element of base type FIELD")
1624 : },
1625 : { .name = NULL }
1626 : };
1627 :
1628 33 : static PyObject *py_V4TAG_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1629 : {
1630 33 : return pytalloc_new(struct V4TAG, type);
1631 : }
1632 :
1633 :
1634 : static PyTypeObject V4TAG_Type = {
1635 : PyVarObject_HEAD_INIT(NULL, 0)
1636 : .tp_name = "krb5ccache.V4TAG",
1637 : .tp_getset = py_V4TAG_getsetters,
1638 : .tp_methods = NULL,
1639 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1640 : .tp_new = py_V4TAG_new,
1641 : };
1642 :
1643 :
1644 0 : static PyObject *py_V4TAGS_get_tag(PyObject *obj, void *closure)
1645 : {
1646 0 : struct V4TAGS *object = pytalloc_get_ptr(obj);
1647 : PyObject *py_tag;
1648 0 : py_tag = pytalloc_reference_ex(&V4TAG_Type, pytalloc_get_mem_ctx(obj), &object->tag);
1649 0 : return py_tag;
1650 : }
1651 :
1652 33 : static int py_V4TAGS_set_tag(PyObject *py_obj, PyObject *value, void *closure)
1653 : {
1654 33 : struct V4TAGS *object = pytalloc_get_ptr(py_obj);
1655 33 : if (value == NULL) {
1656 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->tag");
1657 0 : return -1;
1658 : }
1659 33 : PY_CHECK_TYPE(&V4TAG_Type, value, return -1;);
1660 33 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
1661 0 : PyErr_NoMemory();
1662 0 : return -1;
1663 : }
1664 33 : object->tag = *(struct V4TAG *)pytalloc_get_ptr(value);
1665 33 : return 0;
1666 : }
1667 :
1668 0 : static PyObject *py_V4TAGS_get_further_tags(PyObject *obj, void *closure)
1669 : {
1670 0 : struct V4TAGS *object = pytalloc_get_ptr(obj);
1671 : PyObject *py_further_tags;
1672 0 : py_further_tags = PyBytes_FromStringAndSize((char *)(object->further_tags).data, (object->further_tags).length);
1673 0 : return py_further_tags;
1674 : }
1675 :
1676 33 : static int py_V4TAGS_set_further_tags(PyObject *py_obj, PyObject *value, void *closure)
1677 : {
1678 33 : struct V4TAGS *object = pytalloc_get_ptr(py_obj);
1679 33 : if (value == NULL) {
1680 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->further_tags");
1681 0 : return -1;
1682 : }
1683 33 : object->further_tags = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
1684 33 : return 0;
1685 : }
1686 :
1687 : static PyGetSetDef py_V4TAGS_getsetters[] = {
1688 : {
1689 : .name = discard_const_p(char, "tag"),
1690 : .get = py_V4TAGS_get_tag,
1691 : .set = py_V4TAGS_set_tag,
1692 : .doc = discard_const_p(char, "PIDL-generated element of base type V4TAG")
1693 : },
1694 : {
1695 : .name = discard_const_p(char, "further_tags"),
1696 : .get = py_V4TAGS_get_further_tags,
1697 : .set = py_V4TAGS_set_further_tags,
1698 : .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
1699 : },
1700 : { .name = NULL }
1701 : };
1702 :
1703 33 : static PyObject *py_V4TAGS_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1704 : {
1705 33 : return pytalloc_new(struct V4TAGS, type);
1706 : }
1707 :
1708 :
1709 : static PyTypeObject V4TAGS_Type = {
1710 : PyVarObject_HEAD_INIT(NULL, 0)
1711 : .tp_name = "krb5ccache.V4TAGS",
1712 : .tp_getset = py_V4TAGS_getsetters,
1713 : .tp_methods = NULL,
1714 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1715 : .tp_new = py_V4TAGS_new,
1716 : };
1717 :
1718 :
1719 0 : static PyObject *py_V4HEADER_get_v4tags(PyObject *obj, void *closure)
1720 : {
1721 0 : struct V4HEADER *object = pytalloc_get_ptr(obj);
1722 : PyObject *py_v4tags;
1723 0 : py_v4tags = pytalloc_reference_ex(&V4TAGS_Type, pytalloc_get_mem_ctx(obj), &object->v4tags);
1724 0 : return py_v4tags;
1725 : }
1726 :
1727 33 : static int py_V4HEADER_set_v4tags(PyObject *py_obj, PyObject *value, void *closure)
1728 : {
1729 33 : struct V4HEADER *object = pytalloc_get_ptr(py_obj);
1730 33 : if (value == NULL) {
1731 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->v4tags");
1732 0 : return -1;
1733 : }
1734 33 : PY_CHECK_TYPE(&V4TAGS_Type, value, return -1;);
1735 33 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
1736 0 : PyErr_NoMemory();
1737 0 : return -1;
1738 : }
1739 33 : object->v4tags = *(struct V4TAGS *)pytalloc_get_ptr(value);
1740 33 : return 0;
1741 : }
1742 :
1743 : static PyGetSetDef py_V4HEADER_getsetters[] = {
1744 : {
1745 : .name = discard_const_p(char, "v4tags"),
1746 : .get = py_V4HEADER_get_v4tags,
1747 : .set = py_V4HEADER_set_v4tags,
1748 : .doc = discard_const_p(char, "PIDL-generated element of base type V4TAGS")
1749 : },
1750 : { .name = NULL }
1751 : };
1752 :
1753 33 : static PyObject *py_V4HEADER_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1754 : {
1755 33 : return pytalloc_new(struct V4HEADER, type);
1756 : }
1757 :
1758 :
1759 : static PyTypeObject V4HEADER_Type = {
1760 : PyVarObject_HEAD_INIT(NULL, 0)
1761 : .tp_name = "krb5ccache.V4HEADER",
1762 : .tp_getset = py_V4HEADER_getsetters,
1763 : .tp_methods = NULL,
1764 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1765 : .tp_new = py_V4HEADER_new,
1766 : };
1767 :
1768 0 : static PyObject *py_import_OPTIONAL_HEADER(TALLOC_CTX *mem_ctx, int level, union OPTIONAL_HEADER *in)
1769 : {
1770 : PyObject *ret;
1771 :
1772 0 : switch (level) {
1773 0 : case 3:
1774 0 : ret = Py_None;
1775 0 : Py_INCREF(ret);
1776 0 : return ret;
1777 :
1778 0 : case 4:
1779 0 : ret = pytalloc_reference_ex(&V4HEADER_Type, mem_ctx, &in->v4header);
1780 0 : return ret;
1781 :
1782 : }
1783 0 : PyErr_SetString(PyExc_TypeError, "unknown union level");
1784 0 : return NULL;
1785 : }
1786 :
1787 33 : static union OPTIONAL_HEADER *py_export_OPTIONAL_HEADER(TALLOC_CTX *mem_ctx, int level, PyObject *in)
1788 : {
1789 33 : union OPTIONAL_HEADER *ret = talloc_zero(mem_ctx, union OPTIONAL_HEADER);
1790 33 : switch (level) {
1791 0 : case 3:
1792 0 : break;
1793 :
1794 33 : case 4:
1795 33 : if (in == NULL) {
1796 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->v4header");
1797 0 : talloc_free(ret); return NULL;
1798 : }
1799 33 : PY_CHECK_TYPE(&V4HEADER_Type, in, talloc_free(ret); return NULL;);
1800 33 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
1801 0 : PyErr_NoMemory();
1802 0 : talloc_free(ret); return NULL;
1803 : }
1804 33 : ret->v4header = *(struct V4HEADER *)pytalloc_get_ptr(in);
1805 33 : break;
1806 :
1807 0 : default:
1808 0 : PyErr_SetString(PyExc_TypeError, "invalid union level value");
1809 0 : talloc_free(ret);
1810 0 : ret = NULL;
1811 : }
1812 :
1813 33 : return ret;
1814 : }
1815 :
1816 0 : static PyObject *py_OPTIONAL_HEADER_import(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1817 : {
1818 0 : const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
1819 0 : PyObject *mem_ctx_obj = NULL;
1820 0 : TALLOC_CTX *mem_ctx = NULL;
1821 0 : int level = 0;
1822 0 : PyObject *in_obj = NULL;
1823 0 : union OPTIONAL_HEADER *in = NULL;
1824 :
1825 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:import",
1826 : discard_const_p(char *, kwnames),
1827 : &mem_ctx_obj,
1828 : &level,
1829 : &in_obj)) {
1830 0 : return NULL;
1831 : }
1832 0 : mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
1833 0 : if (mem_ctx == NULL) {
1834 0 : PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
1835 0 : return NULL;
1836 : }
1837 0 : in = (union OPTIONAL_HEADER *)pytalloc_get_ptr(in_obj);
1838 0 : if (in == NULL) {
1839 0 : PyErr_Format(PyExc_TypeError, "in needs to be a pointer to union OPTIONAL_HEADER!");
1840 0 : return NULL;
1841 : }
1842 :
1843 0 : return py_import_OPTIONAL_HEADER(mem_ctx, level, in);
1844 : }
1845 :
1846 33 : static PyObject *py_OPTIONAL_HEADER_export(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1847 : {
1848 33 : const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
1849 33 : PyObject *mem_ctx_obj = NULL;
1850 33 : TALLOC_CTX *mem_ctx = NULL;
1851 33 : int level = 0;
1852 33 : PyObject *in = NULL;
1853 33 : union OPTIONAL_HEADER *out = NULL;
1854 :
1855 33 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:export",
1856 : discard_const_p(char *, kwnames),
1857 : &mem_ctx_obj,
1858 : &level,
1859 : &in)) {
1860 0 : return NULL;
1861 : }
1862 33 : mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
1863 33 : if (mem_ctx == NULL) {
1864 0 : PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
1865 0 : return NULL;
1866 : }
1867 :
1868 33 : out = py_export_OPTIONAL_HEADER(mem_ctx, level, in);
1869 33 : if (out == NULL) {
1870 0 : return NULL;
1871 : }
1872 :
1873 33 : return pytalloc_GenericObject_reference(out);
1874 : }
1875 :
1876 : static PyMethodDef py_OPTIONAL_HEADER_methods[] = {
1877 : { "__import__", PY_DISCARD_FUNC_SIG(PyCFunction,py_OPTIONAL_HEADER_import),
1878 : METH_VARARGS|METH_KEYWORDS|METH_CLASS,
1879 : "T.__import__(mem_ctx, level, in) => ret." },
1880 : { "__export__", PY_DISCARD_FUNC_SIG(PyCFunction,py_OPTIONAL_HEADER_export),
1881 : METH_VARARGS|METH_KEYWORDS|METH_CLASS,
1882 : "T.__export__(mem_ctx, level, in) => ret." },
1883 : { NULL, NULL, 0, NULL }
1884 : };
1885 :
1886 0 : static PyObject *py_OPTIONAL_HEADER_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1887 : {
1888 0 : PyErr_Format(PyExc_TypeError, "New %s Objects are not supported", type->tp_name);
1889 0 : return NULL;
1890 : }
1891 :
1892 :
1893 : static PyTypeObject OPTIONAL_HEADER_Type = {
1894 : PyVarObject_HEAD_INIT(NULL, 0)
1895 : .tp_name = "krb5ccache.OPTIONAL_HEADER",
1896 : .tp_getset = NULL,
1897 : .tp_methods = py_OPTIONAL_HEADER_methods,
1898 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1899 : .tp_new = py_OPTIONAL_HEADER_new,
1900 : };
1901 :
1902 :
1903 0 : static PyObject *py_CCACHE_get_pvno(PyObject *obj, void *closure)
1904 : {
1905 0 : struct CCACHE *object = pytalloc_get_ptr(obj);
1906 : PyObject *py_pvno;
1907 0 : py_pvno = PyLong_FromLong((uint16_t)(object->pvno));
1908 0 : return py_pvno;
1909 : }
1910 :
1911 33 : static int py_CCACHE_set_pvno(PyObject *py_obj, PyObject *value, void *closure)
1912 : {
1913 33 : struct CCACHE *object = pytalloc_get_ptr(py_obj);
1914 33 : if (value == NULL) {
1915 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->pvno");
1916 0 : return -1;
1917 : }
1918 : {
1919 33 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->pvno));
1920 33 : if (PyLong_Check(value)) {
1921 : unsigned long long test_var;
1922 33 : test_var = PyLong_AsUnsignedLongLong(value);
1923 33 : if (PyErr_Occurred() != NULL) {
1924 0 : return -1;
1925 : }
1926 33 : if (test_var > uint_max) {
1927 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1928 : PyLong_Type.tp_name, uint_max, test_var);
1929 0 : return -1;
1930 : }
1931 33 : object->pvno = test_var;
1932 : } else {
1933 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1934 : PyLong_Type.tp_name);
1935 0 : return -1;
1936 : }
1937 : }
1938 33 : return 0;
1939 : }
1940 :
1941 0 : static PyObject *py_CCACHE_get_version(PyObject *obj, void *closure)
1942 : {
1943 0 : struct CCACHE *object = pytalloc_get_ptr(obj);
1944 : PyObject *py_version;
1945 0 : py_version = PyLong_FromLong((uint16_t)(object->version));
1946 0 : return py_version;
1947 : }
1948 :
1949 33 : static int py_CCACHE_set_version(PyObject *py_obj, PyObject *value, void *closure)
1950 : {
1951 33 : struct CCACHE *object = pytalloc_get_ptr(py_obj);
1952 33 : if (value == NULL) {
1953 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->version");
1954 0 : return -1;
1955 : }
1956 : {
1957 33 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->version));
1958 33 : if (PyLong_Check(value)) {
1959 : unsigned long long test_var;
1960 33 : test_var = PyLong_AsUnsignedLongLong(value);
1961 33 : if (PyErr_Occurred() != NULL) {
1962 0 : return -1;
1963 : }
1964 33 : if (test_var > uint_max) {
1965 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1966 : PyLong_Type.tp_name, uint_max, test_var);
1967 0 : return -1;
1968 : }
1969 33 : object->version = test_var;
1970 : } else {
1971 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1972 : PyLong_Type.tp_name);
1973 0 : return -1;
1974 : }
1975 : }
1976 33 : return 0;
1977 : }
1978 :
1979 0 : static PyObject *py_CCACHE_get_optional_header(PyObject *obj, void *closure)
1980 : {
1981 0 : struct CCACHE *object = pytalloc_get_ptr(obj);
1982 : PyObject *py_optional_header;
1983 0 : py_optional_header = pyrpc_import_union(&OPTIONAL_HEADER_Type, pytalloc_get_mem_ctx(obj), object->version, &object->optional_header, "union OPTIONAL_HEADER");
1984 0 : if (py_optional_header == NULL) {
1985 0 : return NULL;
1986 : }
1987 0 : return py_optional_header;
1988 : }
1989 :
1990 33 : static int py_CCACHE_set_optional_header(PyObject *py_obj, PyObject *value, void *closure)
1991 : {
1992 33 : struct CCACHE *object = pytalloc_get_ptr(py_obj);
1993 33 : if (value == NULL) {
1994 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->optional_header");
1995 0 : return -1;
1996 : }
1997 : {
1998 : union OPTIONAL_HEADER *optional_header_switch_0;
1999 33 : optional_header_switch_0 = (union OPTIONAL_HEADER *)pyrpc_export_union(&OPTIONAL_HEADER_Type, pytalloc_get_mem_ctx(py_obj), object->version, value, "union OPTIONAL_HEADER");
2000 33 : if (optional_header_switch_0 == NULL) {
2001 0 : return -1;
2002 : }
2003 33 : object->optional_header = *optional_header_switch_0;
2004 : }
2005 33 : return 0;
2006 : }
2007 :
2008 0 : static PyObject *py_CCACHE_get_principal(PyObject *obj, void *closure)
2009 : {
2010 0 : struct CCACHE *object = pytalloc_get_ptr(obj);
2011 : PyObject *py_principal;
2012 0 : py_principal = pytalloc_reference_ex(&PRINCIPAL_Type, pytalloc_get_mem_ctx(obj), &object->principal);
2013 0 : return py_principal;
2014 : }
2015 :
2016 33 : static int py_CCACHE_set_principal(PyObject *py_obj, PyObject *value, void *closure)
2017 : {
2018 33 : struct CCACHE *object = pytalloc_get_ptr(py_obj);
2019 33 : if (value == NULL) {
2020 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->principal");
2021 0 : return -1;
2022 : }
2023 33 : PY_CHECK_TYPE(&PRINCIPAL_Type, value, return -1;);
2024 33 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
2025 0 : PyErr_NoMemory();
2026 0 : return -1;
2027 : }
2028 33 : object->principal = *(struct PRINCIPAL *)pytalloc_get_ptr(value);
2029 33 : return 0;
2030 : }
2031 :
2032 0 : static PyObject *py_CCACHE_get_cred(PyObject *obj, void *closure)
2033 : {
2034 0 : struct CCACHE *object = pytalloc_get_ptr(obj);
2035 : PyObject *py_cred;
2036 0 : py_cred = pytalloc_reference_ex(&CREDENTIAL_Type, pytalloc_get_mem_ctx(obj), &object->cred);
2037 0 : return py_cred;
2038 : }
2039 :
2040 33 : static int py_CCACHE_set_cred(PyObject *py_obj, PyObject *value, void *closure)
2041 : {
2042 33 : struct CCACHE *object = pytalloc_get_ptr(py_obj);
2043 33 : if (value == NULL) {
2044 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->cred");
2045 0 : return -1;
2046 : }
2047 33 : PY_CHECK_TYPE(&CREDENTIAL_Type, value, return -1;);
2048 33 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
2049 0 : PyErr_NoMemory();
2050 0 : return -1;
2051 : }
2052 33 : object->cred = *(struct CREDENTIAL *)pytalloc_get_ptr(value);
2053 33 : return 0;
2054 : }
2055 :
2056 0 : static PyObject *py_CCACHE_get_further_creds(PyObject *obj, void *closure)
2057 : {
2058 0 : struct CCACHE *object = pytalloc_get_ptr(obj);
2059 : PyObject *py_further_creds;
2060 0 : py_further_creds = PyBytes_FromStringAndSize((char *)(object->further_creds).data, (object->further_creds).length);
2061 0 : return py_further_creds;
2062 : }
2063 :
2064 0 : static int py_CCACHE_set_further_creds(PyObject *py_obj, PyObject *value, void *closure)
2065 : {
2066 0 : struct CCACHE *object = pytalloc_get_ptr(py_obj);
2067 0 : if (value == NULL) {
2068 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->further_creds");
2069 0 : return -1;
2070 : }
2071 0 : object->further_creds = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
2072 0 : return 0;
2073 : }
2074 :
2075 : static PyGetSetDef py_CCACHE_getsetters[] = {
2076 : {
2077 : .name = discard_const_p(char, "pvno"),
2078 : .get = py_CCACHE_get_pvno,
2079 : .set = py_CCACHE_set_pvno,
2080 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
2081 : },
2082 : {
2083 : .name = discard_const_p(char, "version"),
2084 : .get = py_CCACHE_get_version,
2085 : .set = py_CCACHE_set_version,
2086 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
2087 : },
2088 : {
2089 : .name = discard_const_p(char, "optional_header"),
2090 : .get = py_CCACHE_get_optional_header,
2091 : .set = py_CCACHE_set_optional_header,
2092 : .doc = discard_const_p(char, "PIDL-generated element of base type OPTIONAL_HEADER")
2093 : },
2094 : {
2095 : .name = discard_const_p(char, "principal"),
2096 : .get = py_CCACHE_get_principal,
2097 : .set = py_CCACHE_set_principal,
2098 : .doc = discard_const_p(char, "PIDL-generated element of base type PRINCIPAL")
2099 : },
2100 : {
2101 : .name = discard_const_p(char, "cred"),
2102 : .get = py_CCACHE_get_cred,
2103 : .set = py_CCACHE_set_cred,
2104 : .doc = discard_const_p(char, "PIDL-generated element of base type CREDENTIAL")
2105 : },
2106 : {
2107 : .name = discard_const_p(char, "further_creds"),
2108 : .get = py_CCACHE_get_further_creds,
2109 : .set = py_CCACHE_set_further_creds,
2110 : .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
2111 : },
2112 : { .name = NULL }
2113 : };
2114 :
2115 33 : static PyObject *py_CCACHE_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2116 : {
2117 33 : return pytalloc_new(struct CCACHE, type);
2118 : }
2119 :
2120 33 : static PyObject *py_CCACHE_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2121 : {
2122 33 : struct CCACHE *object = pytalloc_get_ptr(py_obj);
2123 33 : PyObject *ret = NULL;
2124 : DATA_BLOB blob;
2125 : enum ndr_err_code err;
2126 33 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
2127 33 : if (tmp_ctx == NULL) {
2128 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
2129 0 : return NULL;
2130 : }
2131 33 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_CCACHE);
2132 33 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2133 0 : TALLOC_FREE(tmp_ctx);
2134 0 : PyErr_SetNdrError(err);
2135 0 : return NULL;
2136 : }
2137 :
2138 33 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
2139 33 : TALLOC_FREE(tmp_ctx);
2140 33 : return ret;
2141 : }
2142 :
2143 0 : static PyObject *py_CCACHE_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
2144 : {
2145 0 : struct CCACHE *object = pytalloc_get_ptr(py_obj);
2146 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
2147 0 : Py_ssize_t blob_length = 0;
2148 : enum ndr_err_code err;
2149 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
2150 0 : PyObject *allow_remaining_obj = NULL;
2151 0 : bool allow_remaining = false;
2152 :
2153 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
2154 : discard_const_p(char *, kwnames),
2155 : &blob.data, &blob_length,
2156 : &allow_remaining_obj)) {
2157 0 : return NULL;
2158 : }
2159 0 : blob.length = blob_length;
2160 :
2161 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
2162 0 : allow_remaining = true;
2163 : }
2164 :
2165 0 : if (allow_remaining) {
2166 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_CCACHE);
2167 : } else {
2168 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_CCACHE);
2169 : }
2170 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2171 0 : PyErr_SetNdrError(err);
2172 0 : return NULL;
2173 : }
2174 :
2175 0 : Py_RETURN_NONE;
2176 : }
2177 :
2178 0 : static PyObject *py_CCACHE_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2179 : {
2180 0 : struct CCACHE *object = pytalloc_get_ptr(py_obj);
2181 : PyObject *ret;
2182 : char *retstr;
2183 :
2184 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_CCACHE, "CCACHE", object);
2185 0 : ret = PyUnicode_FromString(retstr);
2186 0 : talloc_free(retstr);
2187 :
2188 0 : return ret;
2189 : }
2190 :
2191 : static PyMethodDef py_CCACHE_methods[] = {
2192 : { "__ndr_pack__", (PyCFunction)py_CCACHE_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
2193 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_CCACHE_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
2194 : { "__ndr_print__", (PyCFunction)py_CCACHE_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
2195 : { NULL, NULL, 0, NULL }
2196 : };
2197 :
2198 :
2199 : static PyTypeObject CCACHE_Type = {
2200 : PyVarObject_HEAD_INIT(NULL, 0)
2201 : .tp_name = "krb5ccache.CCACHE",
2202 : .tp_getset = py_CCACHE_getsetters,
2203 : .tp_methods = py_CCACHE_methods,
2204 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
2205 : .tp_new = py_CCACHE_new,
2206 : };
2207 :
2208 :
2209 0 : static PyObject *py_MULTIPLE_CREDENTIALS_get_cred(PyObject *obj, void *closure)
2210 : {
2211 0 : struct MULTIPLE_CREDENTIALS *object = pytalloc_get_ptr(obj);
2212 : PyObject *py_cred;
2213 0 : py_cred = pytalloc_reference_ex(&CREDENTIAL_Type, pytalloc_get_mem_ctx(obj), &object->cred);
2214 0 : return py_cred;
2215 : }
2216 :
2217 0 : static int py_MULTIPLE_CREDENTIALS_set_cred(PyObject *py_obj, PyObject *value, void *closure)
2218 : {
2219 0 : struct MULTIPLE_CREDENTIALS *object = pytalloc_get_ptr(py_obj);
2220 0 : if (value == NULL) {
2221 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->cred");
2222 0 : return -1;
2223 : }
2224 0 : PY_CHECK_TYPE(&CREDENTIAL_Type, value, return -1;);
2225 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
2226 0 : PyErr_NoMemory();
2227 0 : return -1;
2228 : }
2229 0 : object->cred = *(struct CREDENTIAL *)pytalloc_get_ptr(value);
2230 0 : return 0;
2231 : }
2232 :
2233 0 : static PyObject *py_MULTIPLE_CREDENTIALS_get_further_creds(PyObject *obj, void *closure)
2234 : {
2235 0 : struct MULTIPLE_CREDENTIALS *object = pytalloc_get_ptr(obj);
2236 : PyObject *py_further_creds;
2237 0 : py_further_creds = PyBytes_FromStringAndSize((char *)(object->further_creds).data, (object->further_creds).length);
2238 0 : return py_further_creds;
2239 : }
2240 :
2241 0 : static int py_MULTIPLE_CREDENTIALS_set_further_creds(PyObject *py_obj, PyObject *value, void *closure)
2242 : {
2243 0 : struct MULTIPLE_CREDENTIALS *object = pytalloc_get_ptr(py_obj);
2244 0 : if (value == NULL) {
2245 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->further_creds");
2246 0 : return -1;
2247 : }
2248 0 : object->further_creds = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
2249 0 : return 0;
2250 : }
2251 :
2252 : static PyGetSetDef py_MULTIPLE_CREDENTIALS_getsetters[] = {
2253 : {
2254 : .name = discard_const_p(char, "cred"),
2255 : .get = py_MULTIPLE_CREDENTIALS_get_cred,
2256 : .set = py_MULTIPLE_CREDENTIALS_set_cred,
2257 : .doc = discard_const_p(char, "PIDL-generated element of base type CREDENTIAL")
2258 : },
2259 : {
2260 : .name = discard_const_p(char, "further_creds"),
2261 : .get = py_MULTIPLE_CREDENTIALS_get_further_creds,
2262 : .set = py_MULTIPLE_CREDENTIALS_set_further_creds,
2263 : .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
2264 : },
2265 : { .name = NULL }
2266 : };
2267 :
2268 0 : static PyObject *py_MULTIPLE_CREDENTIALS_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2269 : {
2270 0 : return pytalloc_new(struct MULTIPLE_CREDENTIALS, type);
2271 : }
2272 :
2273 0 : static PyObject *py_MULTIPLE_CREDENTIALS_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2274 : {
2275 0 : struct MULTIPLE_CREDENTIALS *object = pytalloc_get_ptr(py_obj);
2276 0 : PyObject *ret = NULL;
2277 : DATA_BLOB blob;
2278 : enum ndr_err_code err;
2279 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
2280 0 : if (tmp_ctx == NULL) {
2281 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
2282 0 : return NULL;
2283 : }
2284 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_MULTIPLE_CREDENTIALS);
2285 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2286 0 : TALLOC_FREE(tmp_ctx);
2287 0 : PyErr_SetNdrError(err);
2288 0 : return NULL;
2289 : }
2290 :
2291 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
2292 0 : TALLOC_FREE(tmp_ctx);
2293 0 : return ret;
2294 : }
2295 :
2296 0 : static PyObject *py_MULTIPLE_CREDENTIALS_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
2297 : {
2298 0 : struct MULTIPLE_CREDENTIALS *object = pytalloc_get_ptr(py_obj);
2299 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
2300 0 : Py_ssize_t blob_length = 0;
2301 : enum ndr_err_code err;
2302 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
2303 0 : PyObject *allow_remaining_obj = NULL;
2304 0 : bool allow_remaining = false;
2305 :
2306 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
2307 : discard_const_p(char *, kwnames),
2308 : &blob.data, &blob_length,
2309 : &allow_remaining_obj)) {
2310 0 : return NULL;
2311 : }
2312 0 : blob.length = blob_length;
2313 :
2314 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
2315 0 : allow_remaining = true;
2316 : }
2317 :
2318 0 : if (allow_remaining) {
2319 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_MULTIPLE_CREDENTIALS);
2320 : } else {
2321 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_MULTIPLE_CREDENTIALS);
2322 : }
2323 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2324 0 : PyErr_SetNdrError(err);
2325 0 : return NULL;
2326 : }
2327 :
2328 0 : Py_RETURN_NONE;
2329 : }
2330 :
2331 0 : static PyObject *py_MULTIPLE_CREDENTIALS_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2332 : {
2333 0 : struct MULTIPLE_CREDENTIALS *object = pytalloc_get_ptr(py_obj);
2334 : PyObject *ret;
2335 : char *retstr;
2336 :
2337 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_MULTIPLE_CREDENTIALS, "MULTIPLE_CREDENTIALS", object);
2338 0 : ret = PyUnicode_FromString(retstr);
2339 0 : talloc_free(retstr);
2340 :
2341 0 : return ret;
2342 : }
2343 :
2344 : static PyMethodDef py_MULTIPLE_CREDENTIALS_methods[] = {
2345 : { "__ndr_pack__", (PyCFunction)py_MULTIPLE_CREDENTIALS_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
2346 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_MULTIPLE_CREDENTIALS_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
2347 : { "__ndr_print__", (PyCFunction)py_MULTIPLE_CREDENTIALS_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
2348 : { NULL, NULL, 0, NULL }
2349 : };
2350 :
2351 :
2352 : static PyTypeObject MULTIPLE_CREDENTIALS_Type = {
2353 : PyVarObject_HEAD_INIT(NULL, 0)
2354 : .tp_name = "krb5ccache.MULTIPLE_CREDENTIALS",
2355 : .tp_getset = py_MULTIPLE_CREDENTIALS_getsetters,
2356 : .tp_methods = py_MULTIPLE_CREDENTIALS_methods,
2357 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
2358 : .tp_new = py_MULTIPLE_CREDENTIALS_new,
2359 : };
2360 :
2361 :
2362 0 : static PyObject *py_KEYTAB_KEYBLOCK_get_length(PyObject *obj, void *closure)
2363 : {
2364 0 : struct KEYTAB_KEYBLOCK *object = pytalloc_get_ptr(obj);
2365 : PyObject *py_length;
2366 0 : py_length = PyLong_FromLong((uint16_t)(object->length));
2367 0 : return py_length;
2368 : }
2369 :
2370 0 : static int py_KEYTAB_KEYBLOCK_set_length(PyObject *py_obj, PyObject *value, void *closure)
2371 : {
2372 0 : struct KEYTAB_KEYBLOCK *object = pytalloc_get_ptr(py_obj);
2373 0 : if (value == NULL) {
2374 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->length");
2375 0 : return -1;
2376 : }
2377 : {
2378 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->length));
2379 0 : if (PyLong_Check(value)) {
2380 : unsigned long long test_var;
2381 0 : test_var = PyLong_AsUnsignedLongLong(value);
2382 0 : if (PyErr_Occurred() != NULL) {
2383 0 : return -1;
2384 : }
2385 0 : if (test_var > uint_max) {
2386 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2387 : PyLong_Type.tp_name, uint_max, test_var);
2388 0 : return -1;
2389 : }
2390 0 : object->length = test_var;
2391 : } else {
2392 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2393 : PyLong_Type.tp_name);
2394 0 : return -1;
2395 : }
2396 : }
2397 0 : return 0;
2398 : }
2399 :
2400 184 : static PyObject *py_KEYTAB_KEYBLOCK_get_data(PyObject *obj, void *closure)
2401 : {
2402 184 : struct KEYTAB_KEYBLOCK *object = pytalloc_get_ptr(obj);
2403 : PyObject *py_data;
2404 184 : py_data = PyList_New(object->length);
2405 184 : if (py_data == NULL) {
2406 0 : return NULL;
2407 : }
2408 : {
2409 : int data_cntr_0;
2410 4152 : for (data_cntr_0 = 0; data_cntr_0 < (object->length); data_cntr_0++) {
2411 : PyObject *py_data_0;
2412 3968 : py_data_0 = PyLong_FromLong((uint16_t)((object->data)[data_cntr_0]));
2413 3968 : PyList_SetItem(py_data, data_cntr_0, py_data_0);
2414 : }
2415 : }
2416 184 : return py_data;
2417 : }
2418 :
2419 0 : static int py_KEYTAB_KEYBLOCK_set_data(PyObject *py_obj, PyObject *value, void *closure)
2420 : {
2421 0 : struct KEYTAB_KEYBLOCK *object = pytalloc_get_ptr(py_obj);
2422 0 : if (value == NULL) {
2423 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->data");
2424 0 : return -1;
2425 : }
2426 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
2427 : {
2428 : int data_cntr_0;
2429 0 : object->data = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->data, PyList_GET_SIZE(value));
2430 0 : if (!object->data) { return -1; }
2431 0 : talloc_set_name_const(object->data, "ARRAY: object->data");
2432 0 : for (data_cntr_0 = 0; data_cntr_0 < PyList_GET_SIZE(value); data_cntr_0++) {
2433 0 : if (PyList_GET_ITEM(value, data_cntr_0) == NULL) {
2434 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->data)[data_cntr_0]");
2435 0 : return -1;
2436 : }
2437 : {
2438 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((object->data)[data_cntr_0]));
2439 0 : if (PyLong_Check(PyList_GET_ITEM(value, data_cntr_0))) {
2440 : unsigned long long test_var;
2441 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, data_cntr_0));
2442 0 : if (PyErr_Occurred() != NULL) {
2443 0 : return -1;
2444 : }
2445 0 : if (test_var > uint_max) {
2446 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2447 : PyLong_Type.tp_name, uint_max, test_var);
2448 0 : return -1;
2449 : }
2450 0 : (object->data)[data_cntr_0] = test_var;
2451 : } else {
2452 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2453 : PyLong_Type.tp_name);
2454 0 : return -1;
2455 : }
2456 : }
2457 : }
2458 : }
2459 0 : return 0;
2460 : }
2461 :
2462 : static PyGetSetDef py_KEYTAB_KEYBLOCK_getsetters[] = {
2463 : {
2464 : .name = discard_const_p(char, "length"),
2465 : .get = py_KEYTAB_KEYBLOCK_get_length,
2466 : .set = py_KEYTAB_KEYBLOCK_set_length,
2467 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
2468 : },
2469 : {
2470 : .name = discard_const_p(char, "data"),
2471 : .get = py_KEYTAB_KEYBLOCK_get_data,
2472 : .set = py_KEYTAB_KEYBLOCK_set_data,
2473 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
2474 : },
2475 : { .name = NULL }
2476 : };
2477 :
2478 0 : static PyObject *py_KEYTAB_KEYBLOCK_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2479 : {
2480 0 : return pytalloc_new(struct KEYTAB_KEYBLOCK, type);
2481 : }
2482 :
2483 :
2484 : static PyTypeObject KEYTAB_KEYBLOCK_Type = {
2485 : PyVarObject_HEAD_INIT(NULL, 0)
2486 : .tp_name = "krb5ccache.KEYTAB_KEYBLOCK",
2487 : .tp_getset = py_KEYTAB_KEYBLOCK_getsetters,
2488 : .tp_methods = NULL,
2489 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
2490 : .tp_new = py_KEYTAB_KEYBLOCK_new,
2491 : };
2492 :
2493 :
2494 4 : static PyObject *py_KEYTAB_PRINCIPAL_get_component_count(PyObject *obj, void *closure)
2495 : {
2496 4 : struct KEYTAB_PRINCIPAL *object = pytalloc_get_ptr(obj);
2497 : PyObject *py_component_count;
2498 4 : py_component_count = PyLong_FromLong((uint16_t)(object->component_count));
2499 4 : return py_component_count;
2500 : }
2501 :
2502 0 : static int py_KEYTAB_PRINCIPAL_set_component_count(PyObject *py_obj, PyObject *value, void *closure)
2503 : {
2504 0 : struct KEYTAB_PRINCIPAL *object = pytalloc_get_ptr(py_obj);
2505 0 : if (value == NULL) {
2506 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->component_count");
2507 0 : return -1;
2508 : }
2509 : {
2510 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->component_count));
2511 0 : if (PyLong_Check(value)) {
2512 : unsigned long long test_var;
2513 0 : test_var = PyLong_AsUnsignedLongLong(value);
2514 0 : if (PyErr_Occurred() != NULL) {
2515 0 : return -1;
2516 : }
2517 0 : if (test_var > uint_max) {
2518 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2519 : PyLong_Type.tp_name, uint_max, test_var);
2520 0 : return -1;
2521 : }
2522 0 : object->component_count = test_var;
2523 : } else {
2524 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2525 : PyLong_Type.tp_name);
2526 0 : return -1;
2527 : }
2528 : }
2529 0 : return 0;
2530 : }
2531 :
2532 180 : static PyObject *py_KEYTAB_PRINCIPAL_get_realm(PyObject *obj, void *closure)
2533 : {
2534 180 : struct KEYTAB_PRINCIPAL *object = pytalloc_get_ptr(obj);
2535 : PyObject *py_realm;
2536 180 : py_realm = PyString_FromStringOrNULL(object->realm);
2537 180 : return py_realm;
2538 : }
2539 :
2540 0 : static int py_KEYTAB_PRINCIPAL_set_realm(PyObject *py_obj, PyObject *value, void *closure)
2541 : {
2542 0 : struct KEYTAB_PRINCIPAL *object = pytalloc_get_ptr(py_obj);
2543 0 : if (value == NULL) {
2544 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->realm");
2545 0 : return -1;
2546 : }
2547 : {
2548 : const char *test_str;
2549 : const char *talloc_str;
2550 0 : PyObject *unicode = NULL;
2551 0 : if (PyUnicode_Check(value)) {
2552 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
2553 0 : if (unicode == NULL) {
2554 0 : return -1;
2555 : }
2556 0 : test_str = PyBytes_AS_STRING(unicode);
2557 0 : } else if (PyBytes_Check(value)) {
2558 0 : test_str = PyBytes_AS_STRING(value);
2559 : } else {
2560 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
2561 0 : return -1;
2562 : }
2563 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
2564 0 : if (unicode != NULL) {
2565 0 : Py_DECREF(unicode);
2566 : }
2567 0 : if (talloc_str == NULL) {
2568 0 : PyErr_NoMemory();
2569 0 : return -1;
2570 : }
2571 0 : object->realm = talloc_str;
2572 : }
2573 0 : return 0;
2574 : }
2575 :
2576 180 : static PyObject *py_KEYTAB_PRINCIPAL_get_components(PyObject *obj, void *closure)
2577 : {
2578 180 : struct KEYTAB_PRINCIPAL *object = pytalloc_get_ptr(obj);
2579 : PyObject *py_components;
2580 180 : py_components = PyList_New(object->component_count);
2581 180 : if (py_components == NULL) {
2582 0 : return NULL;
2583 : }
2584 : {
2585 : int components_cntr_0;
2586 360 : for (components_cntr_0 = 0; components_cntr_0 < (object->component_count); components_cntr_0++) {
2587 : PyObject *py_components_0;
2588 180 : py_components_0 = PyString_FromStringOrNULL((object->components)[components_cntr_0]);
2589 180 : PyList_SetItem(py_components, components_cntr_0, py_components_0);
2590 : }
2591 : }
2592 180 : return py_components;
2593 : }
2594 :
2595 0 : static int py_KEYTAB_PRINCIPAL_set_components(PyObject *py_obj, PyObject *value, void *closure)
2596 : {
2597 0 : struct KEYTAB_PRINCIPAL *object = pytalloc_get_ptr(py_obj);
2598 0 : if (value == NULL) {
2599 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->components");
2600 0 : return -1;
2601 : }
2602 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
2603 : {
2604 : int components_cntr_0;
2605 0 : object->components = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->components, PyList_GET_SIZE(value));
2606 0 : if (!object->components) { return -1; }
2607 0 : talloc_set_name_const(object->components, "ARRAY: object->components");
2608 0 : for (components_cntr_0 = 0; components_cntr_0 < PyList_GET_SIZE(value); components_cntr_0++) {
2609 0 : if (PyList_GET_ITEM(value, components_cntr_0) == NULL) {
2610 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->components)[components_cntr_0]");
2611 0 : return -1;
2612 : }
2613 : {
2614 : const char *test_str;
2615 : const char *talloc_str;
2616 0 : PyObject *unicode = NULL;
2617 0 : if (PyUnicode_Check(PyList_GET_ITEM(value, components_cntr_0))) {
2618 0 : unicode = PyUnicode_AsEncodedString(PyList_GET_ITEM(value, components_cntr_0), "utf-8", "ignore");
2619 0 : if (unicode == NULL) {
2620 0 : return -1;
2621 : }
2622 0 : test_str = PyBytes_AS_STRING(unicode);
2623 0 : } else if (PyBytes_Check(PyList_GET_ITEM(value, components_cntr_0))) {
2624 0 : test_str = PyBytes_AS_STRING(PyList_GET_ITEM(value, components_cntr_0));
2625 : } else {
2626 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(PyList_GET_ITEM(value, components_cntr_0))->tp_name);
2627 0 : return -1;
2628 : }
2629 0 : talloc_str = talloc_strdup(object->components, test_str);
2630 0 : if (unicode != NULL) {
2631 0 : Py_DECREF(unicode);
2632 : }
2633 0 : if (talloc_str == NULL) {
2634 0 : PyErr_NoMemory();
2635 0 : return -1;
2636 : }
2637 0 : (object->components)[components_cntr_0] = talloc_str;
2638 : }
2639 : }
2640 : }
2641 0 : return 0;
2642 : }
2643 :
2644 0 : static PyObject *py_KEYTAB_PRINCIPAL_get_name_type(PyObject *obj, void *closure)
2645 : {
2646 0 : struct KEYTAB_PRINCIPAL *object = pytalloc_get_ptr(obj);
2647 : PyObject *py_name_type;
2648 0 : py_name_type = PyLong_FromUnsignedLongLong((uint32_t)(object->name_type));
2649 0 : return py_name_type;
2650 : }
2651 :
2652 0 : static int py_KEYTAB_PRINCIPAL_set_name_type(PyObject *py_obj, PyObject *value, void *closure)
2653 : {
2654 0 : struct KEYTAB_PRINCIPAL *object = pytalloc_get_ptr(py_obj);
2655 0 : if (value == NULL) {
2656 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->name_type");
2657 0 : return -1;
2658 : }
2659 : {
2660 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->name_type));
2661 0 : if (PyLong_Check(value)) {
2662 : unsigned long long test_var;
2663 0 : test_var = PyLong_AsUnsignedLongLong(value);
2664 0 : if (PyErr_Occurred() != NULL) {
2665 0 : return -1;
2666 : }
2667 0 : if (test_var > uint_max) {
2668 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2669 : PyLong_Type.tp_name, uint_max, test_var);
2670 0 : return -1;
2671 : }
2672 0 : object->name_type = test_var;
2673 : } else {
2674 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2675 : PyLong_Type.tp_name);
2676 0 : return -1;
2677 : }
2678 : }
2679 0 : return 0;
2680 : }
2681 :
2682 : static PyGetSetDef py_KEYTAB_PRINCIPAL_getsetters[] = {
2683 : {
2684 : .name = discard_const_p(char, "component_count"),
2685 : .get = py_KEYTAB_PRINCIPAL_get_component_count,
2686 : .set = py_KEYTAB_PRINCIPAL_set_component_count,
2687 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
2688 : },
2689 : {
2690 : .name = discard_const_p(char, "realm"),
2691 : .get = py_KEYTAB_PRINCIPAL_get_realm,
2692 : .set = py_KEYTAB_PRINCIPAL_set_realm,
2693 : .doc = discard_const_p(char, "PIDL-generated element of base type string")
2694 : },
2695 : {
2696 : .name = discard_const_p(char, "components"),
2697 : .get = py_KEYTAB_PRINCIPAL_get_components,
2698 : .set = py_KEYTAB_PRINCIPAL_set_components,
2699 : .doc = discard_const_p(char, "PIDL-generated element of base type string")
2700 : },
2701 : {
2702 : .name = discard_const_p(char, "name_type"),
2703 : .get = py_KEYTAB_PRINCIPAL_get_name_type,
2704 : .set = py_KEYTAB_PRINCIPAL_set_name_type,
2705 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
2706 : },
2707 : { .name = NULL }
2708 : };
2709 :
2710 0 : static PyObject *py_KEYTAB_PRINCIPAL_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2711 : {
2712 0 : return pytalloc_new(struct KEYTAB_PRINCIPAL, type);
2713 : }
2714 :
2715 :
2716 : static PyTypeObject KEYTAB_PRINCIPAL_Type = {
2717 : PyVarObject_HEAD_INIT(NULL, 0)
2718 : .tp_name = "krb5ccache.KEYTAB_PRINCIPAL",
2719 : .tp_getset = py_KEYTAB_PRINCIPAL_getsetters,
2720 : .tp_methods = NULL,
2721 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
2722 : .tp_new = py_KEYTAB_PRINCIPAL_new,
2723 : };
2724 :
2725 :
2726 364 : static PyObject *py_KEYTAB_ENTRY_get_principal(PyObject *obj, void *closure)
2727 : {
2728 364 : struct KEYTAB_ENTRY *object = pytalloc_get_ptr(obj);
2729 : PyObject *py_principal;
2730 364 : py_principal = pytalloc_reference_ex(&KEYTAB_PRINCIPAL_Type, pytalloc_get_mem_ctx(obj), &object->principal);
2731 364 : return py_principal;
2732 : }
2733 :
2734 0 : static int py_KEYTAB_ENTRY_set_principal(PyObject *py_obj, PyObject *value, void *closure)
2735 : {
2736 0 : struct KEYTAB_ENTRY *object = pytalloc_get_ptr(py_obj);
2737 0 : if (value == NULL) {
2738 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->principal");
2739 0 : return -1;
2740 : }
2741 0 : PY_CHECK_TYPE(&KEYTAB_PRINCIPAL_Type, value, return -1;);
2742 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
2743 0 : PyErr_NoMemory();
2744 0 : return -1;
2745 : }
2746 0 : object->principal = *(struct KEYTAB_PRINCIPAL *)pytalloc_get_ptr(value);
2747 0 : return 0;
2748 : }
2749 :
2750 0 : static PyObject *py_KEYTAB_ENTRY_get_timestamp(PyObject *obj, void *closure)
2751 : {
2752 0 : struct KEYTAB_ENTRY *object = pytalloc_get_ptr(obj);
2753 : PyObject *py_timestamp;
2754 0 : py_timestamp = PyLong_FromUnsignedLongLong((uint32_t)(object->timestamp));
2755 0 : return py_timestamp;
2756 : }
2757 :
2758 0 : static int py_KEYTAB_ENTRY_set_timestamp(PyObject *py_obj, PyObject *value, void *closure)
2759 : {
2760 0 : struct KEYTAB_ENTRY *object = pytalloc_get_ptr(py_obj);
2761 0 : if (value == NULL) {
2762 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->timestamp");
2763 0 : return -1;
2764 : }
2765 : {
2766 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->timestamp));
2767 0 : if (PyLong_Check(value)) {
2768 : unsigned long long test_var;
2769 0 : test_var = PyLong_AsUnsignedLongLong(value);
2770 0 : if (PyErr_Occurred() != NULL) {
2771 0 : return -1;
2772 : }
2773 0 : if (test_var > uint_max) {
2774 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2775 : PyLong_Type.tp_name, uint_max, test_var);
2776 0 : return -1;
2777 : }
2778 0 : object->timestamp = test_var;
2779 : } else {
2780 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2781 : PyLong_Type.tp_name);
2782 0 : return -1;
2783 : }
2784 : }
2785 0 : return 0;
2786 : }
2787 :
2788 176 : static PyObject *py_KEYTAB_ENTRY_get_key_version(PyObject *obj, void *closure)
2789 : {
2790 176 : struct KEYTAB_ENTRY *object = pytalloc_get_ptr(obj);
2791 : PyObject *py_key_version;
2792 176 : py_key_version = PyLong_FromLong((uint16_t)(object->key_version));
2793 176 : return py_key_version;
2794 : }
2795 :
2796 0 : static int py_KEYTAB_ENTRY_set_key_version(PyObject *py_obj, PyObject *value, void *closure)
2797 : {
2798 0 : struct KEYTAB_ENTRY *object = pytalloc_get_ptr(py_obj);
2799 0 : if (value == NULL) {
2800 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->key_version");
2801 0 : return -1;
2802 : }
2803 : {
2804 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->key_version));
2805 0 : if (PyLong_Check(value)) {
2806 : unsigned long long test_var;
2807 0 : test_var = PyLong_AsUnsignedLongLong(value);
2808 0 : if (PyErr_Occurred() != NULL) {
2809 0 : return -1;
2810 : }
2811 0 : if (test_var > uint_max) {
2812 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2813 : PyLong_Type.tp_name, uint_max, test_var);
2814 0 : return -1;
2815 : }
2816 0 : object->key_version = test_var;
2817 : } else {
2818 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2819 : PyLong_Type.tp_name);
2820 0 : return -1;
2821 : }
2822 : }
2823 0 : return 0;
2824 : }
2825 :
2826 184 : static PyObject *py_KEYTAB_ENTRY_get_enctype(PyObject *obj, void *closure)
2827 : {
2828 184 : struct KEYTAB_ENTRY *object = pytalloc_get_ptr(obj);
2829 : PyObject *py_enctype;
2830 184 : py_enctype = PyLong_FromLong((uint16_t)(object->enctype));
2831 184 : return py_enctype;
2832 : }
2833 :
2834 0 : static int py_KEYTAB_ENTRY_set_enctype(PyObject *py_obj, PyObject *value, void *closure)
2835 : {
2836 0 : struct KEYTAB_ENTRY *object = pytalloc_get_ptr(py_obj);
2837 0 : if (value == NULL) {
2838 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->enctype");
2839 0 : return -1;
2840 : }
2841 : {
2842 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->enctype));
2843 0 : if (PyLong_Check(value)) {
2844 : unsigned long long test_var;
2845 0 : test_var = PyLong_AsUnsignedLongLong(value);
2846 0 : if (PyErr_Occurred() != NULL) {
2847 0 : return -1;
2848 : }
2849 0 : if (test_var > uint_max) {
2850 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2851 : PyLong_Type.tp_name, uint_max, test_var);
2852 0 : return -1;
2853 : }
2854 0 : object->enctype = test_var;
2855 : } else {
2856 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2857 : PyLong_Type.tp_name);
2858 0 : return -1;
2859 : }
2860 : }
2861 0 : return 0;
2862 : }
2863 :
2864 184 : static PyObject *py_KEYTAB_ENTRY_get_key(PyObject *obj, void *closure)
2865 : {
2866 184 : struct KEYTAB_ENTRY *object = pytalloc_get_ptr(obj);
2867 : PyObject *py_key;
2868 184 : py_key = pytalloc_reference_ex(&KEYTAB_KEYBLOCK_Type, pytalloc_get_mem_ctx(obj), &object->key);
2869 184 : return py_key;
2870 : }
2871 :
2872 0 : static int py_KEYTAB_ENTRY_set_key(PyObject *py_obj, PyObject *value, void *closure)
2873 : {
2874 0 : struct KEYTAB_ENTRY *object = pytalloc_get_ptr(py_obj);
2875 0 : if (value == NULL) {
2876 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->key");
2877 0 : return -1;
2878 : }
2879 0 : PY_CHECK_TYPE(&KEYTAB_KEYBLOCK_Type, value, return -1;);
2880 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
2881 0 : PyErr_NoMemory();
2882 0 : return -1;
2883 : }
2884 0 : object->key = *(struct KEYTAB_KEYBLOCK *)pytalloc_get_ptr(value);
2885 0 : return 0;
2886 : }
2887 :
2888 0 : static PyObject *py_KEYTAB_ENTRY_get_full_key_version(PyObject *obj, void *closure)
2889 : {
2890 0 : struct KEYTAB_ENTRY *object = pytalloc_get_ptr(obj);
2891 : PyObject *py_full_key_version;
2892 0 : py_full_key_version = PyLong_FromUnsignedLongLong((uint32_t)(object->full_key_version));
2893 0 : return py_full_key_version;
2894 : }
2895 :
2896 0 : static int py_KEYTAB_ENTRY_set_full_key_version(PyObject *py_obj, PyObject *value, void *closure)
2897 : {
2898 0 : struct KEYTAB_ENTRY *object = pytalloc_get_ptr(py_obj);
2899 0 : if (value == NULL) {
2900 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->full_key_version");
2901 0 : return -1;
2902 : }
2903 : {
2904 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->full_key_version));
2905 0 : if (PyLong_Check(value)) {
2906 : unsigned long long test_var;
2907 0 : test_var = PyLong_AsUnsignedLongLong(value);
2908 0 : if (PyErr_Occurred() != NULL) {
2909 0 : return -1;
2910 : }
2911 0 : if (test_var > uint_max) {
2912 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2913 : PyLong_Type.tp_name, uint_max, test_var);
2914 0 : return -1;
2915 : }
2916 0 : object->full_key_version = test_var;
2917 : } else {
2918 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2919 : PyLong_Type.tp_name);
2920 0 : return -1;
2921 : }
2922 : }
2923 0 : return 0;
2924 : }
2925 :
2926 : static PyGetSetDef py_KEYTAB_ENTRY_getsetters[] = {
2927 : {
2928 : .name = discard_const_p(char, "principal"),
2929 : .get = py_KEYTAB_ENTRY_get_principal,
2930 : .set = py_KEYTAB_ENTRY_set_principal,
2931 : .doc = discard_const_p(char, "PIDL-generated element of base type KEYTAB_PRINCIPAL")
2932 : },
2933 : {
2934 : .name = discard_const_p(char, "timestamp"),
2935 : .get = py_KEYTAB_ENTRY_get_timestamp,
2936 : .set = py_KEYTAB_ENTRY_set_timestamp,
2937 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
2938 : },
2939 : {
2940 : .name = discard_const_p(char, "key_version"),
2941 : .get = py_KEYTAB_ENTRY_get_key_version,
2942 : .set = py_KEYTAB_ENTRY_set_key_version,
2943 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
2944 : },
2945 : {
2946 : .name = discard_const_p(char, "enctype"),
2947 : .get = py_KEYTAB_ENTRY_get_enctype,
2948 : .set = py_KEYTAB_ENTRY_set_enctype,
2949 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
2950 : },
2951 : {
2952 : .name = discard_const_p(char, "key"),
2953 : .get = py_KEYTAB_ENTRY_get_key,
2954 : .set = py_KEYTAB_ENTRY_set_key,
2955 : .doc = discard_const_p(char, "PIDL-generated element of base type KEYTAB_KEYBLOCK")
2956 : },
2957 : {
2958 : .name = discard_const_p(char, "full_key_version"),
2959 : .get = py_KEYTAB_ENTRY_get_full_key_version,
2960 : .set = py_KEYTAB_ENTRY_set_full_key_version,
2961 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
2962 : },
2963 : { .name = NULL }
2964 : };
2965 :
2966 0 : static PyObject *py_KEYTAB_ENTRY_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2967 : {
2968 0 : return pytalloc_new(struct KEYTAB_ENTRY, type);
2969 : }
2970 :
2971 :
2972 : static PyTypeObject KEYTAB_ENTRY_Type = {
2973 : PyVarObject_HEAD_INIT(NULL, 0)
2974 : .tp_name = "krb5ccache.KEYTAB_ENTRY",
2975 : .tp_getset = py_KEYTAB_ENTRY_getsetters,
2976 : .tp_methods = NULL,
2977 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
2978 : .tp_new = py_KEYTAB_ENTRY_new,
2979 : };
2980 :
2981 :
2982 0 : static PyObject *py_KEYTAB_get_pvno(PyObject *obj, void *closure)
2983 : {
2984 0 : struct KEYTAB *object = pytalloc_get_ptr(obj);
2985 : PyObject *py_pvno;
2986 0 : py_pvno = PyLong_FromLong((uint16_t)(object->pvno));
2987 0 : return py_pvno;
2988 : }
2989 :
2990 0 : static int py_KEYTAB_set_pvno(PyObject *py_obj, PyObject *value, void *closure)
2991 : {
2992 0 : struct KEYTAB *object = pytalloc_get_ptr(py_obj);
2993 0 : if (value == NULL) {
2994 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->pvno");
2995 0 : return -1;
2996 : }
2997 : {
2998 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->pvno));
2999 0 : if (PyLong_Check(value)) {
3000 : unsigned long long test_var;
3001 0 : test_var = PyLong_AsUnsignedLongLong(value);
3002 0 : if (PyErr_Occurred() != NULL) {
3003 0 : return -1;
3004 : }
3005 0 : if (test_var > uint_max) {
3006 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3007 : PyLong_Type.tp_name, uint_max, test_var);
3008 0 : return -1;
3009 : }
3010 0 : object->pvno = test_var;
3011 : } else {
3012 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3013 : PyLong_Type.tp_name);
3014 0 : return -1;
3015 : }
3016 : }
3017 0 : return 0;
3018 : }
3019 :
3020 0 : static PyObject *py_KEYTAB_get_version(PyObject *obj, void *closure)
3021 : {
3022 0 : struct KEYTAB *object = pytalloc_get_ptr(obj);
3023 : PyObject *py_version;
3024 0 : py_version = PyLong_FromLong((uint16_t)(object->version));
3025 0 : return py_version;
3026 : }
3027 :
3028 0 : static int py_KEYTAB_set_version(PyObject *py_obj, PyObject *value, void *closure)
3029 : {
3030 0 : struct KEYTAB *object = pytalloc_get_ptr(py_obj);
3031 0 : if (value == NULL) {
3032 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->version");
3033 0 : return -1;
3034 : }
3035 : {
3036 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->version));
3037 0 : if (PyLong_Check(value)) {
3038 : unsigned long long test_var;
3039 0 : test_var = PyLong_AsUnsignedLongLong(value);
3040 0 : if (PyErr_Occurred() != NULL) {
3041 0 : return -1;
3042 : }
3043 0 : if (test_var > uint_max) {
3044 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3045 : PyLong_Type.tp_name, uint_max, test_var);
3046 0 : return -1;
3047 : }
3048 0 : object->version = test_var;
3049 : } else {
3050 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3051 : PyLong_Type.tp_name);
3052 0 : return -1;
3053 : }
3054 : }
3055 0 : return 0;
3056 : }
3057 :
3058 32 : static PyObject *py_KEYTAB_get_entry(PyObject *obj, void *closure)
3059 : {
3060 32 : struct KEYTAB *object = pytalloc_get_ptr(obj);
3061 : PyObject *py_entry;
3062 32 : py_entry = pytalloc_reference_ex(&KEYTAB_ENTRY_Type, pytalloc_get_mem_ctx(obj), &object->entry);
3063 32 : return py_entry;
3064 : }
3065 :
3066 0 : static int py_KEYTAB_set_entry(PyObject *py_obj, PyObject *value, void *closure)
3067 : {
3068 0 : struct KEYTAB *object = pytalloc_get_ptr(py_obj);
3069 0 : if (value == NULL) {
3070 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->entry");
3071 0 : return -1;
3072 : }
3073 0 : PY_CHECK_TYPE(&KEYTAB_ENTRY_Type, value, return -1;);
3074 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
3075 0 : PyErr_NoMemory();
3076 0 : return -1;
3077 : }
3078 0 : object->entry = *(struct KEYTAB_ENTRY *)pytalloc_get_ptr(value);
3079 0 : return 0;
3080 : }
3081 :
3082 16 : static PyObject *py_KEYTAB_get_further_entry(PyObject *obj, void *closure)
3083 : {
3084 16 : struct KEYTAB *object = pytalloc_get_ptr(obj);
3085 : PyObject *py_further_entry;
3086 16 : py_further_entry = PyBytes_FromStringAndSize((char *)(object->further_entry).data, (object->further_entry).length);
3087 16 : return py_further_entry;
3088 : }
3089 :
3090 0 : static int py_KEYTAB_set_further_entry(PyObject *py_obj, PyObject *value, void *closure)
3091 : {
3092 0 : struct KEYTAB *object = pytalloc_get_ptr(py_obj);
3093 0 : if (value == NULL) {
3094 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->further_entry");
3095 0 : return -1;
3096 : }
3097 0 : object->further_entry = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
3098 0 : return 0;
3099 : }
3100 :
3101 : static PyGetSetDef py_KEYTAB_getsetters[] = {
3102 : {
3103 : .name = discard_const_p(char, "pvno"),
3104 : .get = py_KEYTAB_get_pvno,
3105 : .set = py_KEYTAB_set_pvno,
3106 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
3107 : },
3108 : {
3109 : .name = discard_const_p(char, "version"),
3110 : .get = py_KEYTAB_get_version,
3111 : .set = py_KEYTAB_set_version,
3112 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
3113 : },
3114 : {
3115 : .name = discard_const_p(char, "entry"),
3116 : .get = py_KEYTAB_get_entry,
3117 : .set = py_KEYTAB_set_entry,
3118 : .doc = discard_const_p(char, "PIDL-generated element of base type KEYTAB_ENTRY")
3119 : },
3120 : {
3121 : .name = discard_const_p(char, "further_entry"),
3122 : .get = py_KEYTAB_get_further_entry,
3123 : .set = py_KEYTAB_set_further_entry,
3124 : .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
3125 : },
3126 : { .name = NULL }
3127 : };
3128 :
3129 16 : static PyObject *py_KEYTAB_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
3130 : {
3131 16 : return pytalloc_new(struct KEYTAB, type);
3132 : }
3133 :
3134 0 : static PyObject *py_KEYTAB_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
3135 : {
3136 0 : struct KEYTAB *object = pytalloc_get_ptr(py_obj);
3137 0 : PyObject *ret = NULL;
3138 : DATA_BLOB blob;
3139 : enum ndr_err_code err;
3140 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
3141 0 : if (tmp_ctx == NULL) {
3142 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
3143 0 : return NULL;
3144 : }
3145 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_KEYTAB);
3146 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
3147 0 : TALLOC_FREE(tmp_ctx);
3148 0 : PyErr_SetNdrError(err);
3149 0 : return NULL;
3150 : }
3151 :
3152 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
3153 0 : TALLOC_FREE(tmp_ctx);
3154 0 : return ret;
3155 : }
3156 :
3157 16 : static PyObject *py_KEYTAB_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
3158 : {
3159 16 : struct KEYTAB *object = pytalloc_get_ptr(py_obj);
3160 16 : DATA_BLOB blob = {.data = NULL, .length = 0};
3161 16 : Py_ssize_t blob_length = 0;
3162 : enum ndr_err_code err;
3163 16 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
3164 16 : PyObject *allow_remaining_obj = NULL;
3165 16 : bool allow_remaining = false;
3166 :
3167 16 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
3168 : discard_const_p(char *, kwnames),
3169 : &blob.data, &blob_length,
3170 : &allow_remaining_obj)) {
3171 0 : return NULL;
3172 : }
3173 16 : blob.length = blob_length;
3174 :
3175 16 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
3176 0 : allow_remaining = true;
3177 : }
3178 :
3179 16 : if (allow_remaining) {
3180 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_KEYTAB);
3181 : } else {
3182 16 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_KEYTAB);
3183 : }
3184 16 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
3185 0 : PyErr_SetNdrError(err);
3186 0 : return NULL;
3187 : }
3188 :
3189 16 : Py_RETURN_NONE;
3190 : }
3191 :
3192 0 : static PyObject *py_KEYTAB_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
3193 : {
3194 0 : struct KEYTAB *object = pytalloc_get_ptr(py_obj);
3195 : PyObject *ret;
3196 : char *retstr;
3197 :
3198 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_KEYTAB, "KEYTAB", object);
3199 0 : ret = PyUnicode_FromString(retstr);
3200 0 : talloc_free(retstr);
3201 :
3202 0 : return ret;
3203 : }
3204 :
3205 : static PyMethodDef py_KEYTAB_methods[] = {
3206 : { "__ndr_pack__", (PyCFunction)py_KEYTAB_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
3207 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_KEYTAB_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
3208 : { "__ndr_print__", (PyCFunction)py_KEYTAB_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
3209 : { NULL, NULL, 0, NULL }
3210 : };
3211 :
3212 :
3213 : static PyTypeObject KEYTAB_Type = {
3214 : PyVarObject_HEAD_INIT(NULL, 0)
3215 : .tp_name = "krb5ccache.KEYTAB",
3216 : .tp_getset = py_KEYTAB_getsetters,
3217 : .tp_methods = py_KEYTAB_methods,
3218 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
3219 : .tp_new = py_KEYTAB_new,
3220 : };
3221 :
3222 :
3223 172 : static PyObject *py_MULTIPLE_KEYTAB_ENTRIES_get_entry(PyObject *obj, void *closure)
3224 : {
3225 172 : struct MULTIPLE_KEYTAB_ENTRIES *object = pytalloc_get_ptr(obj);
3226 : PyObject *py_entry;
3227 172 : py_entry = pytalloc_reference_ex(&KEYTAB_ENTRY_Type, pytalloc_get_mem_ctx(obj), &object->entry);
3228 172 : return py_entry;
3229 : }
3230 :
3231 0 : static int py_MULTIPLE_KEYTAB_ENTRIES_set_entry(PyObject *py_obj, PyObject *value, void *closure)
3232 : {
3233 0 : struct MULTIPLE_KEYTAB_ENTRIES *object = pytalloc_get_ptr(py_obj);
3234 0 : if (value == NULL) {
3235 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->entry");
3236 0 : return -1;
3237 : }
3238 0 : PY_CHECK_TYPE(&KEYTAB_ENTRY_Type, value, return -1;);
3239 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
3240 0 : PyErr_NoMemory();
3241 0 : return -1;
3242 : }
3243 0 : object->entry = *(struct KEYTAB_ENTRY *)pytalloc_get_ptr(value);
3244 0 : return 0;
3245 : }
3246 :
3247 168 : static PyObject *py_MULTIPLE_KEYTAB_ENTRIES_get_further_entry(PyObject *obj, void *closure)
3248 : {
3249 168 : struct MULTIPLE_KEYTAB_ENTRIES *object = pytalloc_get_ptr(obj);
3250 : PyObject *py_further_entry;
3251 168 : py_further_entry = PyBytes_FromStringAndSize((char *)(object->further_entry).data, (object->further_entry).length);
3252 168 : return py_further_entry;
3253 : }
3254 :
3255 0 : static int py_MULTIPLE_KEYTAB_ENTRIES_set_further_entry(PyObject *py_obj, PyObject *value, void *closure)
3256 : {
3257 0 : struct MULTIPLE_KEYTAB_ENTRIES *object = pytalloc_get_ptr(py_obj);
3258 0 : if (value == NULL) {
3259 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->further_entry");
3260 0 : return -1;
3261 : }
3262 0 : object->further_entry = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
3263 0 : return 0;
3264 : }
3265 :
3266 : static PyGetSetDef py_MULTIPLE_KEYTAB_ENTRIES_getsetters[] = {
3267 : {
3268 : .name = discard_const_p(char, "entry"),
3269 : .get = py_MULTIPLE_KEYTAB_ENTRIES_get_entry,
3270 : .set = py_MULTIPLE_KEYTAB_ENTRIES_set_entry,
3271 : .doc = discard_const_p(char, "PIDL-generated element of base type KEYTAB_ENTRY")
3272 : },
3273 : {
3274 : .name = discard_const_p(char, "further_entry"),
3275 : .get = py_MULTIPLE_KEYTAB_ENTRIES_get_further_entry,
3276 : .set = py_MULTIPLE_KEYTAB_ENTRIES_set_further_entry,
3277 : .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
3278 : },
3279 : { .name = NULL }
3280 : };
3281 :
3282 168 : static PyObject *py_MULTIPLE_KEYTAB_ENTRIES_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
3283 : {
3284 168 : return pytalloc_new(struct MULTIPLE_KEYTAB_ENTRIES, type);
3285 : }
3286 :
3287 0 : static PyObject *py_MULTIPLE_KEYTAB_ENTRIES_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
3288 : {
3289 0 : struct MULTIPLE_KEYTAB_ENTRIES *object = pytalloc_get_ptr(py_obj);
3290 0 : PyObject *ret = NULL;
3291 : DATA_BLOB blob;
3292 : enum ndr_err_code err;
3293 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
3294 0 : if (tmp_ctx == NULL) {
3295 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
3296 0 : return NULL;
3297 : }
3298 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_MULTIPLE_KEYTAB_ENTRIES);
3299 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
3300 0 : TALLOC_FREE(tmp_ctx);
3301 0 : PyErr_SetNdrError(err);
3302 0 : return NULL;
3303 : }
3304 :
3305 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
3306 0 : TALLOC_FREE(tmp_ctx);
3307 0 : return ret;
3308 : }
3309 :
3310 168 : static PyObject *py_MULTIPLE_KEYTAB_ENTRIES_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
3311 : {
3312 168 : struct MULTIPLE_KEYTAB_ENTRIES *object = pytalloc_get_ptr(py_obj);
3313 168 : DATA_BLOB blob = {.data = NULL, .length = 0};
3314 168 : Py_ssize_t blob_length = 0;
3315 : enum ndr_err_code err;
3316 168 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
3317 168 : PyObject *allow_remaining_obj = NULL;
3318 168 : bool allow_remaining = false;
3319 :
3320 168 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
3321 : discard_const_p(char *, kwnames),
3322 : &blob.data, &blob_length,
3323 : &allow_remaining_obj)) {
3324 0 : return NULL;
3325 : }
3326 168 : blob.length = blob_length;
3327 :
3328 168 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
3329 0 : allow_remaining = true;
3330 : }
3331 :
3332 168 : if (allow_remaining) {
3333 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_MULTIPLE_KEYTAB_ENTRIES);
3334 : } else {
3335 168 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_MULTIPLE_KEYTAB_ENTRIES);
3336 : }
3337 168 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
3338 0 : PyErr_SetNdrError(err);
3339 0 : return NULL;
3340 : }
3341 :
3342 168 : Py_RETURN_NONE;
3343 : }
3344 :
3345 0 : static PyObject *py_MULTIPLE_KEYTAB_ENTRIES_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
3346 : {
3347 0 : struct MULTIPLE_KEYTAB_ENTRIES *object = pytalloc_get_ptr(py_obj);
3348 : PyObject *ret;
3349 : char *retstr;
3350 :
3351 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_MULTIPLE_KEYTAB_ENTRIES, "MULTIPLE_KEYTAB_ENTRIES", object);
3352 0 : ret = PyUnicode_FromString(retstr);
3353 0 : talloc_free(retstr);
3354 :
3355 0 : return ret;
3356 : }
3357 :
3358 : static PyMethodDef py_MULTIPLE_KEYTAB_ENTRIES_methods[] = {
3359 : { "__ndr_pack__", (PyCFunction)py_MULTIPLE_KEYTAB_ENTRIES_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
3360 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_MULTIPLE_KEYTAB_ENTRIES_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
3361 : { "__ndr_print__", (PyCFunction)py_MULTIPLE_KEYTAB_ENTRIES_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
3362 : { NULL, NULL, 0, NULL }
3363 : };
3364 :
3365 :
3366 : static PyTypeObject MULTIPLE_KEYTAB_ENTRIES_Type = {
3367 : PyVarObject_HEAD_INIT(NULL, 0)
3368 : .tp_name = "krb5ccache.MULTIPLE_KEYTAB_ENTRIES",
3369 : .tp_getset = py_MULTIPLE_KEYTAB_ENTRIES_getsetters,
3370 : .tp_methods = py_MULTIPLE_KEYTAB_ENTRIES_methods,
3371 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
3372 : .tp_new = py_MULTIPLE_KEYTAB_ENTRIES_new,
3373 : };
3374 :
3375 :
3376 : const struct PyNdrRpcMethodDef py_ndr_krb5ccache_methods[] = {
3377 : {0}
3378 : };
3379 :
3380 0 : static PyObject *interface_krb5ccache_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
3381 : {
3382 0 : return py_dcerpc_interface_init_helper(type, args, kwargs, &ndr_table_krb5ccache);
3383 : }
3384 :
3385 : #define PY_DOC_KRB5CCACHE "KRB5 credentials cache"
3386 : static PyTypeObject krb5ccache_InterfaceType = {
3387 : PyVarObject_HEAD_INIT(NULL, 0)
3388 : .tp_name = "krb5ccache.krb5ccache",
3389 : .tp_basicsize = sizeof(dcerpc_InterfaceObject),
3390 : .tp_doc = "krb5ccache(binding, lp_ctx=None, credentials=None) -> connection\n"
3391 : "\n"
3392 : "binding should be a DCE/RPC binding string (for example: ncacn_ip_tcp:127.0.0.1)\n"
3393 : "lp_ctx should be a path to a smb.conf file or a param.LoadParm object\n"
3394 : "credentials should be a credentials.Credentials object.\n\n"PY_DOC_KRB5CCACHE,
3395 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
3396 : .tp_new = interface_krb5ccache_new,
3397 : };
3398 :
3399 0 : static PyObject *syntax_krb5ccache_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
3400 : {
3401 0 : return py_dcerpc_syntax_init_helper(type, args, kwargs, &ndr_table_krb5ccache.syntax_id);
3402 : }
3403 :
3404 : #define PY_DOC_KRB5CCACHE_SYNTAX "KRB5 credentials cache"
3405 : static PyTypeObject krb5ccache_SyntaxType = {
3406 : PyVarObject_HEAD_INIT(NULL, 0)
3407 : .tp_name = "krb5ccache.krb5ccache_abstract_syntax",
3408 : .tp_doc = "krb5ccache_abstract_syntax()\n"PY_DOC_KRB5CCACHE_SYNTAX,
3409 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
3410 : .tp_new = syntax_krb5ccache_new,
3411 : };
3412 :
3413 : static PyMethodDef krb5ccache_methods[] = {
3414 : { NULL, NULL, 0, NULL }
3415 : };
3416 :
3417 : static struct PyModuleDef moduledef = {
3418 : PyModuleDef_HEAD_INIT,
3419 : .m_name = "krb5ccache",
3420 : .m_doc = "krb5ccache DCE/RPC",
3421 : .m_size = -1,
3422 : .m_methods = krb5ccache_methods,
3423 : };
3424 70 : MODULE_INIT_FUNC(krb5ccache)
3425 : {
3426 70 : PyObject *m = NULL;
3427 70 : PyObject *dep_talloc = NULL;
3428 70 : PyObject *dep_samba_dcerpc_base = NULL;
3429 70 : PyObject *dep_samba_dcerpc_misc = NULL;
3430 :
3431 70 : dep_talloc = PyImport_ImportModule("talloc");
3432 70 : if (dep_talloc == NULL)
3433 0 : goto out;
3434 :
3435 70 : dep_samba_dcerpc_base = PyImport_ImportModule("samba.dcerpc.base");
3436 70 : if (dep_samba_dcerpc_base == NULL)
3437 0 : goto out;
3438 :
3439 70 : dep_samba_dcerpc_misc = PyImport_ImportModule("samba.dcerpc.misc");
3440 70 : if (dep_samba_dcerpc_misc == NULL)
3441 0 : goto out;
3442 :
3443 70 : BaseObject_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "BaseObject");
3444 70 : if (BaseObject_Type == NULL)
3445 0 : goto out;
3446 :
3447 70 : ClientConnection_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_base, "ClientConnection");
3448 70 : if (ClientConnection_Type == NULL)
3449 0 : goto out;
3450 :
3451 70 : ndr_syntax_id_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_misc, "ndr_syntax_id");
3452 70 : if (ndr_syntax_id_Type == NULL)
3453 0 : goto out;
3454 :
3455 70 : PRINCIPAL_Type.tp_base = BaseObject_Type;
3456 70 : PRINCIPAL_Type.tp_basicsize = pytalloc_BaseObject_size();
3457 :
3458 70 : KEYBLOCK_Type.tp_base = BaseObject_Type;
3459 70 : KEYBLOCK_Type.tp_basicsize = pytalloc_BaseObject_size();
3460 :
3461 70 : ADDRESS_Type.tp_base = BaseObject_Type;
3462 70 : ADDRESS_Type.tp_basicsize = pytalloc_BaseObject_size();
3463 :
3464 70 : ADDRESSES_Type.tp_base = BaseObject_Type;
3465 70 : ADDRESSES_Type.tp_basicsize = pytalloc_BaseObject_size();
3466 :
3467 70 : AUTHDATUM_Type.tp_base = BaseObject_Type;
3468 70 : AUTHDATUM_Type.tp_basicsize = pytalloc_BaseObject_size();
3469 :
3470 70 : AUTHDATA_Type.tp_base = BaseObject_Type;
3471 70 : AUTHDATA_Type.tp_basicsize = pytalloc_BaseObject_size();
3472 :
3473 70 : CREDENTIAL_Type.tp_base = BaseObject_Type;
3474 70 : CREDENTIAL_Type.tp_basicsize = pytalloc_BaseObject_size();
3475 :
3476 70 : DELTATIME_TAG_Type.tp_base = BaseObject_Type;
3477 70 : DELTATIME_TAG_Type.tp_basicsize = pytalloc_BaseObject_size();
3478 :
3479 70 : FIELD_Type.tp_base = BaseObject_Type;
3480 70 : FIELD_Type.tp_basicsize = pytalloc_BaseObject_size();
3481 :
3482 70 : V4TAG_Type.tp_base = BaseObject_Type;
3483 70 : V4TAG_Type.tp_basicsize = pytalloc_BaseObject_size();
3484 :
3485 70 : V4TAGS_Type.tp_base = BaseObject_Type;
3486 70 : V4TAGS_Type.tp_basicsize = pytalloc_BaseObject_size();
3487 :
3488 70 : V4HEADER_Type.tp_base = BaseObject_Type;
3489 70 : V4HEADER_Type.tp_basicsize = pytalloc_BaseObject_size();
3490 :
3491 70 : OPTIONAL_HEADER_Type.tp_base = BaseObject_Type;
3492 70 : OPTIONAL_HEADER_Type.tp_basicsize = pytalloc_BaseObject_size();
3493 :
3494 70 : CCACHE_Type.tp_base = BaseObject_Type;
3495 70 : CCACHE_Type.tp_basicsize = pytalloc_BaseObject_size();
3496 :
3497 70 : MULTIPLE_CREDENTIALS_Type.tp_base = BaseObject_Type;
3498 70 : MULTIPLE_CREDENTIALS_Type.tp_basicsize = pytalloc_BaseObject_size();
3499 :
3500 70 : KEYTAB_KEYBLOCK_Type.tp_base = BaseObject_Type;
3501 70 : KEYTAB_KEYBLOCK_Type.tp_basicsize = pytalloc_BaseObject_size();
3502 :
3503 70 : KEYTAB_PRINCIPAL_Type.tp_base = BaseObject_Type;
3504 70 : KEYTAB_PRINCIPAL_Type.tp_basicsize = pytalloc_BaseObject_size();
3505 :
3506 70 : KEYTAB_ENTRY_Type.tp_base = BaseObject_Type;
3507 70 : KEYTAB_ENTRY_Type.tp_basicsize = pytalloc_BaseObject_size();
3508 :
3509 70 : KEYTAB_Type.tp_base = BaseObject_Type;
3510 70 : KEYTAB_Type.tp_basicsize = pytalloc_BaseObject_size();
3511 :
3512 70 : MULTIPLE_KEYTAB_ENTRIES_Type.tp_base = BaseObject_Type;
3513 70 : MULTIPLE_KEYTAB_ENTRIES_Type.tp_basicsize = pytalloc_BaseObject_size();
3514 :
3515 70 : krb5ccache_InterfaceType.tp_base = ClientConnection_Type;
3516 :
3517 70 : krb5ccache_SyntaxType.tp_base = ndr_syntax_id_Type;
3518 70 : krb5ccache_SyntaxType.tp_basicsize = pytalloc_BaseObject_size();
3519 :
3520 70 : if (PyType_Ready(&PRINCIPAL_Type) < 0)
3521 0 : goto out;
3522 70 : if (PyType_Ready(&KEYBLOCK_Type) < 0)
3523 0 : goto out;
3524 70 : if (PyType_Ready(&ADDRESS_Type) < 0)
3525 0 : goto out;
3526 70 : if (PyType_Ready(&ADDRESSES_Type) < 0)
3527 0 : goto out;
3528 70 : if (PyType_Ready(&AUTHDATUM_Type) < 0)
3529 0 : goto out;
3530 70 : if (PyType_Ready(&AUTHDATA_Type) < 0)
3531 0 : goto out;
3532 70 : if (PyType_Ready(&CREDENTIAL_Type) < 0)
3533 0 : goto out;
3534 70 : if (PyType_Ready(&DELTATIME_TAG_Type) < 0)
3535 0 : goto out;
3536 70 : if (PyType_Ready(&FIELD_Type) < 0)
3537 0 : goto out;
3538 70 : if (PyType_Ready(&V4TAG_Type) < 0)
3539 0 : goto out;
3540 70 : if (PyType_Ready(&V4TAGS_Type) < 0)
3541 0 : goto out;
3542 70 : if (PyType_Ready(&V4HEADER_Type) < 0)
3543 0 : goto out;
3544 70 : if (PyType_Ready(&OPTIONAL_HEADER_Type) < 0)
3545 0 : goto out;
3546 70 : if (PyType_Ready(&CCACHE_Type) < 0)
3547 0 : goto out;
3548 70 : if (PyType_Ready(&MULTIPLE_CREDENTIALS_Type) < 0)
3549 0 : goto out;
3550 70 : if (PyType_Ready(&KEYTAB_KEYBLOCK_Type) < 0)
3551 0 : goto out;
3552 70 : if (PyType_Ready(&KEYTAB_PRINCIPAL_Type) < 0)
3553 0 : goto out;
3554 70 : if (PyType_Ready(&KEYTAB_ENTRY_Type) < 0)
3555 0 : goto out;
3556 70 : if (PyType_Ready(&KEYTAB_Type) < 0)
3557 0 : goto out;
3558 70 : if (PyType_Ready(&MULTIPLE_KEYTAB_ENTRIES_Type) < 0)
3559 0 : goto out;
3560 70 : if (PyType_Ready(&krb5ccache_InterfaceType) < 0)
3561 0 : goto out;
3562 70 : if (PyType_Ready(&krb5ccache_SyntaxType) < 0)
3563 0 : goto out;
3564 70 : if (!PyInterface_AddNdrRpcMethods(&krb5ccache_InterfaceType, py_ndr_krb5ccache_methods))
3565 0 : return NULL;
3566 :
3567 : #ifdef PY_PRINCIPAL_PATCH
3568 : PY_PRINCIPAL_PATCH(&PRINCIPAL_Type);
3569 : #endif
3570 : #ifdef PY_KEYBLOCK_PATCH
3571 : PY_KEYBLOCK_PATCH(&KEYBLOCK_Type);
3572 : #endif
3573 : #ifdef PY_ADDRESS_PATCH
3574 : PY_ADDRESS_PATCH(&ADDRESS_Type);
3575 : #endif
3576 : #ifdef PY_ADDRESSES_PATCH
3577 : PY_ADDRESSES_PATCH(&ADDRESSES_Type);
3578 : #endif
3579 : #ifdef PY_AUTHDATUM_PATCH
3580 : PY_AUTHDATUM_PATCH(&AUTHDATUM_Type);
3581 : #endif
3582 : #ifdef PY_AUTHDATA_PATCH
3583 : PY_AUTHDATA_PATCH(&AUTHDATA_Type);
3584 : #endif
3585 : #ifdef PY_CREDENTIAL_PATCH
3586 : PY_CREDENTIAL_PATCH(&CREDENTIAL_Type);
3587 : #endif
3588 : #ifdef PY_DELTATIME_TAG_PATCH
3589 : PY_DELTATIME_TAG_PATCH(&DELTATIME_TAG_Type);
3590 : #endif
3591 : #ifdef PY_FIELD_PATCH
3592 : PY_FIELD_PATCH(&FIELD_Type);
3593 : #endif
3594 : #ifdef PY_V4TAG_PATCH
3595 : PY_V4TAG_PATCH(&V4TAG_Type);
3596 : #endif
3597 : #ifdef PY_V4TAGS_PATCH
3598 : PY_V4TAGS_PATCH(&V4TAGS_Type);
3599 : #endif
3600 : #ifdef PY_V4HEADER_PATCH
3601 : PY_V4HEADER_PATCH(&V4HEADER_Type);
3602 : #endif
3603 : #ifdef PY_OPTIONAL_HEADER_PATCH
3604 : PY_OPTIONAL_HEADER_PATCH(&OPTIONAL_HEADER_Type);
3605 : #endif
3606 : #ifdef PY_CCACHE_PATCH
3607 : PY_CCACHE_PATCH(&CCACHE_Type);
3608 : #endif
3609 : #ifdef PY_MULTIPLE_CREDENTIALS_PATCH
3610 : PY_MULTIPLE_CREDENTIALS_PATCH(&MULTIPLE_CREDENTIALS_Type);
3611 : #endif
3612 : #ifdef PY_KEYTAB_KEYBLOCK_PATCH
3613 : PY_KEYTAB_KEYBLOCK_PATCH(&KEYTAB_KEYBLOCK_Type);
3614 : #endif
3615 : #ifdef PY_KEYTAB_PRINCIPAL_PATCH
3616 : PY_KEYTAB_PRINCIPAL_PATCH(&KEYTAB_PRINCIPAL_Type);
3617 : #endif
3618 : #ifdef PY_KEYTAB_ENTRY_PATCH
3619 : PY_KEYTAB_ENTRY_PATCH(&KEYTAB_ENTRY_Type);
3620 : #endif
3621 : #ifdef PY_KEYTAB_PATCH
3622 : PY_KEYTAB_PATCH(&KEYTAB_Type);
3623 : #endif
3624 : #ifdef PY_MULTIPLE_KEYTAB_ENTRIES_PATCH
3625 : PY_MULTIPLE_KEYTAB_ENTRIES_PATCH(&MULTIPLE_KEYTAB_ENTRIES_Type);
3626 : #endif
3627 : #ifdef PY_KRB5CCACHE_PATCH
3628 : PY_KRB5CCACHE_PATCH(&krb5ccache_InterfaceType);
3629 : #endif
3630 : #ifdef PY_KRB5CCACHE_ABSTRACT_SYNTAX_PATCH
3631 : PY_KRB5CCACHE_ABSTRACT_SYNTAX_PATCH(&krb5ccache_SyntaxType);
3632 : #endif
3633 : #ifdef PY_ABSTRACT_SYNTAX_PATCH
3634 : PY_ABSTRACT_SYNTAX_PATCH(&krb5ccache_SyntaxType);
3635 : #endif
3636 :
3637 70 : m = PyModule_Create(&moduledef);
3638 70 : if (m == NULL)
3639 0 : goto out;
3640 :
3641 38 : Py_INCREF((PyObject *)(void *)&PRINCIPAL_Type);
3642 70 : PyModule_AddObject(m, "PRINCIPAL", (PyObject *)(void *)&PRINCIPAL_Type);
3643 38 : Py_INCREF((PyObject *)(void *)&KEYBLOCK_Type);
3644 70 : PyModule_AddObject(m, "KEYBLOCK", (PyObject *)(void *)&KEYBLOCK_Type);
3645 38 : Py_INCREF((PyObject *)(void *)&ADDRESS_Type);
3646 70 : PyModule_AddObject(m, "ADDRESS", (PyObject *)(void *)&ADDRESS_Type);
3647 38 : Py_INCREF((PyObject *)(void *)&ADDRESSES_Type);
3648 70 : PyModule_AddObject(m, "ADDRESSES", (PyObject *)(void *)&ADDRESSES_Type);
3649 38 : Py_INCREF((PyObject *)(void *)&AUTHDATUM_Type);
3650 70 : PyModule_AddObject(m, "AUTHDATUM", (PyObject *)(void *)&AUTHDATUM_Type);
3651 38 : Py_INCREF((PyObject *)(void *)&AUTHDATA_Type);
3652 70 : PyModule_AddObject(m, "AUTHDATA", (PyObject *)(void *)&AUTHDATA_Type);
3653 38 : Py_INCREF((PyObject *)(void *)&CREDENTIAL_Type);
3654 70 : PyModule_AddObject(m, "CREDENTIAL", (PyObject *)(void *)&CREDENTIAL_Type);
3655 38 : Py_INCREF((PyObject *)(void *)&DELTATIME_TAG_Type);
3656 70 : PyModule_AddObject(m, "DELTATIME_TAG", (PyObject *)(void *)&DELTATIME_TAG_Type);
3657 38 : Py_INCREF((PyObject *)(void *)&FIELD_Type);
3658 70 : PyModule_AddObject(m, "FIELD", (PyObject *)(void *)&FIELD_Type);
3659 38 : Py_INCREF((PyObject *)(void *)&V4TAG_Type);
3660 70 : PyModule_AddObject(m, "V4TAG", (PyObject *)(void *)&V4TAG_Type);
3661 38 : Py_INCREF((PyObject *)(void *)&V4TAGS_Type);
3662 70 : PyModule_AddObject(m, "V4TAGS", (PyObject *)(void *)&V4TAGS_Type);
3663 38 : Py_INCREF((PyObject *)(void *)&V4HEADER_Type);
3664 70 : PyModule_AddObject(m, "V4HEADER", (PyObject *)(void *)&V4HEADER_Type);
3665 38 : Py_INCREF((PyObject *)(void *)&OPTIONAL_HEADER_Type);
3666 70 : PyModule_AddObject(m, "OPTIONAL_HEADER", (PyObject *)(void *)&OPTIONAL_HEADER_Type);
3667 38 : Py_INCREF((PyObject *)(void *)&CCACHE_Type);
3668 70 : PyModule_AddObject(m, "CCACHE", (PyObject *)(void *)&CCACHE_Type);
3669 38 : Py_INCREF((PyObject *)(void *)&MULTIPLE_CREDENTIALS_Type);
3670 70 : PyModule_AddObject(m, "MULTIPLE_CREDENTIALS", (PyObject *)(void *)&MULTIPLE_CREDENTIALS_Type);
3671 38 : Py_INCREF((PyObject *)(void *)&KEYTAB_KEYBLOCK_Type);
3672 70 : PyModule_AddObject(m, "KEYTAB_KEYBLOCK", (PyObject *)(void *)&KEYTAB_KEYBLOCK_Type);
3673 38 : Py_INCREF((PyObject *)(void *)&KEYTAB_PRINCIPAL_Type);
3674 70 : PyModule_AddObject(m, "KEYTAB_PRINCIPAL", (PyObject *)(void *)&KEYTAB_PRINCIPAL_Type);
3675 38 : Py_INCREF((PyObject *)(void *)&KEYTAB_ENTRY_Type);
3676 70 : PyModule_AddObject(m, "KEYTAB_ENTRY", (PyObject *)(void *)&KEYTAB_ENTRY_Type);
3677 38 : Py_INCREF((PyObject *)(void *)&KEYTAB_Type);
3678 70 : PyModule_AddObject(m, "KEYTAB", (PyObject *)(void *)&KEYTAB_Type);
3679 38 : Py_INCREF((PyObject *)(void *)&MULTIPLE_KEYTAB_ENTRIES_Type);
3680 70 : PyModule_AddObject(m, "MULTIPLE_KEYTAB_ENTRIES", (PyObject *)(void *)&MULTIPLE_KEYTAB_ENTRIES_Type);
3681 38 : Py_INCREF((PyObject *)(void *)&krb5ccache_InterfaceType);
3682 70 : PyModule_AddObject(m, "krb5ccache", (PyObject *)(void *)&krb5ccache_InterfaceType);
3683 38 : Py_INCREF((PyObject *)(void *)&krb5ccache_SyntaxType);
3684 70 : PyModule_AddObject(m, "krb5ccache_abstract_syntax", (PyObject *)(void *)&krb5ccache_SyntaxType);
3685 38 : Py_INCREF((PyObject *)(void *)&krb5ccache_SyntaxType);
3686 70 : PyModule_AddObject(m, "abstract_syntax", (PyObject *)(void *)&krb5ccache_SyntaxType);
3687 : #ifdef PY_MOD_KRB5CCACHE_PATCH
3688 : PY_MOD_KRB5CCACHE_PATCH(m);
3689 : #endif
3690 70 : out:
3691 70 : Py_XDECREF(dep_talloc);
3692 70 : Py_XDECREF(dep_samba_dcerpc_base);
3693 70 : Py_XDECREF(dep_samba_dcerpc_misc);
3694 70 : return m;
3695 :
3696 : }
|