Line data Source code
1 :
2 : /* Python wrapper functions auto-generated by pidl */
3 : #define PY_SSIZE_T_CLEAN 1 /* We use Py_ssize_t for PyArg_ParseTupleAndKeywords */
4 : #include "lib/replace/system/python.h"
5 : #include "python/py3compat.h"
6 : #include "includes.h"
7 : #include "python/modules.h"
8 : #include <pytalloc.h>
9 : #include "librpc/rpc/pyrpc.h"
10 : #include "librpc/rpc/pyrpc_util.h"
11 : #include "bin/default/librpc/gen_ndr/ndr_ntlmssp.h"
12 :
13 :
14 : /*
15 : * Suppress compiler warnings if the generated code does not call these
16 : * functions
17 : */
18 : #ifndef _MAYBE_UNUSED_
19 : #ifdef __has_attribute
20 : #if __has_attribute(unused)
21 : #define _MAYBE_UNUSED_ __attribute__ ((unused))
22 : #else
23 : #define _MAYBE_UNUSED_
24 : #endif
25 : #endif
26 : #endif
27 : /*
28 : * These functions are here to ensure they can be optimized out by
29 : * the compiler based on the constant input values
30 : */
31 :
32 488 : static inline unsigned long long ndr_sizeof2uintmax(size_t var_size)
33 : {
34 488 : switch (var_size) {
35 0 : case 8:
36 0 : return UINT64_MAX;
37 488 : case 4:
38 488 : return UINT32_MAX;
39 0 : case 2:
40 0 : return UINT16_MAX;
41 0 : case 1:
42 0 : return UINT8_MAX;
43 : }
44 :
45 0 : return 0;
46 : }
47 :
48 : static inline _MAYBE_UNUSED_ long long ndr_sizeof2intmax(size_t var_size)
49 : {
50 : switch (var_size) {
51 : case 8:
52 : return INT64_MAX;
53 : case 4:
54 : return INT32_MAX;
55 : case 2:
56 : return INT16_MAX;
57 : case 1:
58 : return INT8_MAX;
59 : }
60 :
61 : return 0;
62 : }
63 :
64 : #include "librpc/gen_ndr/security.h"
65 : static PyTypeObject ntlmssp_VERSION_Type;
66 : static PyTypeObject ntlmssp_Version_Type;
67 : static PyTypeObject NEGOTIATE_MESSAGE_Type;
68 : static PyTypeObject ntlmssp_SingleHostData_Type;
69 : static PyTypeObject ntlmssp_AvValue_Type;
70 : static PyTypeObject AV_PAIR_Type;
71 : static PyTypeObject AV_PAIR_LIST_Type;
72 : static PyTypeObject CHALLENGE_MESSAGE_Type;
73 : static PyTypeObject LM_RESPONSE_Type;
74 : static PyTypeObject LMv2_RESPONSE_Type;
75 : static PyTypeObject ntlmssp_LM_RESPONSE_with_len_Type;
76 : static PyTypeObject NTLM_RESPONSE_Type;
77 : static PyTypeObject NTLMv2_CLIENT_CHALLENGE_Type;
78 : static PyTypeObject NTLMv2_RESPONSE_Type;
79 : static PyTypeObject ntlmssp_NTLM_RESPONSE_with_len_Type;
80 : static PyTypeObject ntlmssp_MIC_Type;
81 : static PyTypeObject AUTHENTICATE_MESSAGE_Type;
82 : static PyTypeObject NTLMSSP_MESSAGE_SIGNATURE_Type;
83 : static PyTypeObject NTLMSSP_MESSAGE_SIGNATURE_NTLMv2_Type;
84 : static PyTypeObject ntlmssp_InterfaceType;
85 :
86 : static PyTypeObject *BaseObject_Type;
87 : static PyTypeObject *LSAP_TOKEN_INFO_INTEGRITY_Type;
88 : static PyTypeObject *ClientConnection_Type;
89 : static PyTypeObject *ndr_syntax_id_Type;
90 :
91 0 : static PyObject *py_ntlmssp_VERSION_get_ProductMajorVersion(PyObject *obj, void *closure)
92 : {
93 0 : struct ntlmssp_VERSION *object = pytalloc_get_ptr(obj);
94 : PyObject *py_ProductMajorVersion;
95 0 : py_ProductMajorVersion = PyLong_FromLong((uint16_t)(object->ProductMajorVersion));
96 0 : return py_ProductMajorVersion;
97 : }
98 :
99 0 : static int py_ntlmssp_VERSION_set_ProductMajorVersion(PyObject *py_obj, PyObject *value, void *closure)
100 : {
101 0 : struct ntlmssp_VERSION *object = pytalloc_get_ptr(py_obj);
102 0 : if (value == NULL) {
103 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->ProductMajorVersion");
104 0 : return -1;
105 : }
106 : {
107 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->ProductMajorVersion));
108 0 : if (PyLong_Check(value)) {
109 : unsigned long long test_var;
110 0 : test_var = PyLong_AsUnsignedLongLong(value);
111 0 : if (PyErr_Occurred() != NULL) {
112 0 : return -1;
113 : }
114 0 : if (test_var > uint_max) {
115 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
116 : PyLong_Type.tp_name, uint_max, test_var);
117 0 : return -1;
118 : }
119 0 : object->ProductMajorVersion = test_var;
120 : } else {
121 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
122 : PyLong_Type.tp_name);
123 0 : return -1;
124 : }
125 : }
126 0 : return 0;
127 : }
128 :
129 0 : static PyObject *py_ntlmssp_VERSION_get_ProductMinorVersion(PyObject *obj, void *closure)
130 : {
131 0 : struct ntlmssp_VERSION *object = pytalloc_get_ptr(obj);
132 : PyObject *py_ProductMinorVersion;
133 0 : py_ProductMinorVersion = PyLong_FromLong((uint16_t)(object->ProductMinorVersion));
134 0 : return py_ProductMinorVersion;
135 : }
136 :
137 0 : static int py_ntlmssp_VERSION_set_ProductMinorVersion(PyObject *py_obj, PyObject *value, void *closure)
138 : {
139 0 : struct ntlmssp_VERSION *object = pytalloc_get_ptr(py_obj);
140 0 : if (value == NULL) {
141 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->ProductMinorVersion");
142 0 : return -1;
143 : }
144 : {
145 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->ProductMinorVersion));
146 0 : if (PyLong_Check(value)) {
147 : unsigned long long test_var;
148 0 : test_var = PyLong_AsUnsignedLongLong(value);
149 0 : if (PyErr_Occurred() != NULL) {
150 0 : return -1;
151 : }
152 0 : if (test_var > uint_max) {
153 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
154 : PyLong_Type.tp_name, uint_max, test_var);
155 0 : return -1;
156 : }
157 0 : object->ProductMinorVersion = test_var;
158 : } else {
159 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
160 : PyLong_Type.tp_name);
161 0 : return -1;
162 : }
163 : }
164 0 : return 0;
165 : }
166 :
167 0 : static PyObject *py_ntlmssp_VERSION_get_ProductBuild(PyObject *obj, void *closure)
168 : {
169 0 : struct ntlmssp_VERSION *object = pytalloc_get_ptr(obj);
170 : PyObject *py_ProductBuild;
171 0 : py_ProductBuild = PyLong_FromLong((uint16_t)(object->ProductBuild));
172 0 : return py_ProductBuild;
173 : }
174 :
175 0 : static int py_ntlmssp_VERSION_set_ProductBuild(PyObject *py_obj, PyObject *value, void *closure)
176 : {
177 0 : struct ntlmssp_VERSION *object = pytalloc_get_ptr(py_obj);
178 0 : if (value == NULL) {
179 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->ProductBuild");
180 0 : return -1;
181 : }
182 : {
183 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->ProductBuild));
184 0 : if (PyLong_Check(value)) {
185 : unsigned long long test_var;
186 0 : test_var = PyLong_AsUnsignedLongLong(value);
187 0 : if (PyErr_Occurred() != NULL) {
188 0 : return -1;
189 : }
190 0 : if (test_var > uint_max) {
191 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
192 : PyLong_Type.tp_name, uint_max, test_var);
193 0 : return -1;
194 : }
195 0 : object->ProductBuild = test_var;
196 : } else {
197 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
198 : PyLong_Type.tp_name);
199 0 : return -1;
200 : }
201 : }
202 0 : return 0;
203 : }
204 :
205 0 : static PyObject *py_ntlmssp_VERSION_get_Reserved(PyObject *obj, void *closure)
206 : {
207 0 : struct ntlmssp_VERSION *object = pytalloc_get_ptr(obj);
208 : PyObject *py_Reserved;
209 0 : py_Reserved = PyList_New(3);
210 0 : if (py_Reserved == NULL) {
211 0 : return NULL;
212 : }
213 : {
214 : int Reserved_cntr_0;
215 0 : for (Reserved_cntr_0 = 0; Reserved_cntr_0 < (3); Reserved_cntr_0++) {
216 : PyObject *py_Reserved_0;
217 0 : py_Reserved_0 = PyLong_FromLong((uint16_t)((object->Reserved)[Reserved_cntr_0]));
218 0 : PyList_SetItem(py_Reserved, Reserved_cntr_0, py_Reserved_0);
219 : }
220 : }
221 0 : return py_Reserved;
222 : }
223 :
224 0 : static int py_ntlmssp_VERSION_set_Reserved(PyObject *py_obj, PyObject *value, void *closure)
225 : {
226 0 : struct ntlmssp_VERSION *object = pytalloc_get_ptr(py_obj);
227 0 : if (value == NULL) {
228 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->Reserved");
229 0 : return -1;
230 : }
231 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
232 : {
233 : int Reserved_cntr_0;
234 0 : if (ARRAY_SIZE(object->Reserved) != PyList_GET_SIZE(value)) {
235 0 : PyErr_Format(PyExc_TypeError, "Expected list of type %s, length %zu, got %zd", Py_TYPE(value)->tp_name, ARRAY_SIZE(object->Reserved), PyList_GET_SIZE(value));
236 0 : return -1;
237 : }
238 0 : for (Reserved_cntr_0 = 0; Reserved_cntr_0 < PyList_GET_SIZE(value); Reserved_cntr_0++) {
239 0 : if (PyList_GET_ITEM(value, Reserved_cntr_0) == NULL) {
240 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->Reserved)[Reserved_cntr_0]");
241 0 : return -1;
242 : }
243 : {
244 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((object->Reserved)[Reserved_cntr_0]));
245 0 : if (PyLong_Check(PyList_GET_ITEM(value, Reserved_cntr_0))) {
246 : unsigned long long test_var;
247 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, Reserved_cntr_0));
248 0 : if (PyErr_Occurred() != NULL) {
249 0 : return -1;
250 : }
251 0 : if (test_var > uint_max) {
252 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
253 : PyLong_Type.tp_name, uint_max, test_var);
254 0 : return -1;
255 : }
256 0 : (object->Reserved)[Reserved_cntr_0] = test_var;
257 : } else {
258 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
259 : PyLong_Type.tp_name);
260 0 : return -1;
261 : }
262 : }
263 : }
264 : }
265 0 : return 0;
266 : }
267 :
268 0 : static PyObject *py_ntlmssp_VERSION_get_NTLMRevisionCurrent(PyObject *obj, void *closure)
269 : {
270 0 : struct ntlmssp_VERSION *object = pytalloc_get_ptr(obj);
271 : PyObject *py_NTLMRevisionCurrent;
272 0 : py_NTLMRevisionCurrent = PyLong_FromLong((uint16_t)(object->NTLMRevisionCurrent));
273 0 : return py_NTLMRevisionCurrent;
274 : }
275 :
276 0 : static int py_ntlmssp_VERSION_set_NTLMRevisionCurrent(PyObject *py_obj, PyObject *value, void *closure)
277 : {
278 0 : struct ntlmssp_VERSION *object = pytalloc_get_ptr(py_obj);
279 0 : if (value == NULL) {
280 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->NTLMRevisionCurrent");
281 0 : return -1;
282 : }
283 : {
284 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->NTLMRevisionCurrent));
285 0 : if (PyLong_Check(value)) {
286 : unsigned long long test_var;
287 0 : test_var = PyLong_AsUnsignedLongLong(value);
288 0 : if (PyErr_Occurred() != NULL) {
289 0 : return -1;
290 : }
291 0 : if (test_var > uint_max) {
292 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
293 : PyLong_Type.tp_name, uint_max, test_var);
294 0 : return -1;
295 : }
296 0 : object->NTLMRevisionCurrent = test_var;
297 : } else {
298 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
299 : PyLong_Type.tp_name);
300 0 : return -1;
301 : }
302 : }
303 0 : return 0;
304 : }
305 :
306 : static PyGetSetDef py_ntlmssp_VERSION_getsetters[] = {
307 : {
308 : .name = discard_const_p(char, "ProductMajorVersion"),
309 : .get = py_ntlmssp_VERSION_get_ProductMajorVersion,
310 : .set = py_ntlmssp_VERSION_set_ProductMajorVersion,
311 : .doc = discard_const_p(char, "PIDL-generated element of base type ntlmssp_WindowsMajorVersion")
312 : },
313 : {
314 : .name = discard_const_p(char, "ProductMinorVersion"),
315 : .get = py_ntlmssp_VERSION_get_ProductMinorVersion,
316 : .set = py_ntlmssp_VERSION_set_ProductMinorVersion,
317 : .doc = discard_const_p(char, "PIDL-generated element of base type ntlmssp_WindowsMinorVersion")
318 : },
319 : {
320 : .name = discard_const_p(char, "ProductBuild"),
321 : .get = py_ntlmssp_VERSION_get_ProductBuild,
322 : .set = py_ntlmssp_VERSION_set_ProductBuild,
323 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
324 : },
325 : {
326 : .name = discard_const_p(char, "Reserved"),
327 : .get = py_ntlmssp_VERSION_get_Reserved,
328 : .set = py_ntlmssp_VERSION_set_Reserved,
329 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
330 : },
331 : {
332 : .name = discard_const_p(char, "NTLMRevisionCurrent"),
333 : .get = py_ntlmssp_VERSION_get_NTLMRevisionCurrent,
334 : .set = py_ntlmssp_VERSION_set_NTLMRevisionCurrent,
335 : .doc = discard_const_p(char, "PIDL-generated element of base type ntlmssp_NTLMRevisionCurrent")
336 : },
337 : { .name = NULL }
338 : };
339 :
340 0 : static PyObject *py_ntlmssp_VERSION_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
341 : {
342 0 : return pytalloc_new(struct ntlmssp_VERSION, type);
343 : }
344 :
345 0 : static PyObject *py_ntlmssp_VERSION_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
346 : {
347 0 : struct ntlmssp_VERSION *object = pytalloc_get_ptr(py_obj);
348 0 : PyObject *ret = NULL;
349 : DATA_BLOB blob;
350 : enum ndr_err_code err;
351 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
352 0 : if (tmp_ctx == NULL) {
353 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
354 0 : return NULL;
355 : }
356 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_ntlmssp_VERSION);
357 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
358 0 : TALLOC_FREE(tmp_ctx);
359 0 : PyErr_SetNdrError(err);
360 0 : return NULL;
361 : }
362 :
363 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
364 0 : TALLOC_FREE(tmp_ctx);
365 0 : return ret;
366 : }
367 :
368 0 : static PyObject *py_ntlmssp_VERSION_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
369 : {
370 0 : struct ntlmssp_VERSION *object = pytalloc_get_ptr(py_obj);
371 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
372 0 : Py_ssize_t blob_length = 0;
373 : enum ndr_err_code err;
374 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
375 0 : PyObject *allow_remaining_obj = NULL;
376 0 : bool allow_remaining = false;
377 :
378 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
379 : discard_const_p(char *, kwnames),
380 : &blob.data, &blob_length,
381 : &allow_remaining_obj)) {
382 0 : return NULL;
383 : }
384 0 : blob.length = blob_length;
385 :
386 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
387 0 : allow_remaining = true;
388 : }
389 :
390 0 : if (allow_remaining) {
391 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_ntlmssp_VERSION);
392 : } else {
393 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_ntlmssp_VERSION);
394 : }
395 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
396 0 : PyErr_SetNdrError(err);
397 0 : return NULL;
398 : }
399 :
400 0 : Py_RETURN_NONE;
401 : }
402 :
403 0 : static PyObject *py_ntlmssp_VERSION_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
404 : {
405 0 : struct ntlmssp_VERSION *object = pytalloc_get_ptr(py_obj);
406 : PyObject *ret;
407 : char *retstr;
408 :
409 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_ntlmssp_VERSION, "ntlmssp_VERSION", object);
410 0 : ret = PyUnicode_FromString(retstr);
411 0 : talloc_free(retstr);
412 :
413 0 : return ret;
414 : }
415 :
416 : static PyMethodDef py_ntlmssp_VERSION_methods[] = {
417 : { "__ndr_pack__", (PyCFunction)py_ntlmssp_VERSION_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
418 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_ntlmssp_VERSION_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
419 : { "__ndr_print__", (PyCFunction)py_ntlmssp_VERSION_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
420 : { NULL, NULL, 0, NULL }
421 : };
422 :
423 :
424 : static PyTypeObject ntlmssp_VERSION_Type = {
425 : PyVarObject_HEAD_INIT(NULL, 0)
426 : .tp_name = "ntlmssp.VERSION",
427 : .tp_getset = py_ntlmssp_VERSION_getsetters,
428 : .tp_methods = py_ntlmssp_VERSION_methods,
429 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
430 : .tp_new = py_ntlmssp_VERSION_new,
431 : };
432 :
433 0 : static PyObject *py_import_ntlmssp_Version(TALLOC_CTX *mem_ctx, int level, union ntlmssp_Version *in)
434 : {
435 : PyObject *ret;
436 :
437 0 : switch (level) {
438 0 : case NTLMSSP_NEGOTIATE_VERSION:
439 0 : ret = pytalloc_reference_ex(&ntlmssp_VERSION_Type, mem_ctx, &in->version);
440 0 : return ret;
441 :
442 0 : default:
443 0 : ret = Py_None;
444 0 : Py_INCREF(ret);
445 0 : return ret;
446 :
447 : }
448 : PyErr_SetString(PyExc_TypeError, "unknown union level");
449 : return NULL;
450 : }
451 :
452 0 : static union ntlmssp_Version *py_export_ntlmssp_Version(TALLOC_CTX *mem_ctx, int level, PyObject *in)
453 : {
454 0 : union ntlmssp_Version *ret = talloc_zero(mem_ctx, union ntlmssp_Version);
455 0 : switch (level) {
456 0 : case NTLMSSP_NEGOTIATE_VERSION:
457 0 : if (in == NULL) {
458 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->version");
459 0 : talloc_free(ret); return NULL;
460 : }
461 0 : PY_CHECK_TYPE(&ntlmssp_VERSION_Type, in, talloc_free(ret); return NULL;);
462 0 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
463 0 : PyErr_NoMemory();
464 0 : talloc_free(ret); return NULL;
465 : }
466 0 : ret->version = *(struct ntlmssp_VERSION *)pytalloc_get_ptr(in);
467 0 : break;
468 :
469 0 : default:
470 0 : break;
471 :
472 : }
473 :
474 0 : return ret;
475 : }
476 :
477 0 : static PyObject *py_ntlmssp_Version_import(PyTypeObject *type, PyObject *args, PyObject *kwargs)
478 : {
479 0 : const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
480 0 : PyObject *mem_ctx_obj = NULL;
481 0 : TALLOC_CTX *mem_ctx = NULL;
482 0 : int level = 0;
483 0 : PyObject *in_obj = NULL;
484 0 : union ntlmssp_Version *in = NULL;
485 :
486 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:import",
487 : discard_const_p(char *, kwnames),
488 : &mem_ctx_obj,
489 : &level,
490 : &in_obj)) {
491 0 : return NULL;
492 : }
493 0 : mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
494 0 : if (mem_ctx == NULL) {
495 0 : PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
496 0 : return NULL;
497 : }
498 0 : in = (union ntlmssp_Version *)pytalloc_get_ptr(in_obj);
499 0 : if (in == NULL) {
500 0 : PyErr_Format(PyExc_TypeError, "in needs to be a pointer to union ntlmssp_Version!");
501 0 : return NULL;
502 : }
503 :
504 0 : return py_import_ntlmssp_Version(mem_ctx, level, in);
505 : }
506 :
507 0 : static PyObject *py_ntlmssp_Version_export(PyTypeObject *type, PyObject *args, PyObject *kwargs)
508 : {
509 0 : const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
510 0 : PyObject *mem_ctx_obj = NULL;
511 0 : TALLOC_CTX *mem_ctx = NULL;
512 0 : int level = 0;
513 0 : PyObject *in = NULL;
514 0 : union ntlmssp_Version *out = NULL;
515 :
516 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:export",
517 : discard_const_p(char *, kwnames),
518 : &mem_ctx_obj,
519 : &level,
520 : &in)) {
521 0 : return NULL;
522 : }
523 0 : mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
524 0 : if (mem_ctx == NULL) {
525 0 : PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
526 0 : return NULL;
527 : }
528 :
529 0 : out = py_export_ntlmssp_Version(mem_ctx, level, in);
530 0 : if (out == NULL) {
531 0 : return NULL;
532 : }
533 :
534 0 : return pytalloc_GenericObject_reference(out);
535 : }
536 :
537 : static PyMethodDef py_ntlmssp_Version_methods[] = {
538 : { "__import__", PY_DISCARD_FUNC_SIG(PyCFunction,py_ntlmssp_Version_import),
539 : METH_VARARGS|METH_KEYWORDS|METH_CLASS,
540 : "T.__import__(mem_ctx, level, in) => ret." },
541 : { "__export__", PY_DISCARD_FUNC_SIG(PyCFunction,py_ntlmssp_Version_export),
542 : METH_VARARGS|METH_KEYWORDS|METH_CLASS,
543 : "T.__export__(mem_ctx, level, in) => ret." },
544 : { NULL, NULL, 0, NULL }
545 : };
546 :
547 0 : static PyObject *py_ntlmssp_Version_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
548 : {
549 0 : PyErr_Format(PyExc_TypeError, "New %s Objects are not supported", type->tp_name);
550 0 : return NULL;
551 : }
552 :
553 :
554 : static PyTypeObject ntlmssp_Version_Type = {
555 : PyVarObject_HEAD_INIT(NULL, 0)
556 : .tp_name = "ntlmssp.Version",
557 : .tp_getset = NULL,
558 : .tp_methods = py_ntlmssp_Version_methods,
559 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
560 : .tp_new = py_ntlmssp_Version_new,
561 : };
562 :
563 :
564 0 : static PyObject *py_NEGOTIATE_MESSAGE_get_Signature(PyObject *obj, void *closure)
565 : {
566 0 : struct NEGOTIATE_MESSAGE *object = pytalloc_get_ptr(obj);
567 : PyObject *py_Signature;
568 0 : if (object->Signature == NULL) {
569 0 : py_Signature = Py_None;
570 0 : Py_INCREF(py_Signature);
571 : } else {
572 0 : py_Signature = PyUnicode_Decode(object->Signature, strlen(object->Signature), "utf-8", "ignore");
573 : }
574 0 : return py_Signature;
575 : }
576 :
577 0 : static int py_NEGOTIATE_MESSAGE_set_Signature(PyObject *py_obj, PyObject *value, void *closure)
578 : {
579 0 : struct NEGOTIATE_MESSAGE *object = pytalloc_get_ptr(py_obj);
580 0 : if (value == NULL) {
581 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->Signature");
582 0 : return -1;
583 : }
584 : {
585 : const char *test_str;
586 : const char *talloc_str;
587 0 : PyObject *unicode = NULL;
588 0 : if (PyUnicode_Check(value)) {
589 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
590 0 : if (unicode == NULL) {
591 0 : return -1;
592 : }
593 0 : test_str = PyBytes_AS_STRING(unicode);
594 0 : } else if (PyBytes_Check(value)) {
595 0 : test_str = PyBytes_AS_STRING(value);
596 : } else {
597 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
598 0 : return -1;
599 : }
600 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
601 0 : if (unicode != NULL) {
602 0 : Py_DECREF(unicode);
603 : }
604 0 : if (talloc_str == NULL) {
605 0 : PyErr_NoMemory();
606 0 : return -1;
607 : }
608 0 : object->Signature = talloc_str;
609 : }
610 0 : return 0;
611 : }
612 :
613 0 : static PyObject *py_NEGOTIATE_MESSAGE_get_MessageType(PyObject *obj, void *closure)
614 : {
615 0 : struct NEGOTIATE_MESSAGE *object = pytalloc_get_ptr(obj);
616 : PyObject *py_MessageType;
617 0 : py_MessageType = PyLong_FromUnsignedLongLong((uint32_t)(object->MessageType));
618 0 : return py_MessageType;
619 : }
620 :
621 0 : static int py_NEGOTIATE_MESSAGE_set_MessageType(PyObject *py_obj, PyObject *value, void *closure)
622 : {
623 0 : struct NEGOTIATE_MESSAGE *object = pytalloc_get_ptr(py_obj);
624 0 : if (value == NULL) {
625 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->MessageType");
626 0 : return -1;
627 : }
628 : {
629 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->MessageType));
630 0 : if (PyLong_Check(value)) {
631 : unsigned long long test_var;
632 0 : test_var = PyLong_AsUnsignedLongLong(value);
633 0 : if (PyErr_Occurred() != NULL) {
634 0 : return -1;
635 : }
636 0 : if (test_var > uint_max) {
637 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
638 : PyLong_Type.tp_name, uint_max, test_var);
639 0 : return -1;
640 : }
641 0 : object->MessageType = test_var;
642 : } else {
643 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
644 : PyLong_Type.tp_name);
645 0 : return -1;
646 : }
647 : }
648 0 : return 0;
649 : }
650 :
651 0 : static PyObject *py_NEGOTIATE_MESSAGE_get_NegotiateFlags(PyObject *obj, void *closure)
652 : {
653 0 : struct NEGOTIATE_MESSAGE *object = pytalloc_get_ptr(obj);
654 : PyObject *py_NegotiateFlags;
655 0 : py_NegotiateFlags = PyLong_FromUnsignedLongLong((uint32_t)(object->NegotiateFlags));
656 0 : return py_NegotiateFlags;
657 : }
658 :
659 0 : static int py_NEGOTIATE_MESSAGE_set_NegotiateFlags(PyObject *py_obj, PyObject *value, void *closure)
660 : {
661 0 : struct NEGOTIATE_MESSAGE *object = pytalloc_get_ptr(py_obj);
662 0 : if (value == NULL) {
663 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->NegotiateFlags");
664 0 : return -1;
665 : }
666 : {
667 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->NegotiateFlags));
668 0 : if (PyLong_Check(value)) {
669 : unsigned long long test_var;
670 0 : test_var = PyLong_AsUnsignedLongLong(value);
671 0 : if (PyErr_Occurred() != NULL) {
672 0 : return -1;
673 : }
674 0 : if (test_var > uint_max) {
675 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
676 : PyLong_Type.tp_name, uint_max, test_var);
677 0 : return -1;
678 : }
679 0 : object->NegotiateFlags = test_var;
680 : } else {
681 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
682 : PyLong_Type.tp_name);
683 0 : return -1;
684 : }
685 : }
686 0 : return 0;
687 : }
688 :
689 0 : static PyObject *py_NEGOTIATE_MESSAGE_get_DomainNameLen(PyObject *obj, void *closure)
690 : {
691 0 : struct NEGOTIATE_MESSAGE *object = pytalloc_get_ptr(obj);
692 : PyObject *py_DomainNameLen;
693 0 : py_DomainNameLen = PyLong_FromLong((uint16_t)(object->DomainNameLen));
694 0 : return py_DomainNameLen;
695 : }
696 :
697 0 : static int py_NEGOTIATE_MESSAGE_set_DomainNameLen(PyObject *py_obj, PyObject *value, void *closure)
698 : {
699 0 : struct NEGOTIATE_MESSAGE *object = pytalloc_get_ptr(py_obj);
700 0 : if (value == NULL) {
701 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->DomainNameLen");
702 0 : return -1;
703 : }
704 : {
705 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->DomainNameLen));
706 0 : if (PyLong_Check(value)) {
707 : unsigned long long test_var;
708 0 : test_var = PyLong_AsUnsignedLongLong(value);
709 0 : if (PyErr_Occurred() != NULL) {
710 0 : return -1;
711 : }
712 0 : if (test_var > uint_max) {
713 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
714 : PyLong_Type.tp_name, uint_max, test_var);
715 0 : return -1;
716 : }
717 0 : object->DomainNameLen = test_var;
718 : } else {
719 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
720 : PyLong_Type.tp_name);
721 0 : return -1;
722 : }
723 : }
724 0 : return 0;
725 : }
726 :
727 0 : static PyObject *py_NEGOTIATE_MESSAGE_get_DomainNameMaxLen(PyObject *obj, void *closure)
728 : {
729 0 : struct NEGOTIATE_MESSAGE *object = pytalloc_get_ptr(obj);
730 : PyObject *py_DomainNameMaxLen;
731 0 : py_DomainNameMaxLen = PyLong_FromLong((uint16_t)(object->DomainNameMaxLen));
732 0 : return py_DomainNameMaxLen;
733 : }
734 :
735 0 : static int py_NEGOTIATE_MESSAGE_set_DomainNameMaxLen(PyObject *py_obj, PyObject *value, void *closure)
736 : {
737 0 : struct NEGOTIATE_MESSAGE *object = pytalloc_get_ptr(py_obj);
738 0 : if (value == NULL) {
739 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->DomainNameMaxLen");
740 0 : return -1;
741 : }
742 : {
743 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->DomainNameMaxLen));
744 0 : if (PyLong_Check(value)) {
745 : unsigned long long test_var;
746 0 : test_var = PyLong_AsUnsignedLongLong(value);
747 0 : if (PyErr_Occurred() != NULL) {
748 0 : return -1;
749 : }
750 0 : if (test_var > uint_max) {
751 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
752 : PyLong_Type.tp_name, uint_max, test_var);
753 0 : return -1;
754 : }
755 0 : object->DomainNameMaxLen = test_var;
756 : } else {
757 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
758 : PyLong_Type.tp_name);
759 0 : return -1;
760 : }
761 : }
762 0 : return 0;
763 : }
764 :
765 0 : static PyObject *py_NEGOTIATE_MESSAGE_get_DomainName(PyObject *obj, void *closure)
766 : {
767 0 : struct NEGOTIATE_MESSAGE *object = pytalloc_get_ptr(obj);
768 : PyObject *py_DomainName;
769 0 : if (object->DomainName == NULL) {
770 0 : Py_RETURN_NONE;
771 : }
772 0 : if (object->DomainName == NULL) {
773 0 : py_DomainName = Py_None;
774 0 : Py_INCREF(py_DomainName);
775 : } else {
776 0 : py_DomainName = PyString_FromStringOrNULL(object->DomainName);
777 : }
778 0 : return py_DomainName;
779 : }
780 :
781 0 : static int py_NEGOTIATE_MESSAGE_set_DomainName(PyObject *py_obj, PyObject *value, void *closure)
782 : {
783 0 : struct NEGOTIATE_MESSAGE *object = pytalloc_get_ptr(py_obj);
784 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->DomainName));
785 0 : if (value == NULL) {
786 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->DomainName");
787 0 : return -1;
788 : }
789 0 : if (value == Py_None) {
790 0 : object->DomainName = NULL;
791 : } else {
792 0 : object->DomainName = NULL;
793 : {
794 : const char *test_str;
795 : const char *talloc_str;
796 0 : PyObject *unicode = NULL;
797 0 : if (PyUnicode_Check(value)) {
798 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
799 0 : if (unicode == NULL) {
800 0 : return -1;
801 : }
802 0 : test_str = PyBytes_AS_STRING(unicode);
803 0 : } else if (PyBytes_Check(value)) {
804 0 : test_str = PyBytes_AS_STRING(value);
805 : } else {
806 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
807 0 : return -1;
808 : }
809 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
810 0 : if (unicode != NULL) {
811 0 : Py_DECREF(unicode);
812 : }
813 0 : if (talloc_str == NULL) {
814 0 : PyErr_NoMemory();
815 0 : return -1;
816 : }
817 0 : object->DomainName = talloc_str;
818 : }
819 : }
820 0 : return 0;
821 : }
822 :
823 0 : static PyObject *py_NEGOTIATE_MESSAGE_get_WorkstationLen(PyObject *obj, void *closure)
824 : {
825 0 : struct NEGOTIATE_MESSAGE *object = pytalloc_get_ptr(obj);
826 : PyObject *py_WorkstationLen;
827 0 : py_WorkstationLen = PyLong_FromLong((uint16_t)(object->WorkstationLen));
828 0 : return py_WorkstationLen;
829 : }
830 :
831 0 : static int py_NEGOTIATE_MESSAGE_set_WorkstationLen(PyObject *py_obj, PyObject *value, void *closure)
832 : {
833 0 : struct NEGOTIATE_MESSAGE *object = pytalloc_get_ptr(py_obj);
834 0 : if (value == NULL) {
835 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->WorkstationLen");
836 0 : return -1;
837 : }
838 : {
839 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->WorkstationLen));
840 0 : if (PyLong_Check(value)) {
841 : unsigned long long test_var;
842 0 : test_var = PyLong_AsUnsignedLongLong(value);
843 0 : if (PyErr_Occurred() != NULL) {
844 0 : return -1;
845 : }
846 0 : if (test_var > uint_max) {
847 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
848 : PyLong_Type.tp_name, uint_max, test_var);
849 0 : return -1;
850 : }
851 0 : object->WorkstationLen = test_var;
852 : } else {
853 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
854 : PyLong_Type.tp_name);
855 0 : return -1;
856 : }
857 : }
858 0 : return 0;
859 : }
860 :
861 0 : static PyObject *py_NEGOTIATE_MESSAGE_get_WorkstationMaxLen(PyObject *obj, void *closure)
862 : {
863 0 : struct NEGOTIATE_MESSAGE *object = pytalloc_get_ptr(obj);
864 : PyObject *py_WorkstationMaxLen;
865 0 : py_WorkstationMaxLen = PyLong_FromLong((uint16_t)(object->WorkstationMaxLen));
866 0 : return py_WorkstationMaxLen;
867 : }
868 :
869 0 : static int py_NEGOTIATE_MESSAGE_set_WorkstationMaxLen(PyObject *py_obj, PyObject *value, void *closure)
870 : {
871 0 : struct NEGOTIATE_MESSAGE *object = pytalloc_get_ptr(py_obj);
872 0 : if (value == NULL) {
873 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->WorkstationMaxLen");
874 0 : return -1;
875 : }
876 : {
877 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->WorkstationMaxLen));
878 0 : if (PyLong_Check(value)) {
879 : unsigned long long test_var;
880 0 : test_var = PyLong_AsUnsignedLongLong(value);
881 0 : if (PyErr_Occurred() != NULL) {
882 0 : return -1;
883 : }
884 0 : if (test_var > uint_max) {
885 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
886 : PyLong_Type.tp_name, uint_max, test_var);
887 0 : return -1;
888 : }
889 0 : object->WorkstationMaxLen = test_var;
890 : } else {
891 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
892 : PyLong_Type.tp_name);
893 0 : return -1;
894 : }
895 : }
896 0 : return 0;
897 : }
898 :
899 0 : static PyObject *py_NEGOTIATE_MESSAGE_get_Workstation(PyObject *obj, void *closure)
900 : {
901 0 : struct NEGOTIATE_MESSAGE *object = pytalloc_get_ptr(obj);
902 : PyObject *py_Workstation;
903 0 : if (object->Workstation == NULL) {
904 0 : Py_RETURN_NONE;
905 : }
906 0 : if (object->Workstation == NULL) {
907 0 : py_Workstation = Py_None;
908 0 : Py_INCREF(py_Workstation);
909 : } else {
910 0 : py_Workstation = PyString_FromStringOrNULL(object->Workstation);
911 : }
912 0 : return py_Workstation;
913 : }
914 :
915 0 : static int py_NEGOTIATE_MESSAGE_set_Workstation(PyObject *py_obj, PyObject *value, void *closure)
916 : {
917 0 : struct NEGOTIATE_MESSAGE *object = pytalloc_get_ptr(py_obj);
918 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->Workstation));
919 0 : if (value == NULL) {
920 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->Workstation");
921 0 : return -1;
922 : }
923 0 : if (value == Py_None) {
924 0 : object->Workstation = NULL;
925 : } else {
926 0 : object->Workstation = NULL;
927 : {
928 : const char *test_str;
929 : const char *talloc_str;
930 0 : PyObject *unicode = NULL;
931 0 : if (PyUnicode_Check(value)) {
932 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
933 0 : if (unicode == NULL) {
934 0 : return -1;
935 : }
936 0 : test_str = PyBytes_AS_STRING(unicode);
937 0 : } else if (PyBytes_Check(value)) {
938 0 : test_str = PyBytes_AS_STRING(value);
939 : } else {
940 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
941 0 : return -1;
942 : }
943 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
944 0 : if (unicode != NULL) {
945 0 : Py_DECREF(unicode);
946 : }
947 0 : if (talloc_str == NULL) {
948 0 : PyErr_NoMemory();
949 0 : return -1;
950 : }
951 0 : object->Workstation = talloc_str;
952 : }
953 : }
954 0 : return 0;
955 : }
956 :
957 0 : static PyObject *py_NEGOTIATE_MESSAGE_get_Version(PyObject *obj, void *closure)
958 : {
959 0 : struct NEGOTIATE_MESSAGE *object = pytalloc_get_ptr(obj);
960 : PyObject *py_Version;
961 0 : py_Version = pyrpc_import_union(&ntlmssp_Version_Type, pytalloc_get_mem_ctx(obj), object->NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION, &object->Version, "union ntlmssp_Version");
962 0 : if (py_Version == NULL) {
963 0 : return NULL;
964 : }
965 0 : return py_Version;
966 : }
967 :
968 0 : static int py_NEGOTIATE_MESSAGE_set_Version(PyObject *py_obj, PyObject *value, void *closure)
969 : {
970 0 : struct NEGOTIATE_MESSAGE *object = pytalloc_get_ptr(py_obj);
971 0 : if (value == NULL) {
972 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->Version");
973 0 : return -1;
974 : }
975 : {
976 : union ntlmssp_Version *Version_switch_0;
977 0 : Version_switch_0 = (union ntlmssp_Version *)pyrpc_export_union(&ntlmssp_Version_Type, pytalloc_get_mem_ctx(py_obj), object->NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION, value, "union ntlmssp_Version");
978 0 : if (Version_switch_0 == NULL) {
979 0 : return -1;
980 : }
981 0 : object->Version = *Version_switch_0;
982 : }
983 0 : return 0;
984 : }
985 :
986 : static PyGetSetDef py_NEGOTIATE_MESSAGE_getsetters[] = {
987 : {
988 : .name = discard_const_p(char, "Signature"),
989 : .get = py_NEGOTIATE_MESSAGE_get_Signature,
990 : .set = py_NEGOTIATE_MESSAGE_set_Signature,
991 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
992 : },
993 : {
994 : .name = discard_const_p(char, "MessageType"),
995 : .get = py_NEGOTIATE_MESSAGE_get_MessageType,
996 : .set = py_NEGOTIATE_MESSAGE_set_MessageType,
997 : .doc = discard_const_p(char, "PIDL-generated element of base type ntlmssp_MessageType")
998 : },
999 : {
1000 : .name = discard_const_p(char, "NegotiateFlags"),
1001 : .get = py_NEGOTIATE_MESSAGE_get_NegotiateFlags,
1002 : .set = py_NEGOTIATE_MESSAGE_set_NegotiateFlags,
1003 : .doc = discard_const_p(char, "PIDL-generated element of base type NEGOTIATE")
1004 : },
1005 : {
1006 : .name = discard_const_p(char, "DomainNameLen"),
1007 : .get = py_NEGOTIATE_MESSAGE_get_DomainNameLen,
1008 : .set = py_NEGOTIATE_MESSAGE_set_DomainNameLen,
1009 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
1010 : },
1011 : {
1012 : .name = discard_const_p(char, "DomainNameMaxLen"),
1013 : .get = py_NEGOTIATE_MESSAGE_get_DomainNameMaxLen,
1014 : .set = py_NEGOTIATE_MESSAGE_set_DomainNameMaxLen,
1015 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
1016 : },
1017 : {
1018 : .name = discard_const_p(char, "DomainName"),
1019 : .get = py_NEGOTIATE_MESSAGE_get_DomainName,
1020 : .set = py_NEGOTIATE_MESSAGE_set_DomainName,
1021 : .doc = discard_const_p(char, "PIDL-generated element of base type string")
1022 : },
1023 : {
1024 : .name = discard_const_p(char, "WorkstationLen"),
1025 : .get = py_NEGOTIATE_MESSAGE_get_WorkstationLen,
1026 : .set = py_NEGOTIATE_MESSAGE_set_WorkstationLen,
1027 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
1028 : },
1029 : {
1030 : .name = discard_const_p(char, "WorkstationMaxLen"),
1031 : .get = py_NEGOTIATE_MESSAGE_get_WorkstationMaxLen,
1032 : .set = py_NEGOTIATE_MESSAGE_set_WorkstationMaxLen,
1033 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
1034 : },
1035 : {
1036 : .name = discard_const_p(char, "Workstation"),
1037 : .get = py_NEGOTIATE_MESSAGE_get_Workstation,
1038 : .set = py_NEGOTIATE_MESSAGE_set_Workstation,
1039 : .doc = discard_const_p(char, "PIDL-generated element of base type string")
1040 : },
1041 : {
1042 : .name = discard_const_p(char, "Version"),
1043 : .get = py_NEGOTIATE_MESSAGE_get_Version,
1044 : .set = py_NEGOTIATE_MESSAGE_set_Version,
1045 : .doc = discard_const_p(char, "PIDL-generated element of base type ntlmssp_Version")
1046 : },
1047 : { .name = NULL }
1048 : };
1049 :
1050 0 : static PyObject *py_NEGOTIATE_MESSAGE_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1051 : {
1052 0 : return pytalloc_new(struct NEGOTIATE_MESSAGE, type);
1053 : }
1054 :
1055 0 : static PyObject *py_NEGOTIATE_MESSAGE_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
1056 : {
1057 0 : struct NEGOTIATE_MESSAGE *object = pytalloc_get_ptr(py_obj);
1058 0 : PyObject *ret = NULL;
1059 : DATA_BLOB blob;
1060 : enum ndr_err_code err;
1061 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
1062 0 : if (tmp_ctx == NULL) {
1063 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
1064 0 : return NULL;
1065 : }
1066 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_NEGOTIATE_MESSAGE);
1067 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
1068 0 : TALLOC_FREE(tmp_ctx);
1069 0 : PyErr_SetNdrError(err);
1070 0 : return NULL;
1071 : }
1072 :
1073 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
1074 0 : TALLOC_FREE(tmp_ctx);
1075 0 : return ret;
1076 : }
1077 :
1078 0 : static PyObject *py_NEGOTIATE_MESSAGE_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
1079 : {
1080 0 : struct NEGOTIATE_MESSAGE *object = pytalloc_get_ptr(py_obj);
1081 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
1082 0 : Py_ssize_t blob_length = 0;
1083 : enum ndr_err_code err;
1084 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
1085 0 : PyObject *allow_remaining_obj = NULL;
1086 0 : bool allow_remaining = false;
1087 :
1088 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
1089 : discard_const_p(char *, kwnames),
1090 : &blob.data, &blob_length,
1091 : &allow_remaining_obj)) {
1092 0 : return NULL;
1093 : }
1094 0 : blob.length = blob_length;
1095 :
1096 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
1097 0 : allow_remaining = true;
1098 : }
1099 :
1100 0 : if (allow_remaining) {
1101 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_NEGOTIATE_MESSAGE);
1102 : } else {
1103 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_NEGOTIATE_MESSAGE);
1104 : }
1105 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
1106 0 : PyErr_SetNdrError(err);
1107 0 : return NULL;
1108 : }
1109 :
1110 0 : Py_RETURN_NONE;
1111 : }
1112 :
1113 0 : static PyObject *py_NEGOTIATE_MESSAGE_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
1114 : {
1115 0 : struct NEGOTIATE_MESSAGE *object = pytalloc_get_ptr(py_obj);
1116 : PyObject *ret;
1117 : char *retstr;
1118 :
1119 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_NEGOTIATE_MESSAGE, "NEGOTIATE_MESSAGE", object);
1120 0 : ret = PyUnicode_FromString(retstr);
1121 0 : talloc_free(retstr);
1122 :
1123 0 : return ret;
1124 : }
1125 :
1126 : static PyMethodDef py_NEGOTIATE_MESSAGE_methods[] = {
1127 : { "__ndr_pack__", (PyCFunction)py_NEGOTIATE_MESSAGE_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
1128 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_NEGOTIATE_MESSAGE_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
1129 : { "__ndr_print__", (PyCFunction)py_NEGOTIATE_MESSAGE_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
1130 : { NULL, NULL, 0, NULL }
1131 : };
1132 :
1133 :
1134 : static PyTypeObject NEGOTIATE_MESSAGE_Type = {
1135 : PyVarObject_HEAD_INIT(NULL, 0)
1136 : .tp_name = "ntlmssp.NEGOTIATE_MESSAGE",
1137 : .tp_getset = py_NEGOTIATE_MESSAGE_getsetters,
1138 : .tp_methods = py_NEGOTIATE_MESSAGE_methods,
1139 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1140 : .tp_new = py_NEGOTIATE_MESSAGE_new,
1141 : };
1142 :
1143 :
1144 0 : static PyObject *py_ntlmssp_SingleHostData_get_Size(PyObject *obj, void *closure)
1145 : {
1146 0 : struct ntlmssp_SingleHostData *object = pytalloc_get_ptr(obj);
1147 : PyObject *py_Size;
1148 0 : py_Size = PyLong_FromUnsignedLongLong((uint32_t)(object->Size));
1149 0 : return py_Size;
1150 : }
1151 :
1152 0 : static int py_ntlmssp_SingleHostData_set_Size(PyObject *py_obj, PyObject *value, void *closure)
1153 : {
1154 0 : struct ntlmssp_SingleHostData *object = pytalloc_get_ptr(py_obj);
1155 0 : if (value == NULL) {
1156 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->Size");
1157 0 : return -1;
1158 : }
1159 : {
1160 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->Size));
1161 0 : if (PyLong_Check(value)) {
1162 : unsigned long long test_var;
1163 0 : test_var = PyLong_AsUnsignedLongLong(value);
1164 0 : if (PyErr_Occurred() != NULL) {
1165 0 : return -1;
1166 : }
1167 0 : if (test_var > uint_max) {
1168 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1169 : PyLong_Type.tp_name, uint_max, test_var);
1170 0 : return -1;
1171 : }
1172 0 : object->Size = test_var;
1173 : } else {
1174 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1175 : PyLong_Type.tp_name);
1176 0 : return -1;
1177 : }
1178 : }
1179 0 : return 0;
1180 : }
1181 :
1182 0 : static PyObject *py_ntlmssp_SingleHostData_get_Z4(PyObject *obj, void *closure)
1183 : {
1184 0 : struct ntlmssp_SingleHostData *object = pytalloc_get_ptr(obj);
1185 : PyObject *py_Z4;
1186 0 : py_Z4 = PyLong_FromUnsignedLongLong((uint32_t)(object->Z4));
1187 0 : return py_Z4;
1188 : }
1189 :
1190 0 : static int py_ntlmssp_SingleHostData_set_Z4(PyObject *py_obj, PyObject *value, void *closure)
1191 : {
1192 0 : struct ntlmssp_SingleHostData *object = pytalloc_get_ptr(py_obj);
1193 0 : if (value == NULL) {
1194 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->Z4");
1195 0 : return -1;
1196 : }
1197 : {
1198 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->Z4));
1199 0 : if (PyLong_Check(value)) {
1200 : unsigned long long test_var;
1201 0 : test_var = PyLong_AsUnsignedLongLong(value);
1202 0 : if (PyErr_Occurred() != NULL) {
1203 0 : return -1;
1204 : }
1205 0 : if (test_var > uint_max) {
1206 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1207 : PyLong_Type.tp_name, uint_max, test_var);
1208 0 : return -1;
1209 : }
1210 0 : object->Z4 = test_var;
1211 : } else {
1212 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1213 : PyLong_Type.tp_name);
1214 0 : return -1;
1215 : }
1216 : }
1217 0 : return 0;
1218 : }
1219 :
1220 0 : static PyObject *py_ntlmssp_SingleHostData_get_token_info(PyObject *obj, void *closure)
1221 : {
1222 0 : struct ntlmssp_SingleHostData *object = pytalloc_get_ptr(obj);
1223 : PyObject *py_token_info;
1224 0 : py_token_info = pytalloc_reference_ex(LSAP_TOKEN_INFO_INTEGRITY_Type, pytalloc_get_mem_ctx(obj), &object->token_info);
1225 0 : return py_token_info;
1226 : }
1227 :
1228 0 : static int py_ntlmssp_SingleHostData_set_token_info(PyObject *py_obj, PyObject *value, void *closure)
1229 : {
1230 0 : struct ntlmssp_SingleHostData *object = pytalloc_get_ptr(py_obj);
1231 0 : if (value == NULL) {
1232 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->token_info");
1233 0 : return -1;
1234 : }
1235 0 : PY_CHECK_TYPE(LSAP_TOKEN_INFO_INTEGRITY_Type, value, return -1;);
1236 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
1237 0 : PyErr_NoMemory();
1238 0 : return -1;
1239 : }
1240 0 : object->token_info = *(struct LSAP_TOKEN_INFO_INTEGRITY *)pytalloc_get_ptr(value);
1241 0 : return 0;
1242 : }
1243 :
1244 0 : static PyObject *py_ntlmssp_SingleHostData_get_remaining(PyObject *obj, void *closure)
1245 : {
1246 0 : struct ntlmssp_SingleHostData *object = pytalloc_get_ptr(obj);
1247 : PyObject *py_remaining;
1248 0 : py_remaining = PyBytes_FromStringAndSize((char *)(object->remaining).data, (object->remaining).length);
1249 0 : return py_remaining;
1250 : }
1251 :
1252 0 : static int py_ntlmssp_SingleHostData_set_remaining(PyObject *py_obj, PyObject *value, void *closure)
1253 : {
1254 0 : struct ntlmssp_SingleHostData *object = pytalloc_get_ptr(py_obj);
1255 0 : if (value == NULL) {
1256 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->remaining");
1257 0 : return -1;
1258 : }
1259 0 : object->remaining = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
1260 0 : return 0;
1261 : }
1262 :
1263 : static PyGetSetDef py_ntlmssp_SingleHostData_getsetters[] = {
1264 : {
1265 : .name = discard_const_p(char, "Size"),
1266 : .get = py_ntlmssp_SingleHostData_get_Size,
1267 : .set = py_ntlmssp_SingleHostData_set_Size,
1268 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
1269 : },
1270 : {
1271 : .name = discard_const_p(char, "Z4"),
1272 : .get = py_ntlmssp_SingleHostData_get_Z4,
1273 : .set = py_ntlmssp_SingleHostData_set_Z4,
1274 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
1275 : },
1276 : {
1277 : .name = discard_const_p(char, "token_info"),
1278 : .get = py_ntlmssp_SingleHostData_get_token_info,
1279 : .set = py_ntlmssp_SingleHostData_set_token_info,
1280 : .doc = discard_const_p(char, "PIDL-generated element of base type LSAP_TOKEN_INFO_INTEGRITY")
1281 : },
1282 : {
1283 : .name = discard_const_p(char, "remaining"),
1284 : .get = py_ntlmssp_SingleHostData_get_remaining,
1285 : .set = py_ntlmssp_SingleHostData_set_remaining,
1286 : .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
1287 : },
1288 : { .name = NULL }
1289 : };
1290 :
1291 0 : static PyObject *py_ntlmssp_SingleHostData_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1292 : {
1293 0 : return pytalloc_new(struct ntlmssp_SingleHostData, type);
1294 : }
1295 :
1296 :
1297 : static PyTypeObject ntlmssp_SingleHostData_Type = {
1298 : PyVarObject_HEAD_INIT(NULL, 0)
1299 : .tp_name = "ntlmssp.SingleHostData",
1300 : .tp_getset = py_ntlmssp_SingleHostData_getsetters,
1301 : .tp_methods = NULL,
1302 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1303 : .tp_new = py_ntlmssp_SingleHostData_new,
1304 : };
1305 :
1306 0 : static PyObject *py_import_ntlmssp_AvValue(TALLOC_CTX *mem_ctx, int level, union ntlmssp_AvValue *in)
1307 : {
1308 : PyObject *ret;
1309 :
1310 0 : switch (level) {
1311 0 : case MsvAvEOL:
1312 0 : ret = Py_None;
1313 0 : Py_INCREF(ret);
1314 0 : return ret;
1315 :
1316 0 : case MsvAvNbComputerName:
1317 0 : ret = PyString_FromStringOrNULL(in->AvNbComputerName);
1318 0 : return ret;
1319 :
1320 0 : case MsvAvNbDomainName:
1321 0 : ret = PyString_FromStringOrNULL(in->AvNbDomainName);
1322 0 : return ret;
1323 :
1324 0 : case MsvAvDnsComputerName:
1325 0 : ret = PyString_FromStringOrNULL(in->AvDnsComputerName);
1326 0 : return ret;
1327 :
1328 0 : case MsvAvDnsDomainName:
1329 0 : ret = PyString_FromStringOrNULL(in->AvDnsDomainName);
1330 0 : return ret;
1331 :
1332 0 : case MsvAvDnsTreeName:
1333 0 : ret = PyString_FromStringOrNULL(in->AvDnsTreeName);
1334 0 : return ret;
1335 :
1336 0 : case MsvAvFlags:
1337 0 : ret = PyLong_FromUnsignedLongLong((uint32_t)(in->AvFlags));
1338 0 : return ret;
1339 :
1340 0 : case MsvAvTimestamp:
1341 0 : ret = PyLong_FromUnsignedLongLong(in->AvTimestamp);
1342 0 : return ret;
1343 :
1344 0 : case MsvAvSingleHost:
1345 0 : ret = pytalloc_reference_ex(&ntlmssp_SingleHostData_Type, mem_ctx, &in->AvSingleHost);
1346 0 : return ret;
1347 :
1348 0 : case MsvAvTargetName:
1349 0 : ret = PyString_FromStringOrNULL(in->AvTargetName);
1350 0 : return ret;
1351 :
1352 0 : case MsvChannelBindings:
1353 0 : ret = PyList_New(16);
1354 0 : if (ret == NULL) {
1355 0 : return NULL;
1356 : }
1357 : {
1358 : int ChannelBindings_cntr_0;
1359 0 : for (ChannelBindings_cntr_0 = 0; ChannelBindings_cntr_0 < (16); ChannelBindings_cntr_0++) {
1360 : PyObject *py_ChannelBindings_0;
1361 0 : py_ChannelBindings_0 = PyLong_FromLong((uint16_t)((in->ChannelBindings)[ChannelBindings_cntr_0]));
1362 0 : PyList_SetItem(ret, ChannelBindings_cntr_0, py_ChannelBindings_0);
1363 : }
1364 : }
1365 0 : return ret;
1366 :
1367 0 : default:
1368 0 : ret = PyBytes_FromStringAndSize((char *)(in->blob).data, (in->blob).length);
1369 0 : return ret;
1370 :
1371 : }
1372 : PyErr_SetString(PyExc_TypeError, "unknown union level");
1373 : return NULL;
1374 : }
1375 :
1376 244 : static union ntlmssp_AvValue *py_export_ntlmssp_AvValue(TALLOC_CTX *mem_ctx, int level, PyObject *in)
1377 : {
1378 244 : union ntlmssp_AvValue *ret = talloc_zero(mem_ctx, union ntlmssp_AvValue);
1379 244 : switch (level) {
1380 0 : case MsvAvEOL:
1381 0 : break;
1382 :
1383 122 : case MsvAvNbComputerName:
1384 122 : if (in == NULL) {
1385 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->AvNbComputerName");
1386 0 : talloc_free(ret); return NULL;
1387 : }
1388 : {
1389 : const char *test_str;
1390 : const char *talloc_str;
1391 122 : PyObject *unicode = NULL;
1392 122 : if (PyUnicode_Check(in)) {
1393 122 : unicode = PyUnicode_AsEncodedString(in, "utf-8", "ignore");
1394 122 : if (unicode == NULL) {
1395 0 : talloc_free(ret); return NULL;
1396 : }
1397 122 : test_str = PyBytes_AS_STRING(unicode);
1398 0 : } else if (PyBytes_Check(in)) {
1399 0 : test_str = PyBytes_AS_STRING(in);
1400 : } else {
1401 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(in)->tp_name);
1402 0 : talloc_free(ret); return NULL;
1403 : }
1404 122 : talloc_str = talloc_strdup(mem_ctx, test_str);
1405 122 : if (unicode != NULL) {
1406 71 : Py_DECREF(unicode);
1407 : }
1408 122 : if (talloc_str == NULL) {
1409 0 : PyErr_NoMemory();
1410 0 : talloc_free(ret); return NULL;
1411 : }
1412 122 : ret->AvNbComputerName = talloc_str;
1413 : }
1414 122 : break;
1415 :
1416 122 : case MsvAvNbDomainName:
1417 122 : if (in == NULL) {
1418 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->AvNbDomainName");
1419 0 : talloc_free(ret); return NULL;
1420 : }
1421 : {
1422 : const char *test_str;
1423 : const char *talloc_str;
1424 122 : PyObject *unicode = NULL;
1425 122 : if (PyUnicode_Check(in)) {
1426 122 : unicode = PyUnicode_AsEncodedString(in, "utf-8", "ignore");
1427 122 : if (unicode == NULL) {
1428 0 : talloc_free(ret); return NULL;
1429 : }
1430 122 : test_str = PyBytes_AS_STRING(unicode);
1431 0 : } else if (PyBytes_Check(in)) {
1432 0 : test_str = PyBytes_AS_STRING(in);
1433 : } else {
1434 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(in)->tp_name);
1435 0 : talloc_free(ret); return NULL;
1436 : }
1437 122 : talloc_str = talloc_strdup(mem_ctx, test_str);
1438 122 : if (unicode != NULL) {
1439 71 : Py_DECREF(unicode);
1440 : }
1441 122 : if (talloc_str == NULL) {
1442 0 : PyErr_NoMemory();
1443 0 : talloc_free(ret); return NULL;
1444 : }
1445 122 : ret->AvNbDomainName = talloc_str;
1446 : }
1447 122 : break;
1448 :
1449 0 : case MsvAvDnsComputerName:
1450 0 : if (in == NULL) {
1451 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->AvDnsComputerName");
1452 0 : talloc_free(ret); return NULL;
1453 : }
1454 : {
1455 : const char *test_str;
1456 : const char *talloc_str;
1457 0 : PyObject *unicode = NULL;
1458 0 : if (PyUnicode_Check(in)) {
1459 0 : unicode = PyUnicode_AsEncodedString(in, "utf-8", "ignore");
1460 0 : if (unicode == NULL) {
1461 0 : talloc_free(ret); return NULL;
1462 : }
1463 0 : test_str = PyBytes_AS_STRING(unicode);
1464 0 : } else if (PyBytes_Check(in)) {
1465 0 : test_str = PyBytes_AS_STRING(in);
1466 : } else {
1467 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(in)->tp_name);
1468 0 : talloc_free(ret); return NULL;
1469 : }
1470 0 : talloc_str = talloc_strdup(mem_ctx, test_str);
1471 0 : if (unicode != NULL) {
1472 0 : Py_DECREF(unicode);
1473 : }
1474 0 : if (talloc_str == NULL) {
1475 0 : PyErr_NoMemory();
1476 0 : talloc_free(ret); return NULL;
1477 : }
1478 0 : ret->AvDnsComputerName = talloc_str;
1479 : }
1480 0 : break;
1481 :
1482 0 : case MsvAvDnsDomainName:
1483 0 : if (in == NULL) {
1484 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->AvDnsDomainName");
1485 0 : talloc_free(ret); return NULL;
1486 : }
1487 : {
1488 : const char *test_str;
1489 : const char *talloc_str;
1490 0 : PyObject *unicode = NULL;
1491 0 : if (PyUnicode_Check(in)) {
1492 0 : unicode = PyUnicode_AsEncodedString(in, "utf-8", "ignore");
1493 0 : if (unicode == NULL) {
1494 0 : talloc_free(ret); return NULL;
1495 : }
1496 0 : test_str = PyBytes_AS_STRING(unicode);
1497 0 : } else if (PyBytes_Check(in)) {
1498 0 : test_str = PyBytes_AS_STRING(in);
1499 : } else {
1500 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(in)->tp_name);
1501 0 : talloc_free(ret); return NULL;
1502 : }
1503 0 : talloc_str = talloc_strdup(mem_ctx, test_str);
1504 0 : if (unicode != NULL) {
1505 0 : Py_DECREF(unicode);
1506 : }
1507 0 : if (talloc_str == NULL) {
1508 0 : PyErr_NoMemory();
1509 0 : talloc_free(ret); return NULL;
1510 : }
1511 0 : ret->AvDnsDomainName = talloc_str;
1512 : }
1513 0 : break;
1514 :
1515 0 : case MsvAvDnsTreeName:
1516 0 : if (in == NULL) {
1517 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->AvDnsTreeName");
1518 0 : talloc_free(ret); return NULL;
1519 : }
1520 : {
1521 : const char *test_str;
1522 : const char *talloc_str;
1523 0 : PyObject *unicode = NULL;
1524 0 : if (PyUnicode_Check(in)) {
1525 0 : unicode = PyUnicode_AsEncodedString(in, "utf-8", "ignore");
1526 0 : if (unicode == NULL) {
1527 0 : talloc_free(ret); return NULL;
1528 : }
1529 0 : test_str = PyBytes_AS_STRING(unicode);
1530 0 : } else if (PyBytes_Check(in)) {
1531 0 : test_str = PyBytes_AS_STRING(in);
1532 : } else {
1533 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(in)->tp_name);
1534 0 : talloc_free(ret); return NULL;
1535 : }
1536 0 : talloc_str = talloc_strdup(mem_ctx, test_str);
1537 0 : if (unicode != NULL) {
1538 0 : Py_DECREF(unicode);
1539 : }
1540 0 : if (talloc_str == NULL) {
1541 0 : PyErr_NoMemory();
1542 0 : talloc_free(ret); return NULL;
1543 : }
1544 0 : ret->AvDnsTreeName = talloc_str;
1545 : }
1546 0 : break;
1547 :
1548 0 : case MsvAvFlags:
1549 0 : if (in == NULL) {
1550 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->AvFlags");
1551 0 : talloc_free(ret); return NULL;
1552 : }
1553 : {
1554 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(ret->AvFlags));
1555 0 : if (PyLong_Check(in)) {
1556 : unsigned long long test_var;
1557 0 : test_var = PyLong_AsUnsignedLongLong(in);
1558 0 : if (PyErr_Occurred() != NULL) {
1559 0 : talloc_free(ret); return NULL;
1560 : }
1561 0 : if (test_var > uint_max) {
1562 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1563 : PyLong_Type.tp_name, uint_max, test_var);
1564 0 : talloc_free(ret); return NULL;
1565 : }
1566 0 : ret->AvFlags = test_var;
1567 : } else {
1568 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1569 : PyLong_Type.tp_name);
1570 0 : talloc_free(ret); return NULL;
1571 : }
1572 : }
1573 0 : break;
1574 :
1575 0 : case MsvAvTimestamp:
1576 0 : if (in == NULL) {
1577 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->AvTimestamp");
1578 0 : talloc_free(ret); return NULL;
1579 : }
1580 : {
1581 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(ret->AvTimestamp));
1582 0 : if (PyLong_Check(in)) {
1583 : unsigned long long test_var;
1584 0 : test_var = PyLong_AsUnsignedLongLong(in);
1585 0 : if (PyErr_Occurred() != NULL) {
1586 0 : talloc_free(ret); return NULL;
1587 : }
1588 0 : if (test_var > uint_max) {
1589 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1590 : PyLong_Type.tp_name, uint_max, test_var);
1591 0 : talloc_free(ret); return NULL;
1592 : }
1593 0 : ret->AvTimestamp = test_var;
1594 : } else {
1595 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1596 : PyLong_Type.tp_name);
1597 0 : talloc_free(ret); return NULL;
1598 : }
1599 : }
1600 0 : break;
1601 :
1602 0 : case MsvAvSingleHost:
1603 0 : if (in == NULL) {
1604 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->AvSingleHost");
1605 0 : talloc_free(ret); return NULL;
1606 : }
1607 0 : PY_CHECK_TYPE(&ntlmssp_SingleHostData_Type, in, talloc_free(ret); return NULL;);
1608 0 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
1609 0 : PyErr_NoMemory();
1610 0 : talloc_free(ret); return NULL;
1611 : }
1612 0 : ret->AvSingleHost = *(struct ntlmssp_SingleHostData *)pytalloc_get_ptr(in);
1613 0 : break;
1614 :
1615 0 : case MsvAvTargetName:
1616 0 : if (in == NULL) {
1617 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->AvTargetName");
1618 0 : talloc_free(ret); return NULL;
1619 : }
1620 : {
1621 : const char *test_str;
1622 : const char *talloc_str;
1623 0 : PyObject *unicode = NULL;
1624 0 : if (PyUnicode_Check(in)) {
1625 0 : unicode = PyUnicode_AsEncodedString(in, "utf-8", "ignore");
1626 0 : if (unicode == NULL) {
1627 0 : talloc_free(ret); return NULL;
1628 : }
1629 0 : test_str = PyBytes_AS_STRING(unicode);
1630 0 : } else if (PyBytes_Check(in)) {
1631 0 : test_str = PyBytes_AS_STRING(in);
1632 : } else {
1633 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(in)->tp_name);
1634 0 : talloc_free(ret); return NULL;
1635 : }
1636 0 : talloc_str = talloc_strdup(mem_ctx, test_str);
1637 0 : if (unicode != NULL) {
1638 0 : Py_DECREF(unicode);
1639 : }
1640 0 : if (talloc_str == NULL) {
1641 0 : PyErr_NoMemory();
1642 0 : talloc_free(ret); return NULL;
1643 : }
1644 0 : ret->AvTargetName = talloc_str;
1645 : }
1646 0 : break;
1647 :
1648 0 : case MsvChannelBindings:
1649 0 : if (in == NULL) {
1650 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->ChannelBindings");
1651 0 : talloc_free(ret); return NULL;
1652 : }
1653 0 : PY_CHECK_TYPE(&PyList_Type, in, talloc_free(ret); return NULL;);
1654 : {
1655 : int ChannelBindings_cntr_0;
1656 0 : if (ARRAY_SIZE(ret->ChannelBindings) != PyList_GET_SIZE(in)) {
1657 0 : PyErr_Format(PyExc_TypeError, "Expected list of type %s, length %zu, got %zd", Py_TYPE(in)->tp_name, ARRAY_SIZE(ret->ChannelBindings), PyList_GET_SIZE(in));
1658 0 : talloc_free(ret); return NULL;
1659 : }
1660 0 : for (ChannelBindings_cntr_0 = 0; ChannelBindings_cntr_0 < PyList_GET_SIZE(in); ChannelBindings_cntr_0++) {
1661 0 : if (PyList_GET_ITEM(in, ChannelBindings_cntr_0) == NULL) {
1662 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (ret->ChannelBindings)[ChannelBindings_cntr_0]");
1663 0 : talloc_free(ret); return NULL;
1664 : }
1665 : {
1666 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((ret->ChannelBindings)[ChannelBindings_cntr_0]));
1667 0 : if (PyLong_Check(PyList_GET_ITEM(in, ChannelBindings_cntr_0))) {
1668 : unsigned long long test_var;
1669 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(in, ChannelBindings_cntr_0));
1670 0 : if (PyErr_Occurred() != NULL) {
1671 0 : talloc_free(ret); return NULL;
1672 : }
1673 0 : if (test_var > uint_max) {
1674 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1675 : PyLong_Type.tp_name, uint_max, test_var);
1676 0 : talloc_free(ret); return NULL;
1677 : }
1678 0 : (ret->ChannelBindings)[ChannelBindings_cntr_0] = test_var;
1679 : } else {
1680 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1681 : PyLong_Type.tp_name);
1682 0 : talloc_free(ret); return NULL;
1683 : }
1684 : }
1685 : }
1686 : }
1687 0 : break;
1688 :
1689 0 : default:
1690 0 : if (in == NULL) {
1691 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->blob");
1692 0 : talloc_free(ret); return NULL;
1693 : }
1694 0 : ret->blob = data_blob_talloc(mem_ctx, PyBytes_AS_STRING(in), PyBytes_GET_SIZE(in));
1695 0 : break;
1696 :
1697 : }
1698 :
1699 244 : return ret;
1700 : }
1701 :
1702 0 : static PyObject *py_ntlmssp_AvValue_import(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1703 : {
1704 0 : const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
1705 0 : PyObject *mem_ctx_obj = NULL;
1706 0 : TALLOC_CTX *mem_ctx = NULL;
1707 0 : int level = 0;
1708 0 : PyObject *in_obj = NULL;
1709 0 : union ntlmssp_AvValue *in = NULL;
1710 :
1711 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:import",
1712 : discard_const_p(char *, kwnames),
1713 : &mem_ctx_obj,
1714 : &level,
1715 : &in_obj)) {
1716 0 : return NULL;
1717 : }
1718 0 : mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
1719 0 : if (mem_ctx == NULL) {
1720 0 : PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
1721 0 : return NULL;
1722 : }
1723 0 : in = (union ntlmssp_AvValue *)pytalloc_get_ptr(in_obj);
1724 0 : if (in == NULL) {
1725 0 : PyErr_Format(PyExc_TypeError, "in needs to be a pointer to union ntlmssp_AvValue!");
1726 0 : return NULL;
1727 : }
1728 :
1729 0 : return py_import_ntlmssp_AvValue(mem_ctx, level, in);
1730 : }
1731 :
1732 244 : static PyObject *py_ntlmssp_AvValue_export(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1733 : {
1734 244 : const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
1735 244 : PyObject *mem_ctx_obj = NULL;
1736 244 : TALLOC_CTX *mem_ctx = NULL;
1737 244 : int level = 0;
1738 244 : PyObject *in = NULL;
1739 244 : union ntlmssp_AvValue *out = NULL;
1740 :
1741 244 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:export",
1742 : discard_const_p(char *, kwnames),
1743 : &mem_ctx_obj,
1744 : &level,
1745 : &in)) {
1746 0 : return NULL;
1747 : }
1748 244 : mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
1749 244 : if (mem_ctx == NULL) {
1750 0 : PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
1751 0 : return NULL;
1752 : }
1753 :
1754 244 : out = py_export_ntlmssp_AvValue(mem_ctx, level, in);
1755 244 : if (out == NULL) {
1756 0 : return NULL;
1757 : }
1758 :
1759 244 : return pytalloc_GenericObject_reference(out);
1760 : }
1761 :
1762 : static PyMethodDef py_ntlmssp_AvValue_methods[] = {
1763 : { "__import__", PY_DISCARD_FUNC_SIG(PyCFunction,py_ntlmssp_AvValue_import),
1764 : METH_VARARGS|METH_KEYWORDS|METH_CLASS,
1765 : "T.__import__(mem_ctx, level, in) => ret." },
1766 : { "__export__", PY_DISCARD_FUNC_SIG(PyCFunction,py_ntlmssp_AvValue_export),
1767 : METH_VARARGS|METH_KEYWORDS|METH_CLASS,
1768 : "T.__export__(mem_ctx, level, in) => ret." },
1769 : { NULL, NULL, 0, NULL }
1770 : };
1771 :
1772 0 : static PyObject *py_ntlmssp_AvValue_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1773 : {
1774 0 : PyErr_Format(PyExc_TypeError, "New %s Objects are not supported", type->tp_name);
1775 0 : return NULL;
1776 : }
1777 :
1778 :
1779 : static PyTypeObject ntlmssp_AvValue_Type = {
1780 : PyVarObject_HEAD_INIT(NULL, 0)
1781 : .tp_name = "ntlmssp.AvValue",
1782 : .tp_getset = NULL,
1783 : .tp_methods = py_ntlmssp_AvValue_methods,
1784 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1785 : .tp_new = py_ntlmssp_AvValue_new,
1786 : };
1787 :
1788 :
1789 0 : static PyObject *py_AV_PAIR_get_AvId(PyObject *obj, void *closure)
1790 : {
1791 0 : struct AV_PAIR *object = pytalloc_get_ptr(obj);
1792 : PyObject *py_AvId;
1793 0 : py_AvId = PyLong_FromLong((uint16_t)(object->AvId));
1794 0 : return py_AvId;
1795 : }
1796 :
1797 366 : static int py_AV_PAIR_set_AvId(PyObject *py_obj, PyObject *value, void *closure)
1798 : {
1799 366 : struct AV_PAIR *object = pytalloc_get_ptr(py_obj);
1800 366 : if (value == NULL) {
1801 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->AvId");
1802 0 : return -1;
1803 : }
1804 : {
1805 366 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->AvId));
1806 366 : if (PyLong_Check(value)) {
1807 : unsigned long long test_var;
1808 366 : test_var = PyLong_AsUnsignedLongLong(value);
1809 366 : if (PyErr_Occurred() != NULL) {
1810 0 : return -1;
1811 : }
1812 366 : if (test_var > uint_max) {
1813 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1814 : PyLong_Type.tp_name, uint_max, test_var);
1815 0 : return -1;
1816 : }
1817 366 : object->AvId = test_var;
1818 : } else {
1819 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1820 : PyLong_Type.tp_name);
1821 0 : return -1;
1822 : }
1823 : }
1824 366 : return 0;
1825 : }
1826 :
1827 0 : static PyObject *py_AV_PAIR_get_AvLen(PyObject *obj, void *closure)
1828 : {
1829 0 : struct AV_PAIR *object = pytalloc_get_ptr(obj);
1830 : PyObject *py_AvLen;
1831 0 : py_AvLen = PyLong_FromLong((uint16_t)(object->AvLen));
1832 0 : return py_AvLen;
1833 : }
1834 :
1835 0 : static int py_AV_PAIR_set_AvLen(PyObject *py_obj, PyObject *value, void *closure)
1836 : {
1837 0 : struct AV_PAIR *object = pytalloc_get_ptr(py_obj);
1838 0 : if (value == NULL) {
1839 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->AvLen");
1840 0 : return -1;
1841 : }
1842 : {
1843 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->AvLen));
1844 0 : if (PyLong_Check(value)) {
1845 : unsigned long long test_var;
1846 0 : test_var = PyLong_AsUnsignedLongLong(value);
1847 0 : if (PyErr_Occurred() != NULL) {
1848 0 : return -1;
1849 : }
1850 0 : if (test_var > uint_max) {
1851 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1852 : PyLong_Type.tp_name, uint_max, test_var);
1853 0 : return -1;
1854 : }
1855 0 : object->AvLen = test_var;
1856 : } else {
1857 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1858 : PyLong_Type.tp_name);
1859 0 : return -1;
1860 : }
1861 : }
1862 0 : return 0;
1863 : }
1864 :
1865 0 : static PyObject *py_AV_PAIR_get_Value(PyObject *obj, void *closure)
1866 : {
1867 0 : struct AV_PAIR *object = pytalloc_get_ptr(obj);
1868 : PyObject *py_Value;
1869 0 : py_Value = pyrpc_import_union(&ntlmssp_AvValue_Type, pytalloc_get_mem_ctx(obj), object->AvId, &object->Value, "union ntlmssp_AvValue");
1870 0 : if (py_Value == NULL) {
1871 0 : return NULL;
1872 : }
1873 0 : return py_Value;
1874 : }
1875 :
1876 244 : static int py_AV_PAIR_set_Value(PyObject *py_obj, PyObject *value, void *closure)
1877 : {
1878 244 : struct AV_PAIR *object = pytalloc_get_ptr(py_obj);
1879 244 : if (value == NULL) {
1880 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->Value");
1881 0 : return -1;
1882 : }
1883 : {
1884 : union ntlmssp_AvValue *Value_switch_1;
1885 244 : Value_switch_1 = (union ntlmssp_AvValue *)pyrpc_export_union(&ntlmssp_AvValue_Type, pytalloc_get_mem_ctx(py_obj), object->AvId, value, "union ntlmssp_AvValue");
1886 244 : if (Value_switch_1 == NULL) {
1887 0 : return -1;
1888 : }
1889 244 : object->Value = *Value_switch_1;
1890 : }
1891 244 : return 0;
1892 : }
1893 :
1894 : static PyGetSetDef py_AV_PAIR_getsetters[] = {
1895 : {
1896 : .name = discard_const_p(char, "AvId"),
1897 : .get = py_AV_PAIR_get_AvId,
1898 : .set = py_AV_PAIR_set_AvId,
1899 : .doc = discard_const_p(char, "PIDL-generated element of base type ntlmssp_AvId")
1900 : },
1901 : {
1902 : .name = discard_const_p(char, "AvLen"),
1903 : .get = py_AV_PAIR_get_AvLen,
1904 : .set = py_AV_PAIR_set_AvLen,
1905 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
1906 : },
1907 : {
1908 : .name = discard_const_p(char, "Value"),
1909 : .get = py_AV_PAIR_get_Value,
1910 : .set = py_AV_PAIR_set_Value,
1911 : .doc = discard_const_p(char, "PIDL-generated element of base type ntlmssp_AvValue")
1912 : },
1913 : { .name = NULL }
1914 : };
1915 :
1916 366 : static PyObject *py_AV_PAIR_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1917 : {
1918 366 : return pytalloc_new(struct AV_PAIR, type);
1919 : }
1920 :
1921 0 : static PyObject *py_AV_PAIR_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
1922 : {
1923 0 : struct AV_PAIR *object = pytalloc_get_ptr(py_obj);
1924 0 : PyObject *ret = NULL;
1925 : DATA_BLOB blob;
1926 : enum ndr_err_code err;
1927 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
1928 0 : if (tmp_ctx == NULL) {
1929 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
1930 0 : return NULL;
1931 : }
1932 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_AV_PAIR);
1933 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
1934 0 : TALLOC_FREE(tmp_ctx);
1935 0 : PyErr_SetNdrError(err);
1936 0 : return NULL;
1937 : }
1938 :
1939 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
1940 0 : TALLOC_FREE(tmp_ctx);
1941 0 : return ret;
1942 : }
1943 :
1944 0 : static PyObject *py_AV_PAIR_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
1945 : {
1946 0 : struct AV_PAIR *object = pytalloc_get_ptr(py_obj);
1947 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
1948 0 : Py_ssize_t blob_length = 0;
1949 : enum ndr_err_code err;
1950 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
1951 0 : PyObject *allow_remaining_obj = NULL;
1952 0 : bool allow_remaining = false;
1953 :
1954 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
1955 : discard_const_p(char *, kwnames),
1956 : &blob.data, &blob_length,
1957 : &allow_remaining_obj)) {
1958 0 : return NULL;
1959 : }
1960 0 : blob.length = blob_length;
1961 :
1962 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
1963 0 : allow_remaining = true;
1964 : }
1965 :
1966 0 : if (allow_remaining) {
1967 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_AV_PAIR);
1968 : } else {
1969 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_AV_PAIR);
1970 : }
1971 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
1972 0 : PyErr_SetNdrError(err);
1973 0 : return NULL;
1974 : }
1975 :
1976 0 : Py_RETURN_NONE;
1977 : }
1978 :
1979 0 : static PyObject *py_AV_PAIR_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
1980 : {
1981 0 : struct AV_PAIR *object = pytalloc_get_ptr(py_obj);
1982 : PyObject *ret;
1983 : char *retstr;
1984 :
1985 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_AV_PAIR, "AV_PAIR", object);
1986 0 : ret = PyUnicode_FromString(retstr);
1987 0 : talloc_free(retstr);
1988 :
1989 0 : return ret;
1990 : }
1991 :
1992 : static PyMethodDef py_AV_PAIR_methods[] = {
1993 : { "__ndr_pack__", (PyCFunction)py_AV_PAIR_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
1994 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_AV_PAIR_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
1995 : { "__ndr_print__", (PyCFunction)py_AV_PAIR_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
1996 : { NULL, NULL, 0, NULL }
1997 : };
1998 :
1999 :
2000 : static PyTypeObject AV_PAIR_Type = {
2001 : PyVarObject_HEAD_INIT(NULL, 0)
2002 : .tp_name = "ntlmssp.AV_PAIR",
2003 : .tp_getset = py_AV_PAIR_getsetters,
2004 : .tp_methods = py_AV_PAIR_methods,
2005 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
2006 : .tp_new = py_AV_PAIR_new,
2007 : };
2008 :
2009 :
2010 0 : static PyObject *py_AV_PAIR_LIST_get_count(PyObject *obj, void *closure)
2011 : {
2012 0 : struct AV_PAIR_LIST *object = pytalloc_get_ptr(obj);
2013 : PyObject *py_count;
2014 0 : py_count = PyLong_FromUnsignedLongLong((uint32_t)(object->count));
2015 0 : return py_count;
2016 : }
2017 :
2018 122 : static int py_AV_PAIR_LIST_set_count(PyObject *py_obj, PyObject *value, void *closure)
2019 : {
2020 122 : struct AV_PAIR_LIST *object = pytalloc_get_ptr(py_obj);
2021 122 : if (value == NULL) {
2022 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->count");
2023 0 : return -1;
2024 : }
2025 : {
2026 122 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->count));
2027 122 : if (PyLong_Check(value)) {
2028 : unsigned long long test_var;
2029 122 : test_var = PyLong_AsUnsignedLongLong(value);
2030 122 : if (PyErr_Occurred() != NULL) {
2031 0 : return -1;
2032 : }
2033 122 : if (test_var > uint_max) {
2034 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2035 : PyLong_Type.tp_name, uint_max, test_var);
2036 0 : return -1;
2037 : }
2038 122 : object->count = test_var;
2039 : } else {
2040 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2041 : PyLong_Type.tp_name);
2042 0 : return -1;
2043 : }
2044 : }
2045 122 : return 0;
2046 : }
2047 :
2048 0 : static PyObject *py_AV_PAIR_LIST_get_pair(PyObject *obj, void *closure)
2049 : {
2050 0 : struct AV_PAIR_LIST *object = pytalloc_get_ptr(obj);
2051 : PyObject *py_pair;
2052 0 : py_pair = PyList_New(object->count);
2053 0 : if (py_pair == NULL) {
2054 0 : return NULL;
2055 : }
2056 : {
2057 : int pair_cntr_0;
2058 0 : for (pair_cntr_0 = 0; pair_cntr_0 < (object->count); pair_cntr_0++) {
2059 : PyObject *py_pair_0;
2060 0 : py_pair_0 = pytalloc_reference_ex(&AV_PAIR_Type, object->pair, &(object->pair)[pair_cntr_0]);
2061 0 : PyList_SetItem(py_pair, pair_cntr_0, py_pair_0);
2062 : }
2063 : }
2064 0 : return py_pair;
2065 : }
2066 :
2067 122 : static int py_AV_PAIR_LIST_set_pair(PyObject *py_obj, PyObject *value, void *closure)
2068 : {
2069 122 : struct AV_PAIR_LIST *object = pytalloc_get_ptr(py_obj);
2070 122 : if (value == NULL) {
2071 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->pair");
2072 0 : return -1;
2073 : }
2074 122 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
2075 : {
2076 : int pair_cntr_0;
2077 122 : object->pair = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->pair, PyList_GET_SIZE(value));
2078 122 : if (!object->pair) { return -1; }
2079 122 : talloc_set_name_const(object->pair, "ARRAY: object->pair");
2080 488 : for (pair_cntr_0 = 0; pair_cntr_0 < PyList_GET_SIZE(value); pair_cntr_0++) {
2081 366 : if (PyList_GET_ITEM(value, pair_cntr_0) == NULL) {
2082 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->pair)[pair_cntr_0]");
2083 0 : return -1;
2084 : }
2085 366 : PY_CHECK_TYPE(&AV_PAIR_Type, PyList_GET_ITEM(value, pair_cntr_0), return -1;);
2086 366 : if (talloc_reference(object->pair, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, pair_cntr_0))) == NULL) {
2087 0 : PyErr_NoMemory();
2088 0 : return -1;
2089 : }
2090 366 : (object->pair)[pair_cntr_0] = *(struct AV_PAIR *)pytalloc_get_ptr(PyList_GET_ITEM(value, pair_cntr_0));
2091 : }
2092 : }
2093 122 : return 0;
2094 : }
2095 :
2096 : static PyGetSetDef py_AV_PAIR_LIST_getsetters[] = {
2097 : {
2098 : .name = discard_const_p(char, "count"),
2099 : .get = py_AV_PAIR_LIST_get_count,
2100 : .set = py_AV_PAIR_LIST_set_count,
2101 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
2102 : },
2103 : {
2104 : .name = discard_const_p(char, "pair"),
2105 : .get = py_AV_PAIR_LIST_get_pair,
2106 : .set = py_AV_PAIR_LIST_set_pair,
2107 : .doc = discard_const_p(char, "PIDL-generated element of base type AV_PAIR")
2108 : },
2109 : { .name = NULL }
2110 : };
2111 :
2112 122 : static PyObject *py_AV_PAIR_LIST_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2113 : {
2114 122 : return pytalloc_new(struct AV_PAIR_LIST, type);
2115 : }
2116 :
2117 122 : static PyObject *py_AV_PAIR_LIST_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2118 : {
2119 122 : struct AV_PAIR_LIST *object = pytalloc_get_ptr(py_obj);
2120 122 : PyObject *ret = NULL;
2121 : DATA_BLOB blob;
2122 : enum ndr_err_code err;
2123 122 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
2124 122 : if (tmp_ctx == NULL) {
2125 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
2126 0 : return NULL;
2127 : }
2128 122 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_AV_PAIR_LIST);
2129 122 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2130 0 : TALLOC_FREE(tmp_ctx);
2131 0 : PyErr_SetNdrError(err);
2132 0 : return NULL;
2133 : }
2134 :
2135 122 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
2136 122 : TALLOC_FREE(tmp_ctx);
2137 122 : return ret;
2138 : }
2139 :
2140 0 : static PyObject *py_AV_PAIR_LIST_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
2141 : {
2142 0 : struct AV_PAIR_LIST *object = pytalloc_get_ptr(py_obj);
2143 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
2144 0 : Py_ssize_t blob_length = 0;
2145 : enum ndr_err_code err;
2146 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
2147 0 : PyObject *allow_remaining_obj = NULL;
2148 0 : bool allow_remaining = false;
2149 :
2150 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
2151 : discard_const_p(char *, kwnames),
2152 : &blob.data, &blob_length,
2153 : &allow_remaining_obj)) {
2154 0 : return NULL;
2155 : }
2156 0 : blob.length = blob_length;
2157 :
2158 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
2159 0 : allow_remaining = true;
2160 : }
2161 :
2162 0 : if (allow_remaining) {
2163 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_AV_PAIR_LIST);
2164 : } else {
2165 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_AV_PAIR_LIST);
2166 : }
2167 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2168 0 : PyErr_SetNdrError(err);
2169 0 : return NULL;
2170 : }
2171 :
2172 0 : Py_RETURN_NONE;
2173 : }
2174 :
2175 0 : static PyObject *py_AV_PAIR_LIST_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2176 : {
2177 0 : struct AV_PAIR_LIST *object = pytalloc_get_ptr(py_obj);
2178 : PyObject *ret;
2179 : char *retstr;
2180 :
2181 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_AV_PAIR_LIST, "AV_PAIR_LIST", object);
2182 0 : ret = PyUnicode_FromString(retstr);
2183 0 : talloc_free(retstr);
2184 :
2185 0 : return ret;
2186 : }
2187 :
2188 : static PyMethodDef py_AV_PAIR_LIST_methods[] = {
2189 : { "__ndr_pack__", (PyCFunction)py_AV_PAIR_LIST_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
2190 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_AV_PAIR_LIST_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
2191 : { "__ndr_print__", (PyCFunction)py_AV_PAIR_LIST_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
2192 : { NULL, NULL, 0, NULL }
2193 : };
2194 :
2195 :
2196 : static PyTypeObject AV_PAIR_LIST_Type = {
2197 : PyVarObject_HEAD_INIT(NULL, 0)
2198 : .tp_name = "ntlmssp.AV_PAIR_LIST",
2199 : .tp_getset = py_AV_PAIR_LIST_getsetters,
2200 : .tp_methods = py_AV_PAIR_LIST_methods,
2201 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
2202 : .tp_new = py_AV_PAIR_LIST_new,
2203 : };
2204 :
2205 :
2206 0 : static PyObject *py_CHALLENGE_MESSAGE_get_Signature(PyObject *obj, void *closure)
2207 : {
2208 0 : struct CHALLENGE_MESSAGE *object = pytalloc_get_ptr(obj);
2209 : PyObject *py_Signature;
2210 0 : if (object->Signature == NULL) {
2211 0 : py_Signature = Py_None;
2212 0 : Py_INCREF(py_Signature);
2213 : } else {
2214 0 : py_Signature = PyUnicode_Decode(object->Signature, strlen(object->Signature), "utf-8", "ignore");
2215 : }
2216 0 : return py_Signature;
2217 : }
2218 :
2219 0 : static int py_CHALLENGE_MESSAGE_set_Signature(PyObject *py_obj, PyObject *value, void *closure)
2220 : {
2221 0 : struct CHALLENGE_MESSAGE *object = pytalloc_get_ptr(py_obj);
2222 0 : if (value == NULL) {
2223 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->Signature");
2224 0 : return -1;
2225 : }
2226 : {
2227 : const char *test_str;
2228 : const char *talloc_str;
2229 0 : PyObject *unicode = NULL;
2230 0 : if (PyUnicode_Check(value)) {
2231 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
2232 0 : if (unicode == NULL) {
2233 0 : return -1;
2234 : }
2235 0 : test_str = PyBytes_AS_STRING(unicode);
2236 0 : } else if (PyBytes_Check(value)) {
2237 0 : test_str = PyBytes_AS_STRING(value);
2238 : } else {
2239 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
2240 0 : return -1;
2241 : }
2242 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
2243 0 : if (unicode != NULL) {
2244 0 : Py_DECREF(unicode);
2245 : }
2246 0 : if (talloc_str == NULL) {
2247 0 : PyErr_NoMemory();
2248 0 : return -1;
2249 : }
2250 0 : object->Signature = talloc_str;
2251 : }
2252 0 : return 0;
2253 : }
2254 :
2255 0 : static PyObject *py_CHALLENGE_MESSAGE_get_MessageType(PyObject *obj, void *closure)
2256 : {
2257 0 : struct CHALLENGE_MESSAGE *object = pytalloc_get_ptr(obj);
2258 : PyObject *py_MessageType;
2259 0 : py_MessageType = PyLong_FromUnsignedLongLong((uint32_t)(object->MessageType));
2260 0 : return py_MessageType;
2261 : }
2262 :
2263 0 : static int py_CHALLENGE_MESSAGE_set_MessageType(PyObject *py_obj, PyObject *value, void *closure)
2264 : {
2265 0 : struct CHALLENGE_MESSAGE *object = pytalloc_get_ptr(py_obj);
2266 0 : if (value == NULL) {
2267 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->MessageType");
2268 0 : return -1;
2269 : }
2270 : {
2271 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->MessageType));
2272 0 : if (PyLong_Check(value)) {
2273 : unsigned long long test_var;
2274 0 : test_var = PyLong_AsUnsignedLongLong(value);
2275 0 : if (PyErr_Occurred() != NULL) {
2276 0 : return -1;
2277 : }
2278 0 : if (test_var > uint_max) {
2279 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2280 : PyLong_Type.tp_name, uint_max, test_var);
2281 0 : return -1;
2282 : }
2283 0 : object->MessageType = test_var;
2284 : } else {
2285 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2286 : PyLong_Type.tp_name);
2287 0 : return -1;
2288 : }
2289 : }
2290 0 : return 0;
2291 : }
2292 :
2293 0 : static PyObject *py_CHALLENGE_MESSAGE_get_TargetNameLen(PyObject *obj, void *closure)
2294 : {
2295 0 : struct CHALLENGE_MESSAGE *object = pytalloc_get_ptr(obj);
2296 : PyObject *py_TargetNameLen;
2297 0 : py_TargetNameLen = PyLong_FromLong((uint16_t)(object->TargetNameLen));
2298 0 : return py_TargetNameLen;
2299 : }
2300 :
2301 0 : static int py_CHALLENGE_MESSAGE_set_TargetNameLen(PyObject *py_obj, PyObject *value, void *closure)
2302 : {
2303 0 : struct CHALLENGE_MESSAGE *object = pytalloc_get_ptr(py_obj);
2304 0 : if (value == NULL) {
2305 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->TargetNameLen");
2306 0 : return -1;
2307 : }
2308 : {
2309 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->TargetNameLen));
2310 0 : if (PyLong_Check(value)) {
2311 : unsigned long long test_var;
2312 0 : test_var = PyLong_AsUnsignedLongLong(value);
2313 0 : if (PyErr_Occurred() != NULL) {
2314 0 : return -1;
2315 : }
2316 0 : if (test_var > uint_max) {
2317 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2318 : PyLong_Type.tp_name, uint_max, test_var);
2319 0 : return -1;
2320 : }
2321 0 : object->TargetNameLen = test_var;
2322 : } else {
2323 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2324 : PyLong_Type.tp_name);
2325 0 : return -1;
2326 : }
2327 : }
2328 0 : return 0;
2329 : }
2330 :
2331 0 : static PyObject *py_CHALLENGE_MESSAGE_get_TargetNameMaxLen(PyObject *obj, void *closure)
2332 : {
2333 0 : struct CHALLENGE_MESSAGE *object = pytalloc_get_ptr(obj);
2334 : PyObject *py_TargetNameMaxLen;
2335 0 : py_TargetNameMaxLen = PyLong_FromLong((uint16_t)(object->TargetNameMaxLen));
2336 0 : return py_TargetNameMaxLen;
2337 : }
2338 :
2339 0 : static int py_CHALLENGE_MESSAGE_set_TargetNameMaxLen(PyObject *py_obj, PyObject *value, void *closure)
2340 : {
2341 0 : struct CHALLENGE_MESSAGE *object = pytalloc_get_ptr(py_obj);
2342 0 : if (value == NULL) {
2343 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->TargetNameMaxLen");
2344 0 : return -1;
2345 : }
2346 : {
2347 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->TargetNameMaxLen));
2348 0 : if (PyLong_Check(value)) {
2349 : unsigned long long test_var;
2350 0 : test_var = PyLong_AsUnsignedLongLong(value);
2351 0 : if (PyErr_Occurred() != NULL) {
2352 0 : return -1;
2353 : }
2354 0 : if (test_var > uint_max) {
2355 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2356 : PyLong_Type.tp_name, uint_max, test_var);
2357 0 : return -1;
2358 : }
2359 0 : object->TargetNameMaxLen = test_var;
2360 : } else {
2361 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2362 : PyLong_Type.tp_name);
2363 0 : return -1;
2364 : }
2365 : }
2366 0 : return 0;
2367 : }
2368 :
2369 0 : static PyObject *py_CHALLENGE_MESSAGE_get_TargetName(PyObject *obj, void *closure)
2370 : {
2371 0 : struct CHALLENGE_MESSAGE *object = pytalloc_get_ptr(obj);
2372 : PyObject *py_TargetName;
2373 0 : if (object->TargetName == NULL) {
2374 0 : Py_RETURN_NONE;
2375 : }
2376 0 : if (object->TargetName == NULL) {
2377 0 : py_TargetName = Py_None;
2378 0 : Py_INCREF(py_TargetName);
2379 : } else {
2380 0 : py_TargetName = PyString_FromStringOrNULL(object->TargetName);
2381 : }
2382 0 : return py_TargetName;
2383 : }
2384 :
2385 0 : static int py_CHALLENGE_MESSAGE_set_TargetName(PyObject *py_obj, PyObject *value, void *closure)
2386 : {
2387 0 : struct CHALLENGE_MESSAGE *object = pytalloc_get_ptr(py_obj);
2388 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->TargetName));
2389 0 : if (value == NULL) {
2390 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->TargetName");
2391 0 : return -1;
2392 : }
2393 0 : if (value == Py_None) {
2394 0 : object->TargetName = NULL;
2395 : } else {
2396 0 : object->TargetName = NULL;
2397 : {
2398 : const char *test_str;
2399 : const char *talloc_str;
2400 0 : PyObject *unicode = NULL;
2401 0 : if (PyUnicode_Check(value)) {
2402 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
2403 0 : if (unicode == NULL) {
2404 0 : return -1;
2405 : }
2406 0 : test_str = PyBytes_AS_STRING(unicode);
2407 0 : } else if (PyBytes_Check(value)) {
2408 0 : test_str = PyBytes_AS_STRING(value);
2409 : } else {
2410 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
2411 0 : return -1;
2412 : }
2413 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
2414 0 : if (unicode != NULL) {
2415 0 : Py_DECREF(unicode);
2416 : }
2417 0 : if (talloc_str == NULL) {
2418 0 : PyErr_NoMemory();
2419 0 : return -1;
2420 : }
2421 0 : object->TargetName = talloc_str;
2422 : }
2423 : }
2424 0 : return 0;
2425 : }
2426 :
2427 0 : static PyObject *py_CHALLENGE_MESSAGE_get_NegotiateFlags(PyObject *obj, void *closure)
2428 : {
2429 0 : struct CHALLENGE_MESSAGE *object = pytalloc_get_ptr(obj);
2430 : PyObject *py_NegotiateFlags;
2431 0 : py_NegotiateFlags = PyLong_FromUnsignedLongLong((uint32_t)(object->NegotiateFlags));
2432 0 : return py_NegotiateFlags;
2433 : }
2434 :
2435 0 : static int py_CHALLENGE_MESSAGE_set_NegotiateFlags(PyObject *py_obj, PyObject *value, void *closure)
2436 : {
2437 0 : struct CHALLENGE_MESSAGE *object = pytalloc_get_ptr(py_obj);
2438 0 : if (value == NULL) {
2439 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->NegotiateFlags");
2440 0 : return -1;
2441 : }
2442 : {
2443 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->NegotiateFlags));
2444 0 : if (PyLong_Check(value)) {
2445 : unsigned long long test_var;
2446 0 : test_var = PyLong_AsUnsignedLongLong(value);
2447 0 : if (PyErr_Occurred() != NULL) {
2448 0 : return -1;
2449 : }
2450 0 : if (test_var > uint_max) {
2451 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2452 : PyLong_Type.tp_name, uint_max, test_var);
2453 0 : return -1;
2454 : }
2455 0 : object->NegotiateFlags = test_var;
2456 : } else {
2457 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2458 : PyLong_Type.tp_name);
2459 0 : return -1;
2460 : }
2461 : }
2462 0 : return 0;
2463 : }
2464 :
2465 0 : static PyObject *py_CHALLENGE_MESSAGE_get_ServerChallenge(PyObject *obj, void *closure)
2466 : {
2467 0 : struct CHALLENGE_MESSAGE *object = pytalloc_get_ptr(obj);
2468 : PyObject *py_ServerChallenge;
2469 0 : py_ServerChallenge = PyList_New(8);
2470 0 : if (py_ServerChallenge == NULL) {
2471 0 : return NULL;
2472 : }
2473 : {
2474 : int ServerChallenge_cntr_0;
2475 0 : for (ServerChallenge_cntr_0 = 0; ServerChallenge_cntr_0 < (8); ServerChallenge_cntr_0++) {
2476 : PyObject *py_ServerChallenge_0;
2477 0 : py_ServerChallenge_0 = PyLong_FromLong((uint16_t)((object->ServerChallenge)[ServerChallenge_cntr_0]));
2478 0 : PyList_SetItem(py_ServerChallenge, ServerChallenge_cntr_0, py_ServerChallenge_0);
2479 : }
2480 : }
2481 0 : return py_ServerChallenge;
2482 : }
2483 :
2484 0 : static int py_CHALLENGE_MESSAGE_set_ServerChallenge(PyObject *py_obj, PyObject *value, void *closure)
2485 : {
2486 0 : struct CHALLENGE_MESSAGE *object = pytalloc_get_ptr(py_obj);
2487 0 : if (value == NULL) {
2488 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->ServerChallenge");
2489 0 : return -1;
2490 : }
2491 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
2492 : {
2493 : int ServerChallenge_cntr_0;
2494 0 : if (ARRAY_SIZE(object->ServerChallenge) != PyList_GET_SIZE(value)) {
2495 0 : PyErr_Format(PyExc_TypeError, "Expected list of type %s, length %zu, got %zd", Py_TYPE(value)->tp_name, ARRAY_SIZE(object->ServerChallenge), PyList_GET_SIZE(value));
2496 0 : return -1;
2497 : }
2498 0 : for (ServerChallenge_cntr_0 = 0; ServerChallenge_cntr_0 < PyList_GET_SIZE(value); ServerChallenge_cntr_0++) {
2499 0 : if (PyList_GET_ITEM(value, ServerChallenge_cntr_0) == NULL) {
2500 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->ServerChallenge)[ServerChallenge_cntr_0]");
2501 0 : return -1;
2502 : }
2503 : {
2504 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((object->ServerChallenge)[ServerChallenge_cntr_0]));
2505 0 : if (PyLong_Check(PyList_GET_ITEM(value, ServerChallenge_cntr_0))) {
2506 : unsigned long long test_var;
2507 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, ServerChallenge_cntr_0));
2508 0 : if (PyErr_Occurred() != NULL) {
2509 0 : return -1;
2510 : }
2511 0 : if (test_var > uint_max) {
2512 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2513 : PyLong_Type.tp_name, uint_max, test_var);
2514 0 : return -1;
2515 : }
2516 0 : (object->ServerChallenge)[ServerChallenge_cntr_0] = test_var;
2517 : } else {
2518 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2519 : PyLong_Type.tp_name);
2520 0 : return -1;
2521 : }
2522 : }
2523 : }
2524 : }
2525 0 : return 0;
2526 : }
2527 :
2528 0 : static PyObject *py_CHALLENGE_MESSAGE_get_Reserved(PyObject *obj, void *closure)
2529 : {
2530 0 : struct CHALLENGE_MESSAGE *object = pytalloc_get_ptr(obj);
2531 : PyObject *py_Reserved;
2532 0 : py_Reserved = PyList_New(8);
2533 0 : if (py_Reserved == NULL) {
2534 0 : return NULL;
2535 : }
2536 : {
2537 : int Reserved_cntr_0;
2538 0 : for (Reserved_cntr_0 = 0; Reserved_cntr_0 < (8); Reserved_cntr_0++) {
2539 : PyObject *py_Reserved_0;
2540 0 : py_Reserved_0 = PyLong_FromLong((uint16_t)((object->Reserved)[Reserved_cntr_0]));
2541 0 : PyList_SetItem(py_Reserved, Reserved_cntr_0, py_Reserved_0);
2542 : }
2543 : }
2544 0 : return py_Reserved;
2545 : }
2546 :
2547 0 : static int py_CHALLENGE_MESSAGE_set_Reserved(PyObject *py_obj, PyObject *value, void *closure)
2548 : {
2549 0 : struct CHALLENGE_MESSAGE *object = pytalloc_get_ptr(py_obj);
2550 0 : if (value == NULL) {
2551 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->Reserved");
2552 0 : return -1;
2553 : }
2554 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
2555 : {
2556 : int Reserved_cntr_0;
2557 0 : if (ARRAY_SIZE(object->Reserved) != PyList_GET_SIZE(value)) {
2558 0 : PyErr_Format(PyExc_TypeError, "Expected list of type %s, length %zu, got %zd", Py_TYPE(value)->tp_name, ARRAY_SIZE(object->Reserved), PyList_GET_SIZE(value));
2559 0 : return -1;
2560 : }
2561 0 : for (Reserved_cntr_0 = 0; Reserved_cntr_0 < PyList_GET_SIZE(value); Reserved_cntr_0++) {
2562 0 : if (PyList_GET_ITEM(value, Reserved_cntr_0) == NULL) {
2563 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->Reserved)[Reserved_cntr_0]");
2564 0 : return -1;
2565 : }
2566 : {
2567 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((object->Reserved)[Reserved_cntr_0]));
2568 0 : if (PyLong_Check(PyList_GET_ITEM(value, Reserved_cntr_0))) {
2569 : unsigned long long test_var;
2570 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, Reserved_cntr_0));
2571 0 : if (PyErr_Occurred() != NULL) {
2572 0 : return -1;
2573 : }
2574 0 : if (test_var > uint_max) {
2575 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2576 : PyLong_Type.tp_name, uint_max, test_var);
2577 0 : return -1;
2578 : }
2579 0 : (object->Reserved)[Reserved_cntr_0] = test_var;
2580 : } else {
2581 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2582 : PyLong_Type.tp_name);
2583 0 : return -1;
2584 : }
2585 : }
2586 : }
2587 : }
2588 0 : return 0;
2589 : }
2590 :
2591 0 : static PyObject *py_CHALLENGE_MESSAGE_get_TargetInfoLen(PyObject *obj, void *closure)
2592 : {
2593 0 : struct CHALLENGE_MESSAGE *object = pytalloc_get_ptr(obj);
2594 : PyObject *py_TargetInfoLen;
2595 0 : py_TargetInfoLen = PyLong_FromLong((uint16_t)(object->TargetInfoLen));
2596 0 : return py_TargetInfoLen;
2597 : }
2598 :
2599 0 : static int py_CHALLENGE_MESSAGE_set_TargetInfoLen(PyObject *py_obj, PyObject *value, void *closure)
2600 : {
2601 0 : struct CHALLENGE_MESSAGE *object = pytalloc_get_ptr(py_obj);
2602 0 : if (value == NULL) {
2603 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->TargetInfoLen");
2604 0 : return -1;
2605 : }
2606 : {
2607 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->TargetInfoLen));
2608 0 : if (PyLong_Check(value)) {
2609 : unsigned long long test_var;
2610 0 : test_var = PyLong_AsUnsignedLongLong(value);
2611 0 : if (PyErr_Occurred() != NULL) {
2612 0 : return -1;
2613 : }
2614 0 : if (test_var > uint_max) {
2615 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2616 : PyLong_Type.tp_name, uint_max, test_var);
2617 0 : return -1;
2618 : }
2619 0 : object->TargetInfoLen = test_var;
2620 : } else {
2621 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2622 : PyLong_Type.tp_name);
2623 0 : return -1;
2624 : }
2625 : }
2626 0 : return 0;
2627 : }
2628 :
2629 0 : static PyObject *py_CHALLENGE_MESSAGE_get_TargetInfoMaxLen(PyObject *obj, void *closure)
2630 : {
2631 0 : struct CHALLENGE_MESSAGE *object = pytalloc_get_ptr(obj);
2632 : PyObject *py_TargetInfoMaxLen;
2633 0 : py_TargetInfoMaxLen = PyLong_FromLong((uint16_t)(object->TargetInfoMaxLen));
2634 0 : return py_TargetInfoMaxLen;
2635 : }
2636 :
2637 0 : static int py_CHALLENGE_MESSAGE_set_TargetInfoMaxLen(PyObject *py_obj, PyObject *value, void *closure)
2638 : {
2639 0 : struct CHALLENGE_MESSAGE *object = pytalloc_get_ptr(py_obj);
2640 0 : if (value == NULL) {
2641 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->TargetInfoMaxLen");
2642 0 : return -1;
2643 : }
2644 : {
2645 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->TargetInfoMaxLen));
2646 0 : if (PyLong_Check(value)) {
2647 : unsigned long long test_var;
2648 0 : test_var = PyLong_AsUnsignedLongLong(value);
2649 0 : if (PyErr_Occurred() != NULL) {
2650 0 : return -1;
2651 : }
2652 0 : if (test_var > uint_max) {
2653 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2654 : PyLong_Type.tp_name, uint_max, test_var);
2655 0 : return -1;
2656 : }
2657 0 : object->TargetInfoMaxLen = test_var;
2658 : } else {
2659 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2660 : PyLong_Type.tp_name);
2661 0 : return -1;
2662 : }
2663 : }
2664 0 : return 0;
2665 : }
2666 :
2667 0 : static PyObject *py_CHALLENGE_MESSAGE_get_TargetInfo(PyObject *obj, void *closure)
2668 : {
2669 0 : struct CHALLENGE_MESSAGE *object = pytalloc_get_ptr(obj);
2670 : PyObject *py_TargetInfo;
2671 0 : if (object->TargetInfo == NULL) {
2672 0 : Py_RETURN_NONE;
2673 : }
2674 0 : if (object->TargetInfo == NULL) {
2675 0 : py_TargetInfo = Py_None;
2676 0 : Py_INCREF(py_TargetInfo);
2677 : } else {
2678 0 : py_TargetInfo = pytalloc_reference_ex(&AV_PAIR_LIST_Type, object->TargetInfo, object->TargetInfo);
2679 : }
2680 0 : return py_TargetInfo;
2681 : }
2682 :
2683 0 : static int py_CHALLENGE_MESSAGE_set_TargetInfo(PyObject *py_obj, PyObject *value, void *closure)
2684 : {
2685 0 : struct CHALLENGE_MESSAGE *object = pytalloc_get_ptr(py_obj);
2686 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->TargetInfo));
2687 0 : if (value == NULL) {
2688 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->TargetInfo");
2689 0 : return -1;
2690 : }
2691 0 : if (value == Py_None) {
2692 0 : object->TargetInfo = NULL;
2693 : } else {
2694 0 : object->TargetInfo = NULL;
2695 0 : PY_CHECK_TYPE(&AV_PAIR_LIST_Type, value, return -1;);
2696 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
2697 0 : PyErr_NoMemory();
2698 0 : return -1;
2699 : }
2700 0 : object->TargetInfo = (struct AV_PAIR_LIST *)pytalloc_get_ptr(value);
2701 : }
2702 0 : return 0;
2703 : }
2704 :
2705 0 : static PyObject *py_CHALLENGE_MESSAGE_get_Version(PyObject *obj, void *closure)
2706 : {
2707 0 : struct CHALLENGE_MESSAGE *object = pytalloc_get_ptr(obj);
2708 : PyObject *py_Version;
2709 0 : py_Version = pyrpc_import_union(&ntlmssp_Version_Type, pytalloc_get_mem_ctx(obj), object->NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION, &object->Version, "union ntlmssp_Version");
2710 0 : if (py_Version == NULL) {
2711 0 : return NULL;
2712 : }
2713 0 : return py_Version;
2714 : }
2715 :
2716 0 : static int py_CHALLENGE_MESSAGE_set_Version(PyObject *py_obj, PyObject *value, void *closure)
2717 : {
2718 0 : struct CHALLENGE_MESSAGE *object = pytalloc_get_ptr(py_obj);
2719 0 : if (value == NULL) {
2720 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->Version");
2721 0 : return -1;
2722 : }
2723 : {
2724 : union ntlmssp_Version *Version_switch_0;
2725 0 : Version_switch_0 = (union ntlmssp_Version *)pyrpc_export_union(&ntlmssp_Version_Type, pytalloc_get_mem_ctx(py_obj), object->NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION, value, "union ntlmssp_Version");
2726 0 : if (Version_switch_0 == NULL) {
2727 0 : return -1;
2728 : }
2729 0 : object->Version = *Version_switch_0;
2730 : }
2731 0 : return 0;
2732 : }
2733 :
2734 : static PyGetSetDef py_CHALLENGE_MESSAGE_getsetters[] = {
2735 : {
2736 : .name = discard_const_p(char, "Signature"),
2737 : .get = py_CHALLENGE_MESSAGE_get_Signature,
2738 : .set = py_CHALLENGE_MESSAGE_set_Signature,
2739 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
2740 : },
2741 : {
2742 : .name = discard_const_p(char, "MessageType"),
2743 : .get = py_CHALLENGE_MESSAGE_get_MessageType,
2744 : .set = py_CHALLENGE_MESSAGE_set_MessageType,
2745 : .doc = discard_const_p(char, "PIDL-generated element of base type ntlmssp_MessageType")
2746 : },
2747 : {
2748 : .name = discard_const_p(char, "TargetNameLen"),
2749 : .get = py_CHALLENGE_MESSAGE_get_TargetNameLen,
2750 : .set = py_CHALLENGE_MESSAGE_set_TargetNameLen,
2751 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
2752 : },
2753 : {
2754 : .name = discard_const_p(char, "TargetNameMaxLen"),
2755 : .get = py_CHALLENGE_MESSAGE_get_TargetNameMaxLen,
2756 : .set = py_CHALLENGE_MESSAGE_set_TargetNameMaxLen,
2757 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
2758 : },
2759 : {
2760 : .name = discard_const_p(char, "TargetName"),
2761 : .get = py_CHALLENGE_MESSAGE_get_TargetName,
2762 : .set = py_CHALLENGE_MESSAGE_set_TargetName,
2763 : .doc = discard_const_p(char, "PIDL-generated element of base type string")
2764 : },
2765 : {
2766 : .name = discard_const_p(char, "NegotiateFlags"),
2767 : .get = py_CHALLENGE_MESSAGE_get_NegotiateFlags,
2768 : .set = py_CHALLENGE_MESSAGE_set_NegotiateFlags,
2769 : .doc = discard_const_p(char, "PIDL-generated element of base type NEGOTIATE")
2770 : },
2771 : {
2772 : .name = discard_const_p(char, "ServerChallenge"),
2773 : .get = py_CHALLENGE_MESSAGE_get_ServerChallenge,
2774 : .set = py_CHALLENGE_MESSAGE_set_ServerChallenge,
2775 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
2776 : },
2777 : {
2778 : .name = discard_const_p(char, "Reserved"),
2779 : .get = py_CHALLENGE_MESSAGE_get_Reserved,
2780 : .set = py_CHALLENGE_MESSAGE_set_Reserved,
2781 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
2782 : },
2783 : {
2784 : .name = discard_const_p(char, "TargetInfoLen"),
2785 : .get = py_CHALLENGE_MESSAGE_get_TargetInfoLen,
2786 : .set = py_CHALLENGE_MESSAGE_set_TargetInfoLen,
2787 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
2788 : },
2789 : {
2790 : .name = discard_const_p(char, "TargetInfoMaxLen"),
2791 : .get = py_CHALLENGE_MESSAGE_get_TargetInfoMaxLen,
2792 : .set = py_CHALLENGE_MESSAGE_set_TargetInfoMaxLen,
2793 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
2794 : },
2795 : {
2796 : .name = discard_const_p(char, "TargetInfo"),
2797 : .get = py_CHALLENGE_MESSAGE_get_TargetInfo,
2798 : .set = py_CHALLENGE_MESSAGE_set_TargetInfo,
2799 : .doc = discard_const_p(char, "PIDL-generated element of base type AV_PAIR_LIST")
2800 : },
2801 : {
2802 : .name = discard_const_p(char, "Version"),
2803 : .get = py_CHALLENGE_MESSAGE_get_Version,
2804 : .set = py_CHALLENGE_MESSAGE_set_Version,
2805 : .doc = discard_const_p(char, "PIDL-generated element of base type ntlmssp_Version")
2806 : },
2807 : { .name = NULL }
2808 : };
2809 :
2810 0 : static PyObject *py_CHALLENGE_MESSAGE_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2811 : {
2812 0 : return pytalloc_new(struct CHALLENGE_MESSAGE, type);
2813 : }
2814 :
2815 0 : static PyObject *py_CHALLENGE_MESSAGE_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2816 : {
2817 0 : struct CHALLENGE_MESSAGE *object = pytalloc_get_ptr(py_obj);
2818 0 : PyObject *ret = NULL;
2819 : DATA_BLOB blob;
2820 : enum ndr_err_code err;
2821 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
2822 0 : if (tmp_ctx == NULL) {
2823 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
2824 0 : return NULL;
2825 : }
2826 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_CHALLENGE_MESSAGE);
2827 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2828 0 : TALLOC_FREE(tmp_ctx);
2829 0 : PyErr_SetNdrError(err);
2830 0 : return NULL;
2831 : }
2832 :
2833 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
2834 0 : TALLOC_FREE(tmp_ctx);
2835 0 : return ret;
2836 : }
2837 :
2838 0 : static PyObject *py_CHALLENGE_MESSAGE_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
2839 : {
2840 0 : struct CHALLENGE_MESSAGE *object = pytalloc_get_ptr(py_obj);
2841 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
2842 0 : Py_ssize_t blob_length = 0;
2843 : enum ndr_err_code err;
2844 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
2845 0 : PyObject *allow_remaining_obj = NULL;
2846 0 : bool allow_remaining = false;
2847 :
2848 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
2849 : discard_const_p(char *, kwnames),
2850 : &blob.data, &blob_length,
2851 : &allow_remaining_obj)) {
2852 0 : return NULL;
2853 : }
2854 0 : blob.length = blob_length;
2855 :
2856 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
2857 0 : allow_remaining = true;
2858 : }
2859 :
2860 0 : if (allow_remaining) {
2861 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_CHALLENGE_MESSAGE);
2862 : } else {
2863 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_CHALLENGE_MESSAGE);
2864 : }
2865 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2866 0 : PyErr_SetNdrError(err);
2867 0 : return NULL;
2868 : }
2869 :
2870 0 : Py_RETURN_NONE;
2871 : }
2872 :
2873 0 : static PyObject *py_CHALLENGE_MESSAGE_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2874 : {
2875 0 : struct CHALLENGE_MESSAGE *object = pytalloc_get_ptr(py_obj);
2876 : PyObject *ret;
2877 : char *retstr;
2878 :
2879 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_CHALLENGE_MESSAGE, "CHALLENGE_MESSAGE", object);
2880 0 : ret = PyUnicode_FromString(retstr);
2881 0 : talloc_free(retstr);
2882 :
2883 0 : return ret;
2884 : }
2885 :
2886 : static PyMethodDef py_CHALLENGE_MESSAGE_methods[] = {
2887 : { "__ndr_pack__", (PyCFunction)py_CHALLENGE_MESSAGE_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
2888 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_CHALLENGE_MESSAGE_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
2889 : { "__ndr_print__", (PyCFunction)py_CHALLENGE_MESSAGE_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
2890 : { NULL, NULL, 0, NULL }
2891 : };
2892 :
2893 :
2894 : static PyTypeObject CHALLENGE_MESSAGE_Type = {
2895 : PyVarObject_HEAD_INIT(NULL, 0)
2896 : .tp_name = "ntlmssp.CHALLENGE_MESSAGE",
2897 : .tp_getset = py_CHALLENGE_MESSAGE_getsetters,
2898 : .tp_methods = py_CHALLENGE_MESSAGE_methods,
2899 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
2900 : .tp_new = py_CHALLENGE_MESSAGE_new,
2901 : };
2902 :
2903 :
2904 0 : static PyObject *py_LM_RESPONSE_get_Response(PyObject *obj, void *closure)
2905 : {
2906 0 : struct LM_RESPONSE *object = pytalloc_get_ptr(obj);
2907 : PyObject *py_Response;
2908 0 : py_Response = PyList_New(24);
2909 0 : if (py_Response == NULL) {
2910 0 : return NULL;
2911 : }
2912 : {
2913 : int Response_cntr_0;
2914 0 : for (Response_cntr_0 = 0; Response_cntr_0 < (24); Response_cntr_0++) {
2915 : PyObject *py_Response_0;
2916 0 : py_Response_0 = PyLong_FromLong((uint16_t)((object->Response)[Response_cntr_0]));
2917 0 : PyList_SetItem(py_Response, Response_cntr_0, py_Response_0);
2918 : }
2919 : }
2920 0 : return py_Response;
2921 : }
2922 :
2923 0 : static int py_LM_RESPONSE_set_Response(PyObject *py_obj, PyObject *value, void *closure)
2924 : {
2925 0 : struct LM_RESPONSE *object = pytalloc_get_ptr(py_obj);
2926 0 : if (value == NULL) {
2927 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->Response");
2928 0 : return -1;
2929 : }
2930 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
2931 : {
2932 : int Response_cntr_0;
2933 0 : if (ARRAY_SIZE(object->Response) != PyList_GET_SIZE(value)) {
2934 0 : PyErr_Format(PyExc_TypeError, "Expected list of type %s, length %zu, got %zd", Py_TYPE(value)->tp_name, ARRAY_SIZE(object->Response), PyList_GET_SIZE(value));
2935 0 : return -1;
2936 : }
2937 0 : for (Response_cntr_0 = 0; Response_cntr_0 < PyList_GET_SIZE(value); Response_cntr_0++) {
2938 0 : if (PyList_GET_ITEM(value, Response_cntr_0) == NULL) {
2939 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->Response)[Response_cntr_0]");
2940 0 : return -1;
2941 : }
2942 : {
2943 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((object->Response)[Response_cntr_0]));
2944 0 : if (PyLong_Check(PyList_GET_ITEM(value, Response_cntr_0))) {
2945 : unsigned long long test_var;
2946 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, Response_cntr_0));
2947 0 : if (PyErr_Occurred() != NULL) {
2948 0 : return -1;
2949 : }
2950 0 : if (test_var > uint_max) {
2951 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2952 : PyLong_Type.tp_name, uint_max, test_var);
2953 0 : return -1;
2954 : }
2955 0 : (object->Response)[Response_cntr_0] = test_var;
2956 : } else {
2957 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2958 : PyLong_Type.tp_name);
2959 0 : return -1;
2960 : }
2961 : }
2962 : }
2963 : }
2964 0 : return 0;
2965 : }
2966 :
2967 : static PyGetSetDef py_LM_RESPONSE_getsetters[] = {
2968 : {
2969 : .name = discard_const_p(char, "Response"),
2970 : .get = py_LM_RESPONSE_get_Response,
2971 : .set = py_LM_RESPONSE_set_Response,
2972 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
2973 : },
2974 : { .name = NULL }
2975 : };
2976 :
2977 0 : static PyObject *py_LM_RESPONSE_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2978 : {
2979 0 : return pytalloc_new(struct LM_RESPONSE, type);
2980 : }
2981 :
2982 0 : static PyObject *py_LM_RESPONSE_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2983 : {
2984 0 : struct LM_RESPONSE *object = pytalloc_get_ptr(py_obj);
2985 0 : PyObject *ret = NULL;
2986 : DATA_BLOB blob;
2987 : enum ndr_err_code err;
2988 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
2989 0 : if (tmp_ctx == NULL) {
2990 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
2991 0 : return NULL;
2992 : }
2993 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_LM_RESPONSE);
2994 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2995 0 : TALLOC_FREE(tmp_ctx);
2996 0 : PyErr_SetNdrError(err);
2997 0 : return NULL;
2998 : }
2999 :
3000 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
3001 0 : TALLOC_FREE(tmp_ctx);
3002 0 : return ret;
3003 : }
3004 :
3005 0 : static PyObject *py_LM_RESPONSE_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
3006 : {
3007 0 : struct LM_RESPONSE *object = pytalloc_get_ptr(py_obj);
3008 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
3009 0 : Py_ssize_t blob_length = 0;
3010 : enum ndr_err_code err;
3011 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
3012 0 : PyObject *allow_remaining_obj = NULL;
3013 0 : bool allow_remaining = false;
3014 :
3015 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
3016 : discard_const_p(char *, kwnames),
3017 : &blob.data, &blob_length,
3018 : &allow_remaining_obj)) {
3019 0 : return NULL;
3020 : }
3021 0 : blob.length = blob_length;
3022 :
3023 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
3024 0 : allow_remaining = true;
3025 : }
3026 :
3027 0 : if (allow_remaining) {
3028 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_LM_RESPONSE);
3029 : } else {
3030 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_LM_RESPONSE);
3031 : }
3032 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
3033 0 : PyErr_SetNdrError(err);
3034 0 : return NULL;
3035 : }
3036 :
3037 0 : Py_RETURN_NONE;
3038 : }
3039 :
3040 0 : static PyObject *py_LM_RESPONSE_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
3041 : {
3042 0 : struct LM_RESPONSE *object = pytalloc_get_ptr(py_obj);
3043 : PyObject *ret;
3044 : char *retstr;
3045 :
3046 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_LM_RESPONSE, "LM_RESPONSE", object);
3047 0 : ret = PyUnicode_FromString(retstr);
3048 0 : talloc_free(retstr);
3049 :
3050 0 : return ret;
3051 : }
3052 :
3053 : static PyMethodDef py_LM_RESPONSE_methods[] = {
3054 : { "__ndr_pack__", (PyCFunction)py_LM_RESPONSE_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
3055 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_LM_RESPONSE_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
3056 : { "__ndr_print__", (PyCFunction)py_LM_RESPONSE_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
3057 : { NULL, NULL, 0, NULL }
3058 : };
3059 :
3060 :
3061 : static PyTypeObject LM_RESPONSE_Type = {
3062 : PyVarObject_HEAD_INIT(NULL, 0)
3063 : .tp_name = "ntlmssp.LM_RESPONSE",
3064 : .tp_getset = py_LM_RESPONSE_getsetters,
3065 : .tp_methods = py_LM_RESPONSE_methods,
3066 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
3067 : .tp_new = py_LM_RESPONSE_new,
3068 : };
3069 :
3070 :
3071 0 : static PyObject *py_LMv2_RESPONSE_get_Response(PyObject *obj, void *closure)
3072 : {
3073 0 : struct LMv2_RESPONSE *object = pytalloc_get_ptr(obj);
3074 : PyObject *py_Response;
3075 0 : py_Response = PyList_New(16);
3076 0 : if (py_Response == NULL) {
3077 0 : return NULL;
3078 : }
3079 : {
3080 : int Response_cntr_0;
3081 0 : for (Response_cntr_0 = 0; Response_cntr_0 < (16); Response_cntr_0++) {
3082 : PyObject *py_Response_0;
3083 0 : py_Response_0 = PyLong_FromLong((uint16_t)((object->Response)[Response_cntr_0]));
3084 0 : PyList_SetItem(py_Response, Response_cntr_0, py_Response_0);
3085 : }
3086 : }
3087 0 : return py_Response;
3088 : }
3089 :
3090 0 : static int py_LMv2_RESPONSE_set_Response(PyObject *py_obj, PyObject *value, void *closure)
3091 : {
3092 0 : struct LMv2_RESPONSE *object = pytalloc_get_ptr(py_obj);
3093 0 : if (value == NULL) {
3094 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->Response");
3095 0 : return -1;
3096 : }
3097 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
3098 : {
3099 : int Response_cntr_0;
3100 0 : if (ARRAY_SIZE(object->Response) != PyList_GET_SIZE(value)) {
3101 0 : PyErr_Format(PyExc_TypeError, "Expected list of type %s, length %zu, got %zd", Py_TYPE(value)->tp_name, ARRAY_SIZE(object->Response), PyList_GET_SIZE(value));
3102 0 : return -1;
3103 : }
3104 0 : for (Response_cntr_0 = 0; Response_cntr_0 < PyList_GET_SIZE(value); Response_cntr_0++) {
3105 0 : if (PyList_GET_ITEM(value, Response_cntr_0) == NULL) {
3106 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->Response)[Response_cntr_0]");
3107 0 : return -1;
3108 : }
3109 : {
3110 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((object->Response)[Response_cntr_0]));
3111 0 : if (PyLong_Check(PyList_GET_ITEM(value, Response_cntr_0))) {
3112 : unsigned long long test_var;
3113 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, Response_cntr_0));
3114 0 : if (PyErr_Occurred() != NULL) {
3115 0 : return -1;
3116 : }
3117 0 : if (test_var > uint_max) {
3118 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3119 : PyLong_Type.tp_name, uint_max, test_var);
3120 0 : return -1;
3121 : }
3122 0 : (object->Response)[Response_cntr_0] = test_var;
3123 : } else {
3124 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3125 : PyLong_Type.tp_name);
3126 0 : return -1;
3127 : }
3128 : }
3129 : }
3130 : }
3131 0 : return 0;
3132 : }
3133 :
3134 0 : static PyObject *py_LMv2_RESPONSE_get_ChallengeFromClient(PyObject *obj, void *closure)
3135 : {
3136 0 : struct LMv2_RESPONSE *object = pytalloc_get_ptr(obj);
3137 : PyObject *py_ChallengeFromClient;
3138 0 : py_ChallengeFromClient = PyList_New(8);
3139 0 : if (py_ChallengeFromClient == NULL) {
3140 0 : return NULL;
3141 : }
3142 : {
3143 : int ChallengeFromClient_cntr_0;
3144 0 : for (ChallengeFromClient_cntr_0 = 0; ChallengeFromClient_cntr_0 < (8); ChallengeFromClient_cntr_0++) {
3145 : PyObject *py_ChallengeFromClient_0;
3146 0 : py_ChallengeFromClient_0 = PyLong_FromLong((uint16_t)((object->ChallengeFromClient)[ChallengeFromClient_cntr_0]));
3147 0 : PyList_SetItem(py_ChallengeFromClient, ChallengeFromClient_cntr_0, py_ChallengeFromClient_0);
3148 : }
3149 : }
3150 0 : return py_ChallengeFromClient;
3151 : }
3152 :
3153 0 : static int py_LMv2_RESPONSE_set_ChallengeFromClient(PyObject *py_obj, PyObject *value, void *closure)
3154 : {
3155 0 : struct LMv2_RESPONSE *object = pytalloc_get_ptr(py_obj);
3156 0 : if (value == NULL) {
3157 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->ChallengeFromClient");
3158 0 : return -1;
3159 : }
3160 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
3161 : {
3162 : int ChallengeFromClient_cntr_0;
3163 0 : if (ARRAY_SIZE(object->ChallengeFromClient) != PyList_GET_SIZE(value)) {
3164 0 : PyErr_Format(PyExc_TypeError, "Expected list of type %s, length %zu, got %zd", Py_TYPE(value)->tp_name, ARRAY_SIZE(object->ChallengeFromClient), PyList_GET_SIZE(value));
3165 0 : return -1;
3166 : }
3167 0 : for (ChallengeFromClient_cntr_0 = 0; ChallengeFromClient_cntr_0 < PyList_GET_SIZE(value); ChallengeFromClient_cntr_0++) {
3168 0 : if (PyList_GET_ITEM(value, ChallengeFromClient_cntr_0) == NULL) {
3169 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->ChallengeFromClient)[ChallengeFromClient_cntr_0]");
3170 0 : return -1;
3171 : }
3172 : {
3173 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((object->ChallengeFromClient)[ChallengeFromClient_cntr_0]));
3174 0 : if (PyLong_Check(PyList_GET_ITEM(value, ChallengeFromClient_cntr_0))) {
3175 : unsigned long long test_var;
3176 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, ChallengeFromClient_cntr_0));
3177 0 : if (PyErr_Occurred() != NULL) {
3178 0 : return -1;
3179 : }
3180 0 : if (test_var > uint_max) {
3181 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3182 : PyLong_Type.tp_name, uint_max, test_var);
3183 0 : return -1;
3184 : }
3185 0 : (object->ChallengeFromClient)[ChallengeFromClient_cntr_0] = test_var;
3186 : } else {
3187 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3188 : PyLong_Type.tp_name);
3189 0 : return -1;
3190 : }
3191 : }
3192 : }
3193 : }
3194 0 : return 0;
3195 : }
3196 :
3197 : static PyGetSetDef py_LMv2_RESPONSE_getsetters[] = {
3198 : {
3199 : .name = discard_const_p(char, "Response"),
3200 : .get = py_LMv2_RESPONSE_get_Response,
3201 : .set = py_LMv2_RESPONSE_set_Response,
3202 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
3203 : },
3204 : {
3205 : .name = discard_const_p(char, "ChallengeFromClient"),
3206 : .get = py_LMv2_RESPONSE_get_ChallengeFromClient,
3207 : .set = py_LMv2_RESPONSE_set_ChallengeFromClient,
3208 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
3209 : },
3210 : { .name = NULL }
3211 : };
3212 :
3213 0 : static PyObject *py_LMv2_RESPONSE_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
3214 : {
3215 0 : return pytalloc_new(struct LMv2_RESPONSE, type);
3216 : }
3217 :
3218 0 : static PyObject *py_LMv2_RESPONSE_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
3219 : {
3220 0 : struct LMv2_RESPONSE *object = pytalloc_get_ptr(py_obj);
3221 0 : PyObject *ret = NULL;
3222 : DATA_BLOB blob;
3223 : enum ndr_err_code err;
3224 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
3225 0 : if (tmp_ctx == NULL) {
3226 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
3227 0 : return NULL;
3228 : }
3229 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_LMv2_RESPONSE);
3230 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
3231 0 : TALLOC_FREE(tmp_ctx);
3232 0 : PyErr_SetNdrError(err);
3233 0 : return NULL;
3234 : }
3235 :
3236 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
3237 0 : TALLOC_FREE(tmp_ctx);
3238 0 : return ret;
3239 : }
3240 :
3241 0 : static PyObject *py_LMv2_RESPONSE_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
3242 : {
3243 0 : struct LMv2_RESPONSE *object = pytalloc_get_ptr(py_obj);
3244 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
3245 0 : Py_ssize_t blob_length = 0;
3246 : enum ndr_err_code err;
3247 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
3248 0 : PyObject *allow_remaining_obj = NULL;
3249 0 : bool allow_remaining = false;
3250 :
3251 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
3252 : discard_const_p(char *, kwnames),
3253 : &blob.data, &blob_length,
3254 : &allow_remaining_obj)) {
3255 0 : return NULL;
3256 : }
3257 0 : blob.length = blob_length;
3258 :
3259 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
3260 0 : allow_remaining = true;
3261 : }
3262 :
3263 0 : if (allow_remaining) {
3264 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_LMv2_RESPONSE);
3265 : } else {
3266 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_LMv2_RESPONSE);
3267 : }
3268 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
3269 0 : PyErr_SetNdrError(err);
3270 0 : return NULL;
3271 : }
3272 :
3273 0 : Py_RETURN_NONE;
3274 : }
3275 :
3276 0 : static PyObject *py_LMv2_RESPONSE_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
3277 : {
3278 0 : struct LMv2_RESPONSE *object = pytalloc_get_ptr(py_obj);
3279 : PyObject *ret;
3280 : char *retstr;
3281 :
3282 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_LMv2_RESPONSE, "LMv2_RESPONSE", object);
3283 0 : ret = PyUnicode_FromString(retstr);
3284 0 : talloc_free(retstr);
3285 :
3286 0 : return ret;
3287 : }
3288 :
3289 : static PyMethodDef py_LMv2_RESPONSE_methods[] = {
3290 : { "__ndr_pack__", (PyCFunction)py_LMv2_RESPONSE_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
3291 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_LMv2_RESPONSE_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
3292 : { "__ndr_print__", (PyCFunction)py_LMv2_RESPONSE_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
3293 : { NULL, NULL, 0, NULL }
3294 : };
3295 :
3296 :
3297 : static PyTypeObject LMv2_RESPONSE_Type = {
3298 : PyVarObject_HEAD_INIT(NULL, 0)
3299 : .tp_name = "ntlmssp.LMv2_RESPONSE",
3300 : .tp_getset = py_LMv2_RESPONSE_getsetters,
3301 : .tp_methods = py_LMv2_RESPONSE_methods,
3302 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
3303 : .tp_new = py_LMv2_RESPONSE_new,
3304 : };
3305 :
3306 0 : static PyObject *py_import_ntlmssp_LM_RESPONSE_with_len(TALLOC_CTX *mem_ctx, int level, union ntlmssp_LM_RESPONSE_with_len *in)
3307 : {
3308 : PyObject *ret;
3309 :
3310 0 : switch (level) {
3311 0 : case 24:
3312 0 : ret = pytalloc_reference_ex(&LM_RESPONSE_Type, mem_ctx, &in->v1);
3313 0 : return ret;
3314 :
3315 0 : default:
3316 0 : ret = Py_None;
3317 0 : Py_INCREF(ret);
3318 0 : return ret;
3319 :
3320 : }
3321 : PyErr_SetString(PyExc_TypeError, "unknown union level");
3322 : return NULL;
3323 : }
3324 :
3325 0 : static union ntlmssp_LM_RESPONSE_with_len *py_export_ntlmssp_LM_RESPONSE_with_len(TALLOC_CTX *mem_ctx, int level, PyObject *in)
3326 : {
3327 0 : union ntlmssp_LM_RESPONSE_with_len *ret = talloc_zero(mem_ctx, union ntlmssp_LM_RESPONSE_with_len);
3328 0 : switch (level) {
3329 0 : case 24:
3330 0 : if (in == NULL) {
3331 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->v1");
3332 0 : talloc_free(ret); return NULL;
3333 : }
3334 0 : PY_CHECK_TYPE(&LM_RESPONSE_Type, in, talloc_free(ret); return NULL;);
3335 0 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
3336 0 : PyErr_NoMemory();
3337 0 : talloc_free(ret); return NULL;
3338 : }
3339 0 : ret->v1 = *(struct LM_RESPONSE *)pytalloc_get_ptr(in);
3340 0 : break;
3341 :
3342 0 : default:
3343 0 : break;
3344 :
3345 : }
3346 :
3347 0 : return ret;
3348 : }
3349 :
3350 0 : static PyObject *py_ntlmssp_LM_RESPONSE_with_len_import(PyTypeObject *type, PyObject *args, PyObject *kwargs)
3351 : {
3352 0 : const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
3353 0 : PyObject *mem_ctx_obj = NULL;
3354 0 : TALLOC_CTX *mem_ctx = NULL;
3355 0 : int level = 0;
3356 0 : PyObject *in_obj = NULL;
3357 0 : union ntlmssp_LM_RESPONSE_with_len *in = NULL;
3358 :
3359 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:import",
3360 : discard_const_p(char *, kwnames),
3361 : &mem_ctx_obj,
3362 : &level,
3363 : &in_obj)) {
3364 0 : return NULL;
3365 : }
3366 0 : mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
3367 0 : if (mem_ctx == NULL) {
3368 0 : PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
3369 0 : return NULL;
3370 : }
3371 0 : in = (union ntlmssp_LM_RESPONSE_with_len *)pytalloc_get_ptr(in_obj);
3372 0 : if (in == NULL) {
3373 0 : PyErr_Format(PyExc_TypeError, "in needs to be a pointer to union ntlmssp_LM_RESPONSE_with_len!");
3374 0 : return NULL;
3375 : }
3376 :
3377 0 : return py_import_ntlmssp_LM_RESPONSE_with_len(mem_ctx, level, in);
3378 : }
3379 :
3380 0 : static PyObject *py_ntlmssp_LM_RESPONSE_with_len_export(PyTypeObject *type, PyObject *args, PyObject *kwargs)
3381 : {
3382 0 : const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
3383 0 : PyObject *mem_ctx_obj = NULL;
3384 0 : TALLOC_CTX *mem_ctx = NULL;
3385 0 : int level = 0;
3386 0 : PyObject *in = NULL;
3387 0 : union ntlmssp_LM_RESPONSE_with_len *out = NULL;
3388 :
3389 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:export",
3390 : discard_const_p(char *, kwnames),
3391 : &mem_ctx_obj,
3392 : &level,
3393 : &in)) {
3394 0 : return NULL;
3395 : }
3396 0 : mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
3397 0 : if (mem_ctx == NULL) {
3398 0 : PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
3399 0 : return NULL;
3400 : }
3401 :
3402 0 : out = py_export_ntlmssp_LM_RESPONSE_with_len(mem_ctx, level, in);
3403 0 : if (out == NULL) {
3404 0 : return NULL;
3405 : }
3406 :
3407 0 : return pytalloc_GenericObject_reference(out);
3408 : }
3409 :
3410 : static PyMethodDef py_ntlmssp_LM_RESPONSE_with_len_methods[] = {
3411 : { "__import__", PY_DISCARD_FUNC_SIG(PyCFunction,py_ntlmssp_LM_RESPONSE_with_len_import),
3412 : METH_VARARGS|METH_KEYWORDS|METH_CLASS,
3413 : "T.__import__(mem_ctx, level, in) => ret." },
3414 : { "__export__", PY_DISCARD_FUNC_SIG(PyCFunction,py_ntlmssp_LM_RESPONSE_with_len_export),
3415 : METH_VARARGS|METH_KEYWORDS|METH_CLASS,
3416 : "T.__export__(mem_ctx, level, in) => ret." },
3417 : { NULL, NULL, 0, NULL }
3418 : };
3419 :
3420 0 : static PyObject *py_ntlmssp_LM_RESPONSE_with_len_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
3421 : {
3422 0 : PyErr_Format(PyExc_TypeError, "New %s Objects are not supported", type->tp_name);
3423 0 : return NULL;
3424 : }
3425 :
3426 :
3427 : static PyTypeObject ntlmssp_LM_RESPONSE_with_len_Type = {
3428 : PyVarObject_HEAD_INIT(NULL, 0)
3429 : .tp_name = "ntlmssp.LM_RESPONSE_with_len",
3430 : .tp_getset = NULL,
3431 : .tp_methods = py_ntlmssp_LM_RESPONSE_with_len_methods,
3432 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
3433 : .tp_new = py_ntlmssp_LM_RESPONSE_with_len_new,
3434 : };
3435 :
3436 :
3437 0 : static PyObject *py_NTLM_RESPONSE_get_Response(PyObject *obj, void *closure)
3438 : {
3439 0 : struct NTLM_RESPONSE *object = pytalloc_get_ptr(obj);
3440 : PyObject *py_Response;
3441 0 : py_Response = PyList_New(24);
3442 0 : if (py_Response == NULL) {
3443 0 : return NULL;
3444 : }
3445 : {
3446 : int Response_cntr_0;
3447 0 : for (Response_cntr_0 = 0; Response_cntr_0 < (24); Response_cntr_0++) {
3448 : PyObject *py_Response_0;
3449 0 : py_Response_0 = PyLong_FromLong((uint16_t)((object->Response)[Response_cntr_0]));
3450 0 : PyList_SetItem(py_Response, Response_cntr_0, py_Response_0);
3451 : }
3452 : }
3453 0 : return py_Response;
3454 : }
3455 :
3456 0 : static int py_NTLM_RESPONSE_set_Response(PyObject *py_obj, PyObject *value, void *closure)
3457 : {
3458 0 : struct NTLM_RESPONSE *object = pytalloc_get_ptr(py_obj);
3459 0 : if (value == NULL) {
3460 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->Response");
3461 0 : return -1;
3462 : }
3463 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
3464 : {
3465 : int Response_cntr_0;
3466 0 : if (ARRAY_SIZE(object->Response) != PyList_GET_SIZE(value)) {
3467 0 : PyErr_Format(PyExc_TypeError, "Expected list of type %s, length %zu, got %zd", Py_TYPE(value)->tp_name, ARRAY_SIZE(object->Response), PyList_GET_SIZE(value));
3468 0 : return -1;
3469 : }
3470 0 : for (Response_cntr_0 = 0; Response_cntr_0 < PyList_GET_SIZE(value); Response_cntr_0++) {
3471 0 : if (PyList_GET_ITEM(value, Response_cntr_0) == NULL) {
3472 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->Response)[Response_cntr_0]");
3473 0 : return -1;
3474 : }
3475 : {
3476 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((object->Response)[Response_cntr_0]));
3477 0 : if (PyLong_Check(PyList_GET_ITEM(value, Response_cntr_0))) {
3478 : unsigned long long test_var;
3479 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, Response_cntr_0));
3480 0 : if (PyErr_Occurred() != NULL) {
3481 0 : return -1;
3482 : }
3483 0 : if (test_var > uint_max) {
3484 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3485 : PyLong_Type.tp_name, uint_max, test_var);
3486 0 : return -1;
3487 : }
3488 0 : (object->Response)[Response_cntr_0] = test_var;
3489 : } else {
3490 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3491 : PyLong_Type.tp_name);
3492 0 : return -1;
3493 : }
3494 : }
3495 : }
3496 : }
3497 0 : return 0;
3498 : }
3499 :
3500 : static PyGetSetDef py_NTLM_RESPONSE_getsetters[] = {
3501 : {
3502 : .name = discard_const_p(char, "Response"),
3503 : .get = py_NTLM_RESPONSE_get_Response,
3504 : .set = py_NTLM_RESPONSE_set_Response,
3505 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
3506 : },
3507 : { .name = NULL }
3508 : };
3509 :
3510 0 : static PyObject *py_NTLM_RESPONSE_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
3511 : {
3512 0 : return pytalloc_new(struct NTLM_RESPONSE, type);
3513 : }
3514 :
3515 0 : static PyObject *py_NTLM_RESPONSE_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
3516 : {
3517 0 : struct NTLM_RESPONSE *object = pytalloc_get_ptr(py_obj);
3518 0 : PyObject *ret = NULL;
3519 : DATA_BLOB blob;
3520 : enum ndr_err_code err;
3521 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
3522 0 : if (tmp_ctx == NULL) {
3523 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
3524 0 : return NULL;
3525 : }
3526 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_NTLM_RESPONSE);
3527 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
3528 0 : TALLOC_FREE(tmp_ctx);
3529 0 : PyErr_SetNdrError(err);
3530 0 : return NULL;
3531 : }
3532 :
3533 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
3534 0 : TALLOC_FREE(tmp_ctx);
3535 0 : return ret;
3536 : }
3537 :
3538 0 : static PyObject *py_NTLM_RESPONSE_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
3539 : {
3540 0 : struct NTLM_RESPONSE *object = pytalloc_get_ptr(py_obj);
3541 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
3542 0 : Py_ssize_t blob_length = 0;
3543 : enum ndr_err_code err;
3544 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
3545 0 : PyObject *allow_remaining_obj = NULL;
3546 0 : bool allow_remaining = false;
3547 :
3548 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
3549 : discard_const_p(char *, kwnames),
3550 : &blob.data, &blob_length,
3551 : &allow_remaining_obj)) {
3552 0 : return NULL;
3553 : }
3554 0 : blob.length = blob_length;
3555 :
3556 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
3557 0 : allow_remaining = true;
3558 : }
3559 :
3560 0 : if (allow_remaining) {
3561 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_NTLM_RESPONSE);
3562 : } else {
3563 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_NTLM_RESPONSE);
3564 : }
3565 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
3566 0 : PyErr_SetNdrError(err);
3567 0 : return NULL;
3568 : }
3569 :
3570 0 : Py_RETURN_NONE;
3571 : }
3572 :
3573 0 : static PyObject *py_NTLM_RESPONSE_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
3574 : {
3575 0 : struct NTLM_RESPONSE *object = pytalloc_get_ptr(py_obj);
3576 : PyObject *ret;
3577 : char *retstr;
3578 :
3579 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_NTLM_RESPONSE, "NTLM_RESPONSE", object);
3580 0 : ret = PyUnicode_FromString(retstr);
3581 0 : talloc_free(retstr);
3582 :
3583 0 : return ret;
3584 : }
3585 :
3586 : static PyMethodDef py_NTLM_RESPONSE_methods[] = {
3587 : { "__ndr_pack__", (PyCFunction)py_NTLM_RESPONSE_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
3588 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_NTLM_RESPONSE_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
3589 : { "__ndr_print__", (PyCFunction)py_NTLM_RESPONSE_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
3590 : { NULL, NULL, 0, NULL }
3591 : };
3592 :
3593 :
3594 : static PyTypeObject NTLM_RESPONSE_Type = {
3595 : PyVarObject_HEAD_INIT(NULL, 0)
3596 : .tp_name = "ntlmssp.NTLM_RESPONSE",
3597 : .tp_getset = py_NTLM_RESPONSE_getsetters,
3598 : .tp_methods = py_NTLM_RESPONSE_methods,
3599 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
3600 : .tp_new = py_NTLM_RESPONSE_new,
3601 : };
3602 :
3603 :
3604 0 : static PyObject *py_NTLMv2_CLIENT_CHALLENGE_get_RespType(PyObject *obj, void *closure)
3605 : {
3606 0 : struct NTLMv2_CLIENT_CHALLENGE *object = pytalloc_get_ptr(obj);
3607 : PyObject *py_RespType;
3608 0 : py_RespType = PyLong_FromLong((uint16_t)(object->RespType));
3609 0 : return py_RespType;
3610 : }
3611 :
3612 0 : static int py_NTLMv2_CLIENT_CHALLENGE_set_RespType(PyObject *py_obj, PyObject *value, void *closure)
3613 : {
3614 0 : struct NTLMv2_CLIENT_CHALLENGE *object = pytalloc_get_ptr(py_obj);
3615 0 : if (value == NULL) {
3616 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->RespType");
3617 0 : return -1;
3618 : }
3619 : {
3620 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->RespType));
3621 0 : if (PyLong_Check(value)) {
3622 : unsigned long long test_var;
3623 0 : test_var = PyLong_AsUnsignedLongLong(value);
3624 0 : if (PyErr_Occurred() != NULL) {
3625 0 : return -1;
3626 : }
3627 0 : if (test_var > uint_max) {
3628 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3629 : PyLong_Type.tp_name, uint_max, test_var);
3630 0 : return -1;
3631 : }
3632 0 : object->RespType = test_var;
3633 : } else {
3634 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3635 : PyLong_Type.tp_name);
3636 0 : return -1;
3637 : }
3638 : }
3639 0 : return 0;
3640 : }
3641 :
3642 0 : static PyObject *py_NTLMv2_CLIENT_CHALLENGE_get_HiRespType(PyObject *obj, void *closure)
3643 : {
3644 0 : struct NTLMv2_CLIENT_CHALLENGE *object = pytalloc_get_ptr(obj);
3645 : PyObject *py_HiRespType;
3646 0 : py_HiRespType = PyLong_FromLong((uint16_t)(object->HiRespType));
3647 0 : return py_HiRespType;
3648 : }
3649 :
3650 0 : static int py_NTLMv2_CLIENT_CHALLENGE_set_HiRespType(PyObject *py_obj, PyObject *value, void *closure)
3651 : {
3652 0 : struct NTLMv2_CLIENT_CHALLENGE *object = pytalloc_get_ptr(py_obj);
3653 0 : if (value == NULL) {
3654 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->HiRespType");
3655 0 : return -1;
3656 : }
3657 : {
3658 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->HiRespType));
3659 0 : if (PyLong_Check(value)) {
3660 : unsigned long long test_var;
3661 0 : test_var = PyLong_AsUnsignedLongLong(value);
3662 0 : if (PyErr_Occurred() != NULL) {
3663 0 : return -1;
3664 : }
3665 0 : if (test_var > uint_max) {
3666 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3667 : PyLong_Type.tp_name, uint_max, test_var);
3668 0 : return -1;
3669 : }
3670 0 : object->HiRespType = test_var;
3671 : } else {
3672 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3673 : PyLong_Type.tp_name);
3674 0 : return -1;
3675 : }
3676 : }
3677 0 : return 0;
3678 : }
3679 :
3680 0 : static PyObject *py_NTLMv2_CLIENT_CHALLENGE_get_Reserved1(PyObject *obj, void *closure)
3681 : {
3682 0 : struct NTLMv2_CLIENT_CHALLENGE *object = pytalloc_get_ptr(obj);
3683 : PyObject *py_Reserved1;
3684 0 : py_Reserved1 = PyLong_FromLong((uint16_t)(object->Reserved1));
3685 0 : return py_Reserved1;
3686 : }
3687 :
3688 0 : static int py_NTLMv2_CLIENT_CHALLENGE_set_Reserved1(PyObject *py_obj, PyObject *value, void *closure)
3689 : {
3690 0 : struct NTLMv2_CLIENT_CHALLENGE *object = pytalloc_get_ptr(py_obj);
3691 0 : if (value == NULL) {
3692 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->Reserved1");
3693 0 : return -1;
3694 : }
3695 : {
3696 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->Reserved1));
3697 0 : if (PyLong_Check(value)) {
3698 : unsigned long long test_var;
3699 0 : test_var = PyLong_AsUnsignedLongLong(value);
3700 0 : if (PyErr_Occurred() != NULL) {
3701 0 : return -1;
3702 : }
3703 0 : if (test_var > uint_max) {
3704 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3705 : PyLong_Type.tp_name, uint_max, test_var);
3706 0 : return -1;
3707 : }
3708 0 : object->Reserved1 = test_var;
3709 : } else {
3710 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3711 : PyLong_Type.tp_name);
3712 0 : return -1;
3713 : }
3714 : }
3715 0 : return 0;
3716 : }
3717 :
3718 0 : static PyObject *py_NTLMv2_CLIENT_CHALLENGE_get_Reserved2(PyObject *obj, void *closure)
3719 : {
3720 0 : struct NTLMv2_CLIENT_CHALLENGE *object = pytalloc_get_ptr(obj);
3721 : PyObject *py_Reserved2;
3722 0 : py_Reserved2 = PyLong_FromUnsignedLongLong((uint32_t)(object->Reserved2));
3723 0 : return py_Reserved2;
3724 : }
3725 :
3726 0 : static int py_NTLMv2_CLIENT_CHALLENGE_set_Reserved2(PyObject *py_obj, PyObject *value, void *closure)
3727 : {
3728 0 : struct NTLMv2_CLIENT_CHALLENGE *object = pytalloc_get_ptr(py_obj);
3729 0 : if (value == NULL) {
3730 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->Reserved2");
3731 0 : return -1;
3732 : }
3733 : {
3734 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->Reserved2));
3735 0 : if (PyLong_Check(value)) {
3736 : unsigned long long test_var;
3737 0 : test_var = PyLong_AsUnsignedLongLong(value);
3738 0 : if (PyErr_Occurred() != NULL) {
3739 0 : return -1;
3740 : }
3741 0 : if (test_var > uint_max) {
3742 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3743 : PyLong_Type.tp_name, uint_max, test_var);
3744 0 : return -1;
3745 : }
3746 0 : object->Reserved2 = test_var;
3747 : } else {
3748 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3749 : PyLong_Type.tp_name);
3750 0 : return -1;
3751 : }
3752 : }
3753 0 : return 0;
3754 : }
3755 :
3756 0 : static PyObject *py_NTLMv2_CLIENT_CHALLENGE_get_TimeStamp(PyObject *obj, void *closure)
3757 : {
3758 0 : struct NTLMv2_CLIENT_CHALLENGE *object = pytalloc_get_ptr(obj);
3759 : PyObject *py_TimeStamp;
3760 0 : py_TimeStamp = PyLong_FromUnsignedLongLong(object->TimeStamp);
3761 0 : return py_TimeStamp;
3762 : }
3763 :
3764 0 : static int py_NTLMv2_CLIENT_CHALLENGE_set_TimeStamp(PyObject *py_obj, PyObject *value, void *closure)
3765 : {
3766 0 : struct NTLMv2_CLIENT_CHALLENGE *object = pytalloc_get_ptr(py_obj);
3767 0 : if (value == NULL) {
3768 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->TimeStamp");
3769 0 : return -1;
3770 : }
3771 : {
3772 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->TimeStamp));
3773 0 : if (PyLong_Check(value)) {
3774 : unsigned long long test_var;
3775 0 : test_var = PyLong_AsUnsignedLongLong(value);
3776 0 : if (PyErr_Occurred() != NULL) {
3777 0 : return -1;
3778 : }
3779 0 : if (test_var > uint_max) {
3780 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3781 : PyLong_Type.tp_name, uint_max, test_var);
3782 0 : return -1;
3783 : }
3784 0 : object->TimeStamp = test_var;
3785 : } else {
3786 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3787 : PyLong_Type.tp_name);
3788 0 : return -1;
3789 : }
3790 : }
3791 0 : return 0;
3792 : }
3793 :
3794 0 : static PyObject *py_NTLMv2_CLIENT_CHALLENGE_get_ChallengeFromClient(PyObject *obj, void *closure)
3795 : {
3796 0 : struct NTLMv2_CLIENT_CHALLENGE *object = pytalloc_get_ptr(obj);
3797 : PyObject *py_ChallengeFromClient;
3798 0 : py_ChallengeFromClient = PyList_New(8);
3799 0 : if (py_ChallengeFromClient == NULL) {
3800 0 : return NULL;
3801 : }
3802 : {
3803 : int ChallengeFromClient_cntr_0;
3804 0 : for (ChallengeFromClient_cntr_0 = 0; ChallengeFromClient_cntr_0 < (8); ChallengeFromClient_cntr_0++) {
3805 : PyObject *py_ChallengeFromClient_0;
3806 0 : py_ChallengeFromClient_0 = PyLong_FromLong((uint16_t)((object->ChallengeFromClient)[ChallengeFromClient_cntr_0]));
3807 0 : PyList_SetItem(py_ChallengeFromClient, ChallengeFromClient_cntr_0, py_ChallengeFromClient_0);
3808 : }
3809 : }
3810 0 : return py_ChallengeFromClient;
3811 : }
3812 :
3813 0 : static int py_NTLMv2_CLIENT_CHALLENGE_set_ChallengeFromClient(PyObject *py_obj, PyObject *value, void *closure)
3814 : {
3815 0 : struct NTLMv2_CLIENT_CHALLENGE *object = pytalloc_get_ptr(py_obj);
3816 0 : if (value == NULL) {
3817 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->ChallengeFromClient");
3818 0 : return -1;
3819 : }
3820 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
3821 : {
3822 : int ChallengeFromClient_cntr_0;
3823 0 : if (ARRAY_SIZE(object->ChallengeFromClient) != PyList_GET_SIZE(value)) {
3824 0 : PyErr_Format(PyExc_TypeError, "Expected list of type %s, length %zu, got %zd", Py_TYPE(value)->tp_name, ARRAY_SIZE(object->ChallengeFromClient), PyList_GET_SIZE(value));
3825 0 : return -1;
3826 : }
3827 0 : for (ChallengeFromClient_cntr_0 = 0; ChallengeFromClient_cntr_0 < PyList_GET_SIZE(value); ChallengeFromClient_cntr_0++) {
3828 0 : if (PyList_GET_ITEM(value, ChallengeFromClient_cntr_0) == NULL) {
3829 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->ChallengeFromClient)[ChallengeFromClient_cntr_0]");
3830 0 : return -1;
3831 : }
3832 : {
3833 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((object->ChallengeFromClient)[ChallengeFromClient_cntr_0]));
3834 0 : if (PyLong_Check(PyList_GET_ITEM(value, ChallengeFromClient_cntr_0))) {
3835 : unsigned long long test_var;
3836 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, ChallengeFromClient_cntr_0));
3837 0 : if (PyErr_Occurred() != NULL) {
3838 0 : return -1;
3839 : }
3840 0 : if (test_var > uint_max) {
3841 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3842 : PyLong_Type.tp_name, uint_max, test_var);
3843 0 : return -1;
3844 : }
3845 0 : (object->ChallengeFromClient)[ChallengeFromClient_cntr_0] = test_var;
3846 : } else {
3847 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3848 : PyLong_Type.tp_name);
3849 0 : return -1;
3850 : }
3851 : }
3852 : }
3853 : }
3854 0 : return 0;
3855 : }
3856 :
3857 0 : static PyObject *py_NTLMv2_CLIENT_CHALLENGE_get_Reserved3(PyObject *obj, void *closure)
3858 : {
3859 0 : struct NTLMv2_CLIENT_CHALLENGE *object = pytalloc_get_ptr(obj);
3860 : PyObject *py_Reserved3;
3861 0 : py_Reserved3 = PyLong_FromUnsignedLongLong((uint32_t)(object->Reserved3));
3862 0 : return py_Reserved3;
3863 : }
3864 :
3865 0 : static int py_NTLMv2_CLIENT_CHALLENGE_set_Reserved3(PyObject *py_obj, PyObject *value, void *closure)
3866 : {
3867 0 : struct NTLMv2_CLIENT_CHALLENGE *object = pytalloc_get_ptr(py_obj);
3868 0 : if (value == NULL) {
3869 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->Reserved3");
3870 0 : return -1;
3871 : }
3872 : {
3873 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->Reserved3));
3874 0 : if (PyLong_Check(value)) {
3875 : unsigned long long test_var;
3876 0 : test_var = PyLong_AsUnsignedLongLong(value);
3877 0 : if (PyErr_Occurred() != NULL) {
3878 0 : return -1;
3879 : }
3880 0 : if (test_var > uint_max) {
3881 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3882 : PyLong_Type.tp_name, uint_max, test_var);
3883 0 : return -1;
3884 : }
3885 0 : object->Reserved3 = test_var;
3886 : } else {
3887 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3888 : PyLong_Type.tp_name);
3889 0 : return -1;
3890 : }
3891 : }
3892 0 : return 0;
3893 : }
3894 :
3895 0 : static PyObject *py_NTLMv2_CLIENT_CHALLENGE_get_AvPairs(PyObject *obj, void *closure)
3896 : {
3897 0 : struct NTLMv2_CLIENT_CHALLENGE *object = pytalloc_get_ptr(obj);
3898 : PyObject *py_AvPairs;
3899 0 : py_AvPairs = pytalloc_reference_ex(&AV_PAIR_LIST_Type, pytalloc_get_mem_ctx(obj), &object->AvPairs);
3900 0 : return py_AvPairs;
3901 : }
3902 :
3903 0 : static int py_NTLMv2_CLIENT_CHALLENGE_set_AvPairs(PyObject *py_obj, PyObject *value, void *closure)
3904 : {
3905 0 : struct NTLMv2_CLIENT_CHALLENGE *object = pytalloc_get_ptr(py_obj);
3906 0 : if (value == NULL) {
3907 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->AvPairs");
3908 0 : return -1;
3909 : }
3910 0 : PY_CHECK_TYPE(&AV_PAIR_LIST_Type, value, return -1;);
3911 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
3912 0 : PyErr_NoMemory();
3913 0 : return -1;
3914 : }
3915 0 : object->AvPairs = *(struct AV_PAIR_LIST *)pytalloc_get_ptr(value);
3916 0 : return 0;
3917 : }
3918 :
3919 : static PyGetSetDef py_NTLMv2_CLIENT_CHALLENGE_getsetters[] = {
3920 : {
3921 : .name = discard_const_p(char, "RespType"),
3922 : .get = py_NTLMv2_CLIENT_CHALLENGE_get_RespType,
3923 : .set = py_NTLMv2_CLIENT_CHALLENGE_set_RespType,
3924 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
3925 : },
3926 : {
3927 : .name = discard_const_p(char, "HiRespType"),
3928 : .get = py_NTLMv2_CLIENT_CHALLENGE_get_HiRespType,
3929 : .set = py_NTLMv2_CLIENT_CHALLENGE_set_HiRespType,
3930 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
3931 : },
3932 : {
3933 : .name = discard_const_p(char, "Reserved1"),
3934 : .get = py_NTLMv2_CLIENT_CHALLENGE_get_Reserved1,
3935 : .set = py_NTLMv2_CLIENT_CHALLENGE_set_Reserved1,
3936 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
3937 : },
3938 : {
3939 : .name = discard_const_p(char, "Reserved2"),
3940 : .get = py_NTLMv2_CLIENT_CHALLENGE_get_Reserved2,
3941 : .set = py_NTLMv2_CLIENT_CHALLENGE_set_Reserved2,
3942 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
3943 : },
3944 : {
3945 : .name = discard_const_p(char, "TimeStamp"),
3946 : .get = py_NTLMv2_CLIENT_CHALLENGE_get_TimeStamp,
3947 : .set = py_NTLMv2_CLIENT_CHALLENGE_set_TimeStamp,
3948 : .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
3949 : },
3950 : {
3951 : .name = discard_const_p(char, "ChallengeFromClient"),
3952 : .get = py_NTLMv2_CLIENT_CHALLENGE_get_ChallengeFromClient,
3953 : .set = py_NTLMv2_CLIENT_CHALLENGE_set_ChallengeFromClient,
3954 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
3955 : },
3956 : {
3957 : .name = discard_const_p(char, "Reserved3"),
3958 : .get = py_NTLMv2_CLIENT_CHALLENGE_get_Reserved3,
3959 : .set = py_NTLMv2_CLIENT_CHALLENGE_set_Reserved3,
3960 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
3961 : },
3962 : {
3963 : .name = discard_const_p(char, "AvPairs"),
3964 : .get = py_NTLMv2_CLIENT_CHALLENGE_get_AvPairs,
3965 : .set = py_NTLMv2_CLIENT_CHALLENGE_set_AvPairs,
3966 : .doc = discard_const_p(char, "PIDL-generated element of base type AV_PAIR_LIST")
3967 : },
3968 : { .name = NULL }
3969 : };
3970 :
3971 0 : static PyObject *py_NTLMv2_CLIENT_CHALLENGE_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
3972 : {
3973 0 : return pytalloc_new(struct NTLMv2_CLIENT_CHALLENGE, type);
3974 : }
3975 :
3976 :
3977 : static PyTypeObject NTLMv2_CLIENT_CHALLENGE_Type = {
3978 : PyVarObject_HEAD_INIT(NULL, 0)
3979 : .tp_name = "ntlmssp.NTLMv2_CLIENT_CHALLENGE",
3980 : .tp_getset = py_NTLMv2_CLIENT_CHALLENGE_getsetters,
3981 : .tp_methods = NULL,
3982 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
3983 : .tp_new = py_NTLMv2_CLIENT_CHALLENGE_new,
3984 : };
3985 :
3986 :
3987 0 : static PyObject *py_NTLMv2_RESPONSE_get_Response(PyObject *obj, void *closure)
3988 : {
3989 0 : struct NTLMv2_RESPONSE *object = pytalloc_get_ptr(obj);
3990 : PyObject *py_Response;
3991 0 : py_Response = PyList_New(16);
3992 0 : if (py_Response == NULL) {
3993 0 : return NULL;
3994 : }
3995 : {
3996 : int Response_cntr_0;
3997 0 : for (Response_cntr_0 = 0; Response_cntr_0 < (16); Response_cntr_0++) {
3998 : PyObject *py_Response_0;
3999 0 : py_Response_0 = PyLong_FromLong((uint16_t)((object->Response)[Response_cntr_0]));
4000 0 : PyList_SetItem(py_Response, Response_cntr_0, py_Response_0);
4001 : }
4002 : }
4003 0 : return py_Response;
4004 : }
4005 :
4006 0 : static int py_NTLMv2_RESPONSE_set_Response(PyObject *py_obj, PyObject *value, void *closure)
4007 : {
4008 0 : struct NTLMv2_RESPONSE *object = pytalloc_get_ptr(py_obj);
4009 0 : if (value == NULL) {
4010 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->Response");
4011 0 : return -1;
4012 : }
4013 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
4014 : {
4015 : int Response_cntr_0;
4016 0 : if (ARRAY_SIZE(object->Response) != PyList_GET_SIZE(value)) {
4017 0 : PyErr_Format(PyExc_TypeError, "Expected list of type %s, length %zu, got %zd", Py_TYPE(value)->tp_name, ARRAY_SIZE(object->Response), PyList_GET_SIZE(value));
4018 0 : return -1;
4019 : }
4020 0 : for (Response_cntr_0 = 0; Response_cntr_0 < PyList_GET_SIZE(value); Response_cntr_0++) {
4021 0 : if (PyList_GET_ITEM(value, Response_cntr_0) == NULL) {
4022 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->Response)[Response_cntr_0]");
4023 0 : return -1;
4024 : }
4025 : {
4026 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((object->Response)[Response_cntr_0]));
4027 0 : if (PyLong_Check(PyList_GET_ITEM(value, Response_cntr_0))) {
4028 : unsigned long long test_var;
4029 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, Response_cntr_0));
4030 0 : if (PyErr_Occurred() != NULL) {
4031 0 : return -1;
4032 : }
4033 0 : if (test_var > uint_max) {
4034 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4035 : PyLong_Type.tp_name, uint_max, test_var);
4036 0 : return -1;
4037 : }
4038 0 : (object->Response)[Response_cntr_0] = test_var;
4039 : } else {
4040 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4041 : PyLong_Type.tp_name);
4042 0 : return -1;
4043 : }
4044 : }
4045 : }
4046 : }
4047 0 : return 0;
4048 : }
4049 :
4050 0 : static PyObject *py_NTLMv2_RESPONSE_get_Challenge(PyObject *obj, void *closure)
4051 : {
4052 0 : struct NTLMv2_RESPONSE *object = pytalloc_get_ptr(obj);
4053 : PyObject *py_Challenge;
4054 0 : py_Challenge = pytalloc_reference_ex(&NTLMv2_CLIENT_CHALLENGE_Type, pytalloc_get_mem_ctx(obj), &object->Challenge);
4055 0 : return py_Challenge;
4056 : }
4057 :
4058 0 : static int py_NTLMv2_RESPONSE_set_Challenge(PyObject *py_obj, PyObject *value, void *closure)
4059 : {
4060 0 : struct NTLMv2_RESPONSE *object = pytalloc_get_ptr(py_obj);
4061 0 : if (value == NULL) {
4062 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->Challenge");
4063 0 : return -1;
4064 : }
4065 0 : PY_CHECK_TYPE(&NTLMv2_CLIENT_CHALLENGE_Type, value, return -1;);
4066 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
4067 0 : PyErr_NoMemory();
4068 0 : return -1;
4069 : }
4070 0 : object->Challenge = *(struct NTLMv2_CLIENT_CHALLENGE *)pytalloc_get_ptr(value);
4071 0 : return 0;
4072 : }
4073 :
4074 : static PyGetSetDef py_NTLMv2_RESPONSE_getsetters[] = {
4075 : {
4076 : .name = discard_const_p(char, "Response"),
4077 : .get = py_NTLMv2_RESPONSE_get_Response,
4078 : .set = py_NTLMv2_RESPONSE_set_Response,
4079 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
4080 : },
4081 : {
4082 : .name = discard_const_p(char, "Challenge"),
4083 : .get = py_NTLMv2_RESPONSE_get_Challenge,
4084 : .set = py_NTLMv2_RESPONSE_set_Challenge,
4085 : .doc = discard_const_p(char, "PIDL-generated element of base type NTLMv2_CLIENT_CHALLENGE")
4086 : },
4087 : { .name = NULL }
4088 : };
4089 :
4090 0 : static PyObject *py_NTLMv2_RESPONSE_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
4091 : {
4092 0 : return pytalloc_new(struct NTLMv2_RESPONSE, type);
4093 : }
4094 :
4095 0 : static PyObject *py_NTLMv2_RESPONSE_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
4096 : {
4097 0 : struct NTLMv2_RESPONSE *object = pytalloc_get_ptr(py_obj);
4098 0 : PyObject *ret = NULL;
4099 : DATA_BLOB blob;
4100 : enum ndr_err_code err;
4101 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
4102 0 : if (tmp_ctx == NULL) {
4103 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
4104 0 : return NULL;
4105 : }
4106 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_NTLMv2_RESPONSE);
4107 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
4108 0 : TALLOC_FREE(tmp_ctx);
4109 0 : PyErr_SetNdrError(err);
4110 0 : return NULL;
4111 : }
4112 :
4113 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
4114 0 : TALLOC_FREE(tmp_ctx);
4115 0 : return ret;
4116 : }
4117 :
4118 0 : static PyObject *py_NTLMv2_RESPONSE_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
4119 : {
4120 0 : struct NTLMv2_RESPONSE *object = pytalloc_get_ptr(py_obj);
4121 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
4122 0 : Py_ssize_t blob_length = 0;
4123 : enum ndr_err_code err;
4124 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
4125 0 : PyObject *allow_remaining_obj = NULL;
4126 0 : bool allow_remaining = false;
4127 :
4128 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
4129 : discard_const_p(char *, kwnames),
4130 : &blob.data, &blob_length,
4131 : &allow_remaining_obj)) {
4132 0 : return NULL;
4133 : }
4134 0 : blob.length = blob_length;
4135 :
4136 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
4137 0 : allow_remaining = true;
4138 : }
4139 :
4140 0 : if (allow_remaining) {
4141 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_NTLMv2_RESPONSE);
4142 : } else {
4143 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_NTLMv2_RESPONSE);
4144 : }
4145 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
4146 0 : PyErr_SetNdrError(err);
4147 0 : return NULL;
4148 : }
4149 :
4150 0 : Py_RETURN_NONE;
4151 : }
4152 :
4153 0 : static PyObject *py_NTLMv2_RESPONSE_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
4154 : {
4155 0 : struct NTLMv2_RESPONSE *object = pytalloc_get_ptr(py_obj);
4156 : PyObject *ret;
4157 : char *retstr;
4158 :
4159 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_NTLMv2_RESPONSE, "NTLMv2_RESPONSE", object);
4160 0 : ret = PyUnicode_FromString(retstr);
4161 0 : talloc_free(retstr);
4162 :
4163 0 : return ret;
4164 : }
4165 :
4166 : static PyMethodDef py_NTLMv2_RESPONSE_methods[] = {
4167 : { "__ndr_pack__", (PyCFunction)py_NTLMv2_RESPONSE_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
4168 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_NTLMv2_RESPONSE_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
4169 : { "__ndr_print__", (PyCFunction)py_NTLMv2_RESPONSE_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
4170 : { NULL, NULL, 0, NULL }
4171 : };
4172 :
4173 :
4174 : static PyTypeObject NTLMv2_RESPONSE_Type = {
4175 : PyVarObject_HEAD_INIT(NULL, 0)
4176 : .tp_name = "ntlmssp.NTLMv2_RESPONSE",
4177 : .tp_getset = py_NTLMv2_RESPONSE_getsetters,
4178 : .tp_methods = py_NTLMv2_RESPONSE_methods,
4179 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
4180 : .tp_new = py_NTLMv2_RESPONSE_new,
4181 : };
4182 :
4183 0 : static PyObject *py_import_ntlmssp_NTLM_RESPONSE_with_len(TALLOC_CTX *mem_ctx, int level, union ntlmssp_NTLM_RESPONSE_with_len *in)
4184 : {
4185 : PyObject *ret;
4186 :
4187 0 : switch (level) {
4188 0 : case 0:
4189 0 : ret = Py_None;
4190 0 : Py_INCREF(ret);
4191 0 : return ret;
4192 :
4193 0 : case 0x18:
4194 0 : ret = pytalloc_reference_ex(&NTLM_RESPONSE_Type, mem_ctx, &in->v1);
4195 0 : return ret;
4196 :
4197 0 : default:
4198 0 : ret = pytalloc_reference_ex(&NTLMv2_RESPONSE_Type, mem_ctx, &in->v2);
4199 0 : return ret;
4200 :
4201 : }
4202 : PyErr_SetString(PyExc_TypeError, "unknown union level");
4203 : return NULL;
4204 : }
4205 :
4206 0 : static union ntlmssp_NTLM_RESPONSE_with_len *py_export_ntlmssp_NTLM_RESPONSE_with_len(TALLOC_CTX *mem_ctx, int level, PyObject *in)
4207 : {
4208 0 : union ntlmssp_NTLM_RESPONSE_with_len *ret = talloc_zero(mem_ctx, union ntlmssp_NTLM_RESPONSE_with_len);
4209 0 : switch (level) {
4210 0 : case 0:
4211 0 : break;
4212 :
4213 0 : case 0x18:
4214 0 : if (in == NULL) {
4215 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->v1");
4216 0 : talloc_free(ret); return NULL;
4217 : }
4218 0 : PY_CHECK_TYPE(&NTLM_RESPONSE_Type, in, talloc_free(ret); return NULL;);
4219 0 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
4220 0 : PyErr_NoMemory();
4221 0 : talloc_free(ret); return NULL;
4222 : }
4223 0 : ret->v1 = *(struct NTLM_RESPONSE *)pytalloc_get_ptr(in);
4224 0 : break;
4225 :
4226 0 : default:
4227 0 : if (in == NULL) {
4228 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->v2");
4229 0 : talloc_free(ret); return NULL;
4230 : }
4231 0 : PY_CHECK_TYPE(&NTLMv2_RESPONSE_Type, in, talloc_free(ret); return NULL;);
4232 0 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
4233 0 : PyErr_NoMemory();
4234 0 : talloc_free(ret); return NULL;
4235 : }
4236 0 : ret->v2 = *(struct NTLMv2_RESPONSE *)pytalloc_get_ptr(in);
4237 0 : break;
4238 :
4239 : }
4240 :
4241 0 : return ret;
4242 : }
4243 :
4244 0 : static PyObject *py_ntlmssp_NTLM_RESPONSE_with_len_import(PyTypeObject *type, PyObject *args, PyObject *kwargs)
4245 : {
4246 0 : const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
4247 0 : PyObject *mem_ctx_obj = NULL;
4248 0 : TALLOC_CTX *mem_ctx = NULL;
4249 0 : int level = 0;
4250 0 : PyObject *in_obj = NULL;
4251 0 : union ntlmssp_NTLM_RESPONSE_with_len *in = NULL;
4252 :
4253 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:import",
4254 : discard_const_p(char *, kwnames),
4255 : &mem_ctx_obj,
4256 : &level,
4257 : &in_obj)) {
4258 0 : return NULL;
4259 : }
4260 0 : mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
4261 0 : if (mem_ctx == NULL) {
4262 0 : PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
4263 0 : return NULL;
4264 : }
4265 0 : in = (union ntlmssp_NTLM_RESPONSE_with_len *)pytalloc_get_ptr(in_obj);
4266 0 : if (in == NULL) {
4267 0 : PyErr_Format(PyExc_TypeError, "in needs to be a pointer to union ntlmssp_NTLM_RESPONSE_with_len!");
4268 0 : return NULL;
4269 : }
4270 :
4271 0 : return py_import_ntlmssp_NTLM_RESPONSE_with_len(mem_ctx, level, in);
4272 : }
4273 :
4274 0 : static PyObject *py_ntlmssp_NTLM_RESPONSE_with_len_export(PyTypeObject *type, PyObject *args, PyObject *kwargs)
4275 : {
4276 0 : const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
4277 0 : PyObject *mem_ctx_obj = NULL;
4278 0 : TALLOC_CTX *mem_ctx = NULL;
4279 0 : int level = 0;
4280 0 : PyObject *in = NULL;
4281 0 : union ntlmssp_NTLM_RESPONSE_with_len *out = NULL;
4282 :
4283 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:export",
4284 : discard_const_p(char *, kwnames),
4285 : &mem_ctx_obj,
4286 : &level,
4287 : &in)) {
4288 0 : return NULL;
4289 : }
4290 0 : mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
4291 0 : if (mem_ctx == NULL) {
4292 0 : PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
4293 0 : return NULL;
4294 : }
4295 :
4296 0 : out = py_export_ntlmssp_NTLM_RESPONSE_with_len(mem_ctx, level, in);
4297 0 : if (out == NULL) {
4298 0 : return NULL;
4299 : }
4300 :
4301 0 : return pytalloc_GenericObject_reference(out);
4302 : }
4303 :
4304 : static PyMethodDef py_ntlmssp_NTLM_RESPONSE_with_len_methods[] = {
4305 : { "__import__", PY_DISCARD_FUNC_SIG(PyCFunction,py_ntlmssp_NTLM_RESPONSE_with_len_import),
4306 : METH_VARARGS|METH_KEYWORDS|METH_CLASS,
4307 : "T.__import__(mem_ctx, level, in) => ret." },
4308 : { "__export__", PY_DISCARD_FUNC_SIG(PyCFunction,py_ntlmssp_NTLM_RESPONSE_with_len_export),
4309 : METH_VARARGS|METH_KEYWORDS|METH_CLASS,
4310 : "T.__export__(mem_ctx, level, in) => ret." },
4311 : { NULL, NULL, 0, NULL }
4312 : };
4313 :
4314 0 : static PyObject *py_ntlmssp_NTLM_RESPONSE_with_len_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
4315 : {
4316 0 : PyErr_Format(PyExc_TypeError, "New %s Objects are not supported", type->tp_name);
4317 0 : return NULL;
4318 : }
4319 :
4320 :
4321 : static PyTypeObject ntlmssp_NTLM_RESPONSE_with_len_Type = {
4322 : PyVarObject_HEAD_INIT(NULL, 0)
4323 : .tp_name = "ntlmssp.NTLM_RESPONSE_with_len",
4324 : .tp_getset = NULL,
4325 : .tp_methods = py_ntlmssp_NTLM_RESPONSE_with_len_methods,
4326 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
4327 : .tp_new = py_ntlmssp_NTLM_RESPONSE_with_len_new,
4328 : };
4329 :
4330 :
4331 0 : static PyObject *py_ntlmssp_MIC_get_MIC(PyObject *obj, void *closure)
4332 : {
4333 0 : struct ntlmssp_MIC *object = pytalloc_get_ptr(obj);
4334 : PyObject *py_MIC;
4335 0 : py_MIC = PyList_New(NTLMSSP_MIC_SIZE);
4336 0 : if (py_MIC == NULL) {
4337 0 : return NULL;
4338 : }
4339 : {
4340 : int MIC_cntr_0;
4341 0 : for (MIC_cntr_0 = 0; MIC_cntr_0 < (NTLMSSP_MIC_SIZE); MIC_cntr_0++) {
4342 : PyObject *py_MIC_0;
4343 0 : py_MIC_0 = PyLong_FromLong((uint16_t)((object->MIC)[MIC_cntr_0]));
4344 0 : PyList_SetItem(py_MIC, MIC_cntr_0, py_MIC_0);
4345 : }
4346 : }
4347 0 : return py_MIC;
4348 : }
4349 :
4350 0 : static int py_ntlmssp_MIC_set_MIC(PyObject *py_obj, PyObject *value, void *closure)
4351 : {
4352 0 : struct ntlmssp_MIC *object = pytalloc_get_ptr(py_obj);
4353 0 : if (value == NULL) {
4354 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->MIC");
4355 0 : return -1;
4356 : }
4357 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
4358 : {
4359 : int MIC_cntr_0;
4360 0 : object->MIC = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->MIC, PyList_GET_SIZE(value));
4361 0 : if (!object->MIC) { return -1; }
4362 0 : talloc_set_name_const(object->MIC, "ARRAY: object->MIC");
4363 0 : for (MIC_cntr_0 = 0; MIC_cntr_0 < PyList_GET_SIZE(value); MIC_cntr_0++) {
4364 0 : if (PyList_GET_ITEM(value, MIC_cntr_0) == NULL) {
4365 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->MIC)[MIC_cntr_0]");
4366 0 : return -1;
4367 : }
4368 : {
4369 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((object->MIC)[MIC_cntr_0]));
4370 0 : if (PyLong_Check(PyList_GET_ITEM(value, MIC_cntr_0))) {
4371 : unsigned long long test_var;
4372 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, MIC_cntr_0));
4373 0 : if (PyErr_Occurred() != NULL) {
4374 0 : return -1;
4375 : }
4376 0 : if (test_var > uint_max) {
4377 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4378 : PyLong_Type.tp_name, uint_max, test_var);
4379 0 : return -1;
4380 : }
4381 0 : (object->MIC)[MIC_cntr_0] = test_var;
4382 : } else {
4383 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4384 : PyLong_Type.tp_name);
4385 0 : return -1;
4386 : }
4387 : }
4388 : }
4389 : }
4390 0 : return 0;
4391 : }
4392 :
4393 : static PyGetSetDef py_ntlmssp_MIC_getsetters[] = {
4394 : {
4395 : .name = discard_const_p(char, "MIC"),
4396 : .get = py_ntlmssp_MIC_get_MIC,
4397 : .set = py_ntlmssp_MIC_set_MIC,
4398 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
4399 : },
4400 : { .name = NULL }
4401 : };
4402 :
4403 0 : static PyObject *py_ntlmssp_MIC_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
4404 : {
4405 0 : return pytalloc_new(struct ntlmssp_MIC, type);
4406 : }
4407 :
4408 :
4409 : static PyTypeObject ntlmssp_MIC_Type = {
4410 : PyVarObject_HEAD_INIT(NULL, 0)
4411 : .tp_name = "ntlmssp.MIC",
4412 : .tp_getset = py_ntlmssp_MIC_getsetters,
4413 : .tp_methods = NULL,
4414 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
4415 : .tp_new = py_ntlmssp_MIC_new,
4416 : };
4417 :
4418 :
4419 0 : static PyObject *py_AUTHENTICATE_MESSAGE_get_Signature(PyObject *obj, void *closure)
4420 : {
4421 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(obj);
4422 : PyObject *py_Signature;
4423 0 : if (object->Signature == NULL) {
4424 0 : py_Signature = Py_None;
4425 0 : Py_INCREF(py_Signature);
4426 : } else {
4427 0 : py_Signature = PyUnicode_Decode(object->Signature, strlen(object->Signature), "utf-8", "ignore");
4428 : }
4429 0 : return py_Signature;
4430 : }
4431 :
4432 0 : static int py_AUTHENTICATE_MESSAGE_set_Signature(PyObject *py_obj, PyObject *value, void *closure)
4433 : {
4434 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(py_obj);
4435 0 : if (value == NULL) {
4436 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->Signature");
4437 0 : return -1;
4438 : }
4439 : {
4440 : const char *test_str;
4441 : const char *talloc_str;
4442 0 : PyObject *unicode = NULL;
4443 0 : if (PyUnicode_Check(value)) {
4444 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
4445 0 : if (unicode == NULL) {
4446 0 : return -1;
4447 : }
4448 0 : test_str = PyBytes_AS_STRING(unicode);
4449 0 : } else if (PyBytes_Check(value)) {
4450 0 : test_str = PyBytes_AS_STRING(value);
4451 : } else {
4452 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
4453 0 : return -1;
4454 : }
4455 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
4456 0 : if (unicode != NULL) {
4457 0 : Py_DECREF(unicode);
4458 : }
4459 0 : if (talloc_str == NULL) {
4460 0 : PyErr_NoMemory();
4461 0 : return -1;
4462 : }
4463 0 : object->Signature = talloc_str;
4464 : }
4465 0 : return 0;
4466 : }
4467 :
4468 0 : static PyObject *py_AUTHENTICATE_MESSAGE_get_MessageType(PyObject *obj, void *closure)
4469 : {
4470 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(obj);
4471 : PyObject *py_MessageType;
4472 0 : py_MessageType = PyLong_FromUnsignedLongLong((uint32_t)(object->MessageType));
4473 0 : return py_MessageType;
4474 : }
4475 :
4476 0 : static int py_AUTHENTICATE_MESSAGE_set_MessageType(PyObject *py_obj, PyObject *value, void *closure)
4477 : {
4478 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(py_obj);
4479 0 : if (value == NULL) {
4480 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->MessageType");
4481 0 : return -1;
4482 : }
4483 : {
4484 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->MessageType));
4485 0 : if (PyLong_Check(value)) {
4486 : unsigned long long test_var;
4487 0 : test_var = PyLong_AsUnsignedLongLong(value);
4488 0 : if (PyErr_Occurred() != NULL) {
4489 0 : return -1;
4490 : }
4491 0 : if (test_var > uint_max) {
4492 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4493 : PyLong_Type.tp_name, uint_max, test_var);
4494 0 : return -1;
4495 : }
4496 0 : object->MessageType = test_var;
4497 : } else {
4498 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4499 : PyLong_Type.tp_name);
4500 0 : return -1;
4501 : }
4502 : }
4503 0 : return 0;
4504 : }
4505 :
4506 0 : static PyObject *py_AUTHENTICATE_MESSAGE_get_LmChallengeResponseLen(PyObject *obj, void *closure)
4507 : {
4508 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(obj);
4509 : PyObject *py_LmChallengeResponseLen;
4510 0 : py_LmChallengeResponseLen = PyLong_FromLong((uint16_t)(object->LmChallengeResponseLen));
4511 0 : return py_LmChallengeResponseLen;
4512 : }
4513 :
4514 0 : static int py_AUTHENTICATE_MESSAGE_set_LmChallengeResponseLen(PyObject *py_obj, PyObject *value, void *closure)
4515 : {
4516 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(py_obj);
4517 0 : if (value == NULL) {
4518 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->LmChallengeResponseLen");
4519 0 : return -1;
4520 : }
4521 : {
4522 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->LmChallengeResponseLen));
4523 0 : if (PyLong_Check(value)) {
4524 : unsigned long long test_var;
4525 0 : test_var = PyLong_AsUnsignedLongLong(value);
4526 0 : if (PyErr_Occurred() != NULL) {
4527 0 : return -1;
4528 : }
4529 0 : if (test_var > uint_max) {
4530 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4531 : PyLong_Type.tp_name, uint_max, test_var);
4532 0 : return -1;
4533 : }
4534 0 : object->LmChallengeResponseLen = test_var;
4535 : } else {
4536 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4537 : PyLong_Type.tp_name);
4538 0 : return -1;
4539 : }
4540 : }
4541 0 : return 0;
4542 : }
4543 :
4544 0 : static PyObject *py_AUTHENTICATE_MESSAGE_get_LmChallengeResponseMaxLen(PyObject *obj, void *closure)
4545 : {
4546 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(obj);
4547 : PyObject *py_LmChallengeResponseMaxLen;
4548 0 : py_LmChallengeResponseMaxLen = PyLong_FromLong((uint16_t)(object->LmChallengeResponseMaxLen));
4549 0 : return py_LmChallengeResponseMaxLen;
4550 : }
4551 :
4552 0 : static int py_AUTHENTICATE_MESSAGE_set_LmChallengeResponseMaxLen(PyObject *py_obj, PyObject *value, void *closure)
4553 : {
4554 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(py_obj);
4555 0 : if (value == NULL) {
4556 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->LmChallengeResponseMaxLen");
4557 0 : return -1;
4558 : }
4559 : {
4560 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->LmChallengeResponseMaxLen));
4561 0 : if (PyLong_Check(value)) {
4562 : unsigned long long test_var;
4563 0 : test_var = PyLong_AsUnsignedLongLong(value);
4564 0 : if (PyErr_Occurred() != NULL) {
4565 0 : return -1;
4566 : }
4567 0 : if (test_var > uint_max) {
4568 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4569 : PyLong_Type.tp_name, uint_max, test_var);
4570 0 : return -1;
4571 : }
4572 0 : object->LmChallengeResponseMaxLen = test_var;
4573 : } else {
4574 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4575 : PyLong_Type.tp_name);
4576 0 : return -1;
4577 : }
4578 : }
4579 0 : return 0;
4580 : }
4581 :
4582 0 : static PyObject *py_AUTHENTICATE_MESSAGE_get_LmChallengeResponse(PyObject *obj, void *closure)
4583 : {
4584 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(obj);
4585 : PyObject *py_LmChallengeResponse;
4586 0 : if (object->LmChallengeResponse == NULL) {
4587 0 : Py_RETURN_NONE;
4588 : }
4589 0 : if (object->LmChallengeResponse == NULL) {
4590 0 : py_LmChallengeResponse = Py_None;
4591 0 : Py_INCREF(py_LmChallengeResponse);
4592 : } else {
4593 0 : py_LmChallengeResponse = pyrpc_import_union(&ntlmssp_LM_RESPONSE_with_len_Type, object->LmChallengeResponse, object->LmChallengeResponseLen, object->LmChallengeResponse, "union ntlmssp_LM_RESPONSE_with_len");
4594 0 : if (py_LmChallengeResponse == NULL) {
4595 0 : return NULL;
4596 : }
4597 : }
4598 0 : return py_LmChallengeResponse;
4599 : }
4600 :
4601 0 : static int py_AUTHENTICATE_MESSAGE_set_LmChallengeResponse(PyObject *py_obj, PyObject *value, void *closure)
4602 : {
4603 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(py_obj);
4604 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->LmChallengeResponse));
4605 0 : if (value == NULL) {
4606 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->LmChallengeResponse");
4607 0 : return -1;
4608 : }
4609 0 : if (value == Py_None) {
4610 0 : object->LmChallengeResponse = NULL;
4611 : } else {
4612 0 : object->LmChallengeResponse = NULL;
4613 : {
4614 : union ntlmssp_LM_RESPONSE_with_len *LmChallengeResponse_switch_2;
4615 0 : LmChallengeResponse_switch_2 = (union ntlmssp_LM_RESPONSE_with_len *)pyrpc_export_union(&ntlmssp_LM_RESPONSE_with_len_Type, pytalloc_get_mem_ctx(py_obj), object->LmChallengeResponseLen, value, "union ntlmssp_LM_RESPONSE_with_len");
4616 0 : if (LmChallengeResponse_switch_2 == NULL) {
4617 0 : return -1;
4618 : }
4619 0 : object->LmChallengeResponse = LmChallengeResponse_switch_2;
4620 : }
4621 : }
4622 0 : return 0;
4623 : }
4624 :
4625 0 : static PyObject *py_AUTHENTICATE_MESSAGE_get_NtChallengeResponseLen(PyObject *obj, void *closure)
4626 : {
4627 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(obj);
4628 : PyObject *py_NtChallengeResponseLen;
4629 0 : py_NtChallengeResponseLen = PyLong_FromLong((uint16_t)(object->NtChallengeResponseLen));
4630 0 : return py_NtChallengeResponseLen;
4631 : }
4632 :
4633 0 : static int py_AUTHENTICATE_MESSAGE_set_NtChallengeResponseLen(PyObject *py_obj, PyObject *value, void *closure)
4634 : {
4635 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(py_obj);
4636 0 : if (value == NULL) {
4637 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->NtChallengeResponseLen");
4638 0 : return -1;
4639 : }
4640 : {
4641 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->NtChallengeResponseLen));
4642 0 : if (PyLong_Check(value)) {
4643 : unsigned long long test_var;
4644 0 : test_var = PyLong_AsUnsignedLongLong(value);
4645 0 : if (PyErr_Occurred() != NULL) {
4646 0 : return -1;
4647 : }
4648 0 : if (test_var > uint_max) {
4649 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4650 : PyLong_Type.tp_name, uint_max, test_var);
4651 0 : return -1;
4652 : }
4653 0 : object->NtChallengeResponseLen = test_var;
4654 : } else {
4655 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4656 : PyLong_Type.tp_name);
4657 0 : return -1;
4658 : }
4659 : }
4660 0 : return 0;
4661 : }
4662 :
4663 0 : static PyObject *py_AUTHENTICATE_MESSAGE_get_NtChallengeResponseMaxLen(PyObject *obj, void *closure)
4664 : {
4665 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(obj);
4666 : PyObject *py_NtChallengeResponseMaxLen;
4667 0 : py_NtChallengeResponseMaxLen = PyLong_FromLong((uint16_t)(object->NtChallengeResponseMaxLen));
4668 0 : return py_NtChallengeResponseMaxLen;
4669 : }
4670 :
4671 0 : static int py_AUTHENTICATE_MESSAGE_set_NtChallengeResponseMaxLen(PyObject *py_obj, PyObject *value, void *closure)
4672 : {
4673 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(py_obj);
4674 0 : if (value == NULL) {
4675 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->NtChallengeResponseMaxLen");
4676 0 : return -1;
4677 : }
4678 : {
4679 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->NtChallengeResponseMaxLen));
4680 0 : if (PyLong_Check(value)) {
4681 : unsigned long long test_var;
4682 0 : test_var = PyLong_AsUnsignedLongLong(value);
4683 0 : if (PyErr_Occurred() != NULL) {
4684 0 : return -1;
4685 : }
4686 0 : if (test_var > uint_max) {
4687 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4688 : PyLong_Type.tp_name, uint_max, test_var);
4689 0 : return -1;
4690 : }
4691 0 : object->NtChallengeResponseMaxLen = test_var;
4692 : } else {
4693 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4694 : PyLong_Type.tp_name);
4695 0 : return -1;
4696 : }
4697 : }
4698 0 : return 0;
4699 : }
4700 :
4701 0 : static PyObject *py_AUTHENTICATE_MESSAGE_get_NtChallengeResponse(PyObject *obj, void *closure)
4702 : {
4703 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(obj);
4704 : PyObject *py_NtChallengeResponse;
4705 0 : if (object->NtChallengeResponse == NULL) {
4706 0 : Py_RETURN_NONE;
4707 : }
4708 0 : if (object->NtChallengeResponse == NULL) {
4709 0 : py_NtChallengeResponse = Py_None;
4710 0 : Py_INCREF(py_NtChallengeResponse);
4711 : } else {
4712 0 : py_NtChallengeResponse = pyrpc_import_union(&ntlmssp_NTLM_RESPONSE_with_len_Type, object->NtChallengeResponse, object->NtChallengeResponseLen, object->NtChallengeResponse, "union ntlmssp_NTLM_RESPONSE_with_len");
4713 0 : if (py_NtChallengeResponse == NULL) {
4714 0 : return NULL;
4715 : }
4716 : }
4717 0 : return py_NtChallengeResponse;
4718 : }
4719 :
4720 0 : static int py_AUTHENTICATE_MESSAGE_set_NtChallengeResponse(PyObject *py_obj, PyObject *value, void *closure)
4721 : {
4722 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(py_obj);
4723 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->NtChallengeResponse));
4724 0 : if (value == NULL) {
4725 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->NtChallengeResponse");
4726 0 : return -1;
4727 : }
4728 0 : if (value == Py_None) {
4729 0 : object->NtChallengeResponse = NULL;
4730 : } else {
4731 0 : object->NtChallengeResponse = NULL;
4732 : {
4733 : union ntlmssp_NTLM_RESPONSE_with_len *NtChallengeResponse_switch_2;
4734 0 : NtChallengeResponse_switch_2 = (union ntlmssp_NTLM_RESPONSE_with_len *)pyrpc_export_union(&ntlmssp_NTLM_RESPONSE_with_len_Type, pytalloc_get_mem_ctx(py_obj), object->NtChallengeResponseLen, value, "union ntlmssp_NTLM_RESPONSE_with_len");
4735 0 : if (NtChallengeResponse_switch_2 == NULL) {
4736 0 : return -1;
4737 : }
4738 0 : object->NtChallengeResponse = NtChallengeResponse_switch_2;
4739 : }
4740 : }
4741 0 : return 0;
4742 : }
4743 :
4744 0 : static PyObject *py_AUTHENTICATE_MESSAGE_get_DomainNameLen(PyObject *obj, void *closure)
4745 : {
4746 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(obj);
4747 : PyObject *py_DomainNameLen;
4748 0 : py_DomainNameLen = PyLong_FromLong((uint16_t)(object->DomainNameLen));
4749 0 : return py_DomainNameLen;
4750 : }
4751 :
4752 0 : static int py_AUTHENTICATE_MESSAGE_set_DomainNameLen(PyObject *py_obj, PyObject *value, void *closure)
4753 : {
4754 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(py_obj);
4755 0 : if (value == NULL) {
4756 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->DomainNameLen");
4757 0 : return -1;
4758 : }
4759 : {
4760 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->DomainNameLen));
4761 0 : if (PyLong_Check(value)) {
4762 : unsigned long long test_var;
4763 0 : test_var = PyLong_AsUnsignedLongLong(value);
4764 0 : if (PyErr_Occurred() != NULL) {
4765 0 : return -1;
4766 : }
4767 0 : if (test_var > uint_max) {
4768 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4769 : PyLong_Type.tp_name, uint_max, test_var);
4770 0 : return -1;
4771 : }
4772 0 : object->DomainNameLen = test_var;
4773 : } else {
4774 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4775 : PyLong_Type.tp_name);
4776 0 : return -1;
4777 : }
4778 : }
4779 0 : return 0;
4780 : }
4781 :
4782 0 : static PyObject *py_AUTHENTICATE_MESSAGE_get_DomainNameMaxLen(PyObject *obj, void *closure)
4783 : {
4784 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(obj);
4785 : PyObject *py_DomainNameMaxLen;
4786 0 : py_DomainNameMaxLen = PyLong_FromLong((uint16_t)(object->DomainNameMaxLen));
4787 0 : return py_DomainNameMaxLen;
4788 : }
4789 :
4790 0 : static int py_AUTHENTICATE_MESSAGE_set_DomainNameMaxLen(PyObject *py_obj, PyObject *value, void *closure)
4791 : {
4792 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(py_obj);
4793 0 : if (value == NULL) {
4794 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->DomainNameMaxLen");
4795 0 : return -1;
4796 : }
4797 : {
4798 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->DomainNameMaxLen));
4799 0 : if (PyLong_Check(value)) {
4800 : unsigned long long test_var;
4801 0 : test_var = PyLong_AsUnsignedLongLong(value);
4802 0 : if (PyErr_Occurred() != NULL) {
4803 0 : return -1;
4804 : }
4805 0 : if (test_var > uint_max) {
4806 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4807 : PyLong_Type.tp_name, uint_max, test_var);
4808 0 : return -1;
4809 : }
4810 0 : object->DomainNameMaxLen = test_var;
4811 : } else {
4812 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4813 : PyLong_Type.tp_name);
4814 0 : return -1;
4815 : }
4816 : }
4817 0 : return 0;
4818 : }
4819 :
4820 0 : static PyObject *py_AUTHENTICATE_MESSAGE_get_DomainName(PyObject *obj, void *closure)
4821 : {
4822 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(obj);
4823 : PyObject *py_DomainName;
4824 0 : if (object->DomainName == NULL) {
4825 0 : Py_RETURN_NONE;
4826 : }
4827 0 : if (object->DomainName == NULL) {
4828 0 : py_DomainName = Py_None;
4829 0 : Py_INCREF(py_DomainName);
4830 : } else {
4831 0 : py_DomainName = PyString_FromStringOrNULL(object->DomainName);
4832 : }
4833 0 : return py_DomainName;
4834 : }
4835 :
4836 0 : static int py_AUTHENTICATE_MESSAGE_set_DomainName(PyObject *py_obj, PyObject *value, void *closure)
4837 : {
4838 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(py_obj);
4839 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->DomainName));
4840 0 : if (value == NULL) {
4841 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->DomainName");
4842 0 : return -1;
4843 : }
4844 0 : if (value == Py_None) {
4845 0 : object->DomainName = NULL;
4846 : } else {
4847 0 : object->DomainName = NULL;
4848 : {
4849 : const char *test_str;
4850 : const char *talloc_str;
4851 0 : PyObject *unicode = NULL;
4852 0 : if (PyUnicode_Check(value)) {
4853 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
4854 0 : if (unicode == NULL) {
4855 0 : return -1;
4856 : }
4857 0 : test_str = PyBytes_AS_STRING(unicode);
4858 0 : } else if (PyBytes_Check(value)) {
4859 0 : test_str = PyBytes_AS_STRING(value);
4860 : } else {
4861 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
4862 0 : return -1;
4863 : }
4864 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
4865 0 : if (unicode != NULL) {
4866 0 : Py_DECREF(unicode);
4867 : }
4868 0 : if (talloc_str == NULL) {
4869 0 : PyErr_NoMemory();
4870 0 : return -1;
4871 : }
4872 0 : object->DomainName = talloc_str;
4873 : }
4874 : }
4875 0 : return 0;
4876 : }
4877 :
4878 0 : static PyObject *py_AUTHENTICATE_MESSAGE_get_UserNameLen(PyObject *obj, void *closure)
4879 : {
4880 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(obj);
4881 : PyObject *py_UserNameLen;
4882 0 : py_UserNameLen = PyLong_FromLong((uint16_t)(object->UserNameLen));
4883 0 : return py_UserNameLen;
4884 : }
4885 :
4886 0 : static int py_AUTHENTICATE_MESSAGE_set_UserNameLen(PyObject *py_obj, PyObject *value, void *closure)
4887 : {
4888 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(py_obj);
4889 0 : if (value == NULL) {
4890 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->UserNameLen");
4891 0 : return -1;
4892 : }
4893 : {
4894 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->UserNameLen));
4895 0 : if (PyLong_Check(value)) {
4896 : unsigned long long test_var;
4897 0 : test_var = PyLong_AsUnsignedLongLong(value);
4898 0 : if (PyErr_Occurred() != NULL) {
4899 0 : return -1;
4900 : }
4901 0 : if (test_var > uint_max) {
4902 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4903 : PyLong_Type.tp_name, uint_max, test_var);
4904 0 : return -1;
4905 : }
4906 0 : object->UserNameLen = test_var;
4907 : } else {
4908 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4909 : PyLong_Type.tp_name);
4910 0 : return -1;
4911 : }
4912 : }
4913 0 : return 0;
4914 : }
4915 :
4916 0 : static PyObject *py_AUTHENTICATE_MESSAGE_get_UserNameMaxLen(PyObject *obj, void *closure)
4917 : {
4918 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(obj);
4919 : PyObject *py_UserNameMaxLen;
4920 0 : py_UserNameMaxLen = PyLong_FromLong((uint16_t)(object->UserNameMaxLen));
4921 0 : return py_UserNameMaxLen;
4922 : }
4923 :
4924 0 : static int py_AUTHENTICATE_MESSAGE_set_UserNameMaxLen(PyObject *py_obj, PyObject *value, void *closure)
4925 : {
4926 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(py_obj);
4927 0 : if (value == NULL) {
4928 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->UserNameMaxLen");
4929 0 : return -1;
4930 : }
4931 : {
4932 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->UserNameMaxLen));
4933 0 : if (PyLong_Check(value)) {
4934 : unsigned long long test_var;
4935 0 : test_var = PyLong_AsUnsignedLongLong(value);
4936 0 : if (PyErr_Occurred() != NULL) {
4937 0 : return -1;
4938 : }
4939 0 : if (test_var > uint_max) {
4940 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4941 : PyLong_Type.tp_name, uint_max, test_var);
4942 0 : return -1;
4943 : }
4944 0 : object->UserNameMaxLen = test_var;
4945 : } else {
4946 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4947 : PyLong_Type.tp_name);
4948 0 : return -1;
4949 : }
4950 : }
4951 0 : return 0;
4952 : }
4953 :
4954 0 : static PyObject *py_AUTHENTICATE_MESSAGE_get_UserName(PyObject *obj, void *closure)
4955 : {
4956 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(obj);
4957 : PyObject *py_UserName;
4958 0 : if (object->UserName == NULL) {
4959 0 : Py_RETURN_NONE;
4960 : }
4961 0 : if (object->UserName == NULL) {
4962 0 : py_UserName = Py_None;
4963 0 : Py_INCREF(py_UserName);
4964 : } else {
4965 0 : py_UserName = PyString_FromStringOrNULL(object->UserName);
4966 : }
4967 0 : return py_UserName;
4968 : }
4969 :
4970 0 : static int py_AUTHENTICATE_MESSAGE_set_UserName(PyObject *py_obj, PyObject *value, void *closure)
4971 : {
4972 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(py_obj);
4973 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->UserName));
4974 0 : if (value == NULL) {
4975 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->UserName");
4976 0 : return -1;
4977 : }
4978 0 : if (value == Py_None) {
4979 0 : object->UserName = NULL;
4980 : } else {
4981 0 : object->UserName = NULL;
4982 : {
4983 : const char *test_str;
4984 : const char *talloc_str;
4985 0 : PyObject *unicode = NULL;
4986 0 : if (PyUnicode_Check(value)) {
4987 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
4988 0 : if (unicode == NULL) {
4989 0 : return -1;
4990 : }
4991 0 : test_str = PyBytes_AS_STRING(unicode);
4992 0 : } else if (PyBytes_Check(value)) {
4993 0 : test_str = PyBytes_AS_STRING(value);
4994 : } else {
4995 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
4996 0 : return -1;
4997 : }
4998 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
4999 0 : if (unicode != NULL) {
5000 0 : Py_DECREF(unicode);
5001 : }
5002 0 : if (talloc_str == NULL) {
5003 0 : PyErr_NoMemory();
5004 0 : return -1;
5005 : }
5006 0 : object->UserName = talloc_str;
5007 : }
5008 : }
5009 0 : return 0;
5010 : }
5011 :
5012 0 : static PyObject *py_AUTHENTICATE_MESSAGE_get_WorkstationLen(PyObject *obj, void *closure)
5013 : {
5014 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(obj);
5015 : PyObject *py_WorkstationLen;
5016 0 : py_WorkstationLen = PyLong_FromLong((uint16_t)(object->WorkstationLen));
5017 0 : return py_WorkstationLen;
5018 : }
5019 :
5020 0 : static int py_AUTHENTICATE_MESSAGE_set_WorkstationLen(PyObject *py_obj, PyObject *value, void *closure)
5021 : {
5022 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(py_obj);
5023 0 : if (value == NULL) {
5024 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->WorkstationLen");
5025 0 : return -1;
5026 : }
5027 : {
5028 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->WorkstationLen));
5029 0 : if (PyLong_Check(value)) {
5030 : unsigned long long test_var;
5031 0 : test_var = PyLong_AsUnsignedLongLong(value);
5032 0 : if (PyErr_Occurred() != NULL) {
5033 0 : return -1;
5034 : }
5035 0 : if (test_var > uint_max) {
5036 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
5037 : PyLong_Type.tp_name, uint_max, test_var);
5038 0 : return -1;
5039 : }
5040 0 : object->WorkstationLen = test_var;
5041 : } else {
5042 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
5043 : PyLong_Type.tp_name);
5044 0 : return -1;
5045 : }
5046 : }
5047 0 : return 0;
5048 : }
5049 :
5050 0 : static PyObject *py_AUTHENTICATE_MESSAGE_get_WorkstationMaxLen(PyObject *obj, void *closure)
5051 : {
5052 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(obj);
5053 : PyObject *py_WorkstationMaxLen;
5054 0 : py_WorkstationMaxLen = PyLong_FromLong((uint16_t)(object->WorkstationMaxLen));
5055 0 : return py_WorkstationMaxLen;
5056 : }
5057 :
5058 0 : static int py_AUTHENTICATE_MESSAGE_set_WorkstationMaxLen(PyObject *py_obj, PyObject *value, void *closure)
5059 : {
5060 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(py_obj);
5061 0 : if (value == NULL) {
5062 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->WorkstationMaxLen");
5063 0 : return -1;
5064 : }
5065 : {
5066 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->WorkstationMaxLen));
5067 0 : if (PyLong_Check(value)) {
5068 : unsigned long long test_var;
5069 0 : test_var = PyLong_AsUnsignedLongLong(value);
5070 0 : if (PyErr_Occurred() != NULL) {
5071 0 : return -1;
5072 : }
5073 0 : if (test_var > uint_max) {
5074 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
5075 : PyLong_Type.tp_name, uint_max, test_var);
5076 0 : return -1;
5077 : }
5078 0 : object->WorkstationMaxLen = test_var;
5079 : } else {
5080 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
5081 : PyLong_Type.tp_name);
5082 0 : return -1;
5083 : }
5084 : }
5085 0 : return 0;
5086 : }
5087 :
5088 0 : static PyObject *py_AUTHENTICATE_MESSAGE_get_Workstation(PyObject *obj, void *closure)
5089 : {
5090 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(obj);
5091 : PyObject *py_Workstation;
5092 0 : if (object->Workstation == NULL) {
5093 0 : Py_RETURN_NONE;
5094 : }
5095 0 : if (object->Workstation == NULL) {
5096 0 : py_Workstation = Py_None;
5097 0 : Py_INCREF(py_Workstation);
5098 : } else {
5099 0 : py_Workstation = PyString_FromStringOrNULL(object->Workstation);
5100 : }
5101 0 : return py_Workstation;
5102 : }
5103 :
5104 0 : static int py_AUTHENTICATE_MESSAGE_set_Workstation(PyObject *py_obj, PyObject *value, void *closure)
5105 : {
5106 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(py_obj);
5107 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->Workstation));
5108 0 : if (value == NULL) {
5109 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->Workstation");
5110 0 : return -1;
5111 : }
5112 0 : if (value == Py_None) {
5113 0 : object->Workstation = NULL;
5114 : } else {
5115 0 : object->Workstation = NULL;
5116 : {
5117 : const char *test_str;
5118 : const char *talloc_str;
5119 0 : PyObject *unicode = NULL;
5120 0 : if (PyUnicode_Check(value)) {
5121 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
5122 0 : if (unicode == NULL) {
5123 0 : return -1;
5124 : }
5125 0 : test_str = PyBytes_AS_STRING(unicode);
5126 0 : } else if (PyBytes_Check(value)) {
5127 0 : test_str = PyBytes_AS_STRING(value);
5128 : } else {
5129 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
5130 0 : return -1;
5131 : }
5132 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
5133 0 : if (unicode != NULL) {
5134 0 : Py_DECREF(unicode);
5135 : }
5136 0 : if (talloc_str == NULL) {
5137 0 : PyErr_NoMemory();
5138 0 : return -1;
5139 : }
5140 0 : object->Workstation = talloc_str;
5141 : }
5142 : }
5143 0 : return 0;
5144 : }
5145 :
5146 0 : static PyObject *py_AUTHENTICATE_MESSAGE_get_EncryptedRandomSessionKeyLen(PyObject *obj, void *closure)
5147 : {
5148 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(obj);
5149 : PyObject *py_EncryptedRandomSessionKeyLen;
5150 0 : py_EncryptedRandomSessionKeyLen = PyLong_FromLong((uint16_t)(object->EncryptedRandomSessionKeyLen));
5151 0 : return py_EncryptedRandomSessionKeyLen;
5152 : }
5153 :
5154 0 : static int py_AUTHENTICATE_MESSAGE_set_EncryptedRandomSessionKeyLen(PyObject *py_obj, PyObject *value, void *closure)
5155 : {
5156 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(py_obj);
5157 0 : if (value == NULL) {
5158 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->EncryptedRandomSessionKeyLen");
5159 0 : return -1;
5160 : }
5161 : {
5162 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->EncryptedRandomSessionKeyLen));
5163 0 : if (PyLong_Check(value)) {
5164 : unsigned long long test_var;
5165 0 : test_var = PyLong_AsUnsignedLongLong(value);
5166 0 : if (PyErr_Occurred() != NULL) {
5167 0 : return -1;
5168 : }
5169 0 : if (test_var > uint_max) {
5170 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
5171 : PyLong_Type.tp_name, uint_max, test_var);
5172 0 : return -1;
5173 : }
5174 0 : object->EncryptedRandomSessionKeyLen = test_var;
5175 : } else {
5176 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
5177 : PyLong_Type.tp_name);
5178 0 : return -1;
5179 : }
5180 : }
5181 0 : return 0;
5182 : }
5183 :
5184 0 : static PyObject *py_AUTHENTICATE_MESSAGE_get_EncryptedRandomSessionKeyMaxLen(PyObject *obj, void *closure)
5185 : {
5186 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(obj);
5187 : PyObject *py_EncryptedRandomSessionKeyMaxLen;
5188 0 : py_EncryptedRandomSessionKeyMaxLen = PyLong_FromLong((uint16_t)(object->EncryptedRandomSessionKeyMaxLen));
5189 0 : return py_EncryptedRandomSessionKeyMaxLen;
5190 : }
5191 :
5192 0 : static int py_AUTHENTICATE_MESSAGE_set_EncryptedRandomSessionKeyMaxLen(PyObject *py_obj, PyObject *value, void *closure)
5193 : {
5194 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(py_obj);
5195 0 : if (value == NULL) {
5196 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->EncryptedRandomSessionKeyMaxLen");
5197 0 : return -1;
5198 : }
5199 : {
5200 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->EncryptedRandomSessionKeyMaxLen));
5201 0 : if (PyLong_Check(value)) {
5202 : unsigned long long test_var;
5203 0 : test_var = PyLong_AsUnsignedLongLong(value);
5204 0 : if (PyErr_Occurred() != NULL) {
5205 0 : return -1;
5206 : }
5207 0 : if (test_var > uint_max) {
5208 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
5209 : PyLong_Type.tp_name, uint_max, test_var);
5210 0 : return -1;
5211 : }
5212 0 : object->EncryptedRandomSessionKeyMaxLen = test_var;
5213 : } else {
5214 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
5215 : PyLong_Type.tp_name);
5216 0 : return -1;
5217 : }
5218 : }
5219 0 : return 0;
5220 : }
5221 :
5222 0 : static PyObject *py_AUTHENTICATE_MESSAGE_get_EncryptedRandomSessionKey(PyObject *obj, void *closure)
5223 : {
5224 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(obj);
5225 : PyObject *py_EncryptedRandomSessionKey;
5226 0 : if (object->EncryptedRandomSessionKey == NULL) {
5227 0 : Py_RETURN_NONE;
5228 : }
5229 0 : if (object->EncryptedRandomSessionKey == NULL) {
5230 0 : py_EncryptedRandomSessionKey = Py_None;
5231 0 : Py_INCREF(py_EncryptedRandomSessionKey);
5232 : } else {
5233 0 : py_EncryptedRandomSessionKey = PyBytes_FromStringAndSize((char *)(*object->EncryptedRandomSessionKey).data, (*object->EncryptedRandomSessionKey).length);
5234 : }
5235 0 : return py_EncryptedRandomSessionKey;
5236 : }
5237 :
5238 0 : static int py_AUTHENTICATE_MESSAGE_set_EncryptedRandomSessionKey(PyObject *py_obj, PyObject *value, void *closure)
5239 : {
5240 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(py_obj);
5241 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->EncryptedRandomSessionKey));
5242 0 : if (value == NULL) {
5243 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->EncryptedRandomSessionKey");
5244 0 : return -1;
5245 : }
5246 0 : if (value == Py_None) {
5247 0 : object->EncryptedRandomSessionKey = NULL;
5248 : } else {
5249 0 : object->EncryptedRandomSessionKey = talloc_ptrtype(pytalloc_get_mem_ctx(py_obj), object->EncryptedRandomSessionKey);
5250 0 : if (object->EncryptedRandomSessionKey == NULL) {
5251 0 : PyErr_NoMemory();
5252 0 : return -1;
5253 : }
5254 0 : *object->EncryptedRandomSessionKey = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
5255 : }
5256 0 : return 0;
5257 : }
5258 :
5259 0 : static PyObject *py_AUTHENTICATE_MESSAGE_get_NegotiateFlags(PyObject *obj, void *closure)
5260 : {
5261 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(obj);
5262 : PyObject *py_NegotiateFlags;
5263 0 : py_NegotiateFlags = PyLong_FromUnsignedLongLong((uint32_t)(object->NegotiateFlags));
5264 0 : return py_NegotiateFlags;
5265 : }
5266 :
5267 0 : static int py_AUTHENTICATE_MESSAGE_set_NegotiateFlags(PyObject *py_obj, PyObject *value, void *closure)
5268 : {
5269 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(py_obj);
5270 0 : if (value == NULL) {
5271 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->NegotiateFlags");
5272 0 : return -1;
5273 : }
5274 : {
5275 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->NegotiateFlags));
5276 0 : if (PyLong_Check(value)) {
5277 : unsigned long long test_var;
5278 0 : test_var = PyLong_AsUnsignedLongLong(value);
5279 0 : if (PyErr_Occurred() != NULL) {
5280 0 : return -1;
5281 : }
5282 0 : if (test_var > uint_max) {
5283 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
5284 : PyLong_Type.tp_name, uint_max, test_var);
5285 0 : return -1;
5286 : }
5287 0 : object->NegotiateFlags = test_var;
5288 : } else {
5289 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
5290 : PyLong_Type.tp_name);
5291 0 : return -1;
5292 : }
5293 : }
5294 0 : return 0;
5295 : }
5296 :
5297 0 : static PyObject *py_AUTHENTICATE_MESSAGE_get_Version(PyObject *obj, void *closure)
5298 : {
5299 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(obj);
5300 : PyObject *py_Version;
5301 0 : py_Version = pyrpc_import_union(&ntlmssp_Version_Type, pytalloc_get_mem_ctx(obj), object->NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION, &object->Version, "union ntlmssp_Version");
5302 0 : if (py_Version == NULL) {
5303 0 : return NULL;
5304 : }
5305 0 : return py_Version;
5306 : }
5307 :
5308 0 : static int py_AUTHENTICATE_MESSAGE_set_Version(PyObject *py_obj, PyObject *value, void *closure)
5309 : {
5310 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(py_obj);
5311 0 : if (value == NULL) {
5312 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->Version");
5313 0 : return -1;
5314 : }
5315 : {
5316 : union ntlmssp_Version *Version_switch_0;
5317 0 : Version_switch_0 = (union ntlmssp_Version *)pyrpc_export_union(&ntlmssp_Version_Type, pytalloc_get_mem_ctx(py_obj), object->NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION, value, "union ntlmssp_Version");
5318 0 : if (Version_switch_0 == NULL) {
5319 0 : return -1;
5320 : }
5321 0 : object->Version = *Version_switch_0;
5322 : }
5323 0 : return 0;
5324 : }
5325 :
5326 : static PyGetSetDef py_AUTHENTICATE_MESSAGE_getsetters[] = {
5327 : {
5328 : .name = discard_const_p(char, "Signature"),
5329 : .get = py_AUTHENTICATE_MESSAGE_get_Signature,
5330 : .set = py_AUTHENTICATE_MESSAGE_set_Signature,
5331 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
5332 : },
5333 : {
5334 : .name = discard_const_p(char, "MessageType"),
5335 : .get = py_AUTHENTICATE_MESSAGE_get_MessageType,
5336 : .set = py_AUTHENTICATE_MESSAGE_set_MessageType,
5337 : .doc = discard_const_p(char, "PIDL-generated element of base type ntlmssp_MessageType")
5338 : },
5339 : {
5340 : .name = discard_const_p(char, "LmChallengeResponseLen"),
5341 : .get = py_AUTHENTICATE_MESSAGE_get_LmChallengeResponseLen,
5342 : .set = py_AUTHENTICATE_MESSAGE_set_LmChallengeResponseLen,
5343 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
5344 : },
5345 : {
5346 : .name = discard_const_p(char, "LmChallengeResponseMaxLen"),
5347 : .get = py_AUTHENTICATE_MESSAGE_get_LmChallengeResponseMaxLen,
5348 : .set = py_AUTHENTICATE_MESSAGE_set_LmChallengeResponseMaxLen,
5349 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
5350 : },
5351 : {
5352 : .name = discard_const_p(char, "LmChallengeResponse"),
5353 : .get = py_AUTHENTICATE_MESSAGE_get_LmChallengeResponse,
5354 : .set = py_AUTHENTICATE_MESSAGE_set_LmChallengeResponse,
5355 : .doc = discard_const_p(char, "PIDL-generated element of base type ntlmssp_LM_RESPONSE_with_len")
5356 : },
5357 : {
5358 : .name = discard_const_p(char, "NtChallengeResponseLen"),
5359 : .get = py_AUTHENTICATE_MESSAGE_get_NtChallengeResponseLen,
5360 : .set = py_AUTHENTICATE_MESSAGE_set_NtChallengeResponseLen,
5361 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
5362 : },
5363 : {
5364 : .name = discard_const_p(char, "NtChallengeResponseMaxLen"),
5365 : .get = py_AUTHENTICATE_MESSAGE_get_NtChallengeResponseMaxLen,
5366 : .set = py_AUTHENTICATE_MESSAGE_set_NtChallengeResponseMaxLen,
5367 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
5368 : },
5369 : {
5370 : .name = discard_const_p(char, "NtChallengeResponse"),
5371 : .get = py_AUTHENTICATE_MESSAGE_get_NtChallengeResponse,
5372 : .set = py_AUTHENTICATE_MESSAGE_set_NtChallengeResponse,
5373 : .doc = discard_const_p(char, "PIDL-generated element of base type ntlmssp_NTLM_RESPONSE_with_len")
5374 : },
5375 : {
5376 : .name = discard_const_p(char, "DomainNameLen"),
5377 : .get = py_AUTHENTICATE_MESSAGE_get_DomainNameLen,
5378 : .set = py_AUTHENTICATE_MESSAGE_set_DomainNameLen,
5379 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
5380 : },
5381 : {
5382 : .name = discard_const_p(char, "DomainNameMaxLen"),
5383 : .get = py_AUTHENTICATE_MESSAGE_get_DomainNameMaxLen,
5384 : .set = py_AUTHENTICATE_MESSAGE_set_DomainNameMaxLen,
5385 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
5386 : },
5387 : {
5388 : .name = discard_const_p(char, "DomainName"),
5389 : .get = py_AUTHENTICATE_MESSAGE_get_DomainName,
5390 : .set = py_AUTHENTICATE_MESSAGE_set_DomainName,
5391 : .doc = discard_const_p(char, "PIDL-generated element of base type string")
5392 : },
5393 : {
5394 : .name = discard_const_p(char, "UserNameLen"),
5395 : .get = py_AUTHENTICATE_MESSAGE_get_UserNameLen,
5396 : .set = py_AUTHENTICATE_MESSAGE_set_UserNameLen,
5397 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
5398 : },
5399 : {
5400 : .name = discard_const_p(char, "UserNameMaxLen"),
5401 : .get = py_AUTHENTICATE_MESSAGE_get_UserNameMaxLen,
5402 : .set = py_AUTHENTICATE_MESSAGE_set_UserNameMaxLen,
5403 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
5404 : },
5405 : {
5406 : .name = discard_const_p(char, "UserName"),
5407 : .get = py_AUTHENTICATE_MESSAGE_get_UserName,
5408 : .set = py_AUTHENTICATE_MESSAGE_set_UserName,
5409 : .doc = discard_const_p(char, "PIDL-generated element of base type string")
5410 : },
5411 : {
5412 : .name = discard_const_p(char, "WorkstationLen"),
5413 : .get = py_AUTHENTICATE_MESSAGE_get_WorkstationLen,
5414 : .set = py_AUTHENTICATE_MESSAGE_set_WorkstationLen,
5415 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
5416 : },
5417 : {
5418 : .name = discard_const_p(char, "WorkstationMaxLen"),
5419 : .get = py_AUTHENTICATE_MESSAGE_get_WorkstationMaxLen,
5420 : .set = py_AUTHENTICATE_MESSAGE_set_WorkstationMaxLen,
5421 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
5422 : },
5423 : {
5424 : .name = discard_const_p(char, "Workstation"),
5425 : .get = py_AUTHENTICATE_MESSAGE_get_Workstation,
5426 : .set = py_AUTHENTICATE_MESSAGE_set_Workstation,
5427 : .doc = discard_const_p(char, "PIDL-generated element of base type string")
5428 : },
5429 : {
5430 : .name = discard_const_p(char, "EncryptedRandomSessionKeyLen"),
5431 : .get = py_AUTHENTICATE_MESSAGE_get_EncryptedRandomSessionKeyLen,
5432 : .set = py_AUTHENTICATE_MESSAGE_set_EncryptedRandomSessionKeyLen,
5433 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
5434 : },
5435 : {
5436 : .name = discard_const_p(char, "EncryptedRandomSessionKeyMaxLen"),
5437 : .get = py_AUTHENTICATE_MESSAGE_get_EncryptedRandomSessionKeyMaxLen,
5438 : .set = py_AUTHENTICATE_MESSAGE_set_EncryptedRandomSessionKeyMaxLen,
5439 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
5440 : },
5441 : {
5442 : .name = discard_const_p(char, "EncryptedRandomSessionKey"),
5443 : .get = py_AUTHENTICATE_MESSAGE_get_EncryptedRandomSessionKey,
5444 : .set = py_AUTHENTICATE_MESSAGE_set_EncryptedRandomSessionKey,
5445 : .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
5446 : },
5447 : {
5448 : .name = discard_const_p(char, "NegotiateFlags"),
5449 : .get = py_AUTHENTICATE_MESSAGE_get_NegotiateFlags,
5450 : .set = py_AUTHENTICATE_MESSAGE_set_NegotiateFlags,
5451 : .doc = discard_const_p(char, "PIDL-generated element of base type NEGOTIATE")
5452 : },
5453 : {
5454 : .name = discard_const_p(char, "Version"),
5455 : .get = py_AUTHENTICATE_MESSAGE_get_Version,
5456 : .set = py_AUTHENTICATE_MESSAGE_set_Version,
5457 : .doc = discard_const_p(char, "PIDL-generated element of base type ntlmssp_Version")
5458 : },
5459 : { .name = NULL }
5460 : };
5461 :
5462 0 : static PyObject *py_AUTHENTICATE_MESSAGE_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
5463 : {
5464 0 : return pytalloc_new(struct AUTHENTICATE_MESSAGE, type);
5465 : }
5466 :
5467 0 : static PyObject *py_AUTHENTICATE_MESSAGE_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
5468 : {
5469 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(py_obj);
5470 0 : PyObject *ret = NULL;
5471 : DATA_BLOB blob;
5472 : enum ndr_err_code err;
5473 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
5474 0 : if (tmp_ctx == NULL) {
5475 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
5476 0 : return NULL;
5477 : }
5478 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_AUTHENTICATE_MESSAGE);
5479 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
5480 0 : TALLOC_FREE(tmp_ctx);
5481 0 : PyErr_SetNdrError(err);
5482 0 : return NULL;
5483 : }
5484 :
5485 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
5486 0 : TALLOC_FREE(tmp_ctx);
5487 0 : return ret;
5488 : }
5489 :
5490 0 : static PyObject *py_AUTHENTICATE_MESSAGE_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
5491 : {
5492 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(py_obj);
5493 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
5494 0 : Py_ssize_t blob_length = 0;
5495 : enum ndr_err_code err;
5496 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
5497 0 : PyObject *allow_remaining_obj = NULL;
5498 0 : bool allow_remaining = false;
5499 :
5500 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
5501 : discard_const_p(char *, kwnames),
5502 : &blob.data, &blob_length,
5503 : &allow_remaining_obj)) {
5504 0 : return NULL;
5505 : }
5506 0 : blob.length = blob_length;
5507 :
5508 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
5509 0 : allow_remaining = true;
5510 : }
5511 :
5512 0 : if (allow_remaining) {
5513 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_AUTHENTICATE_MESSAGE);
5514 : } else {
5515 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_AUTHENTICATE_MESSAGE);
5516 : }
5517 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
5518 0 : PyErr_SetNdrError(err);
5519 0 : return NULL;
5520 : }
5521 :
5522 0 : Py_RETURN_NONE;
5523 : }
5524 :
5525 0 : static PyObject *py_AUTHENTICATE_MESSAGE_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
5526 : {
5527 0 : struct AUTHENTICATE_MESSAGE *object = pytalloc_get_ptr(py_obj);
5528 : PyObject *ret;
5529 : char *retstr;
5530 :
5531 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_AUTHENTICATE_MESSAGE, "AUTHENTICATE_MESSAGE", object);
5532 0 : ret = PyUnicode_FromString(retstr);
5533 0 : talloc_free(retstr);
5534 :
5535 0 : return ret;
5536 : }
5537 :
5538 : static PyMethodDef py_AUTHENTICATE_MESSAGE_methods[] = {
5539 : { "__ndr_pack__", (PyCFunction)py_AUTHENTICATE_MESSAGE_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
5540 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_AUTHENTICATE_MESSAGE_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
5541 : { "__ndr_print__", (PyCFunction)py_AUTHENTICATE_MESSAGE_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
5542 : { NULL, NULL, 0, NULL }
5543 : };
5544 :
5545 :
5546 : static PyTypeObject AUTHENTICATE_MESSAGE_Type = {
5547 : PyVarObject_HEAD_INIT(NULL, 0)
5548 : .tp_name = "ntlmssp.AUTHENTICATE_MESSAGE",
5549 : .tp_getset = py_AUTHENTICATE_MESSAGE_getsetters,
5550 : .tp_methods = py_AUTHENTICATE_MESSAGE_methods,
5551 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
5552 : .tp_new = py_AUTHENTICATE_MESSAGE_new,
5553 : };
5554 :
5555 :
5556 0 : static PyObject *py_NTLMSSP_MESSAGE_SIGNATURE_get_Version(PyObject *obj, void *closure)
5557 : {
5558 0 : struct NTLMSSP_MESSAGE_SIGNATURE *object = pytalloc_get_ptr(obj);
5559 : PyObject *py_Version;
5560 0 : py_Version = PyLong_FromUnsignedLongLong((uint32_t)(object->Version));
5561 0 : return py_Version;
5562 : }
5563 :
5564 0 : static int py_NTLMSSP_MESSAGE_SIGNATURE_set_Version(PyObject *py_obj, PyObject *value, void *closure)
5565 : {
5566 0 : struct NTLMSSP_MESSAGE_SIGNATURE *object = pytalloc_get_ptr(py_obj);
5567 0 : if (value == NULL) {
5568 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->Version");
5569 0 : return -1;
5570 : }
5571 : {
5572 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->Version));
5573 0 : if (PyLong_Check(value)) {
5574 : unsigned long long test_var;
5575 0 : test_var = PyLong_AsUnsignedLongLong(value);
5576 0 : if (PyErr_Occurred() != NULL) {
5577 0 : return -1;
5578 : }
5579 0 : if (test_var > uint_max) {
5580 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
5581 : PyLong_Type.tp_name, uint_max, test_var);
5582 0 : return -1;
5583 : }
5584 0 : object->Version = test_var;
5585 : } else {
5586 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
5587 : PyLong_Type.tp_name);
5588 0 : return -1;
5589 : }
5590 : }
5591 0 : return 0;
5592 : }
5593 :
5594 0 : static PyObject *py_NTLMSSP_MESSAGE_SIGNATURE_get_RandomPad(PyObject *obj, void *closure)
5595 : {
5596 0 : struct NTLMSSP_MESSAGE_SIGNATURE *object = pytalloc_get_ptr(obj);
5597 : PyObject *py_RandomPad;
5598 0 : py_RandomPad = PyLong_FromUnsignedLongLong((uint32_t)(object->RandomPad));
5599 0 : return py_RandomPad;
5600 : }
5601 :
5602 0 : static int py_NTLMSSP_MESSAGE_SIGNATURE_set_RandomPad(PyObject *py_obj, PyObject *value, void *closure)
5603 : {
5604 0 : struct NTLMSSP_MESSAGE_SIGNATURE *object = pytalloc_get_ptr(py_obj);
5605 0 : if (value == NULL) {
5606 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->RandomPad");
5607 0 : return -1;
5608 : }
5609 : {
5610 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->RandomPad));
5611 0 : if (PyLong_Check(value)) {
5612 : unsigned long long test_var;
5613 0 : test_var = PyLong_AsUnsignedLongLong(value);
5614 0 : if (PyErr_Occurred() != NULL) {
5615 0 : return -1;
5616 : }
5617 0 : if (test_var > uint_max) {
5618 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
5619 : PyLong_Type.tp_name, uint_max, test_var);
5620 0 : return -1;
5621 : }
5622 0 : object->RandomPad = test_var;
5623 : } else {
5624 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
5625 : PyLong_Type.tp_name);
5626 0 : return -1;
5627 : }
5628 : }
5629 0 : return 0;
5630 : }
5631 :
5632 0 : static PyObject *py_NTLMSSP_MESSAGE_SIGNATURE_get_Checksum(PyObject *obj, void *closure)
5633 : {
5634 0 : struct NTLMSSP_MESSAGE_SIGNATURE *object = pytalloc_get_ptr(obj);
5635 : PyObject *py_Checksum;
5636 0 : py_Checksum = PyLong_FromUnsignedLongLong((uint32_t)(object->Checksum));
5637 0 : return py_Checksum;
5638 : }
5639 :
5640 0 : static int py_NTLMSSP_MESSAGE_SIGNATURE_set_Checksum(PyObject *py_obj, PyObject *value, void *closure)
5641 : {
5642 0 : struct NTLMSSP_MESSAGE_SIGNATURE *object = pytalloc_get_ptr(py_obj);
5643 0 : if (value == NULL) {
5644 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->Checksum");
5645 0 : return -1;
5646 : }
5647 : {
5648 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->Checksum));
5649 0 : if (PyLong_Check(value)) {
5650 : unsigned long long test_var;
5651 0 : test_var = PyLong_AsUnsignedLongLong(value);
5652 0 : if (PyErr_Occurred() != NULL) {
5653 0 : return -1;
5654 : }
5655 0 : if (test_var > uint_max) {
5656 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
5657 : PyLong_Type.tp_name, uint_max, test_var);
5658 0 : return -1;
5659 : }
5660 0 : object->Checksum = test_var;
5661 : } else {
5662 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
5663 : PyLong_Type.tp_name);
5664 0 : return -1;
5665 : }
5666 : }
5667 0 : return 0;
5668 : }
5669 :
5670 0 : static PyObject *py_NTLMSSP_MESSAGE_SIGNATURE_get_SeqNum(PyObject *obj, void *closure)
5671 : {
5672 0 : struct NTLMSSP_MESSAGE_SIGNATURE *object = pytalloc_get_ptr(obj);
5673 : PyObject *py_SeqNum;
5674 0 : py_SeqNum = PyLong_FromUnsignedLongLong((uint32_t)(object->SeqNum));
5675 0 : return py_SeqNum;
5676 : }
5677 :
5678 0 : static int py_NTLMSSP_MESSAGE_SIGNATURE_set_SeqNum(PyObject *py_obj, PyObject *value, void *closure)
5679 : {
5680 0 : struct NTLMSSP_MESSAGE_SIGNATURE *object = pytalloc_get_ptr(py_obj);
5681 0 : if (value == NULL) {
5682 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->SeqNum");
5683 0 : return -1;
5684 : }
5685 : {
5686 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->SeqNum));
5687 0 : if (PyLong_Check(value)) {
5688 : unsigned long long test_var;
5689 0 : test_var = PyLong_AsUnsignedLongLong(value);
5690 0 : if (PyErr_Occurred() != NULL) {
5691 0 : return -1;
5692 : }
5693 0 : if (test_var > uint_max) {
5694 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
5695 : PyLong_Type.tp_name, uint_max, test_var);
5696 0 : return -1;
5697 : }
5698 0 : object->SeqNum = test_var;
5699 : } else {
5700 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
5701 : PyLong_Type.tp_name);
5702 0 : return -1;
5703 : }
5704 : }
5705 0 : return 0;
5706 : }
5707 :
5708 : static PyGetSetDef py_NTLMSSP_MESSAGE_SIGNATURE_getsetters[] = {
5709 : {
5710 : .name = discard_const_p(char, "Version"),
5711 : .get = py_NTLMSSP_MESSAGE_SIGNATURE_get_Version,
5712 : .set = py_NTLMSSP_MESSAGE_SIGNATURE_set_Version,
5713 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
5714 : },
5715 : {
5716 : .name = discard_const_p(char, "RandomPad"),
5717 : .get = py_NTLMSSP_MESSAGE_SIGNATURE_get_RandomPad,
5718 : .set = py_NTLMSSP_MESSAGE_SIGNATURE_set_RandomPad,
5719 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
5720 : },
5721 : {
5722 : .name = discard_const_p(char, "Checksum"),
5723 : .get = py_NTLMSSP_MESSAGE_SIGNATURE_get_Checksum,
5724 : .set = py_NTLMSSP_MESSAGE_SIGNATURE_set_Checksum,
5725 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
5726 : },
5727 : {
5728 : .name = discard_const_p(char, "SeqNum"),
5729 : .get = py_NTLMSSP_MESSAGE_SIGNATURE_get_SeqNum,
5730 : .set = py_NTLMSSP_MESSAGE_SIGNATURE_set_SeqNum,
5731 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
5732 : },
5733 : { .name = NULL }
5734 : };
5735 :
5736 0 : static PyObject *py_NTLMSSP_MESSAGE_SIGNATURE_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
5737 : {
5738 0 : return pytalloc_new(struct NTLMSSP_MESSAGE_SIGNATURE, type);
5739 : }
5740 :
5741 0 : static PyObject *py_NTLMSSP_MESSAGE_SIGNATURE_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
5742 : {
5743 0 : struct NTLMSSP_MESSAGE_SIGNATURE *object = pytalloc_get_ptr(py_obj);
5744 0 : PyObject *ret = NULL;
5745 : DATA_BLOB blob;
5746 : enum ndr_err_code err;
5747 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
5748 0 : if (tmp_ctx == NULL) {
5749 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
5750 0 : return NULL;
5751 : }
5752 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_NTLMSSP_MESSAGE_SIGNATURE);
5753 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
5754 0 : TALLOC_FREE(tmp_ctx);
5755 0 : PyErr_SetNdrError(err);
5756 0 : return NULL;
5757 : }
5758 :
5759 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
5760 0 : TALLOC_FREE(tmp_ctx);
5761 0 : return ret;
5762 : }
5763 :
5764 0 : static PyObject *py_NTLMSSP_MESSAGE_SIGNATURE_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
5765 : {
5766 0 : struct NTLMSSP_MESSAGE_SIGNATURE *object = pytalloc_get_ptr(py_obj);
5767 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
5768 0 : Py_ssize_t blob_length = 0;
5769 : enum ndr_err_code err;
5770 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
5771 0 : PyObject *allow_remaining_obj = NULL;
5772 0 : bool allow_remaining = false;
5773 :
5774 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
5775 : discard_const_p(char *, kwnames),
5776 : &blob.data, &blob_length,
5777 : &allow_remaining_obj)) {
5778 0 : return NULL;
5779 : }
5780 0 : blob.length = blob_length;
5781 :
5782 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
5783 0 : allow_remaining = true;
5784 : }
5785 :
5786 0 : if (allow_remaining) {
5787 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_NTLMSSP_MESSAGE_SIGNATURE);
5788 : } else {
5789 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_NTLMSSP_MESSAGE_SIGNATURE);
5790 : }
5791 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
5792 0 : PyErr_SetNdrError(err);
5793 0 : return NULL;
5794 : }
5795 :
5796 0 : Py_RETURN_NONE;
5797 : }
5798 :
5799 0 : static PyObject *py_NTLMSSP_MESSAGE_SIGNATURE_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
5800 : {
5801 0 : struct NTLMSSP_MESSAGE_SIGNATURE *object = pytalloc_get_ptr(py_obj);
5802 : PyObject *ret;
5803 : char *retstr;
5804 :
5805 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_NTLMSSP_MESSAGE_SIGNATURE, "NTLMSSP_MESSAGE_SIGNATURE", object);
5806 0 : ret = PyUnicode_FromString(retstr);
5807 0 : talloc_free(retstr);
5808 :
5809 0 : return ret;
5810 : }
5811 :
5812 : static PyMethodDef py_NTLMSSP_MESSAGE_SIGNATURE_methods[] = {
5813 : { "__ndr_pack__", (PyCFunction)py_NTLMSSP_MESSAGE_SIGNATURE_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
5814 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_NTLMSSP_MESSAGE_SIGNATURE_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
5815 : { "__ndr_print__", (PyCFunction)py_NTLMSSP_MESSAGE_SIGNATURE_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
5816 : { NULL, NULL, 0, NULL }
5817 : };
5818 :
5819 :
5820 : static PyTypeObject NTLMSSP_MESSAGE_SIGNATURE_Type = {
5821 : PyVarObject_HEAD_INIT(NULL, 0)
5822 : .tp_name = "ntlmssp.NTLMSSP_MESSAGE_SIGNATURE",
5823 : .tp_getset = py_NTLMSSP_MESSAGE_SIGNATURE_getsetters,
5824 : .tp_methods = py_NTLMSSP_MESSAGE_SIGNATURE_methods,
5825 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
5826 : .tp_new = py_NTLMSSP_MESSAGE_SIGNATURE_new,
5827 : };
5828 :
5829 :
5830 0 : static PyObject *py_NTLMSSP_MESSAGE_SIGNATURE_NTLMv2_get_Version(PyObject *obj, void *closure)
5831 : {
5832 0 : struct NTLMSSP_MESSAGE_SIGNATURE_NTLMv2 *object = pytalloc_get_ptr(obj);
5833 : PyObject *py_Version;
5834 0 : py_Version = PyLong_FromUnsignedLongLong((uint32_t)(object->Version));
5835 0 : return py_Version;
5836 : }
5837 :
5838 0 : static int py_NTLMSSP_MESSAGE_SIGNATURE_NTLMv2_set_Version(PyObject *py_obj, PyObject *value, void *closure)
5839 : {
5840 0 : struct NTLMSSP_MESSAGE_SIGNATURE_NTLMv2 *object = pytalloc_get_ptr(py_obj);
5841 0 : if (value == NULL) {
5842 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->Version");
5843 0 : return -1;
5844 : }
5845 : {
5846 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->Version));
5847 0 : if (PyLong_Check(value)) {
5848 : unsigned long long test_var;
5849 0 : test_var = PyLong_AsUnsignedLongLong(value);
5850 0 : if (PyErr_Occurred() != NULL) {
5851 0 : return -1;
5852 : }
5853 0 : if (test_var > uint_max) {
5854 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
5855 : PyLong_Type.tp_name, uint_max, test_var);
5856 0 : return -1;
5857 : }
5858 0 : object->Version = test_var;
5859 : } else {
5860 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
5861 : PyLong_Type.tp_name);
5862 0 : return -1;
5863 : }
5864 : }
5865 0 : return 0;
5866 : }
5867 :
5868 0 : static PyObject *py_NTLMSSP_MESSAGE_SIGNATURE_NTLMv2_get_Checksum(PyObject *obj, void *closure)
5869 : {
5870 0 : struct NTLMSSP_MESSAGE_SIGNATURE_NTLMv2 *object = pytalloc_get_ptr(obj);
5871 : PyObject *py_Checksum;
5872 0 : py_Checksum = PyList_New(8);
5873 0 : if (py_Checksum == NULL) {
5874 0 : return NULL;
5875 : }
5876 : {
5877 : int Checksum_cntr_0;
5878 0 : for (Checksum_cntr_0 = 0; Checksum_cntr_0 < (8); Checksum_cntr_0++) {
5879 : PyObject *py_Checksum_0;
5880 0 : py_Checksum_0 = PyLong_FromLong((uint16_t)((object->Checksum)[Checksum_cntr_0]));
5881 0 : PyList_SetItem(py_Checksum, Checksum_cntr_0, py_Checksum_0);
5882 : }
5883 : }
5884 0 : return py_Checksum;
5885 : }
5886 :
5887 0 : static int py_NTLMSSP_MESSAGE_SIGNATURE_NTLMv2_set_Checksum(PyObject *py_obj, PyObject *value, void *closure)
5888 : {
5889 0 : struct NTLMSSP_MESSAGE_SIGNATURE_NTLMv2 *object = pytalloc_get_ptr(py_obj);
5890 0 : if (value == NULL) {
5891 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->Checksum");
5892 0 : return -1;
5893 : }
5894 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
5895 : {
5896 : int Checksum_cntr_0;
5897 0 : if (ARRAY_SIZE(object->Checksum) != PyList_GET_SIZE(value)) {
5898 0 : PyErr_Format(PyExc_TypeError, "Expected list of type %s, length %zu, got %zd", Py_TYPE(value)->tp_name, ARRAY_SIZE(object->Checksum), PyList_GET_SIZE(value));
5899 0 : return -1;
5900 : }
5901 0 : for (Checksum_cntr_0 = 0; Checksum_cntr_0 < PyList_GET_SIZE(value); Checksum_cntr_0++) {
5902 0 : if (PyList_GET_ITEM(value, Checksum_cntr_0) == NULL) {
5903 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->Checksum)[Checksum_cntr_0]");
5904 0 : return -1;
5905 : }
5906 : {
5907 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((object->Checksum)[Checksum_cntr_0]));
5908 0 : if (PyLong_Check(PyList_GET_ITEM(value, Checksum_cntr_0))) {
5909 : unsigned long long test_var;
5910 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, Checksum_cntr_0));
5911 0 : if (PyErr_Occurred() != NULL) {
5912 0 : return -1;
5913 : }
5914 0 : if (test_var > uint_max) {
5915 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
5916 : PyLong_Type.tp_name, uint_max, test_var);
5917 0 : return -1;
5918 : }
5919 0 : (object->Checksum)[Checksum_cntr_0] = test_var;
5920 : } else {
5921 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
5922 : PyLong_Type.tp_name);
5923 0 : return -1;
5924 : }
5925 : }
5926 : }
5927 : }
5928 0 : return 0;
5929 : }
5930 :
5931 0 : static PyObject *py_NTLMSSP_MESSAGE_SIGNATURE_NTLMv2_get_SeqNum(PyObject *obj, void *closure)
5932 : {
5933 0 : struct NTLMSSP_MESSAGE_SIGNATURE_NTLMv2 *object = pytalloc_get_ptr(obj);
5934 : PyObject *py_SeqNum;
5935 0 : py_SeqNum = PyLong_FromUnsignedLongLong((uint32_t)(object->SeqNum));
5936 0 : return py_SeqNum;
5937 : }
5938 :
5939 0 : static int py_NTLMSSP_MESSAGE_SIGNATURE_NTLMv2_set_SeqNum(PyObject *py_obj, PyObject *value, void *closure)
5940 : {
5941 0 : struct NTLMSSP_MESSAGE_SIGNATURE_NTLMv2 *object = pytalloc_get_ptr(py_obj);
5942 0 : if (value == NULL) {
5943 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->SeqNum");
5944 0 : return -1;
5945 : }
5946 : {
5947 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->SeqNum));
5948 0 : if (PyLong_Check(value)) {
5949 : unsigned long long test_var;
5950 0 : test_var = PyLong_AsUnsignedLongLong(value);
5951 0 : if (PyErr_Occurred() != NULL) {
5952 0 : return -1;
5953 : }
5954 0 : if (test_var > uint_max) {
5955 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
5956 : PyLong_Type.tp_name, uint_max, test_var);
5957 0 : return -1;
5958 : }
5959 0 : object->SeqNum = test_var;
5960 : } else {
5961 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
5962 : PyLong_Type.tp_name);
5963 0 : return -1;
5964 : }
5965 : }
5966 0 : return 0;
5967 : }
5968 :
5969 : static PyGetSetDef py_NTLMSSP_MESSAGE_SIGNATURE_NTLMv2_getsetters[] = {
5970 : {
5971 : .name = discard_const_p(char, "Version"),
5972 : .get = py_NTLMSSP_MESSAGE_SIGNATURE_NTLMv2_get_Version,
5973 : .set = py_NTLMSSP_MESSAGE_SIGNATURE_NTLMv2_set_Version,
5974 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
5975 : },
5976 : {
5977 : .name = discard_const_p(char, "Checksum"),
5978 : .get = py_NTLMSSP_MESSAGE_SIGNATURE_NTLMv2_get_Checksum,
5979 : .set = py_NTLMSSP_MESSAGE_SIGNATURE_NTLMv2_set_Checksum,
5980 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
5981 : },
5982 : {
5983 : .name = discard_const_p(char, "SeqNum"),
5984 : .get = py_NTLMSSP_MESSAGE_SIGNATURE_NTLMv2_get_SeqNum,
5985 : .set = py_NTLMSSP_MESSAGE_SIGNATURE_NTLMv2_set_SeqNum,
5986 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
5987 : },
5988 : { .name = NULL }
5989 : };
5990 :
5991 0 : static PyObject *py_NTLMSSP_MESSAGE_SIGNATURE_NTLMv2_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
5992 : {
5993 0 : return pytalloc_new(struct NTLMSSP_MESSAGE_SIGNATURE_NTLMv2, type);
5994 : }
5995 :
5996 0 : static PyObject *py_NTLMSSP_MESSAGE_SIGNATURE_NTLMv2_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
5997 : {
5998 0 : struct NTLMSSP_MESSAGE_SIGNATURE_NTLMv2 *object = pytalloc_get_ptr(py_obj);
5999 0 : PyObject *ret = NULL;
6000 : DATA_BLOB blob;
6001 : enum ndr_err_code err;
6002 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
6003 0 : if (tmp_ctx == NULL) {
6004 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
6005 0 : return NULL;
6006 : }
6007 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_NTLMSSP_MESSAGE_SIGNATURE_NTLMv2);
6008 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
6009 0 : TALLOC_FREE(tmp_ctx);
6010 0 : PyErr_SetNdrError(err);
6011 0 : return NULL;
6012 : }
6013 :
6014 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
6015 0 : TALLOC_FREE(tmp_ctx);
6016 0 : return ret;
6017 : }
6018 :
6019 0 : static PyObject *py_NTLMSSP_MESSAGE_SIGNATURE_NTLMv2_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
6020 : {
6021 0 : struct NTLMSSP_MESSAGE_SIGNATURE_NTLMv2 *object = pytalloc_get_ptr(py_obj);
6022 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
6023 0 : Py_ssize_t blob_length = 0;
6024 : enum ndr_err_code err;
6025 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
6026 0 : PyObject *allow_remaining_obj = NULL;
6027 0 : bool allow_remaining = false;
6028 :
6029 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
6030 : discard_const_p(char *, kwnames),
6031 : &blob.data, &blob_length,
6032 : &allow_remaining_obj)) {
6033 0 : return NULL;
6034 : }
6035 0 : blob.length = blob_length;
6036 :
6037 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
6038 0 : allow_remaining = true;
6039 : }
6040 :
6041 0 : if (allow_remaining) {
6042 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_NTLMSSP_MESSAGE_SIGNATURE_NTLMv2);
6043 : } else {
6044 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_NTLMSSP_MESSAGE_SIGNATURE_NTLMv2);
6045 : }
6046 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
6047 0 : PyErr_SetNdrError(err);
6048 0 : return NULL;
6049 : }
6050 :
6051 0 : Py_RETURN_NONE;
6052 : }
6053 :
6054 0 : static PyObject *py_NTLMSSP_MESSAGE_SIGNATURE_NTLMv2_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
6055 : {
6056 0 : struct NTLMSSP_MESSAGE_SIGNATURE_NTLMv2 *object = pytalloc_get_ptr(py_obj);
6057 : PyObject *ret;
6058 : char *retstr;
6059 :
6060 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_NTLMSSP_MESSAGE_SIGNATURE_NTLMv2, "NTLMSSP_MESSAGE_SIGNATURE_NTLMv2", object);
6061 0 : ret = PyUnicode_FromString(retstr);
6062 0 : talloc_free(retstr);
6063 :
6064 0 : return ret;
6065 : }
6066 :
6067 : static PyMethodDef py_NTLMSSP_MESSAGE_SIGNATURE_NTLMv2_methods[] = {
6068 : { "__ndr_pack__", (PyCFunction)py_NTLMSSP_MESSAGE_SIGNATURE_NTLMv2_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
6069 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_NTLMSSP_MESSAGE_SIGNATURE_NTLMv2_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
6070 : { "__ndr_print__", (PyCFunction)py_NTLMSSP_MESSAGE_SIGNATURE_NTLMv2_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
6071 : { NULL, NULL, 0, NULL }
6072 : };
6073 :
6074 :
6075 : static PyTypeObject NTLMSSP_MESSAGE_SIGNATURE_NTLMv2_Type = {
6076 : PyVarObject_HEAD_INIT(NULL, 0)
6077 : .tp_name = "ntlmssp.NTLMSSP_MESSAGE_SIGNATURE_NTLMv2",
6078 : .tp_getset = py_NTLMSSP_MESSAGE_SIGNATURE_NTLMv2_getsetters,
6079 : .tp_methods = py_NTLMSSP_MESSAGE_SIGNATURE_NTLMv2_methods,
6080 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
6081 : .tp_new = py_NTLMSSP_MESSAGE_SIGNATURE_NTLMv2_new,
6082 : };
6083 :
6084 :
6085 : const struct PyNdrRpcMethodDef py_ndr_ntlmssp_methods[] = {
6086 : {0}
6087 : };
6088 :
6089 0 : static PyObject *interface_ntlmssp_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
6090 : {
6091 0 : return py_dcerpc_interface_init_helper(type, args, kwargs, &ndr_table_ntlmssp);
6092 : }
6093 :
6094 : #define PY_DOC_NTLMSSP "NTLM messages"
6095 : static PyTypeObject ntlmssp_InterfaceType = {
6096 : PyVarObject_HEAD_INIT(NULL, 0)
6097 : .tp_name = "ntlmssp.ntlmssp",
6098 : .tp_basicsize = sizeof(dcerpc_InterfaceObject),
6099 : .tp_doc = "ntlmssp(binding, lp_ctx=None, credentials=None) -> connection\n"
6100 : "\n"
6101 : "binding should be a DCE/RPC binding string (for example: ncacn_ip_tcp:127.0.0.1)\n"
6102 : "lp_ctx should be a path to a smb.conf file or a param.LoadParm object\n"
6103 : "credentials should be a credentials.Credentials object.\n\n"PY_DOC_NTLMSSP,
6104 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
6105 : .tp_new = interface_ntlmssp_new,
6106 : };
6107 :
6108 0 : static PyObject *syntax_ntlmssp_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
6109 : {
6110 0 : return py_dcerpc_syntax_init_helper(type, args, kwargs, &ndr_table_ntlmssp.syntax_id);
6111 : }
6112 :
6113 : #define PY_DOC_NTLMSSP_SYNTAX "NTLM messages"
6114 : static PyTypeObject ntlmssp_SyntaxType = {
6115 : PyVarObject_HEAD_INIT(NULL, 0)
6116 : .tp_name = "ntlmssp.ntlmssp_abstract_syntax",
6117 : .tp_doc = "ntlmssp_abstract_syntax()\n"PY_DOC_NTLMSSP_SYNTAX,
6118 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
6119 : .tp_new = syntax_ntlmssp_new,
6120 : };
6121 :
6122 : static PyMethodDef ntlmssp_methods[] = {
6123 : { NULL, NULL, 0, NULL }
6124 : };
6125 :
6126 : static struct PyModuleDef moduledef = {
6127 : PyModuleDef_HEAD_INIT,
6128 : .m_name = "ntlmssp",
6129 : .m_doc = "ntlmssp DCE/RPC",
6130 : .m_size = -1,
6131 : .m_methods = ntlmssp_methods,
6132 : };
6133 99 : MODULE_INIT_FUNC(ntlmssp)
6134 : {
6135 99 : PyObject *m = NULL;
6136 99 : PyObject *dep_samba_dcerpc_security = NULL;
6137 99 : PyObject *dep_talloc = NULL;
6138 99 : PyObject *dep_samba_dcerpc_base = NULL;
6139 99 : PyObject *dep_samba_dcerpc_misc = NULL;
6140 :
6141 99 : dep_samba_dcerpc_security = PyImport_ImportModule("samba.dcerpc.security");
6142 99 : if (dep_samba_dcerpc_security == NULL)
6143 0 : goto out;
6144 :
6145 99 : dep_talloc = PyImport_ImportModule("talloc");
6146 99 : if (dep_talloc == NULL)
6147 0 : goto out;
6148 :
6149 99 : dep_samba_dcerpc_base = PyImport_ImportModule("samba.dcerpc.base");
6150 99 : if (dep_samba_dcerpc_base == NULL)
6151 0 : goto out;
6152 :
6153 99 : dep_samba_dcerpc_misc = PyImport_ImportModule("samba.dcerpc.misc");
6154 99 : if (dep_samba_dcerpc_misc == NULL)
6155 0 : goto out;
6156 :
6157 99 : BaseObject_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "BaseObject");
6158 99 : if (BaseObject_Type == NULL)
6159 0 : goto out;
6160 :
6161 99 : LSAP_TOKEN_INFO_INTEGRITY_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_security, "LSAP_TOKEN_INFO_INTEGRITY");
6162 99 : if (LSAP_TOKEN_INFO_INTEGRITY_Type == NULL)
6163 0 : goto out;
6164 :
6165 99 : ClientConnection_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_base, "ClientConnection");
6166 99 : if (ClientConnection_Type == NULL)
6167 0 : goto out;
6168 :
6169 99 : ndr_syntax_id_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_misc, "ndr_syntax_id");
6170 99 : if (ndr_syntax_id_Type == NULL)
6171 0 : goto out;
6172 :
6173 99 : ntlmssp_VERSION_Type.tp_base = BaseObject_Type;
6174 99 : ntlmssp_VERSION_Type.tp_basicsize = pytalloc_BaseObject_size();
6175 :
6176 99 : ntlmssp_Version_Type.tp_base = BaseObject_Type;
6177 99 : ntlmssp_Version_Type.tp_basicsize = pytalloc_BaseObject_size();
6178 :
6179 99 : NEGOTIATE_MESSAGE_Type.tp_base = BaseObject_Type;
6180 99 : NEGOTIATE_MESSAGE_Type.tp_basicsize = pytalloc_BaseObject_size();
6181 :
6182 99 : ntlmssp_SingleHostData_Type.tp_base = BaseObject_Type;
6183 99 : ntlmssp_SingleHostData_Type.tp_basicsize = pytalloc_BaseObject_size();
6184 :
6185 99 : ntlmssp_AvValue_Type.tp_base = BaseObject_Type;
6186 99 : ntlmssp_AvValue_Type.tp_basicsize = pytalloc_BaseObject_size();
6187 :
6188 99 : AV_PAIR_Type.tp_base = BaseObject_Type;
6189 99 : AV_PAIR_Type.tp_basicsize = pytalloc_BaseObject_size();
6190 :
6191 99 : AV_PAIR_LIST_Type.tp_base = BaseObject_Type;
6192 99 : AV_PAIR_LIST_Type.tp_basicsize = pytalloc_BaseObject_size();
6193 :
6194 99 : CHALLENGE_MESSAGE_Type.tp_base = BaseObject_Type;
6195 99 : CHALLENGE_MESSAGE_Type.tp_basicsize = pytalloc_BaseObject_size();
6196 :
6197 99 : LM_RESPONSE_Type.tp_base = BaseObject_Type;
6198 99 : LM_RESPONSE_Type.tp_basicsize = pytalloc_BaseObject_size();
6199 :
6200 99 : LMv2_RESPONSE_Type.tp_base = BaseObject_Type;
6201 99 : LMv2_RESPONSE_Type.tp_basicsize = pytalloc_BaseObject_size();
6202 :
6203 99 : ntlmssp_LM_RESPONSE_with_len_Type.tp_base = BaseObject_Type;
6204 99 : ntlmssp_LM_RESPONSE_with_len_Type.tp_basicsize = pytalloc_BaseObject_size();
6205 :
6206 99 : NTLM_RESPONSE_Type.tp_base = BaseObject_Type;
6207 99 : NTLM_RESPONSE_Type.tp_basicsize = pytalloc_BaseObject_size();
6208 :
6209 99 : NTLMv2_CLIENT_CHALLENGE_Type.tp_base = BaseObject_Type;
6210 99 : NTLMv2_CLIENT_CHALLENGE_Type.tp_basicsize = pytalloc_BaseObject_size();
6211 :
6212 99 : NTLMv2_RESPONSE_Type.tp_base = BaseObject_Type;
6213 99 : NTLMv2_RESPONSE_Type.tp_basicsize = pytalloc_BaseObject_size();
6214 :
6215 99 : ntlmssp_NTLM_RESPONSE_with_len_Type.tp_base = BaseObject_Type;
6216 99 : ntlmssp_NTLM_RESPONSE_with_len_Type.tp_basicsize = pytalloc_BaseObject_size();
6217 :
6218 99 : ntlmssp_MIC_Type.tp_base = BaseObject_Type;
6219 99 : ntlmssp_MIC_Type.tp_basicsize = pytalloc_BaseObject_size();
6220 :
6221 99 : AUTHENTICATE_MESSAGE_Type.tp_base = BaseObject_Type;
6222 99 : AUTHENTICATE_MESSAGE_Type.tp_basicsize = pytalloc_BaseObject_size();
6223 :
6224 99 : NTLMSSP_MESSAGE_SIGNATURE_Type.tp_base = BaseObject_Type;
6225 99 : NTLMSSP_MESSAGE_SIGNATURE_Type.tp_basicsize = pytalloc_BaseObject_size();
6226 :
6227 99 : NTLMSSP_MESSAGE_SIGNATURE_NTLMv2_Type.tp_base = BaseObject_Type;
6228 99 : NTLMSSP_MESSAGE_SIGNATURE_NTLMv2_Type.tp_basicsize = pytalloc_BaseObject_size();
6229 :
6230 99 : ntlmssp_InterfaceType.tp_base = ClientConnection_Type;
6231 :
6232 99 : ntlmssp_SyntaxType.tp_base = ndr_syntax_id_Type;
6233 99 : ntlmssp_SyntaxType.tp_basicsize = pytalloc_BaseObject_size();
6234 :
6235 99 : if (PyType_Ready(&ntlmssp_VERSION_Type) < 0)
6236 0 : goto out;
6237 99 : if (PyType_Ready(&ntlmssp_Version_Type) < 0)
6238 0 : goto out;
6239 99 : if (PyType_Ready(&NEGOTIATE_MESSAGE_Type) < 0)
6240 0 : goto out;
6241 99 : if (PyType_Ready(&ntlmssp_SingleHostData_Type) < 0)
6242 0 : goto out;
6243 99 : if (PyType_Ready(&ntlmssp_AvValue_Type) < 0)
6244 0 : goto out;
6245 99 : if (PyType_Ready(&AV_PAIR_Type) < 0)
6246 0 : goto out;
6247 99 : if (PyType_Ready(&AV_PAIR_LIST_Type) < 0)
6248 0 : goto out;
6249 99 : if (PyType_Ready(&CHALLENGE_MESSAGE_Type) < 0)
6250 0 : goto out;
6251 99 : if (PyType_Ready(&LM_RESPONSE_Type) < 0)
6252 0 : goto out;
6253 99 : if (PyType_Ready(&LMv2_RESPONSE_Type) < 0)
6254 0 : goto out;
6255 99 : if (PyType_Ready(&ntlmssp_LM_RESPONSE_with_len_Type) < 0)
6256 0 : goto out;
6257 99 : if (PyType_Ready(&NTLM_RESPONSE_Type) < 0)
6258 0 : goto out;
6259 99 : if (PyType_Ready(&NTLMv2_CLIENT_CHALLENGE_Type) < 0)
6260 0 : goto out;
6261 99 : if (PyType_Ready(&NTLMv2_RESPONSE_Type) < 0)
6262 0 : goto out;
6263 99 : if (PyType_Ready(&ntlmssp_NTLM_RESPONSE_with_len_Type) < 0)
6264 0 : goto out;
6265 99 : if (PyType_Ready(&ntlmssp_MIC_Type) < 0)
6266 0 : goto out;
6267 99 : if (PyType_Ready(&AUTHENTICATE_MESSAGE_Type) < 0)
6268 0 : goto out;
6269 99 : if (PyType_Ready(&NTLMSSP_MESSAGE_SIGNATURE_Type) < 0)
6270 0 : goto out;
6271 99 : if (PyType_Ready(&NTLMSSP_MESSAGE_SIGNATURE_NTLMv2_Type) < 0)
6272 0 : goto out;
6273 99 : if (PyType_Ready(&ntlmssp_InterfaceType) < 0)
6274 0 : goto out;
6275 99 : if (PyType_Ready(&ntlmssp_SyntaxType) < 0)
6276 0 : goto out;
6277 99 : if (!PyInterface_AddNdrRpcMethods(&ntlmssp_InterfaceType, py_ndr_ntlmssp_methods))
6278 0 : return NULL;
6279 :
6280 : #ifdef PY_VERSION_PATCH
6281 : PY_VERSION_PATCH(&ntlmssp_VERSION_Type);
6282 : #endif
6283 : #ifdef PY_VERSION_PATCH
6284 : PY_VERSION_PATCH(&ntlmssp_Version_Type);
6285 : #endif
6286 : #ifdef PY_NEGOTIATE_MESSAGE_PATCH
6287 : PY_NEGOTIATE_MESSAGE_PATCH(&NEGOTIATE_MESSAGE_Type);
6288 : #endif
6289 : #ifdef PY_SINGLEHOSTDATA_PATCH
6290 : PY_SINGLEHOSTDATA_PATCH(&ntlmssp_SingleHostData_Type);
6291 : #endif
6292 : #ifdef PY_AVVALUE_PATCH
6293 : PY_AVVALUE_PATCH(&ntlmssp_AvValue_Type);
6294 : #endif
6295 : #ifdef PY_AV_PAIR_PATCH
6296 : PY_AV_PAIR_PATCH(&AV_PAIR_Type);
6297 : #endif
6298 : #ifdef PY_AV_PAIR_LIST_PATCH
6299 : PY_AV_PAIR_LIST_PATCH(&AV_PAIR_LIST_Type);
6300 : #endif
6301 : #ifdef PY_CHALLENGE_MESSAGE_PATCH
6302 : PY_CHALLENGE_MESSAGE_PATCH(&CHALLENGE_MESSAGE_Type);
6303 : #endif
6304 : #ifdef PY_LM_RESPONSE_PATCH
6305 : PY_LM_RESPONSE_PATCH(&LM_RESPONSE_Type);
6306 : #endif
6307 : #ifdef PY_LMV2_RESPONSE_PATCH
6308 : PY_LMV2_RESPONSE_PATCH(&LMv2_RESPONSE_Type);
6309 : #endif
6310 : #ifdef PY_LM_RESPONSE_WITH_LEN_PATCH
6311 : PY_LM_RESPONSE_WITH_LEN_PATCH(&ntlmssp_LM_RESPONSE_with_len_Type);
6312 : #endif
6313 : #ifdef PY_NTLM_RESPONSE_PATCH
6314 : PY_NTLM_RESPONSE_PATCH(&NTLM_RESPONSE_Type);
6315 : #endif
6316 : #ifdef PY_NTLMV2_CLIENT_CHALLENGE_PATCH
6317 : PY_NTLMV2_CLIENT_CHALLENGE_PATCH(&NTLMv2_CLIENT_CHALLENGE_Type);
6318 : #endif
6319 : #ifdef PY_NTLMV2_RESPONSE_PATCH
6320 : PY_NTLMV2_RESPONSE_PATCH(&NTLMv2_RESPONSE_Type);
6321 : #endif
6322 : #ifdef PY_NTLM_RESPONSE_WITH_LEN_PATCH
6323 : PY_NTLM_RESPONSE_WITH_LEN_PATCH(&ntlmssp_NTLM_RESPONSE_with_len_Type);
6324 : #endif
6325 : #ifdef PY_MIC_PATCH
6326 : PY_MIC_PATCH(&ntlmssp_MIC_Type);
6327 : #endif
6328 : #ifdef PY_AUTHENTICATE_MESSAGE_PATCH
6329 : PY_AUTHENTICATE_MESSAGE_PATCH(&AUTHENTICATE_MESSAGE_Type);
6330 : #endif
6331 : #ifdef PY_NTLMSSP_MESSAGE_SIGNATURE_PATCH
6332 : PY_NTLMSSP_MESSAGE_SIGNATURE_PATCH(&NTLMSSP_MESSAGE_SIGNATURE_Type);
6333 : #endif
6334 : #ifdef PY_NTLMSSP_MESSAGE_SIGNATURE_NTLMV2_PATCH
6335 : PY_NTLMSSP_MESSAGE_SIGNATURE_NTLMV2_PATCH(&NTLMSSP_MESSAGE_SIGNATURE_NTLMv2_Type);
6336 : #endif
6337 : #ifdef PY_NTLMSSP_PATCH
6338 : PY_NTLMSSP_PATCH(&ntlmssp_InterfaceType);
6339 : #endif
6340 : #ifdef PY_NTLMSSP_ABSTRACT_SYNTAX_PATCH
6341 : PY_NTLMSSP_ABSTRACT_SYNTAX_PATCH(&ntlmssp_SyntaxType);
6342 : #endif
6343 : #ifdef PY_ABSTRACT_SYNTAX_PATCH
6344 : PY_ABSTRACT_SYNTAX_PATCH(&ntlmssp_SyntaxType);
6345 : #endif
6346 :
6347 99 : m = PyModule_Create(&moduledef);
6348 99 : if (m == NULL)
6349 0 : goto out;
6350 :
6351 99 : PyModule_AddObject(m, "NTLMSSP_NEGOTIATE_NTLM2", PyLong_FromLong(NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY));
6352 99 : PyModule_AddObject(m, "NTLMSSP_MIC_OFFSET", PyLong_FromUnsignedLongLong(72));
6353 99 : PyModule_AddObject(m, "NTLMSSP_MIC_SIZE", PyLong_FromUnsignedLongLong(16));
6354 99 : PyModule_AddObject(m, "NTLMSSP_SIGN_VERSION", PyLong_FromUnsignedLongLong(0x01));
6355 99 : PyModule_AddObject(m, "NTLMSSP_SIG_SIZE", PyLong_FromUnsignedLongLong(16));
6356 99 : PyModule_AddObject(m, "NtLmNegotiate", PyLong_FromUnsignedLongLong((uint32_t)(NtLmNegotiate)));
6357 99 : PyModule_AddObject(m, "NtLmChallenge", PyLong_FromUnsignedLongLong((uint32_t)(NtLmChallenge)));
6358 99 : PyModule_AddObject(m, "NtLmAuthenticate", PyLong_FromUnsignedLongLong((uint32_t)(NtLmAuthenticate)));
6359 99 : PyModule_AddObject(m, "NTLMSSP_NEGOTIATE_UNICODE", PyLong_FromUnsignedLongLong((uint32_t)(NTLMSSP_NEGOTIATE_UNICODE)));
6360 99 : PyModule_AddObject(m, "NTLMSSP_NEGOTIATE_OEM", PyLong_FromUnsignedLongLong((uint32_t)(NTLMSSP_NEGOTIATE_OEM)));
6361 99 : PyModule_AddObject(m, "NTLMSSP_REQUEST_TARGET", PyLong_FromUnsignedLongLong((uint32_t)(NTLMSSP_REQUEST_TARGET)));
6362 99 : PyModule_AddObject(m, "NTLMSSP_NEGOTIATE_SIGN", PyLong_FromUnsignedLongLong((uint32_t)(NTLMSSP_NEGOTIATE_SIGN)));
6363 99 : PyModule_AddObject(m, "NTLMSSP_NEGOTIATE_SEAL", PyLong_FromUnsignedLongLong((uint32_t)(NTLMSSP_NEGOTIATE_SEAL)));
6364 99 : PyModule_AddObject(m, "NTLMSSP_NEGOTIATE_DATAGRAM", PyLong_FromUnsignedLongLong((uint32_t)(NTLMSSP_NEGOTIATE_DATAGRAM)));
6365 99 : PyModule_AddObject(m, "NTLMSSP_NEGOTIATE_LM_KEY", PyLong_FromUnsignedLongLong((uint32_t)(NTLMSSP_NEGOTIATE_LM_KEY)));
6366 99 : PyModule_AddObject(m, "NTLMSSP_NEGOTIATE_NETWARE", PyLong_FromUnsignedLongLong((uint32_t)(NTLMSSP_NEGOTIATE_NETWARE)));
6367 99 : PyModule_AddObject(m, "NTLMSSP_NEGOTIATE_NTLM", PyLong_FromUnsignedLongLong((uint32_t)(NTLMSSP_NEGOTIATE_NTLM)));
6368 99 : PyModule_AddObject(m, "NTLMSSP_NEGOTIATE_NT_ONLY", PyLong_FromUnsignedLongLong((uint32_t)(NTLMSSP_NEGOTIATE_NT_ONLY)));
6369 99 : PyModule_AddObject(m, "NTLMSSP_ANONYMOUS", PyLong_FromUnsignedLongLong((uint32_t)(NTLMSSP_ANONYMOUS)));
6370 99 : PyModule_AddObject(m, "NTLMSSP_NEGOTIATE_OEM_DOMAIN_SUPPLIED", PyLong_FromUnsignedLongLong((uint32_t)(NTLMSSP_NEGOTIATE_OEM_DOMAIN_SUPPLIED)));
6371 99 : PyModule_AddObject(m, "NTLMSSP_NEGOTIATE_OEM_WORKSTATION_SUPPLIED", PyLong_FromUnsignedLongLong((uint32_t)(NTLMSSP_NEGOTIATE_OEM_WORKSTATION_SUPPLIED)));
6372 99 : PyModule_AddObject(m, "NTLMSSP_NEGOTIATE_THIS_IS_LOCAL_CALL", PyLong_FromUnsignedLongLong((uint32_t)(NTLMSSP_NEGOTIATE_THIS_IS_LOCAL_CALL)));
6373 99 : PyModule_AddObject(m, "NTLMSSP_NEGOTIATE_ALWAYS_SIGN", PyLong_FromUnsignedLongLong((uint32_t)(NTLMSSP_NEGOTIATE_ALWAYS_SIGN)));
6374 99 : PyModule_AddObject(m, "NTLMSSP_TARGET_TYPE_DOMAIN", PyLong_FromUnsignedLongLong((uint32_t)(NTLMSSP_TARGET_TYPE_DOMAIN)));
6375 99 : PyModule_AddObject(m, "NTLMSSP_TARGET_TYPE_SERVER", PyLong_FromUnsignedLongLong((uint32_t)(NTLMSSP_TARGET_TYPE_SERVER)));
6376 99 : PyModule_AddObject(m, "NTLMSSP_TARGET_TYPE_SHARE", PyLong_FromUnsignedLongLong((uint32_t)(NTLMSSP_TARGET_TYPE_SHARE)));
6377 99 : PyModule_AddObject(m, "NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY", PyLong_FromUnsignedLongLong((uint32_t)(NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY)));
6378 99 : PyModule_AddObject(m, "NTLMSSP_NEGOTIATE_IDENTIFY", PyLong_FromUnsignedLongLong((uint32_t)(NTLMSSP_NEGOTIATE_IDENTIFY)));
6379 99 : PyModule_AddObject(m, "NTLMSSP_REQUEST_NON_NT_SESSION_KEY", PyLong_FromUnsignedLongLong((uint32_t)(NTLMSSP_REQUEST_NON_NT_SESSION_KEY)));
6380 99 : PyModule_AddObject(m, "NTLMSSP_NEGOTIATE_TARGET_INFO", PyLong_FromUnsignedLongLong((uint32_t)(NTLMSSP_NEGOTIATE_TARGET_INFO)));
6381 99 : PyModule_AddObject(m, "NTLMSSP_NEGOTIATE_VERSION", PyLong_FromUnsignedLongLong((uint32_t)(NTLMSSP_NEGOTIATE_VERSION)));
6382 99 : PyModule_AddObject(m, "NTLMSSP_NEGOTIATE_128", PyLong_FromUnsignedLongLong((uint32_t)(NTLMSSP_NEGOTIATE_128)));
6383 99 : PyModule_AddObject(m, "NTLMSSP_NEGOTIATE_KEY_EXCH", PyLong_FromUnsignedLongLong((uint32_t)(NTLMSSP_NEGOTIATE_KEY_EXCH)));
6384 99 : PyModule_AddObject(m, "NTLMSSP_NEGOTIATE_56", PyLong_FromUnsignedLongLong((uint32_t)(NTLMSSP_NEGOTIATE_56)));
6385 99 : PyModule_AddObject(m, "NTLMSSP_WINDOWS_MAJOR_VERSION_5", PyLong_FromLong((uint16_t)(NTLMSSP_WINDOWS_MAJOR_VERSION_5)));
6386 99 : PyModule_AddObject(m, "NTLMSSP_WINDOWS_MAJOR_VERSION_6", PyLong_FromLong((uint16_t)(NTLMSSP_WINDOWS_MAJOR_VERSION_6)));
6387 99 : PyModule_AddObject(m, "NTLMSSP_WINDOWS_MAJOR_VERSION_10", PyLong_FromLong((uint16_t)(NTLMSSP_WINDOWS_MAJOR_VERSION_10)));
6388 99 : PyModule_AddObject(m, "NTLMSSP_WINDOWS_MINOR_VERSION_0", PyLong_FromLong((uint16_t)(NTLMSSP_WINDOWS_MINOR_VERSION_0)));
6389 99 : PyModule_AddObject(m, "NTLMSSP_WINDOWS_MINOR_VERSION_1", PyLong_FromLong((uint16_t)(NTLMSSP_WINDOWS_MINOR_VERSION_1)));
6390 99 : PyModule_AddObject(m, "NTLMSSP_WINDOWS_MINOR_VERSION_2", PyLong_FromLong((uint16_t)(NTLMSSP_WINDOWS_MINOR_VERSION_2)));
6391 99 : PyModule_AddObject(m, "NTLMSSP_WINDOWS_MINOR_VERSION_3", PyLong_FromLong((uint16_t)(NTLMSSP_WINDOWS_MINOR_VERSION_3)));
6392 99 : PyModule_AddObject(m, "NTLMSSP_REVISION_W2K3_RC1", PyLong_FromLong((uint16_t)(NTLMSSP_REVISION_W2K3_RC1)));
6393 99 : PyModule_AddObject(m, "NTLMSSP_REVISION_W2K3", PyLong_FromLong((uint16_t)(NTLMSSP_REVISION_W2K3)));
6394 99 : PyModule_AddObject(m, "MsvAvEOL", PyLong_FromLong((uint16_t)(MsvAvEOL)));
6395 99 : PyModule_AddObject(m, "MsvAvNbComputerName", PyLong_FromLong((uint16_t)(MsvAvNbComputerName)));
6396 99 : PyModule_AddObject(m, "MsvAvNbDomainName", PyLong_FromLong((uint16_t)(MsvAvNbDomainName)));
6397 99 : PyModule_AddObject(m, "MsvAvDnsComputerName", PyLong_FromLong((uint16_t)(MsvAvDnsComputerName)));
6398 99 : PyModule_AddObject(m, "MsvAvDnsDomainName", PyLong_FromLong((uint16_t)(MsvAvDnsDomainName)));
6399 99 : PyModule_AddObject(m, "MsvAvDnsTreeName", PyLong_FromLong((uint16_t)(MsvAvDnsTreeName)));
6400 99 : PyModule_AddObject(m, "MsvAvFlags", PyLong_FromLong((uint16_t)(MsvAvFlags)));
6401 99 : PyModule_AddObject(m, "MsvAvTimestamp", PyLong_FromLong((uint16_t)(MsvAvTimestamp)));
6402 99 : PyModule_AddObject(m, "MsvAvSingleHost", PyLong_FromLong((uint16_t)(MsvAvSingleHost)));
6403 99 : PyModule_AddObject(m, "MsvAvTargetName", PyLong_FromLong((uint16_t)(MsvAvTargetName)));
6404 99 : PyModule_AddObject(m, "MsvChannelBindings", PyLong_FromLong((uint16_t)(MsvChannelBindings)));
6405 99 : PyModule_AddObject(m, "NTLMSSP_AVFLAG_CONSTRAINTED_ACCOUNT", PyLong_FromUnsignedLongLong((uint32_t)(NTLMSSP_AVFLAG_CONSTRAINTED_ACCOUNT)));
6406 99 : PyModule_AddObject(m, "NTLMSSP_AVFLAG_MIC_IN_AUTHENTICATE_MESSAGE", PyLong_FromUnsignedLongLong((uint32_t)(NTLMSSP_AVFLAG_MIC_IN_AUTHENTICATE_MESSAGE)));
6407 99 : PyModule_AddObject(m, "NTLMSSP_AVFLAG_TARGET_SPN_FROM_UNTRUSTED_SOURCE", PyLong_FromUnsignedLongLong((uint32_t)(NTLMSSP_AVFLAG_TARGET_SPN_FROM_UNTRUSTED_SOURCE)));
6408 68 : Py_INCREF((PyObject *)(void *)&ntlmssp_VERSION_Type);
6409 99 : PyModule_AddObject(m, "VERSION", (PyObject *)(void *)&ntlmssp_VERSION_Type);
6410 68 : Py_INCREF((PyObject *)(void *)&ntlmssp_Version_Type);
6411 99 : PyModule_AddObject(m, "Version", (PyObject *)(void *)&ntlmssp_Version_Type);
6412 68 : Py_INCREF((PyObject *)(void *)&NEGOTIATE_MESSAGE_Type);
6413 99 : PyModule_AddObject(m, "NEGOTIATE_MESSAGE", (PyObject *)(void *)&NEGOTIATE_MESSAGE_Type);
6414 68 : Py_INCREF((PyObject *)(void *)&ntlmssp_SingleHostData_Type);
6415 99 : PyModule_AddObject(m, "SingleHostData", (PyObject *)(void *)&ntlmssp_SingleHostData_Type);
6416 68 : Py_INCREF((PyObject *)(void *)&ntlmssp_AvValue_Type);
6417 99 : PyModule_AddObject(m, "AvValue", (PyObject *)(void *)&ntlmssp_AvValue_Type);
6418 68 : Py_INCREF((PyObject *)(void *)&AV_PAIR_Type);
6419 99 : PyModule_AddObject(m, "AV_PAIR", (PyObject *)(void *)&AV_PAIR_Type);
6420 68 : Py_INCREF((PyObject *)(void *)&AV_PAIR_LIST_Type);
6421 99 : PyModule_AddObject(m, "AV_PAIR_LIST", (PyObject *)(void *)&AV_PAIR_LIST_Type);
6422 68 : Py_INCREF((PyObject *)(void *)&CHALLENGE_MESSAGE_Type);
6423 99 : PyModule_AddObject(m, "CHALLENGE_MESSAGE", (PyObject *)(void *)&CHALLENGE_MESSAGE_Type);
6424 68 : Py_INCREF((PyObject *)(void *)&LM_RESPONSE_Type);
6425 99 : PyModule_AddObject(m, "LM_RESPONSE", (PyObject *)(void *)&LM_RESPONSE_Type);
6426 68 : Py_INCREF((PyObject *)(void *)&LMv2_RESPONSE_Type);
6427 99 : PyModule_AddObject(m, "LMv2_RESPONSE", (PyObject *)(void *)&LMv2_RESPONSE_Type);
6428 68 : Py_INCREF((PyObject *)(void *)&ntlmssp_LM_RESPONSE_with_len_Type);
6429 99 : PyModule_AddObject(m, "LM_RESPONSE_with_len", (PyObject *)(void *)&ntlmssp_LM_RESPONSE_with_len_Type);
6430 68 : Py_INCREF((PyObject *)(void *)&NTLM_RESPONSE_Type);
6431 99 : PyModule_AddObject(m, "NTLM_RESPONSE", (PyObject *)(void *)&NTLM_RESPONSE_Type);
6432 68 : Py_INCREF((PyObject *)(void *)&NTLMv2_CLIENT_CHALLENGE_Type);
6433 99 : PyModule_AddObject(m, "NTLMv2_CLIENT_CHALLENGE", (PyObject *)(void *)&NTLMv2_CLIENT_CHALLENGE_Type);
6434 68 : Py_INCREF((PyObject *)(void *)&NTLMv2_RESPONSE_Type);
6435 99 : PyModule_AddObject(m, "NTLMv2_RESPONSE", (PyObject *)(void *)&NTLMv2_RESPONSE_Type);
6436 68 : Py_INCREF((PyObject *)(void *)&ntlmssp_NTLM_RESPONSE_with_len_Type);
6437 99 : PyModule_AddObject(m, "NTLM_RESPONSE_with_len", (PyObject *)(void *)&ntlmssp_NTLM_RESPONSE_with_len_Type);
6438 68 : Py_INCREF((PyObject *)(void *)&ntlmssp_MIC_Type);
6439 99 : PyModule_AddObject(m, "MIC", (PyObject *)(void *)&ntlmssp_MIC_Type);
6440 68 : Py_INCREF((PyObject *)(void *)&AUTHENTICATE_MESSAGE_Type);
6441 99 : PyModule_AddObject(m, "AUTHENTICATE_MESSAGE", (PyObject *)(void *)&AUTHENTICATE_MESSAGE_Type);
6442 68 : Py_INCREF((PyObject *)(void *)&NTLMSSP_MESSAGE_SIGNATURE_Type);
6443 99 : PyModule_AddObject(m, "NTLMSSP_MESSAGE_SIGNATURE", (PyObject *)(void *)&NTLMSSP_MESSAGE_SIGNATURE_Type);
6444 68 : Py_INCREF((PyObject *)(void *)&NTLMSSP_MESSAGE_SIGNATURE_NTLMv2_Type);
6445 99 : PyModule_AddObject(m, "NTLMSSP_MESSAGE_SIGNATURE_NTLMv2", (PyObject *)(void *)&NTLMSSP_MESSAGE_SIGNATURE_NTLMv2_Type);
6446 68 : Py_INCREF((PyObject *)(void *)&ntlmssp_InterfaceType);
6447 99 : PyModule_AddObject(m, "ntlmssp", (PyObject *)(void *)&ntlmssp_InterfaceType);
6448 68 : Py_INCREF((PyObject *)(void *)&ntlmssp_SyntaxType);
6449 99 : PyModule_AddObject(m, "ntlmssp_abstract_syntax", (PyObject *)(void *)&ntlmssp_SyntaxType);
6450 68 : Py_INCREF((PyObject *)(void *)&ntlmssp_SyntaxType);
6451 99 : PyModule_AddObject(m, "abstract_syntax", (PyObject *)(void *)&ntlmssp_SyntaxType);
6452 : #ifdef PY_MOD_NTLMSSP_PATCH
6453 : PY_MOD_NTLMSSP_PATCH(m);
6454 : #endif
6455 99 : out:
6456 99 : Py_XDECREF(dep_samba_dcerpc_security);
6457 99 : Py_XDECREF(dep_talloc);
6458 99 : Py_XDECREF(dep_samba_dcerpc_base);
6459 99 : Py_XDECREF(dep_samba_dcerpc_misc);
6460 99 : return m;
6461 :
6462 : }
|