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 krb5ccache_InterfaceType;
80 :
81 : static PyTypeObject *BaseObject_Type;
82 : static PyTypeObject *ClientConnection_Type;
83 : static PyTypeObject *ndr_syntax_id_Type;
84 :
85 0 : static PyObject *py_PRINCIPAL_get_name_type(PyObject *obj, void *closure)
86 : {
87 0 : struct PRINCIPAL *object = (struct PRINCIPAL *)pytalloc_get_ptr(obj);
88 : PyObject *py_name_type;
89 0 : py_name_type = PyLong_FromUnsignedLongLong((uint32_t)object->name_type);
90 0 : return py_name_type;
91 : }
92 :
93 66 : static int py_PRINCIPAL_set_name_type(PyObject *py_obj, PyObject *value, void *closure)
94 : {
95 66 : struct PRINCIPAL *object = (struct PRINCIPAL *)pytalloc_get_ptr(py_obj);
96 66 : if (value == NULL) {
97 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->name_type");
98 0 : return -1;
99 : }
100 : {
101 66 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->name_type));
102 66 : if (PyLong_Check(value)) {
103 : unsigned long long test_var;
104 66 : test_var = PyLong_AsUnsignedLongLong(value);
105 66 : if (PyErr_Occurred() != NULL) {
106 0 : return -1;
107 : }
108 66 : if (test_var > uint_max) {
109 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
110 : PyLong_Type.tp_name, uint_max, test_var);
111 0 : return -1;
112 : }
113 66 : object->name_type = test_var;
114 : } else {
115 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
116 : PyLong_Type.tp_name);
117 0 : return -1;
118 : }
119 : }
120 66 : return 0;
121 : }
122 :
123 0 : static PyObject *py_PRINCIPAL_get_component_count(PyObject *obj, void *closure)
124 : {
125 0 : struct PRINCIPAL *object = (struct PRINCIPAL *)pytalloc_get_ptr(obj);
126 : PyObject *py_component_count;
127 0 : py_component_count = PyLong_FromUnsignedLongLong((uint32_t)object->component_count);
128 0 : return py_component_count;
129 : }
130 :
131 66 : static int py_PRINCIPAL_set_component_count(PyObject *py_obj, PyObject *value, void *closure)
132 : {
133 66 : struct PRINCIPAL *object = (struct PRINCIPAL *)pytalloc_get_ptr(py_obj);
134 66 : if (value == NULL) {
135 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->component_count");
136 0 : return -1;
137 : }
138 : {
139 66 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->component_count));
140 66 : if (PyLong_Check(value)) {
141 : unsigned long long test_var;
142 66 : test_var = PyLong_AsUnsignedLongLong(value);
143 66 : if (PyErr_Occurred() != NULL) {
144 0 : return -1;
145 : }
146 66 : if (test_var > uint_max) {
147 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
148 : PyLong_Type.tp_name, uint_max, test_var);
149 0 : return -1;
150 : }
151 66 : object->component_count = test_var;
152 : } else {
153 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
154 : PyLong_Type.tp_name);
155 0 : return -1;
156 : }
157 : }
158 66 : return 0;
159 : }
160 :
161 0 : static PyObject *py_PRINCIPAL_get_realm(PyObject *obj, void *closure)
162 : {
163 0 : struct PRINCIPAL *object = (struct PRINCIPAL *)pytalloc_get_ptr(obj);
164 : PyObject *py_realm;
165 0 : py_realm = PyString_FromStringOrNULL(object->realm);
166 0 : return py_realm;
167 : }
168 :
169 66 : static int py_PRINCIPAL_set_realm(PyObject *py_obj, PyObject *value, void *closure)
170 : {
171 66 : struct PRINCIPAL *object = (struct PRINCIPAL *)pytalloc_get_ptr(py_obj);
172 66 : if (value == NULL) {
173 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->realm");
174 0 : return -1;
175 : }
176 : {
177 : const char *test_str;
178 : const char *talloc_str;
179 66 : PyObject *unicode = NULL;
180 66 : if (PyUnicode_Check(value)) {
181 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
182 0 : if (unicode == NULL) {
183 0 : return -1;
184 : }
185 0 : test_str = PyBytes_AS_STRING(unicode);
186 66 : } else if (PyBytes_Check(value)) {
187 66 : test_str = PyBytes_AS_STRING(value);
188 : } else {
189 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
190 0 : return -1;
191 : }
192 66 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
193 66 : if (unicode != NULL) {
194 0 : Py_DECREF(unicode);
195 : }
196 66 : if (talloc_str == NULL) {
197 0 : PyErr_NoMemory();
198 0 : return -1;
199 : }
200 66 : object->realm = talloc_str;
201 : }
202 66 : return 0;
203 : }
204 :
205 0 : static PyObject *py_PRINCIPAL_get_components(PyObject *obj, void *closure)
206 : {
207 0 : struct PRINCIPAL *object = (struct PRINCIPAL *)pytalloc_get_ptr(obj);
208 : PyObject *py_components;
209 0 : py_components = PyList_New(object->component_count);
210 0 : if (py_components == NULL) {
211 0 : return NULL;
212 : }
213 : {
214 : int components_cntr_0;
215 0 : for (components_cntr_0 = 0; components_cntr_0 < (object->component_count); components_cntr_0++) {
216 : PyObject *py_components_0;
217 0 : py_components_0 = PyString_FromStringOrNULL(object->components[components_cntr_0]);
218 0 : PyList_SetItem(py_components, components_cntr_0, py_components_0);
219 : }
220 : }
221 0 : return py_components;
222 : }
223 :
224 66 : static int py_PRINCIPAL_set_components(PyObject *py_obj, PyObject *value, void *closure)
225 : {
226 66 : struct PRINCIPAL *object = (struct PRINCIPAL *)pytalloc_get_ptr(py_obj);
227 66 : if (value == NULL) {
228 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->components");
229 0 : return -1;
230 : }
231 66 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
232 : {
233 : int components_cntr_0;
234 66 : object->components = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->components, PyList_GET_SIZE(value));
235 66 : if (!object->components) { return -1; }
236 66 : talloc_set_name_const(object->components, "ARRAY: object->components");
237 165 : for (components_cntr_0 = 0; components_cntr_0 < PyList_GET_SIZE(value); components_cntr_0++) {
238 99 : if (PyList_GET_ITEM(value, components_cntr_0) == NULL) {
239 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->components[components_cntr_0]");
240 0 : return -1;
241 : }
242 : {
243 : const char *test_str;
244 : const char *talloc_str;
245 99 : PyObject *unicode = NULL;
246 99 : if (PyUnicode_Check(PyList_GET_ITEM(value, components_cntr_0))) {
247 33 : unicode = PyUnicode_AsEncodedString(PyList_GET_ITEM(value, components_cntr_0), "utf-8", "ignore");
248 33 : if (unicode == NULL) {
249 0 : return -1;
250 : }
251 33 : test_str = PyBytes_AS_STRING(unicode);
252 66 : } else if (PyBytes_Check(PyList_GET_ITEM(value, components_cntr_0))) {
253 66 : test_str = PyBytes_AS_STRING(PyList_GET_ITEM(value, components_cntr_0));
254 : } else {
255 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(PyList_GET_ITEM(value, components_cntr_0))->tp_name);
256 0 : return -1;
257 : }
258 99 : talloc_str = talloc_strdup(object->components, test_str);
259 99 : if (unicode != NULL) {
260 21 : Py_DECREF(unicode);
261 : }
262 99 : if (talloc_str == NULL) {
263 0 : PyErr_NoMemory();
264 0 : return -1;
265 : }
266 99 : object->components[components_cntr_0] = talloc_str;
267 : }
268 : }
269 : }
270 66 : return 0;
271 : }
272 :
273 : static PyGetSetDef py_PRINCIPAL_getsetters[] = {
274 : {
275 : .name = discard_const_p(char, "name_type"),
276 : .get = py_PRINCIPAL_get_name_type,
277 : .set = py_PRINCIPAL_set_name_type,
278 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
279 : },
280 : {
281 : .name = discard_const_p(char, "component_count"),
282 : .get = py_PRINCIPAL_get_component_count,
283 : .set = py_PRINCIPAL_set_component_count,
284 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
285 : },
286 : {
287 : .name = discard_const_p(char, "realm"),
288 : .get = py_PRINCIPAL_get_realm,
289 : .set = py_PRINCIPAL_set_realm,
290 : .doc = discard_const_p(char, "PIDL-generated element of base type string")
291 : },
292 : {
293 : .name = discard_const_p(char, "components"),
294 : .get = py_PRINCIPAL_get_components,
295 : .set = py_PRINCIPAL_set_components,
296 : .doc = discard_const_p(char, "PIDL-generated element of base type string")
297 : },
298 : { .name = NULL }
299 : };
300 :
301 66 : static PyObject *py_PRINCIPAL_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
302 : {
303 66 : return pytalloc_new(struct PRINCIPAL, type);
304 : }
305 :
306 :
307 : static PyTypeObject PRINCIPAL_Type = {
308 : PyVarObject_HEAD_INIT(NULL, 0)
309 : .tp_name = "krb5ccache.PRINCIPAL",
310 : .tp_getset = py_PRINCIPAL_getsetters,
311 : .tp_methods = NULL,
312 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
313 : .tp_new = py_PRINCIPAL_new,
314 : };
315 :
316 :
317 0 : static PyObject *py_KEYBLOCK_get_enctype(PyObject *obj, void *closure)
318 : {
319 0 : struct KEYBLOCK *object = (struct KEYBLOCK *)pytalloc_get_ptr(obj);
320 : PyObject *py_enctype;
321 0 : py_enctype = PyLong_FromLong((uint16_t)object->enctype);
322 0 : return py_enctype;
323 : }
324 :
325 33 : static int py_KEYBLOCK_set_enctype(PyObject *py_obj, PyObject *value, void *closure)
326 : {
327 33 : struct KEYBLOCK *object = (struct KEYBLOCK *)pytalloc_get_ptr(py_obj);
328 33 : if (value == NULL) {
329 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->enctype");
330 0 : return -1;
331 : }
332 : {
333 33 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->enctype));
334 33 : if (PyLong_Check(value)) {
335 : unsigned long long test_var;
336 33 : test_var = PyLong_AsUnsignedLongLong(value);
337 33 : if (PyErr_Occurred() != NULL) {
338 0 : return -1;
339 : }
340 33 : if (test_var > uint_max) {
341 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
342 : PyLong_Type.tp_name, uint_max, test_var);
343 0 : return -1;
344 : }
345 33 : object->enctype = test_var;
346 : } else {
347 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
348 : PyLong_Type.tp_name);
349 0 : return -1;
350 : }
351 : }
352 33 : return 0;
353 : }
354 :
355 0 : static PyObject *py_KEYBLOCK_get_data(PyObject *obj, void *closure)
356 : {
357 0 : struct KEYBLOCK *object = (struct KEYBLOCK *)pytalloc_get_ptr(obj);
358 : PyObject *py_data;
359 0 : py_data = PyBytes_FromStringAndSize((char *)(object->data).data, (object->data).length);
360 0 : return py_data;
361 : }
362 :
363 33 : static int py_KEYBLOCK_set_data(PyObject *py_obj, PyObject *value, void *closure)
364 : {
365 33 : struct KEYBLOCK *object = (struct KEYBLOCK *)pytalloc_get_ptr(py_obj);
366 33 : if (value == NULL) {
367 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->data");
368 0 : return -1;
369 : }
370 33 : object->data = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
371 33 : return 0;
372 : }
373 :
374 : static PyGetSetDef py_KEYBLOCK_getsetters[] = {
375 : {
376 : .name = discard_const_p(char, "enctype"),
377 : .get = py_KEYBLOCK_get_enctype,
378 : .set = py_KEYBLOCK_set_enctype,
379 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
380 : },
381 : {
382 : .name = discard_const_p(char, "data"),
383 : .get = py_KEYBLOCK_get_data,
384 : .set = py_KEYBLOCK_set_data,
385 : .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
386 : },
387 : { .name = NULL }
388 : };
389 :
390 33 : static PyObject *py_KEYBLOCK_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
391 : {
392 33 : return pytalloc_new(struct KEYBLOCK, type);
393 : }
394 :
395 :
396 : static PyTypeObject KEYBLOCK_Type = {
397 : PyVarObject_HEAD_INIT(NULL, 0)
398 : .tp_name = "krb5ccache.KEYBLOCK",
399 : .tp_getset = py_KEYBLOCK_getsetters,
400 : .tp_methods = NULL,
401 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
402 : .tp_new = py_KEYBLOCK_new,
403 : };
404 :
405 :
406 0 : static PyObject *py_ADDRESS_get_addrtype(PyObject *obj, void *closure)
407 : {
408 0 : struct ADDRESS *object = (struct ADDRESS *)pytalloc_get_ptr(obj);
409 : PyObject *py_addrtype;
410 0 : py_addrtype = PyLong_FromLong((uint16_t)object->addrtype);
411 0 : return py_addrtype;
412 : }
413 :
414 0 : static int py_ADDRESS_set_addrtype(PyObject *py_obj, PyObject *value, void *closure)
415 : {
416 0 : struct ADDRESS *object = (struct ADDRESS *)pytalloc_get_ptr(py_obj);
417 0 : if (value == NULL) {
418 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->addrtype");
419 0 : return -1;
420 : }
421 : {
422 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->addrtype));
423 0 : if (PyLong_Check(value)) {
424 : unsigned long long test_var;
425 0 : test_var = PyLong_AsUnsignedLongLong(value);
426 0 : if (PyErr_Occurred() != NULL) {
427 0 : return -1;
428 : }
429 0 : if (test_var > uint_max) {
430 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
431 : PyLong_Type.tp_name, uint_max, test_var);
432 0 : return -1;
433 : }
434 0 : object->addrtype = test_var;
435 : } else {
436 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
437 : PyLong_Type.tp_name);
438 0 : return -1;
439 : }
440 : }
441 0 : return 0;
442 : }
443 :
444 0 : static PyObject *py_ADDRESS_get_data(PyObject *obj, void *closure)
445 : {
446 0 : struct ADDRESS *object = (struct ADDRESS *)pytalloc_get_ptr(obj);
447 : PyObject *py_data;
448 0 : py_data = PyBytes_FromStringAndSize((char *)(object->data).data, (object->data).length);
449 0 : return py_data;
450 : }
451 :
452 0 : static int py_ADDRESS_set_data(PyObject *py_obj, PyObject *value, void *closure)
453 : {
454 0 : struct ADDRESS *object = (struct ADDRESS *)pytalloc_get_ptr(py_obj);
455 0 : if (value == NULL) {
456 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->data");
457 0 : return -1;
458 : }
459 0 : object->data = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
460 0 : return 0;
461 : }
462 :
463 : static PyGetSetDef py_ADDRESS_getsetters[] = {
464 : {
465 : .name = discard_const_p(char, "addrtype"),
466 : .get = py_ADDRESS_get_addrtype,
467 : .set = py_ADDRESS_set_addrtype,
468 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
469 : },
470 : {
471 : .name = discard_const_p(char, "data"),
472 : .get = py_ADDRESS_get_data,
473 : .set = py_ADDRESS_set_data,
474 : .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
475 : },
476 : { .name = NULL }
477 : };
478 :
479 0 : static PyObject *py_ADDRESS_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
480 : {
481 0 : return pytalloc_new(struct ADDRESS, type);
482 : }
483 :
484 :
485 : static PyTypeObject ADDRESS_Type = {
486 : PyVarObject_HEAD_INIT(NULL, 0)
487 : .tp_name = "krb5ccache.ADDRESS",
488 : .tp_getset = py_ADDRESS_getsetters,
489 : .tp_methods = NULL,
490 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
491 : .tp_new = py_ADDRESS_new,
492 : };
493 :
494 :
495 0 : static PyObject *py_ADDRESSES_get_count(PyObject *obj, void *closure)
496 : {
497 0 : struct ADDRESSES *object = (struct ADDRESSES *)pytalloc_get_ptr(obj);
498 : PyObject *py_count;
499 0 : py_count = PyLong_FromUnsignedLongLong((uint32_t)object->count);
500 0 : return py_count;
501 : }
502 :
503 33 : static int py_ADDRESSES_set_count(PyObject *py_obj, PyObject *value, void *closure)
504 : {
505 33 : struct ADDRESSES *object = (struct ADDRESSES *)pytalloc_get_ptr(py_obj);
506 33 : if (value == NULL) {
507 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->count");
508 0 : return -1;
509 : }
510 : {
511 33 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->count));
512 33 : if (PyLong_Check(value)) {
513 : unsigned long long test_var;
514 33 : test_var = PyLong_AsUnsignedLongLong(value);
515 33 : if (PyErr_Occurred() != NULL) {
516 0 : return -1;
517 : }
518 33 : if (test_var > uint_max) {
519 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
520 : PyLong_Type.tp_name, uint_max, test_var);
521 0 : return -1;
522 : }
523 33 : object->count = test_var;
524 : } else {
525 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
526 : PyLong_Type.tp_name);
527 0 : return -1;
528 : }
529 : }
530 33 : return 0;
531 : }
532 :
533 0 : static PyObject *py_ADDRESSES_get_data(PyObject *obj, void *closure)
534 : {
535 0 : struct ADDRESSES *object = (struct ADDRESSES *)pytalloc_get_ptr(obj);
536 : PyObject *py_data;
537 0 : py_data = PyList_New(object->count);
538 0 : if (py_data == NULL) {
539 0 : return NULL;
540 : }
541 : {
542 : int data_cntr_0;
543 0 : for (data_cntr_0 = 0; data_cntr_0 < (object->count); data_cntr_0++) {
544 : PyObject *py_data_0;
545 0 : py_data_0 = pytalloc_reference_ex(&ADDRESS_Type, object->data, &object->data[data_cntr_0]);
546 0 : PyList_SetItem(py_data, data_cntr_0, py_data_0);
547 : }
548 : }
549 0 : return py_data;
550 : }
551 :
552 33 : static int py_ADDRESSES_set_data(PyObject *py_obj, PyObject *value, void *closure)
553 : {
554 33 : struct ADDRESSES *object = (struct ADDRESSES *)pytalloc_get_ptr(py_obj);
555 33 : if (value == NULL) {
556 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->data");
557 0 : return -1;
558 : }
559 33 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
560 : {
561 : int data_cntr_0;
562 33 : object->data = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->data, PyList_GET_SIZE(value));
563 33 : if (!object->data) { return -1; }
564 33 : talloc_set_name_const(object->data, "ARRAY: object->data");
565 33 : for (data_cntr_0 = 0; data_cntr_0 < PyList_GET_SIZE(value); data_cntr_0++) {
566 0 : if (PyList_GET_ITEM(value, data_cntr_0) == NULL) {
567 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->data[data_cntr_0]");
568 0 : return -1;
569 : }
570 0 : PY_CHECK_TYPE(&ADDRESS_Type, PyList_GET_ITEM(value, data_cntr_0), return -1;);
571 0 : if (talloc_reference(object->data, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, data_cntr_0))) == NULL) {
572 0 : PyErr_NoMemory();
573 0 : return -1;
574 : }
575 0 : object->data[data_cntr_0] = *(struct ADDRESS *)pytalloc_get_ptr(PyList_GET_ITEM(value, data_cntr_0));
576 : }
577 : }
578 33 : return 0;
579 : }
580 :
581 : static PyGetSetDef py_ADDRESSES_getsetters[] = {
582 : {
583 : .name = discard_const_p(char, "count"),
584 : .get = py_ADDRESSES_get_count,
585 : .set = py_ADDRESSES_set_count,
586 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
587 : },
588 : {
589 : .name = discard_const_p(char, "data"),
590 : .get = py_ADDRESSES_get_data,
591 : .set = py_ADDRESSES_set_data,
592 : .doc = discard_const_p(char, "PIDL-generated element of base type ADDRESS")
593 : },
594 : { .name = NULL }
595 : };
596 :
597 33 : static PyObject *py_ADDRESSES_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
598 : {
599 33 : return pytalloc_new(struct ADDRESSES, type);
600 : }
601 :
602 :
603 : static PyTypeObject ADDRESSES_Type = {
604 : PyVarObject_HEAD_INIT(NULL, 0)
605 : .tp_name = "krb5ccache.ADDRESSES",
606 : .tp_getset = py_ADDRESSES_getsetters,
607 : .tp_methods = NULL,
608 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
609 : .tp_new = py_ADDRESSES_new,
610 : };
611 :
612 :
613 0 : static PyObject *py_AUTHDATUM_get_ad_type(PyObject *obj, void *closure)
614 : {
615 0 : struct AUTHDATUM *object = (struct AUTHDATUM *)pytalloc_get_ptr(obj);
616 : PyObject *py_ad_type;
617 0 : py_ad_type = PyLong_FromLong((uint16_t)object->ad_type);
618 0 : return py_ad_type;
619 : }
620 :
621 0 : static int py_AUTHDATUM_set_ad_type(PyObject *py_obj, PyObject *value, void *closure)
622 : {
623 0 : struct AUTHDATUM *object = (struct AUTHDATUM *)pytalloc_get_ptr(py_obj);
624 0 : if (value == NULL) {
625 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->ad_type");
626 0 : return -1;
627 : }
628 : {
629 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->ad_type));
630 0 : if (PyLong_Check(value)) {
631 : unsigned long long test_var;
632 0 : test_var = PyLong_AsUnsignedLongLong(value);
633 0 : if (PyErr_Occurred() != NULL) {
634 0 : return -1;
635 : }
636 0 : if (test_var > uint_max) {
637 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
638 : PyLong_Type.tp_name, uint_max, test_var);
639 0 : return -1;
640 : }
641 0 : object->ad_type = test_var;
642 : } else {
643 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
644 : PyLong_Type.tp_name);
645 0 : return -1;
646 : }
647 : }
648 0 : return 0;
649 : }
650 :
651 0 : static PyObject *py_AUTHDATUM_get_data(PyObject *obj, void *closure)
652 : {
653 0 : struct AUTHDATUM *object = (struct AUTHDATUM *)pytalloc_get_ptr(obj);
654 : PyObject *py_data;
655 0 : py_data = PyBytes_FromStringAndSize((char *)(object->data).data, (object->data).length);
656 0 : return py_data;
657 : }
658 :
659 0 : static int py_AUTHDATUM_set_data(PyObject *py_obj, PyObject *value, void *closure)
660 : {
661 0 : struct AUTHDATUM *object = (struct AUTHDATUM *)pytalloc_get_ptr(py_obj);
662 0 : if (value == NULL) {
663 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->data");
664 0 : return -1;
665 : }
666 0 : object->data = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
667 0 : return 0;
668 : }
669 :
670 : static PyGetSetDef py_AUTHDATUM_getsetters[] = {
671 : {
672 : .name = discard_const_p(char, "ad_type"),
673 : .get = py_AUTHDATUM_get_ad_type,
674 : .set = py_AUTHDATUM_set_ad_type,
675 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
676 : },
677 : {
678 : .name = discard_const_p(char, "data"),
679 : .get = py_AUTHDATUM_get_data,
680 : .set = py_AUTHDATUM_set_data,
681 : .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
682 : },
683 : { .name = NULL }
684 : };
685 :
686 0 : static PyObject *py_AUTHDATUM_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
687 : {
688 0 : return pytalloc_new(struct AUTHDATUM, type);
689 : }
690 :
691 :
692 : static PyTypeObject AUTHDATUM_Type = {
693 : PyVarObject_HEAD_INIT(NULL, 0)
694 : .tp_name = "krb5ccache.AUTHDATUM",
695 : .tp_getset = py_AUTHDATUM_getsetters,
696 : .tp_methods = NULL,
697 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
698 : .tp_new = py_AUTHDATUM_new,
699 : };
700 :
701 :
702 0 : static PyObject *py_AUTHDATA_get_count(PyObject *obj, void *closure)
703 : {
704 0 : struct AUTHDATA *object = (struct AUTHDATA *)pytalloc_get_ptr(obj);
705 : PyObject *py_count;
706 0 : py_count = PyLong_FromUnsignedLongLong((uint32_t)object->count);
707 0 : return py_count;
708 : }
709 :
710 33 : static int py_AUTHDATA_set_count(PyObject *py_obj, PyObject *value, void *closure)
711 : {
712 33 : struct AUTHDATA *object = (struct AUTHDATA *)pytalloc_get_ptr(py_obj);
713 33 : if (value == NULL) {
714 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->count");
715 0 : return -1;
716 : }
717 : {
718 33 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->count));
719 33 : if (PyLong_Check(value)) {
720 : unsigned long long test_var;
721 33 : test_var = PyLong_AsUnsignedLongLong(value);
722 33 : if (PyErr_Occurred() != NULL) {
723 0 : return -1;
724 : }
725 33 : if (test_var > uint_max) {
726 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
727 : PyLong_Type.tp_name, uint_max, test_var);
728 0 : return -1;
729 : }
730 33 : object->count = test_var;
731 : } else {
732 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
733 : PyLong_Type.tp_name);
734 0 : return -1;
735 : }
736 : }
737 33 : return 0;
738 : }
739 :
740 0 : static PyObject *py_AUTHDATA_get_data(PyObject *obj, void *closure)
741 : {
742 0 : struct AUTHDATA *object = (struct AUTHDATA *)pytalloc_get_ptr(obj);
743 : PyObject *py_data;
744 0 : py_data = PyList_New(object->count);
745 0 : if (py_data == NULL) {
746 0 : return NULL;
747 : }
748 : {
749 : int data_cntr_0;
750 0 : for (data_cntr_0 = 0; data_cntr_0 < (object->count); data_cntr_0++) {
751 : PyObject *py_data_0;
752 0 : py_data_0 = pytalloc_reference_ex(&AUTHDATUM_Type, object->data, &object->data[data_cntr_0]);
753 0 : PyList_SetItem(py_data, data_cntr_0, py_data_0);
754 : }
755 : }
756 0 : return py_data;
757 : }
758 :
759 33 : static int py_AUTHDATA_set_data(PyObject *py_obj, PyObject *value, void *closure)
760 : {
761 33 : struct AUTHDATA *object = (struct AUTHDATA *)pytalloc_get_ptr(py_obj);
762 33 : if (value == NULL) {
763 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->data");
764 0 : return -1;
765 : }
766 33 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
767 : {
768 : int data_cntr_0;
769 33 : object->data = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->data, PyList_GET_SIZE(value));
770 33 : if (!object->data) { return -1; }
771 33 : talloc_set_name_const(object->data, "ARRAY: object->data");
772 33 : for (data_cntr_0 = 0; data_cntr_0 < PyList_GET_SIZE(value); data_cntr_0++) {
773 0 : if (PyList_GET_ITEM(value, data_cntr_0) == NULL) {
774 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->data[data_cntr_0]");
775 0 : return -1;
776 : }
777 0 : PY_CHECK_TYPE(&AUTHDATUM_Type, PyList_GET_ITEM(value, data_cntr_0), return -1;);
778 0 : if (talloc_reference(object->data, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, data_cntr_0))) == NULL) {
779 0 : PyErr_NoMemory();
780 0 : return -1;
781 : }
782 0 : object->data[data_cntr_0] = *(struct AUTHDATUM *)pytalloc_get_ptr(PyList_GET_ITEM(value, data_cntr_0));
783 : }
784 : }
785 33 : return 0;
786 : }
787 :
788 : static PyGetSetDef py_AUTHDATA_getsetters[] = {
789 : {
790 : .name = discard_const_p(char, "count"),
791 : .get = py_AUTHDATA_get_count,
792 : .set = py_AUTHDATA_set_count,
793 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
794 : },
795 : {
796 : .name = discard_const_p(char, "data"),
797 : .get = py_AUTHDATA_get_data,
798 : .set = py_AUTHDATA_set_data,
799 : .doc = discard_const_p(char, "PIDL-generated element of base type AUTHDATUM")
800 : },
801 : { .name = NULL }
802 : };
803 :
804 33 : static PyObject *py_AUTHDATA_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
805 : {
806 33 : return pytalloc_new(struct AUTHDATA, type);
807 : }
808 :
809 :
810 : static PyTypeObject AUTHDATA_Type = {
811 : PyVarObject_HEAD_INIT(NULL, 0)
812 : .tp_name = "krb5ccache.AUTHDATA",
813 : .tp_getset = py_AUTHDATA_getsetters,
814 : .tp_methods = NULL,
815 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
816 : .tp_new = py_AUTHDATA_new,
817 : };
818 :
819 :
820 0 : static PyObject *py_CREDENTIAL_get_client(PyObject *obj, void *closure)
821 : {
822 0 : struct CREDENTIAL *object = (struct CREDENTIAL *)pytalloc_get_ptr(obj);
823 : PyObject *py_client;
824 0 : py_client = pytalloc_reference_ex(&PRINCIPAL_Type, pytalloc_get_mem_ctx(obj), &object->client);
825 0 : return py_client;
826 : }
827 :
828 33 : static int py_CREDENTIAL_set_client(PyObject *py_obj, PyObject *value, void *closure)
829 : {
830 33 : struct CREDENTIAL *object = (struct CREDENTIAL *)pytalloc_get_ptr(py_obj);
831 33 : if (value == NULL) {
832 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->client");
833 0 : return -1;
834 : }
835 33 : PY_CHECK_TYPE(&PRINCIPAL_Type, value, return -1;);
836 33 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
837 0 : PyErr_NoMemory();
838 0 : return -1;
839 : }
840 33 : object->client = *(struct PRINCIPAL *)pytalloc_get_ptr(value);
841 33 : return 0;
842 : }
843 :
844 0 : static PyObject *py_CREDENTIAL_get_server(PyObject *obj, void *closure)
845 : {
846 0 : struct CREDENTIAL *object = (struct CREDENTIAL *)pytalloc_get_ptr(obj);
847 : PyObject *py_server;
848 0 : py_server = pytalloc_reference_ex(&PRINCIPAL_Type, pytalloc_get_mem_ctx(obj), &object->server);
849 0 : return py_server;
850 : }
851 :
852 33 : static int py_CREDENTIAL_set_server(PyObject *py_obj, PyObject *value, void *closure)
853 : {
854 33 : struct CREDENTIAL *object = (struct CREDENTIAL *)pytalloc_get_ptr(py_obj);
855 33 : if (value == NULL) {
856 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->server");
857 0 : return -1;
858 : }
859 33 : PY_CHECK_TYPE(&PRINCIPAL_Type, value, return -1;);
860 33 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
861 0 : PyErr_NoMemory();
862 0 : return -1;
863 : }
864 33 : object->server = *(struct PRINCIPAL *)pytalloc_get_ptr(value);
865 33 : return 0;
866 : }
867 :
868 0 : static PyObject *py_CREDENTIAL_get_keyblock(PyObject *obj, void *closure)
869 : {
870 0 : struct CREDENTIAL *object = (struct CREDENTIAL *)pytalloc_get_ptr(obj);
871 : PyObject *py_keyblock;
872 0 : py_keyblock = pytalloc_reference_ex(&KEYBLOCK_Type, pytalloc_get_mem_ctx(obj), &object->keyblock);
873 0 : return py_keyblock;
874 : }
875 :
876 33 : static int py_CREDENTIAL_set_keyblock(PyObject *py_obj, PyObject *value, void *closure)
877 : {
878 33 : struct CREDENTIAL *object = (struct CREDENTIAL *)pytalloc_get_ptr(py_obj);
879 33 : if (value == NULL) {
880 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->keyblock");
881 0 : return -1;
882 : }
883 33 : PY_CHECK_TYPE(&KEYBLOCK_Type, value, return -1;);
884 33 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
885 0 : PyErr_NoMemory();
886 0 : return -1;
887 : }
888 33 : object->keyblock = *(struct KEYBLOCK *)pytalloc_get_ptr(value);
889 33 : return 0;
890 : }
891 :
892 33 : static PyObject *py_CREDENTIAL_get_authtime(PyObject *obj, void *closure)
893 : {
894 33 : struct CREDENTIAL *object = (struct CREDENTIAL *)pytalloc_get_ptr(obj);
895 : PyObject *py_authtime;
896 33 : py_authtime = PyLong_FromUnsignedLongLong((uint32_t)object->authtime);
897 33 : return py_authtime;
898 : }
899 :
900 33 : static int py_CREDENTIAL_set_authtime(PyObject *py_obj, PyObject *value, void *closure)
901 : {
902 33 : struct CREDENTIAL *object = (struct CREDENTIAL *)pytalloc_get_ptr(py_obj);
903 33 : if (value == NULL) {
904 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->authtime");
905 0 : return -1;
906 : }
907 : {
908 33 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->authtime));
909 33 : if (PyLong_Check(value)) {
910 : unsigned long long test_var;
911 33 : test_var = PyLong_AsUnsignedLongLong(value);
912 33 : if (PyErr_Occurred() != NULL) {
913 0 : return -1;
914 : }
915 33 : if (test_var > uint_max) {
916 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
917 : PyLong_Type.tp_name, uint_max, test_var);
918 0 : return -1;
919 : }
920 33 : object->authtime = test_var;
921 : } else {
922 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
923 : PyLong_Type.tp_name);
924 0 : return -1;
925 : }
926 : }
927 33 : return 0;
928 : }
929 :
930 33 : static PyObject *py_CREDENTIAL_get_starttime(PyObject *obj, void *closure)
931 : {
932 33 : struct CREDENTIAL *object = (struct CREDENTIAL *)pytalloc_get_ptr(obj);
933 : PyObject *py_starttime;
934 33 : py_starttime = PyLong_FromUnsignedLongLong((uint32_t)object->starttime);
935 33 : return py_starttime;
936 : }
937 :
938 33 : static int py_CREDENTIAL_set_starttime(PyObject *py_obj, PyObject *value, void *closure)
939 : {
940 33 : struct CREDENTIAL *object = (struct CREDENTIAL *)pytalloc_get_ptr(py_obj);
941 33 : if (value == NULL) {
942 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->starttime");
943 0 : return -1;
944 : }
945 : {
946 33 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->starttime));
947 33 : if (PyLong_Check(value)) {
948 : unsigned long long test_var;
949 33 : test_var = PyLong_AsUnsignedLongLong(value);
950 33 : if (PyErr_Occurred() != NULL) {
951 0 : return -1;
952 : }
953 33 : if (test_var > uint_max) {
954 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
955 : PyLong_Type.tp_name, uint_max, test_var);
956 0 : return -1;
957 : }
958 33 : object->starttime = test_var;
959 : } else {
960 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
961 : PyLong_Type.tp_name);
962 0 : return -1;
963 : }
964 : }
965 33 : return 0;
966 : }
967 :
968 66 : static PyObject *py_CREDENTIAL_get_endtime(PyObject *obj, void *closure)
969 : {
970 66 : struct CREDENTIAL *object = (struct CREDENTIAL *)pytalloc_get_ptr(obj);
971 : PyObject *py_endtime;
972 66 : py_endtime = PyLong_FromUnsignedLongLong((uint32_t)object->endtime);
973 66 : return py_endtime;
974 : }
975 :
976 33 : static int py_CREDENTIAL_set_endtime(PyObject *py_obj, PyObject *value, void *closure)
977 : {
978 33 : struct CREDENTIAL *object = (struct CREDENTIAL *)pytalloc_get_ptr(py_obj);
979 33 : if (value == NULL) {
980 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->endtime");
981 0 : return -1;
982 : }
983 : {
984 33 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->endtime));
985 33 : if (PyLong_Check(value)) {
986 : unsigned long long test_var;
987 33 : test_var = PyLong_AsUnsignedLongLong(value);
988 33 : if (PyErr_Occurred() != NULL) {
989 0 : return -1;
990 : }
991 33 : if (test_var > uint_max) {
992 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
993 : PyLong_Type.tp_name, uint_max, test_var);
994 0 : return -1;
995 : }
996 33 : object->endtime = test_var;
997 : } else {
998 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
999 : PyLong_Type.tp_name);
1000 0 : return -1;
1001 : }
1002 : }
1003 33 : return 0;
1004 : }
1005 :
1006 0 : static PyObject *py_CREDENTIAL_get_renew_till(PyObject *obj, void *closure)
1007 : {
1008 0 : struct CREDENTIAL *object = (struct CREDENTIAL *)pytalloc_get_ptr(obj);
1009 : PyObject *py_renew_till;
1010 0 : py_renew_till = PyLong_FromUnsignedLongLong((uint32_t)object->renew_till);
1011 0 : return py_renew_till;
1012 : }
1013 :
1014 33 : static int py_CREDENTIAL_set_renew_till(PyObject *py_obj, PyObject *value, void *closure)
1015 : {
1016 33 : struct CREDENTIAL *object = (struct CREDENTIAL *)pytalloc_get_ptr(py_obj);
1017 33 : if (value == NULL) {
1018 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->renew_till");
1019 0 : return -1;
1020 : }
1021 : {
1022 33 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->renew_till));
1023 33 : if (PyLong_Check(value)) {
1024 : unsigned long long test_var;
1025 33 : test_var = PyLong_AsUnsignedLongLong(value);
1026 33 : if (PyErr_Occurred() != NULL) {
1027 0 : return -1;
1028 : }
1029 33 : if (test_var > uint_max) {
1030 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1031 : PyLong_Type.tp_name, uint_max, test_var);
1032 0 : return -1;
1033 : }
1034 33 : object->renew_till = test_var;
1035 : } else {
1036 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1037 : PyLong_Type.tp_name);
1038 0 : return -1;
1039 : }
1040 : }
1041 33 : return 0;
1042 : }
1043 :
1044 0 : static PyObject *py_CREDENTIAL_get_is_skey(PyObject *obj, void *closure)
1045 : {
1046 0 : struct CREDENTIAL *object = (struct CREDENTIAL *)pytalloc_get_ptr(obj);
1047 : PyObject *py_is_skey;
1048 0 : py_is_skey = PyLong_FromLong((uint16_t)object->is_skey);
1049 0 : return py_is_skey;
1050 : }
1051 :
1052 33 : static int py_CREDENTIAL_set_is_skey(PyObject *py_obj, PyObject *value, void *closure)
1053 : {
1054 33 : struct CREDENTIAL *object = (struct CREDENTIAL *)pytalloc_get_ptr(py_obj);
1055 33 : if (value == NULL) {
1056 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->is_skey");
1057 0 : return -1;
1058 : }
1059 : {
1060 33 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->is_skey));
1061 33 : if (PyLong_Check(value)) {
1062 : unsigned long long test_var;
1063 33 : test_var = PyLong_AsUnsignedLongLong(value);
1064 33 : if (PyErr_Occurred() != NULL) {
1065 0 : return -1;
1066 : }
1067 33 : if (test_var > uint_max) {
1068 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1069 : PyLong_Type.tp_name, uint_max, test_var);
1070 0 : return -1;
1071 : }
1072 33 : object->is_skey = test_var;
1073 : } else {
1074 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1075 : PyLong_Type.tp_name);
1076 0 : return -1;
1077 : }
1078 : }
1079 33 : return 0;
1080 : }
1081 :
1082 0 : static PyObject *py_CREDENTIAL_get_ticket_flags(PyObject *obj, void *closure)
1083 : {
1084 0 : struct CREDENTIAL *object = (struct CREDENTIAL *)pytalloc_get_ptr(obj);
1085 : PyObject *py_ticket_flags;
1086 0 : py_ticket_flags = PyLong_FromUnsignedLongLong((uint32_t)object->ticket_flags);
1087 0 : return py_ticket_flags;
1088 : }
1089 :
1090 33 : static int py_CREDENTIAL_set_ticket_flags(PyObject *py_obj, PyObject *value, void *closure)
1091 : {
1092 33 : struct CREDENTIAL *object = (struct CREDENTIAL *)pytalloc_get_ptr(py_obj);
1093 33 : if (value == NULL) {
1094 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->ticket_flags");
1095 0 : return -1;
1096 : }
1097 : {
1098 33 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->ticket_flags));
1099 33 : if (PyLong_Check(value)) {
1100 : unsigned long long test_var;
1101 33 : test_var = PyLong_AsUnsignedLongLong(value);
1102 33 : if (PyErr_Occurred() != NULL) {
1103 0 : return -1;
1104 : }
1105 33 : if (test_var > uint_max) {
1106 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1107 : PyLong_Type.tp_name, uint_max, test_var);
1108 0 : return -1;
1109 : }
1110 33 : object->ticket_flags = test_var;
1111 : } else {
1112 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1113 : PyLong_Type.tp_name);
1114 0 : return -1;
1115 : }
1116 : }
1117 33 : return 0;
1118 : }
1119 :
1120 0 : static PyObject *py_CREDENTIAL_get_addresses(PyObject *obj, void *closure)
1121 : {
1122 0 : struct CREDENTIAL *object = (struct CREDENTIAL *)pytalloc_get_ptr(obj);
1123 : PyObject *py_addresses;
1124 0 : py_addresses = pytalloc_reference_ex(&ADDRESSES_Type, pytalloc_get_mem_ctx(obj), &object->addresses);
1125 0 : return py_addresses;
1126 : }
1127 :
1128 33 : static int py_CREDENTIAL_set_addresses(PyObject *py_obj, PyObject *value, void *closure)
1129 : {
1130 33 : struct CREDENTIAL *object = (struct CREDENTIAL *)pytalloc_get_ptr(py_obj);
1131 33 : if (value == NULL) {
1132 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->addresses");
1133 0 : return -1;
1134 : }
1135 33 : PY_CHECK_TYPE(&ADDRESSES_Type, value, return -1;);
1136 33 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
1137 0 : PyErr_NoMemory();
1138 0 : return -1;
1139 : }
1140 33 : object->addresses = *(struct ADDRESSES *)pytalloc_get_ptr(value);
1141 33 : return 0;
1142 : }
1143 :
1144 0 : static PyObject *py_CREDENTIAL_get_authdata(PyObject *obj, void *closure)
1145 : {
1146 0 : struct CREDENTIAL *object = (struct CREDENTIAL *)pytalloc_get_ptr(obj);
1147 : PyObject *py_authdata;
1148 0 : py_authdata = pytalloc_reference_ex(&AUTHDATA_Type, pytalloc_get_mem_ctx(obj), &object->authdata);
1149 0 : return py_authdata;
1150 : }
1151 :
1152 33 : static int py_CREDENTIAL_set_authdata(PyObject *py_obj, PyObject *value, void *closure)
1153 : {
1154 33 : struct CREDENTIAL *object = (struct CREDENTIAL *)pytalloc_get_ptr(py_obj);
1155 33 : if (value == NULL) {
1156 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->authdata");
1157 0 : return -1;
1158 : }
1159 33 : PY_CHECK_TYPE(&AUTHDATA_Type, value, return -1;);
1160 33 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
1161 0 : PyErr_NoMemory();
1162 0 : return -1;
1163 : }
1164 33 : object->authdata = *(struct AUTHDATA *)pytalloc_get_ptr(value);
1165 33 : return 0;
1166 : }
1167 :
1168 0 : static PyObject *py_CREDENTIAL_get_ticket(PyObject *obj, void *closure)
1169 : {
1170 0 : struct CREDENTIAL *object = (struct CREDENTIAL *)pytalloc_get_ptr(obj);
1171 : PyObject *py_ticket;
1172 0 : py_ticket = PyBytes_FromStringAndSize((char *)(object->ticket).data, (object->ticket).length);
1173 0 : return py_ticket;
1174 : }
1175 :
1176 33 : static int py_CREDENTIAL_set_ticket(PyObject *py_obj, PyObject *value, void *closure)
1177 : {
1178 33 : struct CREDENTIAL *object = (struct CREDENTIAL *)pytalloc_get_ptr(py_obj);
1179 33 : if (value == NULL) {
1180 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->ticket");
1181 0 : return -1;
1182 : }
1183 33 : object->ticket = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
1184 33 : return 0;
1185 : }
1186 :
1187 0 : static PyObject *py_CREDENTIAL_get_second_ticket(PyObject *obj, void *closure)
1188 : {
1189 0 : struct CREDENTIAL *object = (struct CREDENTIAL *)pytalloc_get_ptr(obj);
1190 : PyObject *py_second_ticket;
1191 0 : py_second_ticket = PyBytes_FromStringAndSize((char *)(object->second_ticket).data, (object->second_ticket).length);
1192 0 : return py_second_ticket;
1193 : }
1194 :
1195 33 : static int py_CREDENTIAL_set_second_ticket(PyObject *py_obj, PyObject *value, void *closure)
1196 : {
1197 33 : struct CREDENTIAL *object = (struct CREDENTIAL *)pytalloc_get_ptr(py_obj);
1198 33 : if (value == NULL) {
1199 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->second_ticket");
1200 0 : return -1;
1201 : }
1202 33 : object->second_ticket = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
1203 33 : return 0;
1204 : }
1205 :
1206 : static PyGetSetDef py_CREDENTIAL_getsetters[] = {
1207 : {
1208 : .name = discard_const_p(char, "client"),
1209 : .get = py_CREDENTIAL_get_client,
1210 : .set = py_CREDENTIAL_set_client,
1211 : .doc = discard_const_p(char, "PIDL-generated element of base type PRINCIPAL")
1212 : },
1213 : {
1214 : .name = discard_const_p(char, "server"),
1215 : .get = py_CREDENTIAL_get_server,
1216 : .set = py_CREDENTIAL_set_server,
1217 : .doc = discard_const_p(char, "PIDL-generated element of base type PRINCIPAL")
1218 : },
1219 : {
1220 : .name = discard_const_p(char, "keyblock"),
1221 : .get = py_CREDENTIAL_get_keyblock,
1222 : .set = py_CREDENTIAL_set_keyblock,
1223 : .doc = discard_const_p(char, "PIDL-generated element of base type KEYBLOCK")
1224 : },
1225 : {
1226 : .name = discard_const_p(char, "authtime"),
1227 : .get = py_CREDENTIAL_get_authtime,
1228 : .set = py_CREDENTIAL_set_authtime,
1229 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
1230 : },
1231 : {
1232 : .name = discard_const_p(char, "starttime"),
1233 : .get = py_CREDENTIAL_get_starttime,
1234 : .set = py_CREDENTIAL_set_starttime,
1235 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
1236 : },
1237 : {
1238 : .name = discard_const_p(char, "endtime"),
1239 : .get = py_CREDENTIAL_get_endtime,
1240 : .set = py_CREDENTIAL_set_endtime,
1241 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
1242 : },
1243 : {
1244 : .name = discard_const_p(char, "renew_till"),
1245 : .get = py_CREDENTIAL_get_renew_till,
1246 : .set = py_CREDENTIAL_set_renew_till,
1247 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
1248 : },
1249 : {
1250 : .name = discard_const_p(char, "is_skey"),
1251 : .get = py_CREDENTIAL_get_is_skey,
1252 : .set = py_CREDENTIAL_set_is_skey,
1253 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
1254 : },
1255 : {
1256 : .name = discard_const_p(char, "ticket_flags"),
1257 : .get = py_CREDENTIAL_get_ticket_flags,
1258 : .set = py_CREDENTIAL_set_ticket_flags,
1259 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
1260 : },
1261 : {
1262 : .name = discard_const_p(char, "addresses"),
1263 : .get = py_CREDENTIAL_get_addresses,
1264 : .set = py_CREDENTIAL_set_addresses,
1265 : .doc = discard_const_p(char, "PIDL-generated element of base type ADDRESSES")
1266 : },
1267 : {
1268 : .name = discard_const_p(char, "authdata"),
1269 : .get = py_CREDENTIAL_get_authdata,
1270 : .set = py_CREDENTIAL_set_authdata,
1271 : .doc = discard_const_p(char, "PIDL-generated element of base type AUTHDATA")
1272 : },
1273 : {
1274 : .name = discard_const_p(char, "ticket"),
1275 : .get = py_CREDENTIAL_get_ticket,
1276 : .set = py_CREDENTIAL_set_ticket,
1277 : .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
1278 : },
1279 : {
1280 : .name = discard_const_p(char, "second_ticket"),
1281 : .get = py_CREDENTIAL_get_second_ticket,
1282 : .set = py_CREDENTIAL_set_second_ticket,
1283 : .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
1284 : },
1285 : { .name = NULL }
1286 : };
1287 :
1288 33 : static PyObject *py_CREDENTIAL_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1289 : {
1290 33 : return pytalloc_new(struct CREDENTIAL, type);
1291 : }
1292 :
1293 :
1294 : static PyTypeObject CREDENTIAL_Type = {
1295 : PyVarObject_HEAD_INIT(NULL, 0)
1296 : .tp_name = "krb5ccache.CREDENTIAL",
1297 : .tp_getset = py_CREDENTIAL_getsetters,
1298 : .tp_methods = NULL,
1299 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1300 : .tp_new = py_CREDENTIAL_new,
1301 : };
1302 :
1303 :
1304 0 : static PyObject *py_DELTATIME_TAG_get_kdc_sec_offset(PyObject *obj, void *closure)
1305 : {
1306 0 : struct DELTATIME_TAG *object = (struct DELTATIME_TAG *)pytalloc_get_ptr(obj);
1307 : PyObject *py_kdc_sec_offset;
1308 0 : py_kdc_sec_offset = PyLong_FromLong(object->kdc_sec_offset);
1309 0 : return py_kdc_sec_offset;
1310 : }
1311 :
1312 33 : static int py_DELTATIME_TAG_set_kdc_sec_offset(PyObject *py_obj, PyObject *value, void *closure)
1313 : {
1314 33 : struct DELTATIME_TAG *object = (struct DELTATIME_TAG *)pytalloc_get_ptr(py_obj);
1315 33 : if (value == NULL) {
1316 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->kdc_sec_offset");
1317 0 : return -1;
1318 : }
1319 : {
1320 33 : const long long int_max = ndr_sizeof2intmax(sizeof(object->kdc_sec_offset));
1321 33 : const long long int_min = -int_max - 1;
1322 33 : if (PyLong_Check(value)) {
1323 : long long test_var;
1324 33 : test_var = PyLong_AsLongLong(value);
1325 33 : if (PyErr_Occurred() != NULL) {
1326 0 : return -1;
1327 : }
1328 33 : if (test_var < int_min || test_var > int_max) {
1329 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range %lld - %lld, got %lld",
1330 : PyLong_Type.tp_name, int_min, int_max, test_var);
1331 0 : return -1;
1332 : }
1333 33 : object->kdc_sec_offset = test_var;
1334 : } else {
1335 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1336 : PyLong_Type.tp_name);
1337 0 : return -1;
1338 : }
1339 : }
1340 33 : return 0;
1341 : }
1342 :
1343 0 : static PyObject *py_DELTATIME_TAG_get_kdc_usec_offset(PyObject *obj, void *closure)
1344 : {
1345 0 : struct DELTATIME_TAG *object = (struct DELTATIME_TAG *)pytalloc_get_ptr(obj);
1346 : PyObject *py_kdc_usec_offset;
1347 0 : py_kdc_usec_offset = PyLong_FromLong(object->kdc_usec_offset);
1348 0 : return py_kdc_usec_offset;
1349 : }
1350 :
1351 33 : static int py_DELTATIME_TAG_set_kdc_usec_offset(PyObject *py_obj, PyObject *value, void *closure)
1352 : {
1353 33 : struct DELTATIME_TAG *object = (struct DELTATIME_TAG *)pytalloc_get_ptr(py_obj);
1354 33 : if (value == NULL) {
1355 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->kdc_usec_offset");
1356 0 : return -1;
1357 : }
1358 : {
1359 33 : const long long int_max = ndr_sizeof2intmax(sizeof(object->kdc_usec_offset));
1360 33 : const long long int_min = -int_max - 1;
1361 33 : if (PyLong_Check(value)) {
1362 : long long test_var;
1363 33 : test_var = PyLong_AsLongLong(value);
1364 33 : if (PyErr_Occurred() != NULL) {
1365 0 : return -1;
1366 : }
1367 33 : if (test_var < int_min || test_var > int_max) {
1368 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range %lld - %lld, got %lld",
1369 : PyLong_Type.tp_name, int_min, int_max, test_var);
1370 0 : return -1;
1371 : }
1372 33 : object->kdc_usec_offset = test_var;
1373 : } else {
1374 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1375 : PyLong_Type.tp_name);
1376 0 : return -1;
1377 : }
1378 : }
1379 33 : return 0;
1380 : }
1381 :
1382 : static PyGetSetDef py_DELTATIME_TAG_getsetters[] = {
1383 : {
1384 : .name = discard_const_p(char, "kdc_sec_offset"),
1385 : .get = py_DELTATIME_TAG_get_kdc_sec_offset,
1386 : .set = py_DELTATIME_TAG_set_kdc_sec_offset,
1387 : .doc = discard_const_p(char, "PIDL-generated element of base type int32")
1388 : },
1389 : {
1390 : .name = discard_const_p(char, "kdc_usec_offset"),
1391 : .get = py_DELTATIME_TAG_get_kdc_usec_offset,
1392 : .set = py_DELTATIME_TAG_set_kdc_usec_offset,
1393 : .doc = discard_const_p(char, "PIDL-generated element of base type int32")
1394 : },
1395 : { .name = NULL }
1396 : };
1397 :
1398 33 : static PyObject *py_DELTATIME_TAG_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1399 : {
1400 33 : return pytalloc_new(struct DELTATIME_TAG, type);
1401 : }
1402 :
1403 :
1404 : static PyTypeObject DELTATIME_TAG_Type = {
1405 : PyVarObject_HEAD_INIT(NULL, 0)
1406 : .tp_name = "krb5ccache.DELTATIME_TAG",
1407 : .tp_getset = py_DELTATIME_TAG_getsetters,
1408 : .tp_methods = NULL,
1409 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1410 : .tp_new = py_DELTATIME_TAG_new,
1411 : };
1412 :
1413 0 : static PyObject *py_import_FIELD(TALLOC_CTX *mem_ctx, int level, union FIELD *in)
1414 : {
1415 : PyObject *ret;
1416 :
1417 0 : switch (level) {
1418 0 : case 1:
1419 0 : ret = pytalloc_reference_ex(&DELTATIME_TAG_Type, mem_ctx, &in->deltatime_tag);
1420 0 : return ret;
1421 :
1422 : }
1423 0 : PyErr_SetString(PyExc_TypeError, "unknown union level");
1424 0 : return NULL;
1425 : }
1426 :
1427 33 : static union FIELD *py_export_FIELD(TALLOC_CTX *mem_ctx, int level, PyObject *in)
1428 : {
1429 33 : union FIELD *ret = talloc_zero(mem_ctx, union FIELD);
1430 33 : switch (level) {
1431 33 : case 1:
1432 33 : if (in == NULL) {
1433 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->deltatime_tag");
1434 0 : talloc_free(ret); return NULL;
1435 : }
1436 33 : PY_CHECK_TYPE(&DELTATIME_TAG_Type, in, talloc_free(ret); return NULL;);
1437 33 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
1438 0 : PyErr_NoMemory();
1439 0 : talloc_free(ret); return NULL;
1440 : }
1441 33 : ret->deltatime_tag = *(struct DELTATIME_TAG *)pytalloc_get_ptr(in);
1442 33 : break;
1443 :
1444 0 : default:
1445 0 : PyErr_SetString(PyExc_TypeError, "invalid union level value");
1446 0 : talloc_free(ret);
1447 0 : ret = NULL;
1448 : }
1449 :
1450 33 : return ret;
1451 : }
1452 :
1453 0 : static PyObject *py_FIELD_import(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1454 : {
1455 0 : const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
1456 0 : PyObject *mem_ctx_obj = NULL;
1457 0 : TALLOC_CTX *mem_ctx = NULL;
1458 0 : int level = 0;
1459 0 : PyObject *in_obj = NULL;
1460 0 : union FIELD *in = NULL;
1461 :
1462 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:import",
1463 : discard_const_p(char *, kwnames),
1464 : &mem_ctx_obj,
1465 : &level,
1466 : &in_obj)) {
1467 0 : return NULL;
1468 : }
1469 0 : mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
1470 0 : if (mem_ctx == NULL) {
1471 0 : PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
1472 0 : return NULL;
1473 : }
1474 0 : in = (union FIELD *)pytalloc_get_ptr(in_obj);
1475 0 : if (in == NULL) {
1476 0 : PyErr_Format(PyExc_TypeError, "in needs to be a pointer to union FIELD!");
1477 0 : return NULL;
1478 : }
1479 :
1480 0 : return py_import_FIELD(mem_ctx, level, in);
1481 : }
1482 :
1483 33 : static PyObject *py_FIELD_export(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1484 : {
1485 33 : const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
1486 33 : PyObject *mem_ctx_obj = NULL;
1487 33 : TALLOC_CTX *mem_ctx = NULL;
1488 33 : int level = 0;
1489 33 : PyObject *in = NULL;
1490 33 : union FIELD *out = NULL;
1491 :
1492 33 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:export",
1493 : discard_const_p(char *, kwnames),
1494 : &mem_ctx_obj,
1495 : &level,
1496 : &in)) {
1497 0 : return NULL;
1498 : }
1499 33 : mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
1500 33 : if (mem_ctx == NULL) {
1501 0 : PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
1502 0 : return NULL;
1503 : }
1504 :
1505 33 : out = py_export_FIELD(mem_ctx, level, in);
1506 33 : if (out == NULL) {
1507 0 : return NULL;
1508 : }
1509 :
1510 33 : return pytalloc_GenericObject_reference(out);
1511 : }
1512 :
1513 : static PyMethodDef py_FIELD_methods[] = {
1514 : { "__import__", PY_DISCARD_FUNC_SIG(PyCFunction,py_FIELD_import),
1515 : METH_VARARGS|METH_KEYWORDS|METH_CLASS,
1516 : "T.__import__(mem_ctx, level, in) => ret." },
1517 : { "__export__", PY_DISCARD_FUNC_SIG(PyCFunction,py_FIELD_export),
1518 : METH_VARARGS|METH_KEYWORDS|METH_CLASS,
1519 : "T.__export__(mem_ctx, level, in) => ret." },
1520 : { NULL, NULL, 0, NULL }
1521 : };
1522 :
1523 0 : static PyObject *py_FIELD_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1524 : {
1525 0 : PyErr_Format(PyExc_TypeError, "New %s Objects are not supported", type->tp_name);
1526 0 : return NULL;
1527 : }
1528 :
1529 :
1530 : static PyTypeObject FIELD_Type = {
1531 : PyVarObject_HEAD_INIT(NULL, 0)
1532 : .tp_name = "krb5ccache.FIELD",
1533 : .tp_getset = NULL,
1534 : .tp_methods = py_FIELD_methods,
1535 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1536 : .tp_new = py_FIELD_new,
1537 : };
1538 :
1539 :
1540 0 : static PyObject *py_V4TAG_get_tag(PyObject *obj, void *closure)
1541 : {
1542 0 : struct V4TAG *object = (struct V4TAG *)pytalloc_get_ptr(obj);
1543 : PyObject *py_tag;
1544 0 : py_tag = PyLong_FromLong((uint16_t)object->tag);
1545 0 : return py_tag;
1546 : }
1547 :
1548 33 : static int py_V4TAG_set_tag(PyObject *py_obj, PyObject *value, void *closure)
1549 : {
1550 33 : struct V4TAG *object = (struct V4TAG *)pytalloc_get_ptr(py_obj);
1551 33 : if (value == NULL) {
1552 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->tag");
1553 0 : return -1;
1554 : }
1555 : {
1556 33 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->tag));
1557 33 : if (PyLong_Check(value)) {
1558 : unsigned long long test_var;
1559 33 : test_var = PyLong_AsUnsignedLongLong(value);
1560 33 : if (PyErr_Occurred() != NULL) {
1561 0 : return -1;
1562 : }
1563 33 : if (test_var > uint_max) {
1564 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1565 : PyLong_Type.tp_name, uint_max, test_var);
1566 0 : return -1;
1567 : }
1568 33 : object->tag = test_var;
1569 : } else {
1570 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1571 : PyLong_Type.tp_name);
1572 0 : return -1;
1573 : }
1574 : }
1575 33 : return 0;
1576 : }
1577 :
1578 0 : static PyObject *py_V4TAG_get_field(PyObject *obj, void *closure)
1579 : {
1580 0 : struct V4TAG *object = (struct V4TAG *)pytalloc_get_ptr(obj);
1581 : PyObject *py_field;
1582 0 : py_field = pyrpc_import_union(&FIELD_Type, pytalloc_get_mem_ctx(obj), object->tag, &object->field, "union FIELD");
1583 0 : if (py_field == NULL) {
1584 0 : return NULL;
1585 : }
1586 0 : return py_field;
1587 : }
1588 :
1589 33 : static int py_V4TAG_set_field(PyObject *py_obj, PyObject *value, void *closure)
1590 : {
1591 33 : struct V4TAG *object = (struct V4TAG *)pytalloc_get_ptr(py_obj);
1592 33 : if (value == NULL) {
1593 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->field");
1594 0 : return -1;
1595 : }
1596 : {
1597 : union FIELD *field_switch_1;
1598 33 : field_switch_1 = (union FIELD *)pyrpc_export_union(&FIELD_Type, pytalloc_get_mem_ctx(py_obj), object->tag, value, "union FIELD");
1599 33 : if (field_switch_1 == NULL) {
1600 0 : return -1;
1601 : }
1602 33 : object->field = *field_switch_1;
1603 : }
1604 33 : return 0;
1605 : }
1606 :
1607 : static PyGetSetDef py_V4TAG_getsetters[] = {
1608 : {
1609 : .name = discard_const_p(char, "tag"),
1610 : .get = py_V4TAG_get_tag,
1611 : .set = py_V4TAG_set_tag,
1612 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
1613 : },
1614 : {
1615 : .name = discard_const_p(char, "field"),
1616 : .get = py_V4TAG_get_field,
1617 : .set = py_V4TAG_set_field,
1618 : .doc = discard_const_p(char, "PIDL-generated element of base type FIELD")
1619 : },
1620 : { .name = NULL }
1621 : };
1622 :
1623 33 : static PyObject *py_V4TAG_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1624 : {
1625 33 : return pytalloc_new(struct V4TAG, type);
1626 : }
1627 :
1628 :
1629 : static PyTypeObject V4TAG_Type = {
1630 : PyVarObject_HEAD_INIT(NULL, 0)
1631 : .tp_name = "krb5ccache.V4TAG",
1632 : .tp_getset = py_V4TAG_getsetters,
1633 : .tp_methods = NULL,
1634 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1635 : .tp_new = py_V4TAG_new,
1636 : };
1637 :
1638 :
1639 0 : static PyObject *py_V4TAGS_get_tag(PyObject *obj, void *closure)
1640 : {
1641 0 : struct V4TAGS *object = (struct V4TAGS *)pytalloc_get_ptr(obj);
1642 : PyObject *py_tag;
1643 0 : py_tag = pytalloc_reference_ex(&V4TAG_Type, pytalloc_get_mem_ctx(obj), &object->tag);
1644 0 : return py_tag;
1645 : }
1646 :
1647 33 : static int py_V4TAGS_set_tag(PyObject *py_obj, PyObject *value, void *closure)
1648 : {
1649 33 : struct V4TAGS *object = (struct V4TAGS *)pytalloc_get_ptr(py_obj);
1650 33 : if (value == NULL) {
1651 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->tag");
1652 0 : return -1;
1653 : }
1654 33 : PY_CHECK_TYPE(&V4TAG_Type, value, return -1;);
1655 33 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
1656 0 : PyErr_NoMemory();
1657 0 : return -1;
1658 : }
1659 33 : object->tag = *(struct V4TAG *)pytalloc_get_ptr(value);
1660 33 : return 0;
1661 : }
1662 :
1663 0 : static PyObject *py_V4TAGS_get_further_tags(PyObject *obj, void *closure)
1664 : {
1665 0 : struct V4TAGS *object = (struct V4TAGS *)pytalloc_get_ptr(obj);
1666 : PyObject *py_further_tags;
1667 0 : py_further_tags = PyBytes_FromStringAndSize((char *)(object->further_tags).data, (object->further_tags).length);
1668 0 : return py_further_tags;
1669 : }
1670 :
1671 33 : static int py_V4TAGS_set_further_tags(PyObject *py_obj, PyObject *value, void *closure)
1672 : {
1673 33 : struct V4TAGS *object = (struct V4TAGS *)pytalloc_get_ptr(py_obj);
1674 33 : if (value == NULL) {
1675 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->further_tags");
1676 0 : return -1;
1677 : }
1678 33 : object->further_tags = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
1679 33 : return 0;
1680 : }
1681 :
1682 : static PyGetSetDef py_V4TAGS_getsetters[] = {
1683 : {
1684 : .name = discard_const_p(char, "tag"),
1685 : .get = py_V4TAGS_get_tag,
1686 : .set = py_V4TAGS_set_tag,
1687 : .doc = discard_const_p(char, "PIDL-generated element of base type V4TAG")
1688 : },
1689 : {
1690 : .name = discard_const_p(char, "further_tags"),
1691 : .get = py_V4TAGS_get_further_tags,
1692 : .set = py_V4TAGS_set_further_tags,
1693 : .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
1694 : },
1695 : { .name = NULL }
1696 : };
1697 :
1698 33 : static PyObject *py_V4TAGS_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1699 : {
1700 33 : return pytalloc_new(struct V4TAGS, type);
1701 : }
1702 :
1703 :
1704 : static PyTypeObject V4TAGS_Type = {
1705 : PyVarObject_HEAD_INIT(NULL, 0)
1706 : .tp_name = "krb5ccache.V4TAGS",
1707 : .tp_getset = py_V4TAGS_getsetters,
1708 : .tp_methods = NULL,
1709 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1710 : .tp_new = py_V4TAGS_new,
1711 : };
1712 :
1713 :
1714 0 : static PyObject *py_V4HEADER_get_v4tags(PyObject *obj, void *closure)
1715 : {
1716 0 : struct V4HEADER *object = (struct V4HEADER *)pytalloc_get_ptr(obj);
1717 : PyObject *py_v4tags;
1718 0 : py_v4tags = pytalloc_reference_ex(&V4TAGS_Type, pytalloc_get_mem_ctx(obj), &object->v4tags);
1719 0 : return py_v4tags;
1720 : }
1721 :
1722 33 : static int py_V4HEADER_set_v4tags(PyObject *py_obj, PyObject *value, void *closure)
1723 : {
1724 33 : struct V4HEADER *object = (struct V4HEADER *)pytalloc_get_ptr(py_obj);
1725 33 : if (value == NULL) {
1726 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->v4tags");
1727 0 : return -1;
1728 : }
1729 33 : PY_CHECK_TYPE(&V4TAGS_Type, value, return -1;);
1730 33 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
1731 0 : PyErr_NoMemory();
1732 0 : return -1;
1733 : }
1734 33 : object->v4tags = *(struct V4TAGS *)pytalloc_get_ptr(value);
1735 33 : return 0;
1736 : }
1737 :
1738 : static PyGetSetDef py_V4HEADER_getsetters[] = {
1739 : {
1740 : .name = discard_const_p(char, "v4tags"),
1741 : .get = py_V4HEADER_get_v4tags,
1742 : .set = py_V4HEADER_set_v4tags,
1743 : .doc = discard_const_p(char, "PIDL-generated element of base type V4TAGS")
1744 : },
1745 : { .name = NULL }
1746 : };
1747 :
1748 33 : static PyObject *py_V4HEADER_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1749 : {
1750 33 : return pytalloc_new(struct V4HEADER, type);
1751 : }
1752 :
1753 :
1754 : static PyTypeObject V4HEADER_Type = {
1755 : PyVarObject_HEAD_INIT(NULL, 0)
1756 : .tp_name = "krb5ccache.V4HEADER",
1757 : .tp_getset = py_V4HEADER_getsetters,
1758 : .tp_methods = NULL,
1759 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1760 : .tp_new = py_V4HEADER_new,
1761 : };
1762 :
1763 0 : static PyObject *py_import_OPTIONAL_HEADER(TALLOC_CTX *mem_ctx, int level, union OPTIONAL_HEADER *in)
1764 : {
1765 : PyObject *ret;
1766 :
1767 0 : switch (level) {
1768 0 : case 3:
1769 0 : ret = Py_None;
1770 0 : Py_INCREF(ret);
1771 0 : return ret;
1772 :
1773 0 : case 4:
1774 0 : ret = pytalloc_reference_ex(&V4HEADER_Type, mem_ctx, &in->v4header);
1775 0 : return ret;
1776 :
1777 : }
1778 0 : PyErr_SetString(PyExc_TypeError, "unknown union level");
1779 0 : return NULL;
1780 : }
1781 :
1782 33 : static union OPTIONAL_HEADER *py_export_OPTIONAL_HEADER(TALLOC_CTX *mem_ctx, int level, PyObject *in)
1783 : {
1784 33 : union OPTIONAL_HEADER *ret = talloc_zero(mem_ctx, union OPTIONAL_HEADER);
1785 33 : switch (level) {
1786 0 : case 3:
1787 0 : break;
1788 :
1789 33 : case 4:
1790 33 : if (in == NULL) {
1791 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->v4header");
1792 0 : talloc_free(ret); return NULL;
1793 : }
1794 33 : PY_CHECK_TYPE(&V4HEADER_Type, in, talloc_free(ret); return NULL;);
1795 33 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
1796 0 : PyErr_NoMemory();
1797 0 : talloc_free(ret); return NULL;
1798 : }
1799 33 : ret->v4header = *(struct V4HEADER *)pytalloc_get_ptr(in);
1800 33 : break;
1801 :
1802 0 : default:
1803 0 : PyErr_SetString(PyExc_TypeError, "invalid union level value");
1804 0 : talloc_free(ret);
1805 0 : ret = NULL;
1806 : }
1807 :
1808 33 : return ret;
1809 : }
1810 :
1811 0 : static PyObject *py_OPTIONAL_HEADER_import(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1812 : {
1813 0 : const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
1814 0 : PyObject *mem_ctx_obj = NULL;
1815 0 : TALLOC_CTX *mem_ctx = NULL;
1816 0 : int level = 0;
1817 0 : PyObject *in_obj = NULL;
1818 0 : union OPTIONAL_HEADER *in = NULL;
1819 :
1820 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:import",
1821 : discard_const_p(char *, kwnames),
1822 : &mem_ctx_obj,
1823 : &level,
1824 : &in_obj)) {
1825 0 : return NULL;
1826 : }
1827 0 : mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
1828 0 : if (mem_ctx == NULL) {
1829 0 : PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
1830 0 : return NULL;
1831 : }
1832 0 : in = (union OPTIONAL_HEADER *)pytalloc_get_ptr(in_obj);
1833 0 : if (in == NULL) {
1834 0 : PyErr_Format(PyExc_TypeError, "in needs to be a pointer to union OPTIONAL_HEADER!");
1835 0 : return NULL;
1836 : }
1837 :
1838 0 : return py_import_OPTIONAL_HEADER(mem_ctx, level, in);
1839 : }
1840 :
1841 33 : static PyObject *py_OPTIONAL_HEADER_export(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1842 : {
1843 33 : const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
1844 33 : PyObject *mem_ctx_obj = NULL;
1845 33 : TALLOC_CTX *mem_ctx = NULL;
1846 33 : int level = 0;
1847 33 : PyObject *in = NULL;
1848 33 : union OPTIONAL_HEADER *out = NULL;
1849 :
1850 33 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:export",
1851 : discard_const_p(char *, kwnames),
1852 : &mem_ctx_obj,
1853 : &level,
1854 : &in)) {
1855 0 : return NULL;
1856 : }
1857 33 : mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
1858 33 : if (mem_ctx == NULL) {
1859 0 : PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
1860 0 : return NULL;
1861 : }
1862 :
1863 33 : out = py_export_OPTIONAL_HEADER(mem_ctx, level, in);
1864 33 : if (out == NULL) {
1865 0 : return NULL;
1866 : }
1867 :
1868 33 : return pytalloc_GenericObject_reference(out);
1869 : }
1870 :
1871 : static PyMethodDef py_OPTIONAL_HEADER_methods[] = {
1872 : { "__import__", PY_DISCARD_FUNC_SIG(PyCFunction,py_OPTIONAL_HEADER_import),
1873 : METH_VARARGS|METH_KEYWORDS|METH_CLASS,
1874 : "T.__import__(mem_ctx, level, in) => ret." },
1875 : { "__export__", PY_DISCARD_FUNC_SIG(PyCFunction,py_OPTIONAL_HEADER_export),
1876 : METH_VARARGS|METH_KEYWORDS|METH_CLASS,
1877 : "T.__export__(mem_ctx, level, in) => ret." },
1878 : { NULL, NULL, 0, NULL }
1879 : };
1880 :
1881 0 : static PyObject *py_OPTIONAL_HEADER_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1882 : {
1883 0 : PyErr_Format(PyExc_TypeError, "New %s Objects are not supported", type->tp_name);
1884 0 : return NULL;
1885 : }
1886 :
1887 :
1888 : static PyTypeObject OPTIONAL_HEADER_Type = {
1889 : PyVarObject_HEAD_INIT(NULL, 0)
1890 : .tp_name = "krb5ccache.OPTIONAL_HEADER",
1891 : .tp_getset = NULL,
1892 : .tp_methods = py_OPTIONAL_HEADER_methods,
1893 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1894 : .tp_new = py_OPTIONAL_HEADER_new,
1895 : };
1896 :
1897 :
1898 0 : static PyObject *py_CCACHE_get_pvno(PyObject *obj, void *closure)
1899 : {
1900 0 : struct CCACHE *object = (struct CCACHE *)pytalloc_get_ptr(obj);
1901 : PyObject *py_pvno;
1902 0 : py_pvno = PyLong_FromLong((uint16_t)object->pvno);
1903 0 : return py_pvno;
1904 : }
1905 :
1906 33 : static int py_CCACHE_set_pvno(PyObject *py_obj, PyObject *value, void *closure)
1907 : {
1908 33 : struct CCACHE *object = (struct CCACHE *)pytalloc_get_ptr(py_obj);
1909 33 : if (value == NULL) {
1910 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->pvno");
1911 0 : return -1;
1912 : }
1913 : {
1914 33 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->pvno));
1915 33 : if (PyLong_Check(value)) {
1916 : unsigned long long test_var;
1917 33 : test_var = PyLong_AsUnsignedLongLong(value);
1918 33 : if (PyErr_Occurred() != NULL) {
1919 0 : return -1;
1920 : }
1921 33 : if (test_var > uint_max) {
1922 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1923 : PyLong_Type.tp_name, uint_max, test_var);
1924 0 : return -1;
1925 : }
1926 33 : object->pvno = test_var;
1927 : } else {
1928 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1929 : PyLong_Type.tp_name);
1930 0 : return -1;
1931 : }
1932 : }
1933 33 : return 0;
1934 : }
1935 :
1936 0 : static PyObject *py_CCACHE_get_version(PyObject *obj, void *closure)
1937 : {
1938 0 : struct CCACHE *object = (struct CCACHE *)pytalloc_get_ptr(obj);
1939 : PyObject *py_version;
1940 0 : py_version = PyLong_FromLong((uint16_t)object->version);
1941 0 : return py_version;
1942 : }
1943 :
1944 33 : static int py_CCACHE_set_version(PyObject *py_obj, PyObject *value, void *closure)
1945 : {
1946 33 : struct CCACHE *object = (struct CCACHE *)pytalloc_get_ptr(py_obj);
1947 33 : if (value == NULL) {
1948 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->version");
1949 0 : return -1;
1950 : }
1951 : {
1952 33 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->version));
1953 33 : if (PyLong_Check(value)) {
1954 : unsigned long long test_var;
1955 33 : test_var = PyLong_AsUnsignedLongLong(value);
1956 33 : if (PyErr_Occurred() != NULL) {
1957 0 : return -1;
1958 : }
1959 33 : if (test_var > uint_max) {
1960 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1961 : PyLong_Type.tp_name, uint_max, test_var);
1962 0 : return -1;
1963 : }
1964 33 : object->version = test_var;
1965 : } else {
1966 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1967 : PyLong_Type.tp_name);
1968 0 : return -1;
1969 : }
1970 : }
1971 33 : return 0;
1972 : }
1973 :
1974 0 : static PyObject *py_CCACHE_get_optional_header(PyObject *obj, void *closure)
1975 : {
1976 0 : struct CCACHE *object = (struct CCACHE *)pytalloc_get_ptr(obj);
1977 : PyObject *py_optional_header;
1978 0 : py_optional_header = pyrpc_import_union(&OPTIONAL_HEADER_Type, pytalloc_get_mem_ctx(obj), object->version, &object->optional_header, "union OPTIONAL_HEADER");
1979 0 : if (py_optional_header == NULL) {
1980 0 : return NULL;
1981 : }
1982 0 : return py_optional_header;
1983 : }
1984 :
1985 33 : static int py_CCACHE_set_optional_header(PyObject *py_obj, PyObject *value, void *closure)
1986 : {
1987 33 : struct CCACHE *object = (struct CCACHE *)pytalloc_get_ptr(py_obj);
1988 33 : if (value == NULL) {
1989 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->optional_header");
1990 0 : return -1;
1991 : }
1992 : {
1993 : union OPTIONAL_HEADER *optional_header_switch_0;
1994 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");
1995 33 : if (optional_header_switch_0 == NULL) {
1996 0 : return -1;
1997 : }
1998 33 : object->optional_header = *optional_header_switch_0;
1999 : }
2000 33 : return 0;
2001 : }
2002 :
2003 0 : static PyObject *py_CCACHE_get_principal(PyObject *obj, void *closure)
2004 : {
2005 0 : struct CCACHE *object = (struct CCACHE *)pytalloc_get_ptr(obj);
2006 : PyObject *py_principal;
2007 0 : py_principal = pytalloc_reference_ex(&PRINCIPAL_Type, pytalloc_get_mem_ctx(obj), &object->principal);
2008 0 : return py_principal;
2009 : }
2010 :
2011 33 : static int py_CCACHE_set_principal(PyObject *py_obj, PyObject *value, void *closure)
2012 : {
2013 33 : struct CCACHE *object = (struct CCACHE *)pytalloc_get_ptr(py_obj);
2014 33 : if (value == NULL) {
2015 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->principal");
2016 0 : return -1;
2017 : }
2018 33 : PY_CHECK_TYPE(&PRINCIPAL_Type, value, return -1;);
2019 33 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
2020 0 : PyErr_NoMemory();
2021 0 : return -1;
2022 : }
2023 33 : object->principal = *(struct PRINCIPAL *)pytalloc_get_ptr(value);
2024 33 : return 0;
2025 : }
2026 :
2027 0 : static PyObject *py_CCACHE_get_cred(PyObject *obj, void *closure)
2028 : {
2029 0 : struct CCACHE *object = (struct CCACHE *)pytalloc_get_ptr(obj);
2030 : PyObject *py_cred;
2031 0 : py_cred = pytalloc_reference_ex(&CREDENTIAL_Type, pytalloc_get_mem_ctx(obj), &object->cred);
2032 0 : return py_cred;
2033 : }
2034 :
2035 33 : static int py_CCACHE_set_cred(PyObject *py_obj, PyObject *value, void *closure)
2036 : {
2037 33 : struct CCACHE *object = (struct CCACHE *)pytalloc_get_ptr(py_obj);
2038 33 : if (value == NULL) {
2039 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->cred");
2040 0 : return -1;
2041 : }
2042 33 : PY_CHECK_TYPE(&CREDENTIAL_Type, value, return -1;);
2043 33 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
2044 0 : PyErr_NoMemory();
2045 0 : return -1;
2046 : }
2047 33 : object->cred = *(struct CREDENTIAL *)pytalloc_get_ptr(value);
2048 33 : return 0;
2049 : }
2050 :
2051 0 : static PyObject *py_CCACHE_get_further_creds(PyObject *obj, void *closure)
2052 : {
2053 0 : struct CCACHE *object = (struct CCACHE *)pytalloc_get_ptr(obj);
2054 : PyObject *py_further_creds;
2055 0 : py_further_creds = PyBytes_FromStringAndSize((char *)(object->further_creds).data, (object->further_creds).length);
2056 0 : return py_further_creds;
2057 : }
2058 :
2059 0 : static int py_CCACHE_set_further_creds(PyObject *py_obj, PyObject *value, void *closure)
2060 : {
2061 0 : struct CCACHE *object = (struct CCACHE *)pytalloc_get_ptr(py_obj);
2062 0 : if (value == NULL) {
2063 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->further_creds");
2064 0 : return -1;
2065 : }
2066 0 : object->further_creds = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
2067 0 : return 0;
2068 : }
2069 :
2070 : static PyGetSetDef py_CCACHE_getsetters[] = {
2071 : {
2072 : .name = discard_const_p(char, "pvno"),
2073 : .get = py_CCACHE_get_pvno,
2074 : .set = py_CCACHE_set_pvno,
2075 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
2076 : },
2077 : {
2078 : .name = discard_const_p(char, "version"),
2079 : .get = py_CCACHE_get_version,
2080 : .set = py_CCACHE_set_version,
2081 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
2082 : },
2083 : {
2084 : .name = discard_const_p(char, "optional_header"),
2085 : .get = py_CCACHE_get_optional_header,
2086 : .set = py_CCACHE_set_optional_header,
2087 : .doc = discard_const_p(char, "PIDL-generated element of base type OPTIONAL_HEADER")
2088 : },
2089 : {
2090 : .name = discard_const_p(char, "principal"),
2091 : .get = py_CCACHE_get_principal,
2092 : .set = py_CCACHE_set_principal,
2093 : .doc = discard_const_p(char, "PIDL-generated element of base type PRINCIPAL")
2094 : },
2095 : {
2096 : .name = discard_const_p(char, "cred"),
2097 : .get = py_CCACHE_get_cred,
2098 : .set = py_CCACHE_set_cred,
2099 : .doc = discard_const_p(char, "PIDL-generated element of base type CREDENTIAL")
2100 : },
2101 : {
2102 : .name = discard_const_p(char, "further_creds"),
2103 : .get = py_CCACHE_get_further_creds,
2104 : .set = py_CCACHE_set_further_creds,
2105 : .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
2106 : },
2107 : { .name = NULL }
2108 : };
2109 :
2110 33 : static PyObject *py_CCACHE_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2111 : {
2112 33 : return pytalloc_new(struct CCACHE, type);
2113 : }
2114 :
2115 33 : static PyObject *py_CCACHE_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2116 : {
2117 33 : struct CCACHE *object = (struct CCACHE *)pytalloc_get_ptr(py_obj);
2118 33 : PyObject *ret = NULL;
2119 : DATA_BLOB blob;
2120 : enum ndr_err_code err;
2121 33 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
2122 33 : if (tmp_ctx == NULL) {
2123 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
2124 0 : return NULL;
2125 : }
2126 33 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_CCACHE);
2127 33 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2128 0 : TALLOC_FREE(tmp_ctx);
2129 0 : PyErr_SetNdrError(err);
2130 0 : return NULL;
2131 : }
2132 :
2133 33 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
2134 33 : TALLOC_FREE(tmp_ctx);
2135 33 : return ret;
2136 : }
2137 :
2138 0 : static PyObject *py_CCACHE_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
2139 : {
2140 0 : struct CCACHE *object = (struct CCACHE *)pytalloc_get_ptr(py_obj);
2141 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
2142 0 : Py_ssize_t blob_length = 0;
2143 : enum ndr_err_code err;
2144 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
2145 0 : PyObject *allow_remaining_obj = NULL;
2146 0 : bool allow_remaining = false;
2147 :
2148 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
2149 : discard_const_p(char *, kwnames),
2150 : &blob.data, &blob_length,
2151 : &allow_remaining_obj)) {
2152 0 : return NULL;
2153 : }
2154 0 : blob.length = blob_length;
2155 :
2156 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
2157 0 : allow_remaining = true;
2158 : }
2159 :
2160 0 : if (allow_remaining) {
2161 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_CCACHE);
2162 : } else {
2163 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_CCACHE);
2164 : }
2165 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2166 0 : PyErr_SetNdrError(err);
2167 0 : return NULL;
2168 : }
2169 :
2170 0 : Py_RETURN_NONE;
2171 : }
2172 :
2173 0 : static PyObject *py_CCACHE_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2174 : {
2175 0 : struct CCACHE *object = (struct CCACHE *)pytalloc_get_ptr(py_obj);
2176 : PyObject *ret;
2177 : char *retstr;
2178 :
2179 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_CCACHE, "CCACHE", object);
2180 0 : ret = PyUnicode_FromString(retstr);
2181 0 : talloc_free(retstr);
2182 :
2183 0 : return ret;
2184 : }
2185 :
2186 : static PyMethodDef py_CCACHE_methods[] = {
2187 : { "__ndr_pack__", (PyCFunction)py_CCACHE_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
2188 : { "__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" },
2189 : { "__ndr_print__", (PyCFunction)py_CCACHE_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
2190 : { NULL, NULL, 0, NULL }
2191 : };
2192 :
2193 :
2194 : static PyTypeObject CCACHE_Type = {
2195 : PyVarObject_HEAD_INIT(NULL, 0)
2196 : .tp_name = "krb5ccache.CCACHE",
2197 : .tp_getset = py_CCACHE_getsetters,
2198 : .tp_methods = py_CCACHE_methods,
2199 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
2200 : .tp_new = py_CCACHE_new,
2201 : };
2202 :
2203 :
2204 0 : static PyObject *py_MULTIPLE_CREDENTIALS_get_cred(PyObject *obj, void *closure)
2205 : {
2206 0 : struct MULTIPLE_CREDENTIALS *object = (struct MULTIPLE_CREDENTIALS *)pytalloc_get_ptr(obj);
2207 : PyObject *py_cred;
2208 0 : py_cred = pytalloc_reference_ex(&CREDENTIAL_Type, pytalloc_get_mem_ctx(obj), &object->cred);
2209 0 : return py_cred;
2210 : }
2211 :
2212 0 : static int py_MULTIPLE_CREDENTIALS_set_cred(PyObject *py_obj, PyObject *value, void *closure)
2213 : {
2214 0 : struct MULTIPLE_CREDENTIALS *object = (struct MULTIPLE_CREDENTIALS *)pytalloc_get_ptr(py_obj);
2215 0 : if (value == NULL) {
2216 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->cred");
2217 0 : return -1;
2218 : }
2219 0 : PY_CHECK_TYPE(&CREDENTIAL_Type, value, return -1;);
2220 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
2221 0 : PyErr_NoMemory();
2222 0 : return -1;
2223 : }
2224 0 : object->cred = *(struct CREDENTIAL *)pytalloc_get_ptr(value);
2225 0 : return 0;
2226 : }
2227 :
2228 0 : static PyObject *py_MULTIPLE_CREDENTIALS_get_further_creds(PyObject *obj, void *closure)
2229 : {
2230 0 : struct MULTIPLE_CREDENTIALS *object = (struct MULTIPLE_CREDENTIALS *)pytalloc_get_ptr(obj);
2231 : PyObject *py_further_creds;
2232 0 : py_further_creds = PyBytes_FromStringAndSize((char *)(object->further_creds).data, (object->further_creds).length);
2233 0 : return py_further_creds;
2234 : }
2235 :
2236 0 : static int py_MULTIPLE_CREDENTIALS_set_further_creds(PyObject *py_obj, PyObject *value, void *closure)
2237 : {
2238 0 : struct MULTIPLE_CREDENTIALS *object = (struct MULTIPLE_CREDENTIALS *)pytalloc_get_ptr(py_obj);
2239 0 : if (value == NULL) {
2240 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->further_creds");
2241 0 : return -1;
2242 : }
2243 0 : object->further_creds = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
2244 0 : return 0;
2245 : }
2246 :
2247 : static PyGetSetDef py_MULTIPLE_CREDENTIALS_getsetters[] = {
2248 : {
2249 : .name = discard_const_p(char, "cred"),
2250 : .get = py_MULTIPLE_CREDENTIALS_get_cred,
2251 : .set = py_MULTIPLE_CREDENTIALS_set_cred,
2252 : .doc = discard_const_p(char, "PIDL-generated element of base type CREDENTIAL")
2253 : },
2254 : {
2255 : .name = discard_const_p(char, "further_creds"),
2256 : .get = py_MULTIPLE_CREDENTIALS_get_further_creds,
2257 : .set = py_MULTIPLE_CREDENTIALS_set_further_creds,
2258 : .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
2259 : },
2260 : { .name = NULL }
2261 : };
2262 :
2263 0 : static PyObject *py_MULTIPLE_CREDENTIALS_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2264 : {
2265 0 : return pytalloc_new(struct MULTIPLE_CREDENTIALS, type);
2266 : }
2267 :
2268 0 : static PyObject *py_MULTIPLE_CREDENTIALS_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2269 : {
2270 0 : struct MULTIPLE_CREDENTIALS *object = (struct MULTIPLE_CREDENTIALS *)pytalloc_get_ptr(py_obj);
2271 0 : PyObject *ret = NULL;
2272 : DATA_BLOB blob;
2273 : enum ndr_err_code err;
2274 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
2275 0 : if (tmp_ctx == NULL) {
2276 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
2277 0 : return NULL;
2278 : }
2279 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_MULTIPLE_CREDENTIALS);
2280 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2281 0 : TALLOC_FREE(tmp_ctx);
2282 0 : PyErr_SetNdrError(err);
2283 0 : return NULL;
2284 : }
2285 :
2286 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
2287 0 : TALLOC_FREE(tmp_ctx);
2288 0 : return ret;
2289 : }
2290 :
2291 0 : static PyObject *py_MULTIPLE_CREDENTIALS_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
2292 : {
2293 0 : struct MULTIPLE_CREDENTIALS *object = (struct MULTIPLE_CREDENTIALS *)pytalloc_get_ptr(py_obj);
2294 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
2295 0 : Py_ssize_t blob_length = 0;
2296 : enum ndr_err_code err;
2297 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
2298 0 : PyObject *allow_remaining_obj = NULL;
2299 0 : bool allow_remaining = false;
2300 :
2301 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
2302 : discard_const_p(char *, kwnames),
2303 : &blob.data, &blob_length,
2304 : &allow_remaining_obj)) {
2305 0 : return NULL;
2306 : }
2307 0 : blob.length = blob_length;
2308 :
2309 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
2310 0 : allow_remaining = true;
2311 : }
2312 :
2313 0 : if (allow_remaining) {
2314 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_MULTIPLE_CREDENTIALS);
2315 : } else {
2316 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_MULTIPLE_CREDENTIALS);
2317 : }
2318 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2319 0 : PyErr_SetNdrError(err);
2320 0 : return NULL;
2321 : }
2322 :
2323 0 : Py_RETURN_NONE;
2324 : }
2325 :
2326 0 : static PyObject *py_MULTIPLE_CREDENTIALS_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2327 : {
2328 0 : struct MULTIPLE_CREDENTIALS *object = (struct MULTIPLE_CREDENTIALS *)pytalloc_get_ptr(py_obj);
2329 : PyObject *ret;
2330 : char *retstr;
2331 :
2332 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_MULTIPLE_CREDENTIALS, "MULTIPLE_CREDENTIALS", object);
2333 0 : ret = PyUnicode_FromString(retstr);
2334 0 : talloc_free(retstr);
2335 :
2336 0 : return ret;
2337 : }
2338 :
2339 : static PyMethodDef py_MULTIPLE_CREDENTIALS_methods[] = {
2340 : { "__ndr_pack__", (PyCFunction)py_MULTIPLE_CREDENTIALS_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
2341 : { "__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" },
2342 : { "__ndr_print__", (PyCFunction)py_MULTIPLE_CREDENTIALS_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
2343 : { NULL, NULL, 0, NULL }
2344 : };
2345 :
2346 :
2347 : static PyTypeObject MULTIPLE_CREDENTIALS_Type = {
2348 : PyVarObject_HEAD_INIT(NULL, 0)
2349 : .tp_name = "krb5ccache.MULTIPLE_CREDENTIALS",
2350 : .tp_getset = py_MULTIPLE_CREDENTIALS_getsetters,
2351 : .tp_methods = py_MULTIPLE_CREDENTIALS_methods,
2352 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
2353 : .tp_new = py_MULTIPLE_CREDENTIALS_new,
2354 : };
2355 :
2356 :
2357 : const struct PyNdrRpcMethodDef py_ndr_krb5ccache_methods[] = {
2358 : {0}
2359 : };
2360 :
2361 0 : static PyObject *interface_krb5ccache_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2362 : {
2363 0 : return py_dcerpc_interface_init_helper(type, args, kwargs, &ndr_table_krb5ccache);
2364 : }
2365 :
2366 : #define PY_DOC_KRB5CCACHE "KRB5 credentials cache"
2367 : static PyTypeObject krb5ccache_InterfaceType = {
2368 : PyVarObject_HEAD_INIT(NULL, 0)
2369 : .tp_name = "krb5ccache.krb5ccache",
2370 : .tp_basicsize = sizeof(dcerpc_InterfaceObject),
2371 : .tp_doc = "krb5ccache(binding, lp_ctx=None, credentials=None) -> connection\n"
2372 : "\n"
2373 : "binding should be a DCE/RPC binding string (for example: ncacn_ip_tcp:127.0.0.1)\n"
2374 : "lp_ctx should be a path to a smb.conf file or a param.LoadParm object\n"
2375 : "credentials should be a credentials.Credentials object.\n\n"PY_DOC_KRB5CCACHE,
2376 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
2377 : .tp_new = interface_krb5ccache_new,
2378 : };
2379 :
2380 0 : static PyObject *syntax_krb5ccache_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2381 : {
2382 0 : return py_dcerpc_syntax_init_helper(type, args, kwargs, &ndr_table_krb5ccache.syntax_id);
2383 : }
2384 :
2385 : #define PY_DOC_KRB5CCACHE_SYNTAX "KRB5 credentials cache"
2386 : static PyTypeObject krb5ccache_SyntaxType = {
2387 : PyVarObject_HEAD_INIT(NULL, 0)
2388 : .tp_name = "krb5ccache.krb5ccache_abstract_syntax",
2389 : .tp_doc = "krb5ccache_abstract_syntax()\n"PY_DOC_KRB5CCACHE_SYNTAX,
2390 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
2391 : .tp_new = syntax_krb5ccache_new,
2392 : };
2393 :
2394 : static PyMethodDef krb5ccache_methods[] = {
2395 : { NULL, NULL, 0, NULL }
2396 : };
2397 :
2398 : static struct PyModuleDef moduledef = {
2399 : PyModuleDef_HEAD_INIT,
2400 : .m_name = "krb5ccache",
2401 : .m_doc = "krb5ccache DCE/RPC",
2402 : .m_size = -1,
2403 : .m_methods = krb5ccache_methods,
2404 : };
2405 64 : MODULE_INIT_FUNC(krb5ccache)
2406 : {
2407 64 : PyObject *m = NULL;
2408 64 : PyObject *dep_talloc = NULL;
2409 64 : PyObject *dep_samba_dcerpc_base = NULL;
2410 64 : PyObject *dep_samba_dcerpc_misc = NULL;
2411 :
2412 64 : dep_talloc = PyImport_ImportModule("talloc");
2413 64 : if (dep_talloc == NULL)
2414 0 : goto out;
2415 :
2416 64 : dep_samba_dcerpc_base = PyImport_ImportModule("samba.dcerpc.base");
2417 64 : if (dep_samba_dcerpc_base == NULL)
2418 0 : goto out;
2419 :
2420 64 : dep_samba_dcerpc_misc = PyImport_ImportModule("samba.dcerpc.misc");
2421 64 : if (dep_samba_dcerpc_misc == NULL)
2422 0 : goto out;
2423 :
2424 64 : BaseObject_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "BaseObject");
2425 64 : if (BaseObject_Type == NULL)
2426 0 : goto out;
2427 :
2428 64 : ClientConnection_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_base, "ClientConnection");
2429 64 : if (ClientConnection_Type == NULL)
2430 0 : goto out;
2431 :
2432 64 : ndr_syntax_id_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_misc, "ndr_syntax_id");
2433 64 : if (ndr_syntax_id_Type == NULL)
2434 0 : goto out;
2435 :
2436 64 : PRINCIPAL_Type.tp_base = BaseObject_Type;
2437 64 : PRINCIPAL_Type.tp_basicsize = pytalloc_BaseObject_size();
2438 :
2439 64 : KEYBLOCK_Type.tp_base = BaseObject_Type;
2440 64 : KEYBLOCK_Type.tp_basicsize = pytalloc_BaseObject_size();
2441 :
2442 64 : ADDRESS_Type.tp_base = BaseObject_Type;
2443 64 : ADDRESS_Type.tp_basicsize = pytalloc_BaseObject_size();
2444 :
2445 64 : ADDRESSES_Type.tp_base = BaseObject_Type;
2446 64 : ADDRESSES_Type.tp_basicsize = pytalloc_BaseObject_size();
2447 :
2448 64 : AUTHDATUM_Type.tp_base = BaseObject_Type;
2449 64 : AUTHDATUM_Type.tp_basicsize = pytalloc_BaseObject_size();
2450 :
2451 64 : AUTHDATA_Type.tp_base = BaseObject_Type;
2452 64 : AUTHDATA_Type.tp_basicsize = pytalloc_BaseObject_size();
2453 :
2454 64 : CREDENTIAL_Type.tp_base = BaseObject_Type;
2455 64 : CREDENTIAL_Type.tp_basicsize = pytalloc_BaseObject_size();
2456 :
2457 64 : DELTATIME_TAG_Type.tp_base = BaseObject_Type;
2458 64 : DELTATIME_TAG_Type.tp_basicsize = pytalloc_BaseObject_size();
2459 :
2460 64 : FIELD_Type.tp_base = BaseObject_Type;
2461 64 : FIELD_Type.tp_basicsize = pytalloc_BaseObject_size();
2462 :
2463 64 : V4TAG_Type.tp_base = BaseObject_Type;
2464 64 : V4TAG_Type.tp_basicsize = pytalloc_BaseObject_size();
2465 :
2466 64 : V4TAGS_Type.tp_base = BaseObject_Type;
2467 64 : V4TAGS_Type.tp_basicsize = pytalloc_BaseObject_size();
2468 :
2469 64 : V4HEADER_Type.tp_base = BaseObject_Type;
2470 64 : V4HEADER_Type.tp_basicsize = pytalloc_BaseObject_size();
2471 :
2472 64 : OPTIONAL_HEADER_Type.tp_base = BaseObject_Type;
2473 64 : OPTIONAL_HEADER_Type.tp_basicsize = pytalloc_BaseObject_size();
2474 :
2475 64 : CCACHE_Type.tp_base = BaseObject_Type;
2476 64 : CCACHE_Type.tp_basicsize = pytalloc_BaseObject_size();
2477 :
2478 64 : MULTIPLE_CREDENTIALS_Type.tp_base = BaseObject_Type;
2479 64 : MULTIPLE_CREDENTIALS_Type.tp_basicsize = pytalloc_BaseObject_size();
2480 :
2481 64 : krb5ccache_InterfaceType.tp_base = ClientConnection_Type;
2482 :
2483 64 : krb5ccache_SyntaxType.tp_base = ndr_syntax_id_Type;
2484 64 : krb5ccache_SyntaxType.tp_basicsize = pytalloc_BaseObject_size();
2485 :
2486 64 : if (PyType_Ready(&PRINCIPAL_Type) < 0)
2487 0 : goto out;
2488 64 : if (PyType_Ready(&KEYBLOCK_Type) < 0)
2489 0 : goto out;
2490 64 : if (PyType_Ready(&ADDRESS_Type) < 0)
2491 0 : goto out;
2492 64 : if (PyType_Ready(&ADDRESSES_Type) < 0)
2493 0 : goto out;
2494 64 : if (PyType_Ready(&AUTHDATUM_Type) < 0)
2495 0 : goto out;
2496 64 : if (PyType_Ready(&AUTHDATA_Type) < 0)
2497 0 : goto out;
2498 64 : if (PyType_Ready(&CREDENTIAL_Type) < 0)
2499 0 : goto out;
2500 64 : if (PyType_Ready(&DELTATIME_TAG_Type) < 0)
2501 0 : goto out;
2502 64 : if (PyType_Ready(&FIELD_Type) < 0)
2503 0 : goto out;
2504 64 : if (PyType_Ready(&V4TAG_Type) < 0)
2505 0 : goto out;
2506 64 : if (PyType_Ready(&V4TAGS_Type) < 0)
2507 0 : goto out;
2508 64 : if (PyType_Ready(&V4HEADER_Type) < 0)
2509 0 : goto out;
2510 64 : if (PyType_Ready(&OPTIONAL_HEADER_Type) < 0)
2511 0 : goto out;
2512 64 : if (PyType_Ready(&CCACHE_Type) < 0)
2513 0 : goto out;
2514 64 : if (PyType_Ready(&MULTIPLE_CREDENTIALS_Type) < 0)
2515 0 : goto out;
2516 64 : if (PyType_Ready(&krb5ccache_InterfaceType) < 0)
2517 0 : goto out;
2518 64 : if (PyType_Ready(&krb5ccache_SyntaxType) < 0)
2519 0 : goto out;
2520 64 : if (!PyInterface_AddNdrRpcMethods(&krb5ccache_InterfaceType, py_ndr_krb5ccache_methods))
2521 0 : return NULL;
2522 :
2523 : #ifdef PY_PRINCIPAL_PATCH
2524 : PY_PRINCIPAL_PATCH(&PRINCIPAL_Type);
2525 : #endif
2526 : #ifdef PY_KEYBLOCK_PATCH
2527 : PY_KEYBLOCK_PATCH(&KEYBLOCK_Type);
2528 : #endif
2529 : #ifdef PY_ADDRESS_PATCH
2530 : PY_ADDRESS_PATCH(&ADDRESS_Type);
2531 : #endif
2532 : #ifdef PY_ADDRESSES_PATCH
2533 : PY_ADDRESSES_PATCH(&ADDRESSES_Type);
2534 : #endif
2535 : #ifdef PY_AUTHDATUM_PATCH
2536 : PY_AUTHDATUM_PATCH(&AUTHDATUM_Type);
2537 : #endif
2538 : #ifdef PY_AUTHDATA_PATCH
2539 : PY_AUTHDATA_PATCH(&AUTHDATA_Type);
2540 : #endif
2541 : #ifdef PY_CREDENTIAL_PATCH
2542 : PY_CREDENTIAL_PATCH(&CREDENTIAL_Type);
2543 : #endif
2544 : #ifdef PY_DELTATIME_TAG_PATCH
2545 : PY_DELTATIME_TAG_PATCH(&DELTATIME_TAG_Type);
2546 : #endif
2547 : #ifdef PY_FIELD_PATCH
2548 : PY_FIELD_PATCH(&FIELD_Type);
2549 : #endif
2550 : #ifdef PY_V4TAG_PATCH
2551 : PY_V4TAG_PATCH(&V4TAG_Type);
2552 : #endif
2553 : #ifdef PY_V4TAGS_PATCH
2554 : PY_V4TAGS_PATCH(&V4TAGS_Type);
2555 : #endif
2556 : #ifdef PY_V4HEADER_PATCH
2557 : PY_V4HEADER_PATCH(&V4HEADER_Type);
2558 : #endif
2559 : #ifdef PY_OPTIONAL_HEADER_PATCH
2560 : PY_OPTIONAL_HEADER_PATCH(&OPTIONAL_HEADER_Type);
2561 : #endif
2562 : #ifdef PY_CCACHE_PATCH
2563 : PY_CCACHE_PATCH(&CCACHE_Type);
2564 : #endif
2565 : #ifdef PY_MULTIPLE_CREDENTIALS_PATCH
2566 : PY_MULTIPLE_CREDENTIALS_PATCH(&MULTIPLE_CREDENTIALS_Type);
2567 : #endif
2568 : #ifdef PY_KRB5CCACHE_PATCH
2569 : PY_KRB5CCACHE_PATCH(&krb5ccache_InterfaceType);
2570 : #endif
2571 : #ifdef PY_KRB5CCACHE_ABSTRACT_SYNTAX_PATCH
2572 : PY_KRB5CCACHE_ABSTRACT_SYNTAX_PATCH(&krb5ccache_SyntaxType);
2573 : #endif
2574 : #ifdef PY_ABSTRACT_SYNTAX_PATCH
2575 : PY_ABSTRACT_SYNTAX_PATCH(&krb5ccache_SyntaxType);
2576 : #endif
2577 :
2578 64 : m = PyModule_Create(&moduledef);
2579 64 : if (m == NULL)
2580 0 : goto out;
2581 :
2582 35 : Py_INCREF((PyObject *)(void *)&PRINCIPAL_Type);
2583 64 : PyModule_AddObject(m, "PRINCIPAL", (PyObject *)(void *)&PRINCIPAL_Type);
2584 35 : Py_INCREF((PyObject *)(void *)&KEYBLOCK_Type);
2585 64 : PyModule_AddObject(m, "KEYBLOCK", (PyObject *)(void *)&KEYBLOCK_Type);
2586 35 : Py_INCREF((PyObject *)(void *)&ADDRESS_Type);
2587 64 : PyModule_AddObject(m, "ADDRESS", (PyObject *)(void *)&ADDRESS_Type);
2588 35 : Py_INCREF((PyObject *)(void *)&ADDRESSES_Type);
2589 64 : PyModule_AddObject(m, "ADDRESSES", (PyObject *)(void *)&ADDRESSES_Type);
2590 35 : Py_INCREF((PyObject *)(void *)&AUTHDATUM_Type);
2591 64 : PyModule_AddObject(m, "AUTHDATUM", (PyObject *)(void *)&AUTHDATUM_Type);
2592 35 : Py_INCREF((PyObject *)(void *)&AUTHDATA_Type);
2593 64 : PyModule_AddObject(m, "AUTHDATA", (PyObject *)(void *)&AUTHDATA_Type);
2594 35 : Py_INCREF((PyObject *)(void *)&CREDENTIAL_Type);
2595 64 : PyModule_AddObject(m, "CREDENTIAL", (PyObject *)(void *)&CREDENTIAL_Type);
2596 35 : Py_INCREF((PyObject *)(void *)&DELTATIME_TAG_Type);
2597 64 : PyModule_AddObject(m, "DELTATIME_TAG", (PyObject *)(void *)&DELTATIME_TAG_Type);
2598 35 : Py_INCREF((PyObject *)(void *)&FIELD_Type);
2599 64 : PyModule_AddObject(m, "FIELD", (PyObject *)(void *)&FIELD_Type);
2600 35 : Py_INCREF((PyObject *)(void *)&V4TAG_Type);
2601 64 : PyModule_AddObject(m, "V4TAG", (PyObject *)(void *)&V4TAG_Type);
2602 35 : Py_INCREF((PyObject *)(void *)&V4TAGS_Type);
2603 64 : PyModule_AddObject(m, "V4TAGS", (PyObject *)(void *)&V4TAGS_Type);
2604 35 : Py_INCREF((PyObject *)(void *)&V4HEADER_Type);
2605 64 : PyModule_AddObject(m, "V4HEADER", (PyObject *)(void *)&V4HEADER_Type);
2606 35 : Py_INCREF((PyObject *)(void *)&OPTIONAL_HEADER_Type);
2607 64 : PyModule_AddObject(m, "OPTIONAL_HEADER", (PyObject *)(void *)&OPTIONAL_HEADER_Type);
2608 35 : Py_INCREF((PyObject *)(void *)&CCACHE_Type);
2609 64 : PyModule_AddObject(m, "CCACHE", (PyObject *)(void *)&CCACHE_Type);
2610 35 : Py_INCREF((PyObject *)(void *)&MULTIPLE_CREDENTIALS_Type);
2611 64 : PyModule_AddObject(m, "MULTIPLE_CREDENTIALS", (PyObject *)(void *)&MULTIPLE_CREDENTIALS_Type);
2612 35 : Py_INCREF((PyObject *)(void *)&krb5ccache_InterfaceType);
2613 64 : PyModule_AddObject(m, "krb5ccache", (PyObject *)(void *)&krb5ccache_InterfaceType);
2614 35 : Py_INCREF((PyObject *)(void *)&krb5ccache_SyntaxType);
2615 64 : PyModule_AddObject(m, "krb5ccache_abstract_syntax", (PyObject *)(void *)&krb5ccache_SyntaxType);
2616 35 : Py_INCREF((PyObject *)(void *)&krb5ccache_SyntaxType);
2617 64 : PyModule_AddObject(m, "abstract_syntax", (PyObject *)(void *)&krb5ccache_SyntaxType);
2618 : #ifdef PY_MOD_KRB5CCACHE_PATCH
2619 : PY_MOD_KRB5CCACHE_PATCH(m);
2620 : #endif
2621 64 : out:
2622 64 : Py_XDECREF(dep_talloc);
2623 64 : Py_XDECREF(dep_samba_dcerpc_base);
2624 64 : Py_XDECREF(dep_samba_dcerpc_misc);
2625 64 : return m;
2626 :
2627 : }
|