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