git add -f bin/default/librpc/gen_ndr/*.[ch] bin/default/source*/librpc/gen_ndr/...
[metze/samba/wip.git] / bin.gen_ndr / default / librpc / gen_ndr / py_krb5pac.c
1
2 /* Python wrapper functions auto-generated by pidl */
3 #include <Python.h>
4 #include "includes.h"
5 #include <pytalloc.h>
6 #include "librpc/rpc/pyrpc.h"
7 #include "librpc/rpc/pyrpc_util.h"
8 #include "bin/default/librpc/gen_ndr/ndr_krb5pac.h"
9 #include "bin/default/librpc/gen_ndr/ndr_krb5pac_c.h"
10
11 #include "librpc/gen_ndr/security.h"
12 #include "librpc/gen_ndr/lsa.h"
13 #include "librpc/gen_ndr/netlogon.h"
14 #include "librpc/gen_ndr/samr.h"
15 staticforward PyTypeObject PAC_LOGON_NAME_Type;
16 staticforward PyTypeObject PAC_SIGNATURE_DATA_Type;
17 staticforward PyTypeObject PAC_LOGON_INFO_Type;
18 staticforward PyTypeObject PAC_CONSTRAINED_DELEGATION_Type;
19 staticforward PyTypeObject PAC_UPN_DNS_INFO_Type;
20 staticforward PyTypeObject PAC_LOGON_INFO_CTR_Type;
21 staticforward PyTypeObject PAC_CONSTRAINED_DELEGATION_CTR_Type;
22 staticforward PyTypeObject DATA_BLOB_REM_Type;
23 staticforward PyTypeObject PAC_BUFFER_Type;
24 staticforward PyTypeObject PAC_DATA_Type;
25 staticforward PyTypeObject PAC_BUFFER_RAW_Type;
26 staticforward PyTypeObject PAC_DATA_RAW_Type;
27 staticforward PyTypeObject PAC_Validate_Type;
28 staticforward PyTypeObject netsamlogoncache_entry_Type;
29 staticforward PyTypeObject krb5pac_InterfaceType;
30
31 void initkrb5pac(void);static PyTypeObject *lsa_String_Type;
32 static PyTypeObject *dom_sid_Type;
33 static PyTypeObject *netr_SamInfo3_Type;
34 static PyTypeObject *Object_Type;
35 static PyTypeObject *ClientConnection_Type;
36 static PyTypeObject *samr_RidWithAttributeArray_Type;
37
38 static PyObject *py_PAC_LOGON_NAME_get_logon_time(PyObject *obj, void *closure)
39 {
40         struct PAC_LOGON_NAME *object = (struct PAC_LOGON_NAME *)pytalloc_get_ptr(obj);
41         PyObject *py_logon_time;
42         py_logon_time = PyLong_FromLongLong(object->logon_time);
43         return py_logon_time;
44 }
45
46 static int py_PAC_LOGON_NAME_set_logon_time(PyObject *py_obj, PyObject *value, void *closure)
47 {
48         struct PAC_LOGON_NAME *object = (struct PAC_LOGON_NAME *)pytalloc_get_ptr(py_obj);
49         if (PyLong_Check(value)) {
50                 object->logon_time = PyLong_AsLongLong(value);
51         } else if (PyInt_Check(value)) {
52                 object->logon_time = PyInt_AsLong(value);
53         } else {
54                 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
55                   PyInt_Type.tp_name, PyLong_Type.tp_name);
56                 return -1;
57         }
58         return 0;
59 }
60
61 static PyObject *py_PAC_LOGON_NAME_get_size(PyObject *obj, void *closure)
62 {
63         struct PAC_LOGON_NAME *object = (struct PAC_LOGON_NAME *)pytalloc_get_ptr(obj);
64         PyObject *py_size;
65         py_size = PyInt_FromLong(object->size);
66         return py_size;
67 }
68
69 static int py_PAC_LOGON_NAME_set_size(PyObject *py_obj, PyObject *value, void *closure)
70 {
71         struct PAC_LOGON_NAME *object = (struct PAC_LOGON_NAME *)pytalloc_get_ptr(py_obj);
72         PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
73         object->size = PyInt_AsLong(value);
74         return 0;
75 }
76
77 static PyObject *py_PAC_LOGON_NAME_get_account_name(PyObject *obj, void *closure)
78 {
79         struct PAC_LOGON_NAME *object = (struct PAC_LOGON_NAME *)pytalloc_get_ptr(obj);
80         PyObject *py_account_name;
81         if (object->account_name == NULL) {
82                 py_account_name = Py_None;
83                 Py_INCREF(py_account_name);
84         } else {
85                 py_account_name = PyUnicode_Decode(object->account_name, strlen(object->account_name), "utf-8", "ignore");
86         }
87         return py_account_name;
88 }
89
90 static int py_PAC_LOGON_NAME_set_account_name(PyObject *py_obj, PyObject *value, void *closure)
91 {
92         struct PAC_LOGON_NAME *object = (struct PAC_LOGON_NAME *)pytalloc_get_ptr(py_obj);
93         if (PyUnicode_Check(value)) {
94                 object->account_name = PyString_AS_STRING(PyUnicode_AsEncodedString(value, "utf-8", "ignore"));
95         } else if (PyString_Check(value)) {
96                 object->account_name = PyString_AS_STRING(value);
97         } else {
98                 PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
99                 return -1;
100         }
101         return 0;
102 }
103
104 static PyGetSetDef py_PAC_LOGON_NAME_getsetters[] = {
105         { discard_const_p(char, "logon_time"), py_PAC_LOGON_NAME_get_logon_time, py_PAC_LOGON_NAME_set_logon_time },
106         { discard_const_p(char, "size"), py_PAC_LOGON_NAME_get_size, py_PAC_LOGON_NAME_set_size },
107         { discard_const_p(char, "account_name"), py_PAC_LOGON_NAME_get_account_name, py_PAC_LOGON_NAME_set_account_name },
108         { NULL }
109 };
110
111 static PyObject *py_PAC_LOGON_NAME_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
112 {
113         return pytalloc_new(struct PAC_LOGON_NAME, type);
114 }
115
116
117 static PyTypeObject PAC_LOGON_NAME_Type = {
118         PyObject_HEAD_INIT(NULL) 0,
119         .tp_name = "krb5pac.PAC_LOGON_NAME",
120         .tp_getset = py_PAC_LOGON_NAME_getsetters,
121         .tp_methods = NULL,
122         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
123         .tp_basicsize = sizeof(pytalloc_Object),
124         .tp_new = py_PAC_LOGON_NAME_new,
125 };
126
127
128 static PyObject *py_PAC_SIGNATURE_DATA_get_type(PyObject *obj, void *closure)
129 {
130         struct PAC_SIGNATURE_DATA *object = (struct PAC_SIGNATURE_DATA *)pytalloc_get_ptr(obj);
131         PyObject *py_type;
132         py_type = PyInt_FromLong(object->type);
133         return py_type;
134 }
135
136 static int py_PAC_SIGNATURE_DATA_set_type(PyObject *py_obj, PyObject *value, void *closure)
137 {
138         struct PAC_SIGNATURE_DATA *object = (struct PAC_SIGNATURE_DATA *)pytalloc_get_ptr(py_obj);
139         PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
140         object->type = PyInt_AsLong(value);
141         return 0;
142 }
143
144 static PyObject *py_PAC_SIGNATURE_DATA_get_signature(PyObject *obj, void *closure)
145 {
146         struct PAC_SIGNATURE_DATA *object = (struct PAC_SIGNATURE_DATA *)pytalloc_get_ptr(obj);
147         PyObject *py_signature;
148         py_signature = PyString_FromStringAndSize((char *)(object->signature).data, (object->signature).length);
149         return py_signature;
150 }
151
152 static int py_PAC_SIGNATURE_DATA_set_signature(PyObject *py_obj, PyObject *value, void *closure)
153 {
154         struct PAC_SIGNATURE_DATA *object = (struct PAC_SIGNATURE_DATA *)pytalloc_get_ptr(py_obj);
155         object->signature = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyString_AS_STRING(value), PyString_GET_SIZE(value));
156         return 0;
157 }
158
159 static PyGetSetDef py_PAC_SIGNATURE_DATA_getsetters[] = {
160         { discard_const_p(char, "type"), py_PAC_SIGNATURE_DATA_get_type, py_PAC_SIGNATURE_DATA_set_type },
161         { discard_const_p(char, "signature"), py_PAC_SIGNATURE_DATA_get_signature, py_PAC_SIGNATURE_DATA_set_signature },
162         { NULL }
163 };
164
165 static PyObject *py_PAC_SIGNATURE_DATA_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
166 {
167         return pytalloc_new(struct PAC_SIGNATURE_DATA, type);
168 }
169
170 static PyObject *py_PAC_SIGNATURE_DATA_ndr_pack(PyObject *py_obj)
171 {
172         struct PAC_SIGNATURE_DATA *object = (struct PAC_SIGNATURE_DATA *)pytalloc_get_ptr(py_obj);
173         DATA_BLOB blob;
174         enum ndr_err_code err;
175         err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_PAC_SIGNATURE_DATA);
176         if (err != NDR_ERR_SUCCESS) {
177                 PyErr_SetNdrError(err);
178                 return NULL;
179         }
180
181         return PyString_FromStringAndSize((char *)blob.data, blob.length);
182 }
183
184 static PyObject *py_PAC_SIGNATURE_DATA_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
185 {
186         struct PAC_SIGNATURE_DATA *object = (struct PAC_SIGNATURE_DATA *)pytalloc_get_ptr(py_obj);
187         DATA_BLOB blob;
188         int blob_length = 0;
189         enum ndr_err_code err;
190         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
191         PyObject *allow_remaining_obj = NULL;
192         bool allow_remaining = false;
193
194         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|O:__ndr_unpack__",
195                 discard_const_p(char *, kwnames),
196                 &blob.data, &blob_length,
197                 &allow_remaining_obj)) {
198                 return NULL;
199         }
200         blob.length = blob_length;
201
202         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
203                 allow_remaining = true;
204         }
205
206         if (allow_remaining) {
207                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_SIGNATURE_DATA);
208         } else {
209                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_SIGNATURE_DATA);
210         }
211         if (err != NDR_ERR_SUCCESS) {
212                 PyErr_SetNdrError(err);
213                 return NULL;
214         }
215
216         Py_RETURN_NONE;
217 }
218
219 static PyObject *py_PAC_SIGNATURE_DATA_ndr_print(PyObject *py_obj)
220 {
221         struct PAC_SIGNATURE_DATA *object = (struct PAC_SIGNATURE_DATA *)pytalloc_get_ptr(py_obj);
222         PyObject *ret;
223         char *retstr;
224
225         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_PAC_SIGNATURE_DATA, "PAC_SIGNATURE_DATA", object);
226         ret = PyString_FromString(retstr);
227         talloc_free(retstr);
228
229         return ret;
230 }
231
232 static PyMethodDef py_PAC_SIGNATURE_DATA_methods[] = {
233         { "__ndr_pack__", (PyCFunction)py_PAC_SIGNATURE_DATA_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
234         { "__ndr_unpack__", (PyCFunction)py_PAC_SIGNATURE_DATA_ndr_unpack, METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
235         { "__ndr_print__", (PyCFunction)py_PAC_SIGNATURE_DATA_ndr_print, METH_VARARGS, "S.ndr_print(object) -> None\nNDR print" },
236         { NULL, NULL, 0, NULL }
237 };
238
239
240 static PyTypeObject PAC_SIGNATURE_DATA_Type = {
241         PyObject_HEAD_INIT(NULL) 0,
242         .tp_name = "krb5pac.PAC_SIGNATURE_DATA",
243         .tp_getset = py_PAC_SIGNATURE_DATA_getsetters,
244         .tp_methods = py_PAC_SIGNATURE_DATA_methods,
245         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
246         .tp_basicsize = sizeof(pytalloc_Object),
247         .tp_new = py_PAC_SIGNATURE_DATA_new,
248 };
249
250
251 static PyObject *py_PAC_LOGON_INFO_get_info3(PyObject *obj, void *closure)
252 {
253         struct PAC_LOGON_INFO *object = (struct PAC_LOGON_INFO *)pytalloc_get_ptr(obj);
254         PyObject *py_info3;
255         py_info3 = pytalloc_reference_ex(netr_SamInfo3_Type, pytalloc_get_mem_ctx(obj), &object->info3);
256         return py_info3;
257 }
258
259 static int py_PAC_LOGON_INFO_set_info3(PyObject *py_obj, PyObject *value, void *closure)
260 {
261         struct PAC_LOGON_INFO *object = (struct PAC_LOGON_INFO *)pytalloc_get_ptr(py_obj);
262         PY_CHECK_TYPE(netr_SamInfo3_Type, value, return -1;);
263         if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
264                 PyErr_NoMemory();
265                 return -1;
266         }
267         object->info3 = *(struct netr_SamInfo3 *)pytalloc_get_ptr(value);
268         return 0;
269 }
270
271 static PyObject *py_PAC_LOGON_INFO_get_res_group_dom_sid(PyObject *obj, void *closure)
272 {
273         struct PAC_LOGON_INFO *object = (struct PAC_LOGON_INFO *)pytalloc_get_ptr(obj);
274         PyObject *py_res_group_dom_sid;
275         if (object->res_group_dom_sid == NULL) {
276                 py_res_group_dom_sid = Py_None;
277                 Py_INCREF(py_res_group_dom_sid);
278         } else {
279                 py_res_group_dom_sid = pytalloc_reference_ex(dom_sid_Type, object->res_group_dom_sid, object->res_group_dom_sid);
280         }
281         return py_res_group_dom_sid;
282 }
283
284 static int py_PAC_LOGON_INFO_set_res_group_dom_sid(PyObject *py_obj, PyObject *value, void *closure)
285 {
286         struct PAC_LOGON_INFO *object = (struct PAC_LOGON_INFO *)pytalloc_get_ptr(py_obj);
287         talloc_unlink(pytalloc_get_mem_ctx(py_obj), object->res_group_dom_sid);
288         if (value == Py_None) {
289                 object->res_group_dom_sid = NULL;
290         } else {
291                 object->res_group_dom_sid = NULL;
292                 PY_CHECK_TYPE(dom_sid_Type, value, return -1;);
293                 if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
294                         PyErr_NoMemory();
295                         return -1;
296                 }
297                 object->res_group_dom_sid = (struct dom_sid *)pytalloc_get_ptr(value);
298         }
299         return 0;
300 }
301
302 static PyObject *py_PAC_LOGON_INFO_get_res_groups(PyObject *obj, void *closure)
303 {
304         struct PAC_LOGON_INFO *object = (struct PAC_LOGON_INFO *)pytalloc_get_ptr(obj);
305         PyObject *py_res_groups;
306         py_res_groups = pytalloc_reference_ex(samr_RidWithAttributeArray_Type, pytalloc_get_mem_ctx(obj), &object->res_groups);
307         return py_res_groups;
308 }
309
310 static int py_PAC_LOGON_INFO_set_res_groups(PyObject *py_obj, PyObject *value, void *closure)
311 {
312         struct PAC_LOGON_INFO *object = (struct PAC_LOGON_INFO *)pytalloc_get_ptr(py_obj);
313         PY_CHECK_TYPE(samr_RidWithAttributeArray_Type, value, return -1;);
314         if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
315                 PyErr_NoMemory();
316                 return -1;
317         }
318         object->res_groups = *(struct samr_RidWithAttributeArray *)pytalloc_get_ptr(value);
319         return 0;
320 }
321
322 static PyGetSetDef py_PAC_LOGON_INFO_getsetters[] = {
323         { discard_const_p(char, "info3"), py_PAC_LOGON_INFO_get_info3, py_PAC_LOGON_INFO_set_info3 },
324         { discard_const_p(char, "res_group_dom_sid"), py_PAC_LOGON_INFO_get_res_group_dom_sid, py_PAC_LOGON_INFO_set_res_group_dom_sid },
325         { discard_const_p(char, "res_groups"), py_PAC_LOGON_INFO_get_res_groups, py_PAC_LOGON_INFO_set_res_groups },
326         { NULL }
327 };
328
329 static PyObject *py_PAC_LOGON_INFO_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
330 {
331         return pytalloc_new(struct PAC_LOGON_INFO, type);
332 }
333
334
335 static PyTypeObject PAC_LOGON_INFO_Type = {
336         PyObject_HEAD_INIT(NULL) 0,
337         .tp_name = "krb5pac.PAC_LOGON_INFO",
338         .tp_getset = py_PAC_LOGON_INFO_getsetters,
339         .tp_methods = NULL,
340         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
341         .tp_basicsize = sizeof(pytalloc_Object),
342         .tp_new = py_PAC_LOGON_INFO_new,
343 };
344
345
346 static PyObject *py_PAC_CONSTRAINED_DELEGATION_get_proxy_target(PyObject *obj, void *closure)
347 {
348         struct PAC_CONSTRAINED_DELEGATION *object = (struct PAC_CONSTRAINED_DELEGATION *)pytalloc_get_ptr(obj);
349         PyObject *py_proxy_target;
350         py_proxy_target = pytalloc_reference_ex(lsa_String_Type, pytalloc_get_mem_ctx(obj), &object->proxy_target);
351         return py_proxy_target;
352 }
353
354 static int py_PAC_CONSTRAINED_DELEGATION_set_proxy_target(PyObject *py_obj, PyObject *value, void *closure)
355 {
356         struct PAC_CONSTRAINED_DELEGATION *object = (struct PAC_CONSTRAINED_DELEGATION *)pytalloc_get_ptr(py_obj);
357         PY_CHECK_TYPE(lsa_String_Type, value, return -1;);
358         if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
359                 PyErr_NoMemory();
360                 return -1;
361         }
362         object->proxy_target = *(struct lsa_String *)pytalloc_get_ptr(value);
363         return 0;
364 }
365
366 static PyObject *py_PAC_CONSTRAINED_DELEGATION_get_num_transited_services(PyObject *obj, void *closure)
367 {
368         struct PAC_CONSTRAINED_DELEGATION *object = (struct PAC_CONSTRAINED_DELEGATION *)pytalloc_get_ptr(obj);
369         PyObject *py_num_transited_services;
370         py_num_transited_services = PyInt_FromLong(object->num_transited_services);
371         return py_num_transited_services;
372 }
373
374 static int py_PAC_CONSTRAINED_DELEGATION_set_num_transited_services(PyObject *py_obj, PyObject *value, void *closure)
375 {
376         struct PAC_CONSTRAINED_DELEGATION *object = (struct PAC_CONSTRAINED_DELEGATION *)pytalloc_get_ptr(py_obj);
377         PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
378         object->num_transited_services = PyInt_AsLong(value);
379         return 0;
380 }
381
382 static PyObject *py_PAC_CONSTRAINED_DELEGATION_get_transited_services(PyObject *obj, void *closure)
383 {
384         struct PAC_CONSTRAINED_DELEGATION *object = (struct PAC_CONSTRAINED_DELEGATION *)pytalloc_get_ptr(obj);
385         PyObject *py_transited_services;
386         if (object->transited_services == NULL) {
387                 py_transited_services = Py_None;
388                 Py_INCREF(py_transited_services);
389         } else {
390                 py_transited_services = PyList_New(object->num_transited_services);
391                 if (py_transited_services == NULL) {
392                         return NULL;
393                 }
394                 {
395                         int transited_services_cntr_1;
396                         for (transited_services_cntr_1 = 0; transited_services_cntr_1 < object->num_transited_services; transited_services_cntr_1++) {
397                                 PyObject *py_transited_services_1;
398                                 py_transited_services_1 = pytalloc_reference_ex(lsa_String_Type, object->transited_services, &object->transited_services[transited_services_cntr_1]);
399                                 PyList_SetItem(py_transited_services, transited_services_cntr_1, py_transited_services_1);
400                         }
401                 }
402         }
403         return py_transited_services;
404 }
405
406 static int py_PAC_CONSTRAINED_DELEGATION_set_transited_services(PyObject *py_obj, PyObject *value, void *closure)
407 {
408         struct PAC_CONSTRAINED_DELEGATION *object = (struct PAC_CONSTRAINED_DELEGATION *)pytalloc_get_ptr(py_obj);
409         talloc_unlink(pytalloc_get_mem_ctx(py_obj), object->transited_services);
410         if (value == Py_None) {
411                 object->transited_services = NULL;
412         } else {
413                 object->transited_services = NULL;
414                 PY_CHECK_TYPE(&PyList_Type, value, return -1;);
415                 {
416                         int transited_services_cntr_1;
417                         object->transited_services = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->transited_services, PyList_GET_SIZE(value));
418                         if (!object->transited_services) { return -1;; }
419                         talloc_set_name_const(object->transited_services, "ARRAY: object->transited_services");
420                         for (transited_services_cntr_1 = 0; transited_services_cntr_1 < PyList_GET_SIZE(value); transited_services_cntr_1++) {
421                                 PY_CHECK_TYPE(lsa_String_Type, PyList_GET_ITEM(value, transited_services_cntr_1), return -1;);
422                                 if (talloc_reference(object->transited_services, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, transited_services_cntr_1))) == NULL) {
423                                         PyErr_NoMemory();
424                                         return -1;
425                                 }
426                                 object->transited_services[transited_services_cntr_1] = *(struct lsa_String *)pytalloc_get_ptr(PyList_GET_ITEM(value, transited_services_cntr_1));
427                         }
428                 }
429         }
430         return 0;
431 }
432
433 static PyGetSetDef py_PAC_CONSTRAINED_DELEGATION_getsetters[] = {
434         { discard_const_p(char, "proxy_target"), py_PAC_CONSTRAINED_DELEGATION_get_proxy_target, py_PAC_CONSTRAINED_DELEGATION_set_proxy_target },
435         { discard_const_p(char, "num_transited_services"), py_PAC_CONSTRAINED_DELEGATION_get_num_transited_services, py_PAC_CONSTRAINED_DELEGATION_set_num_transited_services },
436         { discard_const_p(char, "transited_services"), py_PAC_CONSTRAINED_DELEGATION_get_transited_services, py_PAC_CONSTRAINED_DELEGATION_set_transited_services },
437         { NULL }
438 };
439
440 static PyObject *py_PAC_CONSTRAINED_DELEGATION_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
441 {
442         return pytalloc_new(struct PAC_CONSTRAINED_DELEGATION, type);
443 }
444
445
446 static PyTypeObject PAC_CONSTRAINED_DELEGATION_Type = {
447         PyObject_HEAD_INIT(NULL) 0,
448         .tp_name = "krb5pac.PAC_CONSTRAINED_DELEGATION",
449         .tp_getset = py_PAC_CONSTRAINED_DELEGATION_getsetters,
450         .tp_methods = NULL,
451         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
452         .tp_basicsize = sizeof(pytalloc_Object),
453         .tp_new = py_PAC_CONSTRAINED_DELEGATION_new,
454 };
455
456
457 static PyObject *py_PAC_UPN_DNS_INFO_get_upn_size(PyObject *obj, void *closure)
458 {
459         struct PAC_UPN_DNS_INFO *object = (struct PAC_UPN_DNS_INFO *)pytalloc_get_ptr(obj);
460         PyObject *py_upn_size;
461         py_upn_size = PyInt_FromLong(object->upn_size);
462         return py_upn_size;
463 }
464
465 static int py_PAC_UPN_DNS_INFO_set_upn_size(PyObject *py_obj, PyObject *value, void *closure)
466 {
467         struct PAC_UPN_DNS_INFO *object = (struct PAC_UPN_DNS_INFO *)pytalloc_get_ptr(py_obj);
468         PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
469         object->upn_size = PyInt_AsLong(value);
470         return 0;
471 }
472
473 static PyObject *py_PAC_UPN_DNS_INFO_get_upn_offset(PyObject *obj, void *closure)
474 {
475         struct PAC_UPN_DNS_INFO *object = (struct PAC_UPN_DNS_INFO *)pytalloc_get_ptr(obj);
476         PyObject *py_upn_offset;
477         py_upn_offset = PyInt_FromLong(object->upn_offset);
478         return py_upn_offset;
479 }
480
481 static int py_PAC_UPN_DNS_INFO_set_upn_offset(PyObject *py_obj, PyObject *value, void *closure)
482 {
483         struct PAC_UPN_DNS_INFO *object = (struct PAC_UPN_DNS_INFO *)pytalloc_get_ptr(py_obj);
484         PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
485         object->upn_offset = PyInt_AsLong(value);
486         return 0;
487 }
488
489 static PyObject *py_PAC_UPN_DNS_INFO_get_domain_size(PyObject *obj, void *closure)
490 {
491         struct PAC_UPN_DNS_INFO *object = (struct PAC_UPN_DNS_INFO *)pytalloc_get_ptr(obj);
492         PyObject *py_domain_size;
493         py_domain_size = PyInt_FromLong(object->domain_size);
494         return py_domain_size;
495 }
496
497 static int py_PAC_UPN_DNS_INFO_set_domain_size(PyObject *py_obj, PyObject *value, void *closure)
498 {
499         struct PAC_UPN_DNS_INFO *object = (struct PAC_UPN_DNS_INFO *)pytalloc_get_ptr(py_obj);
500         PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
501         object->domain_size = PyInt_AsLong(value);
502         return 0;
503 }
504
505 static PyObject *py_PAC_UPN_DNS_INFO_get_domain_offset(PyObject *obj, void *closure)
506 {
507         struct PAC_UPN_DNS_INFO *object = (struct PAC_UPN_DNS_INFO *)pytalloc_get_ptr(obj);
508         PyObject *py_domain_offset;
509         py_domain_offset = PyInt_FromLong(object->domain_offset);
510         return py_domain_offset;
511 }
512
513 static int py_PAC_UPN_DNS_INFO_set_domain_offset(PyObject *py_obj, PyObject *value, void *closure)
514 {
515         struct PAC_UPN_DNS_INFO *object = (struct PAC_UPN_DNS_INFO *)pytalloc_get_ptr(py_obj);
516         PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
517         object->domain_offset = PyInt_AsLong(value);
518         return 0;
519 }
520
521 static PyObject *py_PAC_UPN_DNS_INFO_get_flags(PyObject *obj, void *closure)
522 {
523         struct PAC_UPN_DNS_INFO *object = (struct PAC_UPN_DNS_INFO *)pytalloc_get_ptr(obj);
524         PyObject *py_flags;
525         py_flags = PyInt_FromLong(object->flags);
526         return py_flags;
527 }
528
529 static int py_PAC_UPN_DNS_INFO_set_flags(PyObject *py_obj, PyObject *value, void *closure)
530 {
531         struct PAC_UPN_DNS_INFO *object = (struct PAC_UPN_DNS_INFO *)pytalloc_get_ptr(py_obj);
532         if (PyLong_Check(value)) {
533                 object->flags = PyLong_AsLongLong(value);
534         } else if (PyInt_Check(value)) {
535                 object->flags = PyInt_AsLong(value);
536         } else {
537                 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
538                   PyInt_Type.tp_name, PyLong_Type.tp_name);
539                 return -1;
540         }
541         return 0;
542 }
543
544 static PyObject *py_PAC_UPN_DNS_INFO_get_padding(PyObject *obj, void *closure)
545 {
546         struct PAC_UPN_DNS_INFO *object = (struct PAC_UPN_DNS_INFO *)pytalloc_get_ptr(obj);
547         PyObject *py_padding;
548         py_padding = PyInt_FromLong(object->padding);
549         return py_padding;
550 }
551
552 static int py_PAC_UPN_DNS_INFO_set_padding(PyObject *py_obj, PyObject *value, void *closure)
553 {
554         struct PAC_UPN_DNS_INFO *object = (struct PAC_UPN_DNS_INFO *)pytalloc_get_ptr(py_obj);
555         PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
556         object->padding = PyInt_AsLong(value);
557         return 0;
558 }
559
560 static PyObject *py_PAC_UPN_DNS_INFO_get_upn_name(PyObject *obj, void *closure)
561 {
562         struct PAC_UPN_DNS_INFO *object = (struct PAC_UPN_DNS_INFO *)pytalloc_get_ptr(obj);
563         PyObject *py_upn_name;
564         if (object->upn_name == NULL) {
565                 py_upn_name = Py_None;
566                 Py_INCREF(py_upn_name);
567         } else {
568                 py_upn_name = PyUnicode_Decode(object->upn_name, strlen(object->upn_name), "utf-8", "ignore");
569         }
570         return py_upn_name;
571 }
572
573 static int py_PAC_UPN_DNS_INFO_set_upn_name(PyObject *py_obj, PyObject *value, void *closure)
574 {
575         struct PAC_UPN_DNS_INFO *object = (struct PAC_UPN_DNS_INFO *)pytalloc_get_ptr(py_obj);
576         if (PyUnicode_Check(value)) {
577                 object->upn_name = PyString_AS_STRING(PyUnicode_AsEncodedString(value, "utf-8", "ignore"));
578         } else if (PyString_Check(value)) {
579                 object->upn_name = PyString_AS_STRING(value);
580         } else {
581                 PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
582                 return -1;
583         }
584         return 0;
585 }
586
587 static PyObject *py_PAC_UPN_DNS_INFO_get_domain_name(PyObject *obj, void *closure)
588 {
589         struct PAC_UPN_DNS_INFO *object = (struct PAC_UPN_DNS_INFO *)pytalloc_get_ptr(obj);
590         PyObject *py_domain_name;
591         if (object->domain_name == NULL) {
592                 py_domain_name = Py_None;
593                 Py_INCREF(py_domain_name);
594         } else {
595                 py_domain_name = PyUnicode_Decode(object->domain_name, strlen(object->domain_name), "utf-8", "ignore");
596         }
597         return py_domain_name;
598 }
599
600 static int py_PAC_UPN_DNS_INFO_set_domain_name(PyObject *py_obj, PyObject *value, void *closure)
601 {
602         struct PAC_UPN_DNS_INFO *object = (struct PAC_UPN_DNS_INFO *)pytalloc_get_ptr(py_obj);
603         if (PyUnicode_Check(value)) {
604                 object->domain_name = PyString_AS_STRING(PyUnicode_AsEncodedString(value, "utf-8", "ignore"));
605         } else if (PyString_Check(value)) {
606                 object->domain_name = PyString_AS_STRING(value);
607         } else {
608                 PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
609                 return -1;
610         }
611         return 0;
612 }
613
614 static PyGetSetDef py_PAC_UPN_DNS_INFO_getsetters[] = {
615         { discard_const_p(char, "upn_size"), py_PAC_UPN_DNS_INFO_get_upn_size, py_PAC_UPN_DNS_INFO_set_upn_size },
616         { discard_const_p(char, "upn_offset"), py_PAC_UPN_DNS_INFO_get_upn_offset, py_PAC_UPN_DNS_INFO_set_upn_offset },
617         { discard_const_p(char, "domain_size"), py_PAC_UPN_DNS_INFO_get_domain_size, py_PAC_UPN_DNS_INFO_set_domain_size },
618         { discard_const_p(char, "domain_offset"), py_PAC_UPN_DNS_INFO_get_domain_offset, py_PAC_UPN_DNS_INFO_set_domain_offset },
619         { discard_const_p(char, "flags"), py_PAC_UPN_DNS_INFO_get_flags, py_PAC_UPN_DNS_INFO_set_flags },
620         { discard_const_p(char, "padding"), py_PAC_UPN_DNS_INFO_get_padding, py_PAC_UPN_DNS_INFO_set_padding },
621         { discard_const_p(char, "upn_name"), py_PAC_UPN_DNS_INFO_get_upn_name, py_PAC_UPN_DNS_INFO_set_upn_name },
622         { discard_const_p(char, "domain_name"), py_PAC_UPN_DNS_INFO_get_domain_name, py_PAC_UPN_DNS_INFO_set_domain_name },
623         { NULL }
624 };
625
626 static PyObject *py_PAC_UPN_DNS_INFO_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
627 {
628         return pytalloc_new(struct PAC_UPN_DNS_INFO, type);
629 }
630
631
632 static PyTypeObject PAC_UPN_DNS_INFO_Type = {
633         PyObject_HEAD_INIT(NULL) 0,
634         .tp_name = "krb5pac.PAC_UPN_DNS_INFO",
635         .tp_getset = py_PAC_UPN_DNS_INFO_getsetters,
636         .tp_methods = NULL,
637         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
638         .tp_basicsize = sizeof(pytalloc_Object),
639         .tp_new = py_PAC_UPN_DNS_INFO_new,
640 };
641
642
643 static PyObject *py_PAC_LOGON_INFO_CTR_get_info(PyObject *obj, void *closure)
644 {
645         struct PAC_LOGON_INFO_CTR *object = (struct PAC_LOGON_INFO_CTR *)pytalloc_get_ptr(obj);
646         PyObject *py_info;
647         if (object->info == NULL) {
648                 py_info = Py_None;
649                 Py_INCREF(py_info);
650         } else {
651                 py_info = pytalloc_reference_ex(&PAC_LOGON_INFO_Type, object->info, object->info);
652         }
653         return py_info;
654 }
655
656 static int py_PAC_LOGON_INFO_CTR_set_info(PyObject *py_obj, PyObject *value, void *closure)
657 {
658         struct PAC_LOGON_INFO_CTR *object = (struct PAC_LOGON_INFO_CTR *)pytalloc_get_ptr(py_obj);
659         talloc_unlink(pytalloc_get_mem_ctx(py_obj), object->info);
660         if (value == Py_None) {
661                 object->info = NULL;
662         } else {
663                 object->info = NULL;
664                 PY_CHECK_TYPE(&PAC_LOGON_INFO_Type, value, return -1;);
665                 if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
666                         PyErr_NoMemory();
667                         return -1;
668                 }
669                 object->info = (struct PAC_LOGON_INFO *)pytalloc_get_ptr(value);
670         }
671         return 0;
672 }
673
674 static PyGetSetDef py_PAC_LOGON_INFO_CTR_getsetters[] = {
675         { discard_const_p(char, "info"), py_PAC_LOGON_INFO_CTR_get_info, py_PAC_LOGON_INFO_CTR_set_info },
676         { NULL }
677 };
678
679 static PyObject *py_PAC_LOGON_INFO_CTR_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
680 {
681         return pytalloc_new(struct PAC_LOGON_INFO_CTR, type);
682 }
683
684 static PyObject *py_PAC_LOGON_INFO_CTR_ndr_pack(PyObject *py_obj)
685 {
686         struct PAC_LOGON_INFO_CTR *object = (struct PAC_LOGON_INFO_CTR *)pytalloc_get_ptr(py_obj);
687         DATA_BLOB blob;
688         enum ndr_err_code err;
689         err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_PAC_LOGON_INFO_CTR);
690         if (err != NDR_ERR_SUCCESS) {
691                 PyErr_SetNdrError(err);
692                 return NULL;
693         }
694
695         return PyString_FromStringAndSize((char *)blob.data, blob.length);
696 }
697
698 static PyObject *py_PAC_LOGON_INFO_CTR_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
699 {
700         struct PAC_LOGON_INFO_CTR *object = (struct PAC_LOGON_INFO_CTR *)pytalloc_get_ptr(py_obj);
701         DATA_BLOB blob;
702         int blob_length = 0;
703         enum ndr_err_code err;
704         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
705         PyObject *allow_remaining_obj = NULL;
706         bool allow_remaining = false;
707
708         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|O:__ndr_unpack__",
709                 discard_const_p(char *, kwnames),
710                 &blob.data, &blob_length,
711                 &allow_remaining_obj)) {
712                 return NULL;
713         }
714         blob.length = blob_length;
715
716         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
717                 allow_remaining = true;
718         }
719
720         if (allow_remaining) {
721                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_LOGON_INFO_CTR);
722         } else {
723                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_LOGON_INFO_CTR);
724         }
725         if (err != NDR_ERR_SUCCESS) {
726                 PyErr_SetNdrError(err);
727                 return NULL;
728         }
729
730         Py_RETURN_NONE;
731 }
732
733 static PyObject *py_PAC_LOGON_INFO_CTR_ndr_print(PyObject *py_obj)
734 {
735         struct PAC_LOGON_INFO_CTR *object = (struct PAC_LOGON_INFO_CTR *)pytalloc_get_ptr(py_obj);
736         PyObject *ret;
737         char *retstr;
738
739         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_PAC_LOGON_INFO_CTR, "PAC_LOGON_INFO_CTR", object);
740         ret = PyString_FromString(retstr);
741         talloc_free(retstr);
742
743         return ret;
744 }
745
746 static PyMethodDef py_PAC_LOGON_INFO_CTR_methods[] = {
747         { "__ndr_pack__", (PyCFunction)py_PAC_LOGON_INFO_CTR_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
748         { "__ndr_unpack__", (PyCFunction)py_PAC_LOGON_INFO_CTR_ndr_unpack, METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
749         { "__ndr_print__", (PyCFunction)py_PAC_LOGON_INFO_CTR_ndr_print, METH_VARARGS, "S.ndr_print(object) -> None\nNDR print" },
750         { NULL, NULL, 0, NULL }
751 };
752
753
754 static PyTypeObject PAC_LOGON_INFO_CTR_Type = {
755         PyObject_HEAD_INIT(NULL) 0,
756         .tp_name = "krb5pac.PAC_LOGON_INFO_CTR",
757         .tp_getset = py_PAC_LOGON_INFO_CTR_getsetters,
758         .tp_methods = py_PAC_LOGON_INFO_CTR_methods,
759         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
760         .tp_basicsize = sizeof(pytalloc_Object),
761         .tp_new = py_PAC_LOGON_INFO_CTR_new,
762 };
763
764
765 static PyObject *py_PAC_CONSTRAINED_DELEGATION_CTR_get_info(PyObject *obj, void *closure)
766 {
767         struct PAC_CONSTRAINED_DELEGATION_CTR *object = (struct PAC_CONSTRAINED_DELEGATION_CTR *)pytalloc_get_ptr(obj);
768         PyObject *py_info;
769         if (object->info == NULL) {
770                 py_info = Py_None;
771                 Py_INCREF(py_info);
772         } else {
773                 py_info = pytalloc_reference_ex(&PAC_CONSTRAINED_DELEGATION_Type, object->info, object->info);
774         }
775         return py_info;
776 }
777
778 static int py_PAC_CONSTRAINED_DELEGATION_CTR_set_info(PyObject *py_obj, PyObject *value, void *closure)
779 {
780         struct PAC_CONSTRAINED_DELEGATION_CTR *object = (struct PAC_CONSTRAINED_DELEGATION_CTR *)pytalloc_get_ptr(py_obj);
781         talloc_unlink(pytalloc_get_mem_ctx(py_obj), object->info);
782         if (value == Py_None) {
783                 object->info = NULL;
784         } else {
785                 object->info = NULL;
786                 PY_CHECK_TYPE(&PAC_CONSTRAINED_DELEGATION_Type, value, return -1;);
787                 if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
788                         PyErr_NoMemory();
789                         return -1;
790                 }
791                 object->info = (struct PAC_CONSTRAINED_DELEGATION *)pytalloc_get_ptr(value);
792         }
793         return 0;
794 }
795
796 static PyGetSetDef py_PAC_CONSTRAINED_DELEGATION_CTR_getsetters[] = {
797         { discard_const_p(char, "info"), py_PAC_CONSTRAINED_DELEGATION_CTR_get_info, py_PAC_CONSTRAINED_DELEGATION_CTR_set_info },
798         { NULL }
799 };
800
801 static PyObject *py_PAC_CONSTRAINED_DELEGATION_CTR_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
802 {
803         return pytalloc_new(struct PAC_CONSTRAINED_DELEGATION_CTR, type);
804 }
805
806 static PyObject *py_PAC_CONSTRAINED_DELEGATION_CTR_ndr_pack(PyObject *py_obj)
807 {
808         struct PAC_CONSTRAINED_DELEGATION_CTR *object = (struct PAC_CONSTRAINED_DELEGATION_CTR *)pytalloc_get_ptr(py_obj);
809         DATA_BLOB blob;
810         enum ndr_err_code err;
811         err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_PAC_CONSTRAINED_DELEGATION_CTR);
812         if (err != NDR_ERR_SUCCESS) {
813                 PyErr_SetNdrError(err);
814                 return NULL;
815         }
816
817         return PyString_FromStringAndSize((char *)blob.data, blob.length);
818 }
819
820 static PyObject *py_PAC_CONSTRAINED_DELEGATION_CTR_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
821 {
822         struct PAC_CONSTRAINED_DELEGATION_CTR *object = (struct PAC_CONSTRAINED_DELEGATION_CTR *)pytalloc_get_ptr(py_obj);
823         DATA_BLOB blob;
824         int blob_length = 0;
825         enum ndr_err_code err;
826         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
827         PyObject *allow_remaining_obj = NULL;
828         bool allow_remaining = false;
829
830         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|O:__ndr_unpack__",
831                 discard_const_p(char *, kwnames),
832                 &blob.data, &blob_length,
833                 &allow_remaining_obj)) {
834                 return NULL;
835         }
836         blob.length = blob_length;
837
838         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
839                 allow_remaining = true;
840         }
841
842         if (allow_remaining) {
843                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_CONSTRAINED_DELEGATION_CTR);
844         } else {
845                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_CONSTRAINED_DELEGATION_CTR);
846         }
847         if (err != NDR_ERR_SUCCESS) {
848                 PyErr_SetNdrError(err);
849                 return NULL;
850         }
851
852         Py_RETURN_NONE;
853 }
854
855 static PyObject *py_PAC_CONSTRAINED_DELEGATION_CTR_ndr_print(PyObject *py_obj)
856 {
857         struct PAC_CONSTRAINED_DELEGATION_CTR *object = (struct PAC_CONSTRAINED_DELEGATION_CTR *)pytalloc_get_ptr(py_obj);
858         PyObject *ret;
859         char *retstr;
860
861         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_PAC_CONSTRAINED_DELEGATION_CTR, "PAC_CONSTRAINED_DELEGATION_CTR", object);
862         ret = PyString_FromString(retstr);
863         talloc_free(retstr);
864
865         return ret;
866 }
867
868 static PyMethodDef py_PAC_CONSTRAINED_DELEGATION_CTR_methods[] = {
869         { "__ndr_pack__", (PyCFunction)py_PAC_CONSTRAINED_DELEGATION_CTR_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
870         { "__ndr_unpack__", (PyCFunction)py_PAC_CONSTRAINED_DELEGATION_CTR_ndr_unpack, METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
871         { "__ndr_print__", (PyCFunction)py_PAC_CONSTRAINED_DELEGATION_CTR_ndr_print, METH_VARARGS, "S.ndr_print(object) -> None\nNDR print" },
872         { NULL, NULL, 0, NULL }
873 };
874
875
876 static PyTypeObject PAC_CONSTRAINED_DELEGATION_CTR_Type = {
877         PyObject_HEAD_INIT(NULL) 0,
878         .tp_name = "krb5pac.PAC_CONSTRAINED_DELEGATION_CTR",
879         .tp_getset = py_PAC_CONSTRAINED_DELEGATION_CTR_getsetters,
880         .tp_methods = py_PAC_CONSTRAINED_DELEGATION_CTR_methods,
881         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
882         .tp_basicsize = sizeof(pytalloc_Object),
883         .tp_new = py_PAC_CONSTRAINED_DELEGATION_CTR_new,
884 };
885
886
887 static PyObject *py_DATA_BLOB_REM_get_remaining(PyObject *obj, void *closure)
888 {
889         struct DATA_BLOB_REM *object = (struct DATA_BLOB_REM *)pytalloc_get_ptr(obj);
890         PyObject *py_remaining;
891         py_remaining = PyString_FromStringAndSize((char *)(object->remaining).data, (object->remaining).length);
892         return py_remaining;
893 }
894
895 static int py_DATA_BLOB_REM_set_remaining(PyObject *py_obj, PyObject *value, void *closure)
896 {
897         struct DATA_BLOB_REM *object = (struct DATA_BLOB_REM *)pytalloc_get_ptr(py_obj);
898         object->remaining = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyString_AS_STRING(value), PyString_GET_SIZE(value));
899         return 0;
900 }
901
902 static PyGetSetDef py_DATA_BLOB_REM_getsetters[] = {
903         { discard_const_p(char, "remaining"), py_DATA_BLOB_REM_get_remaining, py_DATA_BLOB_REM_set_remaining },
904         { NULL }
905 };
906
907 static PyObject *py_DATA_BLOB_REM_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
908 {
909         return pytalloc_new(struct DATA_BLOB_REM, type);
910 }
911
912
913 static PyTypeObject DATA_BLOB_REM_Type = {
914         PyObject_HEAD_INIT(NULL) 0,
915         .tp_name = "krb5pac.DATA_BLOB_REM",
916         .tp_getset = py_DATA_BLOB_REM_getsetters,
917         .tp_methods = NULL,
918         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
919         .tp_basicsize = sizeof(pytalloc_Object),
920         .tp_new = py_DATA_BLOB_REM_new,
921 };
922
923 PyObject *py_import_PAC_INFO(TALLOC_CTX *mem_ctx, int level, union PAC_INFO *in)
924 {
925         PyObject *ret;
926
927         switch (level) {
928                 case PAC_TYPE_LOGON_INFO:
929                         ret = pytalloc_reference_ex(&PAC_LOGON_INFO_CTR_Type, mem_ctx, &in->logon_info);
930                         return ret;
931
932                 case PAC_TYPE_SRV_CHECKSUM:
933                         ret = pytalloc_reference_ex(&PAC_SIGNATURE_DATA_Type, mem_ctx, &in->srv_cksum);
934                         return ret;
935
936                 case PAC_TYPE_KDC_CHECKSUM:
937                         ret = pytalloc_reference_ex(&PAC_SIGNATURE_DATA_Type, mem_ctx, &in->kdc_cksum);
938                         return ret;
939
940                 case PAC_TYPE_LOGON_NAME:
941                         ret = pytalloc_reference_ex(&PAC_LOGON_NAME_Type, mem_ctx, &in->logon_name);
942                         return ret;
943
944                 case PAC_TYPE_CONSTRAINED_DELEGATION:
945                         ret = pytalloc_reference_ex(&PAC_CONSTRAINED_DELEGATION_CTR_Type, mem_ctx, &in->constrained_delegation);
946                         return ret;
947
948                 case PAC_TYPE_UPN_DNS_INFO:
949                         ret = pytalloc_reference_ex(&PAC_UPN_DNS_INFO_Type, mem_ctx, &in->upn_dns_info);
950                         return ret;
951
952                 default:
953                         ret = pytalloc_reference_ex(&DATA_BLOB_REM_Type, mem_ctx, &in->unknown);
954                         return ret;
955
956         }
957         PyErr_SetString(PyExc_TypeError, "unknown union level");
958         return NULL;
959 }
960
961 union PAC_INFO *py_export_PAC_INFO(TALLOC_CTX *mem_ctx, int level, PyObject *in)
962 {
963         union PAC_INFO *ret = talloc_zero(mem_ctx, union PAC_INFO);
964         switch (level) {
965                 case PAC_TYPE_LOGON_INFO:
966                         PY_CHECK_TYPE(&PAC_LOGON_INFO_CTR_Type, in, talloc_free(ret); return NULL;);
967                         if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
968                                 PyErr_NoMemory();
969                                 talloc_free(ret); return NULL;
970                         }
971                         ret->logon_info = *(struct PAC_LOGON_INFO_CTR *)pytalloc_get_ptr(in);
972                         break;
973
974                 case PAC_TYPE_SRV_CHECKSUM:
975                         PY_CHECK_TYPE(&PAC_SIGNATURE_DATA_Type, in, talloc_free(ret); return NULL;);
976                         if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
977                                 PyErr_NoMemory();
978                                 talloc_free(ret); return NULL;
979                         }
980                         ret->srv_cksum = *(struct PAC_SIGNATURE_DATA *)pytalloc_get_ptr(in);
981                         break;
982
983                 case PAC_TYPE_KDC_CHECKSUM:
984                         PY_CHECK_TYPE(&PAC_SIGNATURE_DATA_Type, in, talloc_free(ret); return NULL;);
985                         if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
986                                 PyErr_NoMemory();
987                                 talloc_free(ret); return NULL;
988                         }
989                         ret->kdc_cksum = *(struct PAC_SIGNATURE_DATA *)pytalloc_get_ptr(in);
990                         break;
991
992                 case PAC_TYPE_LOGON_NAME:
993                         PY_CHECK_TYPE(&PAC_LOGON_NAME_Type, in, talloc_free(ret); return NULL;);
994                         if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
995                                 PyErr_NoMemory();
996                                 talloc_free(ret); return NULL;
997                         }
998                         ret->logon_name = *(struct PAC_LOGON_NAME *)pytalloc_get_ptr(in);
999                         break;
1000
1001                 case PAC_TYPE_CONSTRAINED_DELEGATION:
1002                         PY_CHECK_TYPE(&PAC_CONSTRAINED_DELEGATION_CTR_Type, in, talloc_free(ret); return NULL;);
1003                         if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
1004                                 PyErr_NoMemory();
1005                                 talloc_free(ret); return NULL;
1006                         }
1007                         ret->constrained_delegation = *(struct PAC_CONSTRAINED_DELEGATION_CTR *)pytalloc_get_ptr(in);
1008                         break;
1009
1010                 case PAC_TYPE_UPN_DNS_INFO:
1011                         PY_CHECK_TYPE(&PAC_UPN_DNS_INFO_Type, in, talloc_free(ret); return NULL;);
1012                         if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
1013                                 PyErr_NoMemory();
1014                                 talloc_free(ret); return NULL;
1015                         }
1016                         ret->upn_dns_info = *(struct PAC_UPN_DNS_INFO *)pytalloc_get_ptr(in);
1017                         break;
1018
1019                 default:
1020                         PY_CHECK_TYPE(&DATA_BLOB_REM_Type, in, talloc_free(ret); return NULL;);
1021                         if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
1022                                 PyErr_NoMemory();
1023                                 talloc_free(ret); return NULL;
1024                         }
1025                         ret->unknown = *(struct DATA_BLOB_REM *)pytalloc_get_ptr(in);
1026                         break;
1027
1028         }
1029
1030         return ret;
1031 }
1032
1033
1034 static PyObject *py_PAC_BUFFER_get_type(PyObject *obj, void *closure)
1035 {
1036         struct PAC_BUFFER *object = (struct PAC_BUFFER *)pytalloc_get_ptr(obj);
1037         PyObject *py_type;
1038         py_type = PyInt_FromLong(object->type);
1039         return py_type;
1040 }
1041
1042 static int py_PAC_BUFFER_set_type(PyObject *py_obj, PyObject *value, void *closure)
1043 {
1044         struct PAC_BUFFER *object = (struct PAC_BUFFER *)pytalloc_get_ptr(py_obj);
1045         if (PyLong_Check(value)) {
1046                 object->type = PyLong_AsLongLong(value);
1047         } else if (PyInt_Check(value)) {
1048                 object->type = PyInt_AsLong(value);
1049         } else {
1050                 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
1051                   PyInt_Type.tp_name, PyLong_Type.tp_name);
1052                 return -1;
1053         }
1054         return 0;
1055 }
1056
1057 static PyObject *py_PAC_BUFFER_get__ndr_size(PyObject *obj, void *closure)
1058 {
1059         struct PAC_BUFFER *object = (struct PAC_BUFFER *)pytalloc_get_ptr(obj);
1060         PyObject *py__ndr_size;
1061         py__ndr_size = PyInt_FromLong(object->_ndr_size);
1062         return py__ndr_size;
1063 }
1064
1065 static int py_PAC_BUFFER_set__ndr_size(PyObject *py_obj, PyObject *value, void *closure)
1066 {
1067         struct PAC_BUFFER *object = (struct PAC_BUFFER *)pytalloc_get_ptr(py_obj);
1068         PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
1069         object->_ndr_size = PyInt_AsLong(value);
1070         return 0;
1071 }
1072
1073 static PyObject *py_PAC_BUFFER_get_info(PyObject *obj, void *closure)
1074 {
1075         struct PAC_BUFFER *object = (struct PAC_BUFFER *)pytalloc_get_ptr(obj);
1076         PyObject *py_info;
1077         if (object->info == NULL) {
1078                 py_info = Py_None;
1079                 Py_INCREF(py_info);
1080         } else {
1081                 py_info = py_import_PAC_INFO(object->info, object->type, object->info);
1082                 if (py_info == NULL) {
1083                         return NULL;
1084                 }
1085         }
1086         return py_info;
1087 }
1088
1089 static int py_PAC_BUFFER_set_info(PyObject *py_obj, PyObject *value, void *closure)
1090 {
1091         struct PAC_BUFFER *object = (struct PAC_BUFFER *)pytalloc_get_ptr(py_obj);
1092         talloc_unlink(pytalloc_get_mem_ctx(py_obj), object->info);
1093         if (value == Py_None) {
1094                 object->info = NULL;
1095         } else {
1096                 object->info = NULL;
1097                 {
1098                         union PAC_INFO *info_switch_2;
1099                         info_switch_2 = py_export_PAC_INFO(pytalloc_get_mem_ctx(py_obj), object->type, value);
1100                         if (info_switch_2 == NULL) {
1101                                 return -1;
1102                         }
1103                         object->info = info_switch_2;
1104                 }
1105         }
1106         return 0;
1107 }
1108
1109 static PyObject *py_PAC_BUFFER_get__pad(PyObject *obj, void *closure)
1110 {
1111         struct PAC_BUFFER *object = (struct PAC_BUFFER *)pytalloc_get_ptr(obj);
1112         PyObject *py__pad;
1113         py__pad = PyInt_FromLong(object->_pad);
1114         return py__pad;
1115 }
1116
1117 static int py_PAC_BUFFER_set__pad(PyObject *py_obj, PyObject *value, void *closure)
1118 {
1119         struct PAC_BUFFER *object = (struct PAC_BUFFER *)pytalloc_get_ptr(py_obj);
1120         PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
1121         object->_pad = PyInt_AsLong(value);
1122         return 0;
1123 }
1124
1125 static PyGetSetDef py_PAC_BUFFER_getsetters[] = {
1126         { discard_const_p(char, "type"), py_PAC_BUFFER_get_type, py_PAC_BUFFER_set_type },
1127         { discard_const_p(char, "_ndr_size"), py_PAC_BUFFER_get__ndr_size, py_PAC_BUFFER_set__ndr_size },
1128         { discard_const_p(char, "info"), py_PAC_BUFFER_get_info, py_PAC_BUFFER_set_info },
1129         { discard_const_p(char, "_pad"), py_PAC_BUFFER_get__pad, py_PAC_BUFFER_set__pad },
1130         { NULL }
1131 };
1132
1133 static PyObject *py_PAC_BUFFER_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1134 {
1135         return pytalloc_new(struct PAC_BUFFER, type);
1136 }
1137
1138 static PyObject *py_PAC_BUFFER_ndr_pack(PyObject *py_obj)
1139 {
1140         struct PAC_BUFFER *object = (struct PAC_BUFFER *)pytalloc_get_ptr(py_obj);
1141         DATA_BLOB blob;
1142         enum ndr_err_code err;
1143         err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_PAC_BUFFER);
1144         if (err != NDR_ERR_SUCCESS) {
1145                 PyErr_SetNdrError(err);
1146                 return NULL;
1147         }
1148
1149         return PyString_FromStringAndSize((char *)blob.data, blob.length);
1150 }
1151
1152 static PyObject *py_PAC_BUFFER_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
1153 {
1154         struct PAC_BUFFER *object = (struct PAC_BUFFER *)pytalloc_get_ptr(py_obj);
1155         DATA_BLOB blob;
1156         int blob_length = 0;
1157         enum ndr_err_code err;
1158         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
1159         PyObject *allow_remaining_obj = NULL;
1160         bool allow_remaining = false;
1161
1162         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|O:__ndr_unpack__",
1163                 discard_const_p(char *, kwnames),
1164                 &blob.data, &blob_length,
1165                 &allow_remaining_obj)) {
1166                 return NULL;
1167         }
1168         blob.length = blob_length;
1169
1170         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
1171                 allow_remaining = true;
1172         }
1173
1174         if (allow_remaining) {
1175                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_BUFFER);
1176         } else {
1177                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_BUFFER);
1178         }
1179         if (err != NDR_ERR_SUCCESS) {
1180                 PyErr_SetNdrError(err);
1181                 return NULL;
1182         }
1183
1184         Py_RETURN_NONE;
1185 }
1186
1187 static PyObject *py_PAC_BUFFER_ndr_print(PyObject *py_obj)
1188 {
1189         struct PAC_BUFFER *object = (struct PAC_BUFFER *)pytalloc_get_ptr(py_obj);
1190         PyObject *ret;
1191         char *retstr;
1192
1193         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_PAC_BUFFER, "PAC_BUFFER", object);
1194         ret = PyString_FromString(retstr);
1195         talloc_free(retstr);
1196
1197         return ret;
1198 }
1199
1200 static PyMethodDef py_PAC_BUFFER_methods[] = {
1201         { "__ndr_pack__", (PyCFunction)py_PAC_BUFFER_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
1202         { "__ndr_unpack__", (PyCFunction)py_PAC_BUFFER_ndr_unpack, METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
1203         { "__ndr_print__", (PyCFunction)py_PAC_BUFFER_ndr_print, METH_VARARGS, "S.ndr_print(object) -> None\nNDR print" },
1204         { NULL, NULL, 0, NULL }
1205 };
1206
1207
1208 static PyTypeObject PAC_BUFFER_Type = {
1209         PyObject_HEAD_INIT(NULL) 0,
1210         .tp_name = "krb5pac.PAC_BUFFER",
1211         .tp_getset = py_PAC_BUFFER_getsetters,
1212         .tp_methods = py_PAC_BUFFER_methods,
1213         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1214         .tp_basicsize = sizeof(pytalloc_Object),
1215         .tp_new = py_PAC_BUFFER_new,
1216 };
1217
1218
1219 static PyObject *py_PAC_DATA_get_num_buffers(PyObject *obj, void *closure)
1220 {
1221         struct PAC_DATA *object = (struct PAC_DATA *)pytalloc_get_ptr(obj);
1222         PyObject *py_num_buffers;
1223         py_num_buffers = PyInt_FromLong(object->num_buffers);
1224         return py_num_buffers;
1225 }
1226
1227 static int py_PAC_DATA_set_num_buffers(PyObject *py_obj, PyObject *value, void *closure)
1228 {
1229         struct PAC_DATA *object = (struct PAC_DATA *)pytalloc_get_ptr(py_obj);
1230         PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
1231         object->num_buffers = PyInt_AsLong(value);
1232         return 0;
1233 }
1234
1235 static PyObject *py_PAC_DATA_get_version(PyObject *obj, void *closure)
1236 {
1237         struct PAC_DATA *object = (struct PAC_DATA *)pytalloc_get_ptr(obj);
1238         PyObject *py_version;
1239         py_version = PyInt_FromLong(object->version);
1240         return py_version;
1241 }
1242
1243 static int py_PAC_DATA_set_version(PyObject *py_obj, PyObject *value, void *closure)
1244 {
1245         struct PAC_DATA *object = (struct PAC_DATA *)pytalloc_get_ptr(py_obj);
1246         PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
1247         object->version = PyInt_AsLong(value);
1248         return 0;
1249 }
1250
1251 static PyObject *py_PAC_DATA_get_buffers(PyObject *obj, void *closure)
1252 {
1253         struct PAC_DATA *object = (struct PAC_DATA *)pytalloc_get_ptr(obj);
1254         PyObject *py_buffers;
1255         py_buffers = PyList_New(object->num_buffers);
1256         if (py_buffers == NULL) {
1257                 return NULL;
1258         }
1259         {
1260                 int buffers_cntr_0;
1261                 for (buffers_cntr_0 = 0; buffers_cntr_0 < object->num_buffers; buffers_cntr_0++) {
1262                         PyObject *py_buffers_0;
1263                         py_buffers_0 = pytalloc_reference_ex(&PAC_BUFFER_Type, object->buffers, &object->buffers[buffers_cntr_0]);
1264                         PyList_SetItem(py_buffers, buffers_cntr_0, py_buffers_0);
1265                 }
1266         }
1267         return py_buffers;
1268 }
1269
1270 static int py_PAC_DATA_set_buffers(PyObject *py_obj, PyObject *value, void *closure)
1271 {
1272         struct PAC_DATA *object = (struct PAC_DATA *)pytalloc_get_ptr(py_obj);
1273         PY_CHECK_TYPE(&PyList_Type, value, return -1;);
1274         {
1275                 int buffers_cntr_0;
1276                 object->buffers = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->buffers, PyList_GET_SIZE(value));
1277                 if (!object->buffers) { return -1;; }
1278                 talloc_set_name_const(object->buffers, "ARRAY: object->buffers");
1279                 for (buffers_cntr_0 = 0; buffers_cntr_0 < PyList_GET_SIZE(value); buffers_cntr_0++) {
1280                         PY_CHECK_TYPE(&PAC_BUFFER_Type, PyList_GET_ITEM(value, buffers_cntr_0), return -1;);
1281                         if (talloc_reference(object->buffers, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, buffers_cntr_0))) == NULL) {
1282                                 PyErr_NoMemory();
1283                                 return -1;
1284                         }
1285                         object->buffers[buffers_cntr_0] = *(struct PAC_BUFFER *)pytalloc_get_ptr(PyList_GET_ITEM(value, buffers_cntr_0));
1286                 }
1287         }
1288         return 0;
1289 }
1290
1291 static PyGetSetDef py_PAC_DATA_getsetters[] = {
1292         { discard_const_p(char, "num_buffers"), py_PAC_DATA_get_num_buffers, py_PAC_DATA_set_num_buffers },
1293         { discard_const_p(char, "version"), py_PAC_DATA_get_version, py_PAC_DATA_set_version },
1294         { discard_const_p(char, "buffers"), py_PAC_DATA_get_buffers, py_PAC_DATA_set_buffers },
1295         { NULL }
1296 };
1297
1298 static PyObject *py_PAC_DATA_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1299 {
1300         return pytalloc_new(struct PAC_DATA, type);
1301 }
1302
1303 static PyObject *py_PAC_DATA_ndr_pack(PyObject *py_obj)
1304 {
1305         struct PAC_DATA *object = (struct PAC_DATA *)pytalloc_get_ptr(py_obj);
1306         DATA_BLOB blob;
1307         enum ndr_err_code err;
1308         err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_PAC_DATA);
1309         if (err != NDR_ERR_SUCCESS) {
1310                 PyErr_SetNdrError(err);
1311                 return NULL;
1312         }
1313
1314         return PyString_FromStringAndSize((char *)blob.data, blob.length);
1315 }
1316
1317 static PyObject *py_PAC_DATA_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
1318 {
1319         struct PAC_DATA *object = (struct PAC_DATA *)pytalloc_get_ptr(py_obj);
1320         DATA_BLOB blob;
1321         int blob_length = 0;
1322         enum ndr_err_code err;
1323         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
1324         PyObject *allow_remaining_obj = NULL;
1325         bool allow_remaining = false;
1326
1327         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|O:__ndr_unpack__",
1328                 discard_const_p(char *, kwnames),
1329                 &blob.data, &blob_length,
1330                 &allow_remaining_obj)) {
1331                 return NULL;
1332         }
1333         blob.length = blob_length;
1334
1335         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
1336                 allow_remaining = true;
1337         }
1338
1339         if (allow_remaining) {
1340                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_DATA);
1341         } else {
1342                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_DATA);
1343         }
1344         if (err != NDR_ERR_SUCCESS) {
1345                 PyErr_SetNdrError(err);
1346                 return NULL;
1347         }
1348
1349         Py_RETURN_NONE;
1350 }
1351
1352 static PyObject *py_PAC_DATA_ndr_print(PyObject *py_obj)
1353 {
1354         struct PAC_DATA *object = (struct PAC_DATA *)pytalloc_get_ptr(py_obj);
1355         PyObject *ret;
1356         char *retstr;
1357
1358         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_PAC_DATA, "PAC_DATA", object);
1359         ret = PyString_FromString(retstr);
1360         talloc_free(retstr);
1361
1362         return ret;
1363 }
1364
1365 static PyMethodDef py_PAC_DATA_methods[] = {
1366         { "__ndr_pack__", (PyCFunction)py_PAC_DATA_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
1367         { "__ndr_unpack__", (PyCFunction)py_PAC_DATA_ndr_unpack, METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
1368         { "__ndr_print__", (PyCFunction)py_PAC_DATA_ndr_print, METH_VARARGS, "S.ndr_print(object) -> None\nNDR print" },
1369         { NULL, NULL, 0, NULL }
1370 };
1371
1372
1373 static PyTypeObject PAC_DATA_Type = {
1374         PyObject_HEAD_INIT(NULL) 0,
1375         .tp_name = "krb5pac.PAC_DATA",
1376         .tp_getset = py_PAC_DATA_getsetters,
1377         .tp_methods = py_PAC_DATA_methods,
1378         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1379         .tp_basicsize = sizeof(pytalloc_Object),
1380         .tp_new = py_PAC_DATA_new,
1381 };
1382
1383
1384 static PyObject *py_PAC_BUFFER_RAW_get_type(PyObject *obj, void *closure)
1385 {
1386         struct PAC_BUFFER_RAW *object = (struct PAC_BUFFER_RAW *)pytalloc_get_ptr(obj);
1387         PyObject *py_type;
1388         py_type = PyInt_FromLong(object->type);
1389         return py_type;
1390 }
1391
1392 static int py_PAC_BUFFER_RAW_set_type(PyObject *py_obj, PyObject *value, void *closure)
1393 {
1394         struct PAC_BUFFER_RAW *object = (struct PAC_BUFFER_RAW *)pytalloc_get_ptr(py_obj);
1395         if (PyLong_Check(value)) {
1396                 object->type = PyLong_AsLongLong(value);
1397         } else if (PyInt_Check(value)) {
1398                 object->type = PyInt_AsLong(value);
1399         } else {
1400                 PyErr_Format(PyExc_TypeError, "Expected type %s or %s",\
1401                   PyInt_Type.tp_name, PyLong_Type.tp_name);
1402                 return -1;
1403         }
1404         return 0;
1405 }
1406
1407 static PyObject *py_PAC_BUFFER_RAW_get_ndr_size(PyObject *obj, void *closure)
1408 {
1409         struct PAC_BUFFER_RAW *object = (struct PAC_BUFFER_RAW *)pytalloc_get_ptr(obj);
1410         PyObject *py_ndr_size;
1411         py_ndr_size = PyInt_FromLong(object->ndr_size);
1412         return py_ndr_size;
1413 }
1414
1415 static int py_PAC_BUFFER_RAW_set_ndr_size(PyObject *py_obj, PyObject *value, void *closure)
1416 {
1417         struct PAC_BUFFER_RAW *object = (struct PAC_BUFFER_RAW *)pytalloc_get_ptr(py_obj);
1418         PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
1419         object->ndr_size = PyInt_AsLong(value);
1420         return 0;
1421 }
1422
1423 static PyObject *py_PAC_BUFFER_RAW_get_info(PyObject *obj, void *closure)
1424 {
1425         struct PAC_BUFFER_RAW *object = (struct PAC_BUFFER_RAW *)pytalloc_get_ptr(obj);
1426         PyObject *py_info;
1427         if (object->info == NULL) {
1428                 py_info = Py_None;
1429                 Py_INCREF(py_info);
1430         } else {
1431                 py_info = pytalloc_reference_ex(&DATA_BLOB_REM_Type, object->info, object->info);
1432         }
1433         return py_info;
1434 }
1435
1436 static int py_PAC_BUFFER_RAW_set_info(PyObject *py_obj, PyObject *value, void *closure)
1437 {
1438         struct PAC_BUFFER_RAW *object = (struct PAC_BUFFER_RAW *)pytalloc_get_ptr(py_obj);
1439         talloc_unlink(pytalloc_get_mem_ctx(py_obj), object->info);
1440         if (value == Py_None) {
1441                 object->info = NULL;
1442         } else {
1443                 object->info = NULL;
1444                 PY_CHECK_TYPE(&DATA_BLOB_REM_Type, value, return -1;);
1445                 if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
1446                         PyErr_NoMemory();
1447                         return -1;
1448                 }
1449                 object->info = (struct DATA_BLOB_REM *)pytalloc_get_ptr(value);
1450         }
1451         return 0;
1452 }
1453
1454 static PyObject *py_PAC_BUFFER_RAW_get__pad(PyObject *obj, void *closure)
1455 {
1456         struct PAC_BUFFER_RAW *object = (struct PAC_BUFFER_RAW *)pytalloc_get_ptr(obj);
1457         PyObject *py__pad;
1458         py__pad = PyInt_FromLong(object->_pad);
1459         return py__pad;
1460 }
1461
1462 static int py_PAC_BUFFER_RAW_set__pad(PyObject *py_obj, PyObject *value, void *closure)
1463 {
1464         struct PAC_BUFFER_RAW *object = (struct PAC_BUFFER_RAW *)pytalloc_get_ptr(py_obj);
1465         PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
1466         object->_pad = PyInt_AsLong(value);
1467         return 0;
1468 }
1469
1470 static PyGetSetDef py_PAC_BUFFER_RAW_getsetters[] = {
1471         { discard_const_p(char, "type"), py_PAC_BUFFER_RAW_get_type, py_PAC_BUFFER_RAW_set_type },
1472         { discard_const_p(char, "ndr_size"), py_PAC_BUFFER_RAW_get_ndr_size, py_PAC_BUFFER_RAW_set_ndr_size },
1473         { discard_const_p(char, "info"), py_PAC_BUFFER_RAW_get_info, py_PAC_BUFFER_RAW_set_info },
1474         { discard_const_p(char, "_pad"), py_PAC_BUFFER_RAW_get__pad, py_PAC_BUFFER_RAW_set__pad },
1475         { NULL }
1476 };
1477
1478 static PyObject *py_PAC_BUFFER_RAW_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1479 {
1480         return pytalloc_new(struct PAC_BUFFER_RAW, type);
1481 }
1482
1483 static PyObject *py_PAC_BUFFER_RAW_ndr_pack(PyObject *py_obj)
1484 {
1485         struct PAC_BUFFER_RAW *object = (struct PAC_BUFFER_RAW *)pytalloc_get_ptr(py_obj);
1486         DATA_BLOB blob;
1487         enum ndr_err_code err;
1488         err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_PAC_BUFFER_RAW);
1489         if (err != NDR_ERR_SUCCESS) {
1490                 PyErr_SetNdrError(err);
1491                 return NULL;
1492         }
1493
1494         return PyString_FromStringAndSize((char *)blob.data, blob.length);
1495 }
1496
1497 static PyObject *py_PAC_BUFFER_RAW_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
1498 {
1499         struct PAC_BUFFER_RAW *object = (struct PAC_BUFFER_RAW *)pytalloc_get_ptr(py_obj);
1500         DATA_BLOB blob;
1501         int blob_length = 0;
1502         enum ndr_err_code err;
1503         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
1504         PyObject *allow_remaining_obj = NULL;
1505         bool allow_remaining = false;
1506
1507         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|O:__ndr_unpack__",
1508                 discard_const_p(char *, kwnames),
1509                 &blob.data, &blob_length,
1510                 &allow_remaining_obj)) {
1511                 return NULL;
1512         }
1513         blob.length = blob_length;
1514
1515         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
1516                 allow_remaining = true;
1517         }
1518
1519         if (allow_remaining) {
1520                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_BUFFER_RAW);
1521         } else {
1522                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_BUFFER_RAW);
1523         }
1524         if (err != NDR_ERR_SUCCESS) {
1525                 PyErr_SetNdrError(err);
1526                 return NULL;
1527         }
1528
1529         Py_RETURN_NONE;
1530 }
1531
1532 static PyObject *py_PAC_BUFFER_RAW_ndr_print(PyObject *py_obj)
1533 {
1534         struct PAC_BUFFER_RAW *object = (struct PAC_BUFFER_RAW *)pytalloc_get_ptr(py_obj);
1535         PyObject *ret;
1536         char *retstr;
1537
1538         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_PAC_BUFFER_RAW, "PAC_BUFFER_RAW", object);
1539         ret = PyString_FromString(retstr);
1540         talloc_free(retstr);
1541
1542         return ret;
1543 }
1544
1545 static PyMethodDef py_PAC_BUFFER_RAW_methods[] = {
1546         { "__ndr_pack__", (PyCFunction)py_PAC_BUFFER_RAW_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
1547         { "__ndr_unpack__", (PyCFunction)py_PAC_BUFFER_RAW_ndr_unpack, METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
1548         { "__ndr_print__", (PyCFunction)py_PAC_BUFFER_RAW_ndr_print, METH_VARARGS, "S.ndr_print(object) -> None\nNDR print" },
1549         { NULL, NULL, 0, NULL }
1550 };
1551
1552
1553 static PyTypeObject PAC_BUFFER_RAW_Type = {
1554         PyObject_HEAD_INIT(NULL) 0,
1555         .tp_name = "krb5pac.PAC_BUFFER_RAW",
1556         .tp_getset = py_PAC_BUFFER_RAW_getsetters,
1557         .tp_methods = py_PAC_BUFFER_RAW_methods,
1558         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1559         .tp_basicsize = sizeof(pytalloc_Object),
1560         .tp_new = py_PAC_BUFFER_RAW_new,
1561 };
1562
1563
1564 static PyObject *py_PAC_DATA_RAW_get_num_buffers(PyObject *obj, void *closure)
1565 {
1566         struct PAC_DATA_RAW *object = (struct PAC_DATA_RAW *)pytalloc_get_ptr(obj);
1567         PyObject *py_num_buffers;
1568         py_num_buffers = PyInt_FromLong(object->num_buffers);
1569         return py_num_buffers;
1570 }
1571
1572 static int py_PAC_DATA_RAW_set_num_buffers(PyObject *py_obj, PyObject *value, void *closure)
1573 {
1574         struct PAC_DATA_RAW *object = (struct PAC_DATA_RAW *)pytalloc_get_ptr(py_obj);
1575         PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
1576         object->num_buffers = PyInt_AsLong(value);
1577         return 0;
1578 }
1579
1580 static PyObject *py_PAC_DATA_RAW_get_version(PyObject *obj, void *closure)
1581 {
1582         struct PAC_DATA_RAW *object = (struct PAC_DATA_RAW *)pytalloc_get_ptr(obj);
1583         PyObject *py_version;
1584         py_version = PyInt_FromLong(object->version);
1585         return py_version;
1586 }
1587
1588 static int py_PAC_DATA_RAW_set_version(PyObject *py_obj, PyObject *value, void *closure)
1589 {
1590         struct PAC_DATA_RAW *object = (struct PAC_DATA_RAW *)pytalloc_get_ptr(py_obj);
1591         PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
1592         object->version = PyInt_AsLong(value);
1593         return 0;
1594 }
1595
1596 static PyObject *py_PAC_DATA_RAW_get_buffers(PyObject *obj, void *closure)
1597 {
1598         struct PAC_DATA_RAW *object = (struct PAC_DATA_RAW *)pytalloc_get_ptr(obj);
1599         PyObject *py_buffers;
1600         py_buffers = PyList_New(object->num_buffers);
1601         if (py_buffers == NULL) {
1602                 return NULL;
1603         }
1604         {
1605                 int buffers_cntr_0;
1606                 for (buffers_cntr_0 = 0; buffers_cntr_0 < object->num_buffers; buffers_cntr_0++) {
1607                         PyObject *py_buffers_0;
1608                         py_buffers_0 = pytalloc_reference_ex(&PAC_BUFFER_RAW_Type, object->buffers, &object->buffers[buffers_cntr_0]);
1609                         PyList_SetItem(py_buffers, buffers_cntr_0, py_buffers_0);
1610                 }
1611         }
1612         return py_buffers;
1613 }
1614
1615 static int py_PAC_DATA_RAW_set_buffers(PyObject *py_obj, PyObject *value, void *closure)
1616 {
1617         struct PAC_DATA_RAW *object = (struct PAC_DATA_RAW *)pytalloc_get_ptr(py_obj);
1618         PY_CHECK_TYPE(&PyList_Type, value, return -1;);
1619         {
1620                 int buffers_cntr_0;
1621                 object->buffers = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->buffers, PyList_GET_SIZE(value));
1622                 if (!object->buffers) { return -1;; }
1623                 talloc_set_name_const(object->buffers, "ARRAY: object->buffers");
1624                 for (buffers_cntr_0 = 0; buffers_cntr_0 < PyList_GET_SIZE(value); buffers_cntr_0++) {
1625                         PY_CHECK_TYPE(&PAC_BUFFER_RAW_Type, PyList_GET_ITEM(value, buffers_cntr_0), return -1;);
1626                         if (talloc_reference(object->buffers, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, buffers_cntr_0))) == NULL) {
1627                                 PyErr_NoMemory();
1628                                 return -1;
1629                         }
1630                         object->buffers[buffers_cntr_0] = *(struct PAC_BUFFER_RAW *)pytalloc_get_ptr(PyList_GET_ITEM(value, buffers_cntr_0));
1631                 }
1632         }
1633         return 0;
1634 }
1635
1636 static PyGetSetDef py_PAC_DATA_RAW_getsetters[] = {
1637         { discard_const_p(char, "num_buffers"), py_PAC_DATA_RAW_get_num_buffers, py_PAC_DATA_RAW_set_num_buffers },
1638         { discard_const_p(char, "version"), py_PAC_DATA_RAW_get_version, py_PAC_DATA_RAW_set_version },
1639         { discard_const_p(char, "buffers"), py_PAC_DATA_RAW_get_buffers, py_PAC_DATA_RAW_set_buffers },
1640         { NULL }
1641 };
1642
1643 static PyObject *py_PAC_DATA_RAW_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1644 {
1645         return pytalloc_new(struct PAC_DATA_RAW, type);
1646 }
1647
1648 static PyObject *py_PAC_DATA_RAW_ndr_pack(PyObject *py_obj)
1649 {
1650         struct PAC_DATA_RAW *object = (struct PAC_DATA_RAW *)pytalloc_get_ptr(py_obj);
1651         DATA_BLOB blob;
1652         enum ndr_err_code err;
1653         err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_PAC_DATA_RAW);
1654         if (err != NDR_ERR_SUCCESS) {
1655                 PyErr_SetNdrError(err);
1656                 return NULL;
1657         }
1658
1659         return PyString_FromStringAndSize((char *)blob.data, blob.length);
1660 }
1661
1662 static PyObject *py_PAC_DATA_RAW_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
1663 {
1664         struct PAC_DATA_RAW *object = (struct PAC_DATA_RAW *)pytalloc_get_ptr(py_obj);
1665         DATA_BLOB blob;
1666         int blob_length = 0;
1667         enum ndr_err_code err;
1668         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
1669         PyObject *allow_remaining_obj = NULL;
1670         bool allow_remaining = false;
1671
1672         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|O:__ndr_unpack__",
1673                 discard_const_p(char *, kwnames),
1674                 &blob.data, &blob_length,
1675                 &allow_remaining_obj)) {
1676                 return NULL;
1677         }
1678         blob.length = blob_length;
1679
1680         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
1681                 allow_remaining = true;
1682         }
1683
1684         if (allow_remaining) {
1685                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_DATA_RAW);
1686         } else {
1687                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_DATA_RAW);
1688         }
1689         if (err != NDR_ERR_SUCCESS) {
1690                 PyErr_SetNdrError(err);
1691                 return NULL;
1692         }
1693
1694         Py_RETURN_NONE;
1695 }
1696
1697 static PyObject *py_PAC_DATA_RAW_ndr_print(PyObject *py_obj)
1698 {
1699         struct PAC_DATA_RAW *object = (struct PAC_DATA_RAW *)pytalloc_get_ptr(py_obj);
1700         PyObject *ret;
1701         char *retstr;
1702
1703         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_PAC_DATA_RAW, "PAC_DATA_RAW", object);
1704         ret = PyString_FromString(retstr);
1705         talloc_free(retstr);
1706
1707         return ret;
1708 }
1709
1710 static PyMethodDef py_PAC_DATA_RAW_methods[] = {
1711         { "__ndr_pack__", (PyCFunction)py_PAC_DATA_RAW_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
1712         { "__ndr_unpack__", (PyCFunction)py_PAC_DATA_RAW_ndr_unpack, METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
1713         { "__ndr_print__", (PyCFunction)py_PAC_DATA_RAW_ndr_print, METH_VARARGS, "S.ndr_print(object) -> None\nNDR print" },
1714         { NULL, NULL, 0, NULL }
1715 };
1716
1717
1718 static PyTypeObject PAC_DATA_RAW_Type = {
1719         PyObject_HEAD_INIT(NULL) 0,
1720         .tp_name = "krb5pac.PAC_DATA_RAW",
1721         .tp_getset = py_PAC_DATA_RAW_getsetters,
1722         .tp_methods = py_PAC_DATA_RAW_methods,
1723         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1724         .tp_basicsize = sizeof(pytalloc_Object),
1725         .tp_new = py_PAC_DATA_RAW_new,
1726 };
1727
1728
1729 static PyObject *py_PAC_Validate_get_MessageType(PyObject *obj, void *closure)
1730 {
1731         struct PAC_Validate *object = (struct PAC_Validate *)pytalloc_get_ptr(obj);
1732         PyObject *py_MessageType;
1733         py_MessageType = PyInt_FromLong(object->MessageType);
1734         return py_MessageType;
1735 }
1736
1737 static int py_PAC_Validate_set_MessageType(PyObject *py_obj, PyObject *value, void *closure)
1738 {
1739         struct PAC_Validate *object = (struct PAC_Validate *)pytalloc_get_ptr(py_obj);
1740         PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
1741         object->MessageType = PyInt_AsLong(value);
1742         return 0;
1743 }
1744
1745 static PyObject *py_PAC_Validate_get_ChecksumLength(PyObject *obj, void *closure)
1746 {
1747         struct PAC_Validate *object = (struct PAC_Validate *)pytalloc_get_ptr(obj);
1748         PyObject *py_ChecksumLength;
1749         py_ChecksumLength = PyInt_FromLong(object->ChecksumLength);
1750         return py_ChecksumLength;
1751 }
1752
1753 static int py_PAC_Validate_set_ChecksumLength(PyObject *py_obj, PyObject *value, void *closure)
1754 {
1755         struct PAC_Validate *object = (struct PAC_Validate *)pytalloc_get_ptr(py_obj);
1756         PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
1757         object->ChecksumLength = PyInt_AsLong(value);
1758         return 0;
1759 }
1760
1761 static PyObject *py_PAC_Validate_get_SignatureType(PyObject *obj, void *closure)
1762 {
1763         struct PAC_Validate *object = (struct PAC_Validate *)pytalloc_get_ptr(obj);
1764         PyObject *py_SignatureType;
1765         py_SignatureType = PyInt_FromLong(object->SignatureType);
1766         return py_SignatureType;
1767 }
1768
1769 static int py_PAC_Validate_set_SignatureType(PyObject *py_obj, PyObject *value, void *closure)
1770 {
1771         struct PAC_Validate *object = (struct PAC_Validate *)pytalloc_get_ptr(py_obj);
1772         PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
1773         object->SignatureType = PyInt_AsLong(value);
1774         return 0;
1775 }
1776
1777 static PyObject *py_PAC_Validate_get_SignatureLength(PyObject *obj, void *closure)
1778 {
1779         struct PAC_Validate *object = (struct PAC_Validate *)pytalloc_get_ptr(obj);
1780         PyObject *py_SignatureLength;
1781         py_SignatureLength = PyInt_FromLong(object->SignatureLength);
1782         return py_SignatureLength;
1783 }
1784
1785 static int py_PAC_Validate_set_SignatureLength(PyObject *py_obj, PyObject *value, void *closure)
1786 {
1787         struct PAC_Validate *object = (struct PAC_Validate *)pytalloc_get_ptr(py_obj);
1788         PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
1789         object->SignatureLength = PyInt_AsLong(value);
1790         return 0;
1791 }
1792
1793 static PyObject *py_PAC_Validate_get_ChecksumAndSignature(PyObject *obj, void *closure)
1794 {
1795         struct PAC_Validate *object = (struct PAC_Validate *)pytalloc_get_ptr(obj);
1796         PyObject *py_ChecksumAndSignature;
1797         py_ChecksumAndSignature = PyString_FromStringAndSize((char *)(object->ChecksumAndSignature).data, (object->ChecksumAndSignature).length);
1798         return py_ChecksumAndSignature;
1799 }
1800
1801 static int py_PAC_Validate_set_ChecksumAndSignature(PyObject *py_obj, PyObject *value, void *closure)
1802 {
1803         struct PAC_Validate *object = (struct PAC_Validate *)pytalloc_get_ptr(py_obj);
1804         object->ChecksumAndSignature = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyString_AS_STRING(value), PyString_GET_SIZE(value));
1805         return 0;
1806 }
1807
1808 static PyGetSetDef py_PAC_Validate_getsetters[] = {
1809         { discard_const_p(char, "MessageType"), py_PAC_Validate_get_MessageType, py_PAC_Validate_set_MessageType },
1810         { discard_const_p(char, "ChecksumLength"), py_PAC_Validate_get_ChecksumLength, py_PAC_Validate_set_ChecksumLength },
1811         { discard_const_p(char, "SignatureType"), py_PAC_Validate_get_SignatureType, py_PAC_Validate_set_SignatureType },
1812         { discard_const_p(char, "SignatureLength"), py_PAC_Validate_get_SignatureLength, py_PAC_Validate_set_SignatureLength },
1813         { discard_const_p(char, "ChecksumAndSignature"), py_PAC_Validate_get_ChecksumAndSignature, py_PAC_Validate_set_ChecksumAndSignature },
1814         { NULL }
1815 };
1816
1817 static PyObject *py_PAC_Validate_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1818 {
1819         return pytalloc_new(struct PAC_Validate, type);
1820 }
1821
1822 static PyObject *py_PAC_Validate_ndr_pack(PyObject *py_obj)
1823 {
1824         struct PAC_Validate *object = (struct PAC_Validate *)pytalloc_get_ptr(py_obj);
1825         DATA_BLOB blob;
1826         enum ndr_err_code err;
1827         err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_PAC_Validate);
1828         if (err != NDR_ERR_SUCCESS) {
1829                 PyErr_SetNdrError(err);
1830                 return NULL;
1831         }
1832
1833         return PyString_FromStringAndSize((char *)blob.data, blob.length);
1834 }
1835
1836 static PyObject *py_PAC_Validate_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
1837 {
1838         struct PAC_Validate *object = (struct PAC_Validate *)pytalloc_get_ptr(py_obj);
1839         DATA_BLOB blob;
1840         int blob_length = 0;
1841         enum ndr_err_code err;
1842         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
1843         PyObject *allow_remaining_obj = NULL;
1844         bool allow_remaining = false;
1845
1846         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|O:__ndr_unpack__",
1847                 discard_const_p(char *, kwnames),
1848                 &blob.data, &blob_length,
1849                 &allow_remaining_obj)) {
1850                 return NULL;
1851         }
1852         blob.length = blob_length;
1853
1854         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
1855                 allow_remaining = true;
1856         }
1857
1858         if (allow_remaining) {
1859                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_Validate);
1860         } else {
1861                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_PAC_Validate);
1862         }
1863         if (err != NDR_ERR_SUCCESS) {
1864                 PyErr_SetNdrError(err);
1865                 return NULL;
1866         }
1867
1868         Py_RETURN_NONE;
1869 }
1870
1871 static PyObject *py_PAC_Validate_ndr_print(PyObject *py_obj)
1872 {
1873         struct PAC_Validate *object = (struct PAC_Validate *)pytalloc_get_ptr(py_obj);
1874         PyObject *ret;
1875         char *retstr;
1876
1877         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_PAC_Validate, "PAC_Validate", object);
1878         ret = PyString_FromString(retstr);
1879         talloc_free(retstr);
1880
1881         return ret;
1882 }
1883
1884 static PyMethodDef py_PAC_Validate_methods[] = {
1885         { "__ndr_pack__", (PyCFunction)py_PAC_Validate_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
1886         { "__ndr_unpack__", (PyCFunction)py_PAC_Validate_ndr_unpack, METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
1887         { "__ndr_print__", (PyCFunction)py_PAC_Validate_ndr_print, METH_VARARGS, "S.ndr_print(object) -> None\nNDR print" },
1888         { NULL, NULL, 0, NULL }
1889 };
1890
1891
1892 static PyTypeObject PAC_Validate_Type = {
1893         PyObject_HEAD_INIT(NULL) 0,
1894         .tp_name = "krb5pac.PAC_Validate",
1895         .tp_getset = py_PAC_Validate_getsetters,
1896         .tp_methods = py_PAC_Validate_methods,
1897         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1898         .tp_basicsize = sizeof(pytalloc_Object),
1899         .tp_new = py_PAC_Validate_new,
1900 };
1901
1902
1903 static PyObject *py_netsamlogoncache_entry_get_timestamp(PyObject *obj, void *closure)
1904 {
1905         struct netsamlogoncache_entry *object = (struct netsamlogoncache_entry *)pytalloc_get_ptr(obj);
1906         PyObject *py_timestamp;
1907         py_timestamp = PyInt_FromLong(object->timestamp);
1908         return py_timestamp;
1909 }
1910
1911 static int py_netsamlogoncache_entry_set_timestamp(PyObject *py_obj, PyObject *value, void *closure)
1912 {
1913         struct netsamlogoncache_entry *object = (struct netsamlogoncache_entry *)pytalloc_get_ptr(py_obj);
1914         PY_CHECK_TYPE(&PyInt_Type, value, return -1;);
1915         object->timestamp = PyInt_AsLong(value);
1916         return 0;
1917 }
1918
1919 static PyObject *py_netsamlogoncache_entry_get_info3(PyObject *obj, void *closure)
1920 {
1921         struct netsamlogoncache_entry *object = (struct netsamlogoncache_entry *)pytalloc_get_ptr(obj);
1922         PyObject *py_info3;
1923         py_info3 = pytalloc_reference_ex(netr_SamInfo3_Type, pytalloc_get_mem_ctx(obj), &object->info3);
1924         return py_info3;
1925 }
1926
1927 static int py_netsamlogoncache_entry_set_info3(PyObject *py_obj, PyObject *value, void *closure)
1928 {
1929         struct netsamlogoncache_entry *object = (struct netsamlogoncache_entry *)pytalloc_get_ptr(py_obj);
1930         PY_CHECK_TYPE(netr_SamInfo3_Type, value, return -1;);
1931         if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
1932                 PyErr_NoMemory();
1933                 return -1;
1934         }
1935         object->info3 = *(struct netr_SamInfo3 *)pytalloc_get_ptr(value);
1936         return 0;
1937 }
1938
1939 static PyGetSetDef py_netsamlogoncache_entry_getsetters[] = {
1940         { discard_const_p(char, "timestamp"), py_netsamlogoncache_entry_get_timestamp, py_netsamlogoncache_entry_set_timestamp },
1941         { discard_const_p(char, "info3"), py_netsamlogoncache_entry_get_info3, py_netsamlogoncache_entry_set_info3 },
1942         { NULL }
1943 };
1944
1945 static PyObject *py_netsamlogoncache_entry_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1946 {
1947         return pytalloc_new(struct netsamlogoncache_entry, type);
1948 }
1949
1950 static PyObject *py_netsamlogoncache_entry_ndr_pack(PyObject *py_obj)
1951 {
1952         struct netsamlogoncache_entry *object = (struct netsamlogoncache_entry *)pytalloc_get_ptr(py_obj);
1953         DATA_BLOB blob;
1954         enum ndr_err_code err;
1955         err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_netsamlogoncache_entry);
1956         if (err != NDR_ERR_SUCCESS) {
1957                 PyErr_SetNdrError(err);
1958                 return NULL;
1959         }
1960
1961         return PyString_FromStringAndSize((char *)blob.data, blob.length);
1962 }
1963
1964 static PyObject *py_netsamlogoncache_entry_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
1965 {
1966         struct netsamlogoncache_entry *object = (struct netsamlogoncache_entry *)pytalloc_get_ptr(py_obj);
1967         DATA_BLOB blob;
1968         int blob_length = 0;
1969         enum ndr_err_code err;
1970         const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
1971         PyObject *allow_remaining_obj = NULL;
1972         bool allow_remaining = false;
1973
1974         if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|O:__ndr_unpack__",
1975                 discard_const_p(char *, kwnames),
1976                 &blob.data, &blob_length,
1977                 &allow_remaining_obj)) {
1978                 return NULL;
1979         }
1980         blob.length = blob_length;
1981
1982         if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
1983                 allow_remaining = true;
1984         }
1985
1986         if (allow_remaining) {
1987                 err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_netsamlogoncache_entry);
1988         } else {
1989                 err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_netsamlogoncache_entry);
1990         }
1991         if (err != NDR_ERR_SUCCESS) {
1992                 PyErr_SetNdrError(err);
1993                 return NULL;
1994         }
1995
1996         Py_RETURN_NONE;
1997 }
1998
1999 static PyObject *py_netsamlogoncache_entry_ndr_print(PyObject *py_obj)
2000 {
2001         struct netsamlogoncache_entry *object = (struct netsamlogoncache_entry *)pytalloc_get_ptr(py_obj);
2002         PyObject *ret;
2003         char *retstr;
2004
2005         retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_netsamlogoncache_entry, "netsamlogoncache_entry", object);
2006         ret = PyString_FromString(retstr);
2007         talloc_free(retstr);
2008
2009         return ret;
2010 }
2011
2012 static PyMethodDef py_netsamlogoncache_entry_methods[] = {
2013         { "__ndr_pack__", (PyCFunction)py_netsamlogoncache_entry_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
2014         { "__ndr_unpack__", (PyCFunction)py_netsamlogoncache_entry_ndr_unpack, METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
2015         { "__ndr_print__", (PyCFunction)py_netsamlogoncache_entry_ndr_print, METH_VARARGS, "S.ndr_print(object) -> None\nNDR print" },
2016         { NULL, NULL, 0, NULL }
2017 };
2018
2019
2020 static PyTypeObject netsamlogoncache_entry_Type = {
2021         PyObject_HEAD_INIT(NULL) 0,
2022         .tp_name = "krb5pac.netsamlogoncache_entry",
2023         .tp_getset = py_netsamlogoncache_entry_getsetters,
2024         .tp_methods = py_netsamlogoncache_entry_methods,
2025         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
2026         .tp_basicsize = sizeof(pytalloc_Object),
2027         .tp_new = py_netsamlogoncache_entry_new,
2028 };
2029
2030
2031 const struct PyNdrRpcMethodDef py_ndr_krb5pac_methods[] = {
2032         { NULL }
2033 };
2034
2035 static PyObject *interface_krb5pac_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2036 {
2037         return py_dcerpc_interface_init_helper(type, args, kwargs, &ndr_table_krb5pac);
2038 }
2039
2040 #define PY_DOC_KRB5PAC "Active Directory KRB5 PAC"
2041 static PyTypeObject krb5pac_InterfaceType = {
2042         PyObject_HEAD_INIT(NULL) 0,
2043         .tp_name = "krb5pac.krb5pac",
2044         .tp_basicsize = sizeof(dcerpc_InterfaceObject),
2045         .tp_doc = "krb5pac(binding, lp_ctx=None, credentials=None) -> connection\n"
2046 "\n"
2047 "binding should be a DCE/RPC binding string (for example: ncacn_ip_tcp:127.0.0.1)\n"
2048 "lp_ctx should be a path to a smb.conf file or a param.LoadParm object\n"
2049 "credentials should be a credentials.Credentials object.\n\n"PY_DOC_KRB5PAC,
2050         .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
2051         .tp_new = interface_krb5pac_new,
2052 };
2053
2054 static PyMethodDef krb5pac_methods[] = {
2055         { NULL, NULL, 0, NULL }
2056 };
2057
2058 void initkrb5pac(void)
2059 {
2060         PyObject *m;
2061         PyObject *dep_samba_dcerpc_samr;
2062         PyObject *dep_samba_dcerpc_security;
2063         PyObject *dep_talloc;
2064         PyObject *dep_samba_dcerpc_base;
2065         PyObject *dep_samba_dcerpc_netlogon;
2066         PyObject *dep_samba_dcerpc_lsa;
2067
2068         dep_samba_dcerpc_samr = PyImport_ImportModule("samba.dcerpc.samr");
2069         if (dep_samba_dcerpc_samr == NULL)
2070                 return;
2071
2072         dep_samba_dcerpc_security = PyImport_ImportModule("samba.dcerpc.security");
2073         if (dep_samba_dcerpc_security == NULL)
2074                 return;
2075
2076         dep_talloc = PyImport_ImportModule("talloc");
2077         if (dep_talloc == NULL)
2078                 return;
2079
2080         dep_samba_dcerpc_base = PyImport_ImportModule("samba.dcerpc.base");
2081         if (dep_samba_dcerpc_base == NULL)
2082                 return;
2083
2084         dep_samba_dcerpc_netlogon = PyImport_ImportModule("samba.dcerpc.netlogon");
2085         if (dep_samba_dcerpc_netlogon == NULL)
2086                 return;
2087
2088         dep_samba_dcerpc_lsa = PyImport_ImportModule("samba.dcerpc.lsa");
2089         if (dep_samba_dcerpc_lsa == NULL)
2090                 return;
2091
2092         lsa_String_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_lsa, "String");
2093         if (lsa_String_Type == NULL)
2094                 return;
2095
2096         dom_sid_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_security, "dom_sid");
2097         if (dom_sid_Type == NULL)
2098                 return;
2099
2100         netr_SamInfo3_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_netlogon, "netr_SamInfo3");
2101         if (netr_SamInfo3_Type == NULL)
2102                 return;
2103
2104         Object_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "Object");
2105         if (Object_Type == NULL)
2106                 return;
2107
2108         ClientConnection_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_base, "ClientConnection");
2109         if (ClientConnection_Type == NULL)
2110                 return;
2111
2112         samr_RidWithAttributeArray_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_samr, "RidWithAttributeArray");
2113         if (samr_RidWithAttributeArray_Type == NULL)
2114                 return;
2115
2116         PAC_LOGON_NAME_Type.tp_base = Object_Type;
2117
2118         PAC_SIGNATURE_DATA_Type.tp_base = Object_Type;
2119
2120         PAC_LOGON_INFO_Type.tp_base = Object_Type;
2121
2122         PAC_CONSTRAINED_DELEGATION_Type.tp_base = Object_Type;
2123
2124         PAC_UPN_DNS_INFO_Type.tp_base = Object_Type;
2125
2126         PAC_LOGON_INFO_CTR_Type.tp_base = Object_Type;
2127
2128         PAC_CONSTRAINED_DELEGATION_CTR_Type.tp_base = Object_Type;
2129
2130         DATA_BLOB_REM_Type.tp_base = Object_Type;
2131
2132         PAC_BUFFER_Type.tp_base = Object_Type;
2133
2134         PAC_DATA_Type.tp_base = Object_Type;
2135
2136         PAC_BUFFER_RAW_Type.tp_base = Object_Type;
2137
2138         PAC_DATA_RAW_Type.tp_base = Object_Type;
2139
2140         PAC_Validate_Type.tp_base = Object_Type;
2141
2142         netsamlogoncache_entry_Type.tp_base = Object_Type;
2143
2144         krb5pac_InterfaceType.tp_base = ClientConnection_Type;
2145
2146         if (PyType_Ready(&PAC_LOGON_NAME_Type) < 0)
2147                 return;
2148         if (PyType_Ready(&PAC_SIGNATURE_DATA_Type) < 0)
2149                 return;
2150         if (PyType_Ready(&PAC_LOGON_INFO_Type) < 0)
2151                 return;
2152         if (PyType_Ready(&PAC_CONSTRAINED_DELEGATION_Type) < 0)
2153                 return;
2154         if (PyType_Ready(&PAC_UPN_DNS_INFO_Type) < 0)
2155                 return;
2156         if (PyType_Ready(&PAC_LOGON_INFO_CTR_Type) < 0)
2157                 return;
2158         if (PyType_Ready(&PAC_CONSTRAINED_DELEGATION_CTR_Type) < 0)
2159                 return;
2160         if (PyType_Ready(&DATA_BLOB_REM_Type) < 0)
2161                 return;
2162         if (PyType_Ready(&PAC_BUFFER_Type) < 0)
2163                 return;
2164         if (PyType_Ready(&PAC_DATA_Type) < 0)
2165                 return;
2166         if (PyType_Ready(&PAC_BUFFER_RAW_Type) < 0)
2167                 return;
2168         if (PyType_Ready(&PAC_DATA_RAW_Type) < 0)
2169                 return;
2170         if (PyType_Ready(&PAC_Validate_Type) < 0)
2171                 return;
2172         if (PyType_Ready(&netsamlogoncache_entry_Type) < 0)
2173                 return;
2174         if (PyType_Ready(&krb5pac_InterfaceType) < 0)
2175                 return;
2176         if (!PyInterface_AddNdrRpcMethods(&krb5pac_InterfaceType, py_ndr_krb5pac_methods))
2177                 return;
2178
2179 #ifdef PY_PAC_LOGON_NAME_PATCH
2180         PY_PAC_LOGON_NAME_PATCH(&PAC_LOGON_NAME_Type);
2181 #endif
2182 #ifdef PY_PAC_SIGNATURE_DATA_PATCH
2183         PY_PAC_SIGNATURE_DATA_PATCH(&PAC_SIGNATURE_DATA_Type);
2184 #endif
2185 #ifdef PY_PAC_LOGON_INFO_PATCH
2186         PY_PAC_LOGON_INFO_PATCH(&PAC_LOGON_INFO_Type);
2187 #endif
2188 #ifdef PY_PAC_CONSTRAINED_DELEGATION_PATCH
2189         PY_PAC_CONSTRAINED_DELEGATION_PATCH(&PAC_CONSTRAINED_DELEGATION_Type);
2190 #endif
2191 #ifdef PY_PAC_UPN_DNS_INFO_PATCH
2192         PY_PAC_UPN_DNS_INFO_PATCH(&PAC_UPN_DNS_INFO_Type);
2193 #endif
2194 #ifdef PY_PAC_LOGON_INFO_CTR_PATCH
2195         PY_PAC_LOGON_INFO_CTR_PATCH(&PAC_LOGON_INFO_CTR_Type);
2196 #endif
2197 #ifdef PY_PAC_CONSTRAINED_DELEGATION_CTR_PATCH
2198         PY_PAC_CONSTRAINED_DELEGATION_CTR_PATCH(&PAC_CONSTRAINED_DELEGATION_CTR_Type);
2199 #endif
2200 #ifdef PY_DATA_BLOB_REM_PATCH
2201         PY_DATA_BLOB_REM_PATCH(&DATA_BLOB_REM_Type);
2202 #endif
2203 #ifdef PY_PAC_BUFFER_PATCH
2204         PY_PAC_BUFFER_PATCH(&PAC_BUFFER_Type);
2205 #endif
2206 #ifdef PY_PAC_DATA_PATCH
2207         PY_PAC_DATA_PATCH(&PAC_DATA_Type);
2208 #endif
2209 #ifdef PY_PAC_BUFFER_RAW_PATCH
2210         PY_PAC_BUFFER_RAW_PATCH(&PAC_BUFFER_RAW_Type);
2211 #endif
2212 #ifdef PY_PAC_DATA_RAW_PATCH
2213         PY_PAC_DATA_RAW_PATCH(&PAC_DATA_RAW_Type);
2214 #endif
2215 #ifdef PY_PAC_VALIDATE_PATCH
2216         PY_PAC_VALIDATE_PATCH(&PAC_Validate_Type);
2217 #endif
2218 #ifdef PY_NETSAMLOGONCACHE_ENTRY_PATCH
2219         PY_NETSAMLOGONCACHE_ENTRY_PATCH(&netsamlogoncache_entry_Type);
2220 #endif
2221 #ifdef PY_KRB5PAC_PATCH
2222         PY_KRB5PAC_PATCH(&krb5pac_InterfaceType);
2223 #endif
2224
2225         m = Py_InitModule3("krb5pac", krb5pac_methods, "krb5pac DCE/RPC");
2226         if (m == NULL)
2227                 return;
2228
2229         PyModule_AddObject(m, "NETLOGON_GENERIC_KRB5_PAC_VALIDATE", PyInt_FromLong(3));
2230         PyModule_AddObject(m, "PAC_TYPE_LOGON_INFO", PyInt_FromLong(PAC_TYPE_LOGON_INFO));
2231         PyModule_AddObject(m, "PAC_TYPE_CONSTRAINED_DELEGATION", PyInt_FromLong(PAC_TYPE_CONSTRAINED_DELEGATION));
2232         PyModule_AddObject(m, "PAC_TYPE_SRV_CHECKSUM", PyInt_FromLong(PAC_TYPE_SRV_CHECKSUM));
2233         PyModule_AddObject(m, "PAC_TYPE_KDC_CHECKSUM", PyInt_FromLong(PAC_TYPE_KDC_CHECKSUM));
2234         PyModule_AddObject(m, "PAC_TYPE_LOGON_NAME", PyInt_FromLong(PAC_TYPE_LOGON_NAME));
2235         PyModule_AddObject(m, "PAC_TYPE_UPN_DNS_INFO", PyInt_FromLong(PAC_TYPE_UPN_DNS_INFO));
2236         PyModule_AddObject(m, "UDI_ACCT_HAS_NO_UPN", PyInt_FromLong(UDI_ACCT_HAS_NO_UPN));
2237         Py_INCREF((PyObject *)(void *)&PAC_LOGON_NAME_Type);
2238         PyModule_AddObject(m, "PAC_LOGON_NAME", (PyObject *)(void *)&PAC_LOGON_NAME_Type);
2239         Py_INCREF((PyObject *)(void *)&PAC_SIGNATURE_DATA_Type);
2240         PyModule_AddObject(m, "PAC_SIGNATURE_DATA", (PyObject *)(void *)&PAC_SIGNATURE_DATA_Type);
2241         Py_INCREF((PyObject *)(void *)&PAC_LOGON_INFO_Type);
2242         PyModule_AddObject(m, "PAC_LOGON_INFO", (PyObject *)(void *)&PAC_LOGON_INFO_Type);
2243         Py_INCREF((PyObject *)(void *)&PAC_CONSTRAINED_DELEGATION_Type);
2244         PyModule_AddObject(m, "PAC_CONSTRAINED_DELEGATION", (PyObject *)(void *)&PAC_CONSTRAINED_DELEGATION_Type);
2245         Py_INCREF((PyObject *)(void *)&PAC_UPN_DNS_INFO_Type);
2246         PyModule_AddObject(m, "PAC_UPN_DNS_INFO", (PyObject *)(void *)&PAC_UPN_DNS_INFO_Type);
2247         Py_INCREF((PyObject *)(void *)&PAC_LOGON_INFO_CTR_Type);
2248         PyModule_AddObject(m, "PAC_LOGON_INFO_CTR", (PyObject *)(void *)&PAC_LOGON_INFO_CTR_Type);
2249         Py_INCREF((PyObject *)(void *)&PAC_CONSTRAINED_DELEGATION_CTR_Type);
2250         PyModule_AddObject(m, "PAC_CONSTRAINED_DELEGATION_CTR", (PyObject *)(void *)&PAC_CONSTRAINED_DELEGATION_CTR_Type);
2251         Py_INCREF((PyObject *)(void *)&DATA_BLOB_REM_Type);
2252         PyModule_AddObject(m, "DATA_BLOB_REM", (PyObject *)(void *)&DATA_BLOB_REM_Type);
2253         Py_INCREF((PyObject *)(void *)&PAC_BUFFER_Type);
2254         PyModule_AddObject(m, "PAC_BUFFER", (PyObject *)(void *)&PAC_BUFFER_Type);
2255         Py_INCREF((PyObject *)(void *)&PAC_DATA_Type);
2256         PyModule_AddObject(m, "PAC_DATA", (PyObject *)(void *)&PAC_DATA_Type);
2257         Py_INCREF((PyObject *)(void *)&PAC_BUFFER_RAW_Type);
2258         PyModule_AddObject(m, "PAC_BUFFER_RAW", (PyObject *)(void *)&PAC_BUFFER_RAW_Type);
2259         Py_INCREF((PyObject *)(void *)&PAC_DATA_RAW_Type);
2260         PyModule_AddObject(m, "PAC_DATA_RAW", (PyObject *)(void *)&PAC_DATA_RAW_Type);
2261         Py_INCREF((PyObject *)(void *)&PAC_Validate_Type);
2262         PyModule_AddObject(m, "PAC_Validate", (PyObject *)(void *)&PAC_Validate_Type);
2263         Py_INCREF((PyObject *)(void *)&netsamlogoncache_entry_Type);
2264         PyModule_AddObject(m, "netsamlogoncache_entry", (PyObject *)(void *)&netsamlogoncache_entry_Type);
2265         Py_INCREF((PyObject *)(void *)&krb5pac_InterfaceType);
2266         PyModule_AddObject(m, "krb5pac", (PyObject *)(void *)&krb5pac_InterfaceType);
2267 #ifdef PY_MOD_KRB5PAC_PATCH
2268         PY_MOD_KRB5PAC_PATCH(m);
2269 #endif
2270
2271 }