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_auth.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 0 : static inline unsigned long long ndr_sizeof2uintmax(size_t var_size)
33 : {
34 0 : switch (var_size) {
35 0 : case 8:
36 0 : return UINT64_MAX;
37 0 : case 4:
38 0 : 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/misc.h"
65 : #include "librpc/gen_ndr/security.h"
66 : #include "librpc/gen_ndr/lsa.h"
67 : #include "librpc/gen_ndr/krb5pac.h"
68 : static PyTypeObject auth_user_info_Type;
69 : static PyTypeObject auth_user_info_torture_Type;
70 : static PyTypeObject auth_user_info_unix_Type;
71 : static PyTypeObject auth_user_info_dc_Type;
72 : static PyTypeObject auth_session_info_Type;
73 : static PyTypeObject auth_session_info_transport_Type;
74 :
75 : static PyTypeObject *BaseObject_Type;
76 : static PyTypeObject *dom_sid_Type;
77 : static PyTypeObject *security_token_Type;
78 : static PyTypeObject *security_unix_token_Type;
79 : static PyTypeObject *GUID_Type;
80 : #include "librpc/ndr/py_auth.c"
81 :
82 :
83 2 : static PyObject *py_auth_user_info_get_account_name(PyObject *obj, void *closure)
84 : {
85 2 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(obj);
86 : PyObject *py_account_name;
87 2 : if (object->account_name == NULL) {
88 0 : Py_RETURN_NONE;
89 : }
90 2 : if (object->account_name == NULL) {
91 0 : py_account_name = Py_None;
92 0 : Py_INCREF(py_account_name);
93 : } else {
94 2 : if (object->account_name == NULL) {
95 0 : py_account_name = Py_None;
96 0 : Py_INCREF(py_account_name);
97 : } else {
98 2 : py_account_name = PyUnicode_Decode(object->account_name, strlen(object->account_name), "utf-8", "ignore");
99 : }
100 : }
101 2 : return py_account_name;
102 : }
103 :
104 0 : static int py_auth_user_info_set_account_name(PyObject *py_obj, PyObject *value, void *closure)
105 : {
106 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(py_obj);
107 0 : if (value == NULL) {
108 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->account_name");
109 0 : return -1;
110 : }
111 0 : if (value == Py_None) {
112 0 : object->account_name = NULL;
113 : } else {
114 0 : object->account_name = NULL;
115 : {
116 : const char *test_str;
117 : const char *talloc_str;
118 0 : PyObject *unicode = NULL;
119 0 : if (PyUnicode_Check(value)) {
120 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
121 0 : if (unicode == NULL) {
122 0 : PyErr_NoMemory();
123 0 : return -1;
124 : }
125 0 : test_str = PyBytes_AS_STRING(unicode);
126 0 : } else if (PyBytes_Check(value)) {
127 0 : test_str = PyBytes_AS_STRING(value);
128 : } else {
129 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
130 0 : return -1;
131 : }
132 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
133 0 : if (unicode != NULL) {
134 0 : Py_DECREF(unicode);
135 : }
136 0 : if (talloc_str == NULL) {
137 0 : PyErr_NoMemory();
138 0 : return -1;
139 : }
140 0 : object->account_name = talloc_str;
141 : }
142 : }
143 0 : return 0;
144 : }
145 :
146 0 : static PyObject *py_auth_user_info_get_user_principal_name(PyObject *obj, void *closure)
147 : {
148 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(obj);
149 : PyObject *py_user_principal_name;
150 0 : if (object->user_principal_name == NULL) {
151 0 : Py_RETURN_NONE;
152 : }
153 0 : if (object->user_principal_name == NULL) {
154 0 : py_user_principal_name = Py_None;
155 0 : Py_INCREF(py_user_principal_name);
156 : } else {
157 0 : if (object->user_principal_name == NULL) {
158 0 : py_user_principal_name = Py_None;
159 0 : Py_INCREF(py_user_principal_name);
160 : } else {
161 0 : py_user_principal_name = PyUnicode_Decode(object->user_principal_name, strlen(object->user_principal_name), "utf-8", "ignore");
162 : }
163 : }
164 0 : return py_user_principal_name;
165 : }
166 :
167 0 : static int py_auth_user_info_set_user_principal_name(PyObject *py_obj, PyObject *value, void *closure)
168 : {
169 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(py_obj);
170 0 : if (value == NULL) {
171 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->user_principal_name");
172 0 : return -1;
173 : }
174 0 : if (value == Py_None) {
175 0 : object->user_principal_name = NULL;
176 : } else {
177 0 : object->user_principal_name = NULL;
178 : {
179 : const char *test_str;
180 : const char *talloc_str;
181 0 : PyObject *unicode = NULL;
182 0 : if (PyUnicode_Check(value)) {
183 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
184 0 : if (unicode == NULL) {
185 0 : PyErr_NoMemory();
186 0 : return -1;
187 : }
188 0 : test_str = PyBytes_AS_STRING(unicode);
189 0 : } else if (PyBytes_Check(value)) {
190 0 : test_str = PyBytes_AS_STRING(value);
191 : } else {
192 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
193 0 : return -1;
194 : }
195 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
196 0 : if (unicode != NULL) {
197 0 : Py_DECREF(unicode);
198 : }
199 0 : if (talloc_str == NULL) {
200 0 : PyErr_NoMemory();
201 0 : return -1;
202 : }
203 0 : object->user_principal_name = talloc_str;
204 : }
205 : }
206 0 : return 0;
207 : }
208 :
209 0 : static PyObject *py_auth_user_info_get_user_principal_constructed(PyObject *obj, void *closure)
210 : {
211 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(obj);
212 : PyObject *py_user_principal_constructed;
213 0 : py_user_principal_constructed = PyLong_FromLong((uint16_t)object->user_principal_constructed);
214 0 : return py_user_principal_constructed;
215 : }
216 :
217 0 : static int py_auth_user_info_set_user_principal_constructed(PyObject *py_obj, PyObject *value, void *closure)
218 : {
219 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(py_obj);
220 0 : if (value == NULL) {
221 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->user_principal_constructed");
222 0 : return -1;
223 : }
224 : {
225 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->user_principal_constructed));
226 0 : if (PyLong_Check(value)) {
227 : unsigned long long test_var;
228 0 : test_var = PyLong_AsUnsignedLongLong(value);
229 0 : if (PyErr_Occurred() != NULL) {
230 0 : return -1;
231 : }
232 0 : if (test_var > uint_max) {
233 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
234 : PyLong_Type.tp_name, uint_max, test_var);
235 0 : return -1;
236 : }
237 0 : object->user_principal_constructed = test_var;
238 : } else {
239 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
240 : PyLong_Type.tp_name);
241 0 : return -1;
242 : }
243 : }
244 0 : return 0;
245 : }
246 :
247 2 : static PyObject *py_auth_user_info_get_domain_name(PyObject *obj, void *closure)
248 : {
249 2 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(obj);
250 : PyObject *py_domain_name;
251 2 : if (object->domain_name == NULL) {
252 0 : Py_RETURN_NONE;
253 : }
254 2 : if (object->domain_name == NULL) {
255 0 : py_domain_name = Py_None;
256 0 : Py_INCREF(py_domain_name);
257 : } else {
258 2 : if (object->domain_name == NULL) {
259 0 : py_domain_name = Py_None;
260 0 : Py_INCREF(py_domain_name);
261 : } else {
262 2 : py_domain_name = PyUnicode_Decode(object->domain_name, strlen(object->domain_name), "utf-8", "ignore");
263 : }
264 : }
265 2 : return py_domain_name;
266 : }
267 :
268 0 : static int py_auth_user_info_set_domain_name(PyObject *py_obj, PyObject *value, void *closure)
269 : {
270 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(py_obj);
271 0 : if (value == NULL) {
272 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->domain_name");
273 0 : return -1;
274 : }
275 0 : if (value == Py_None) {
276 0 : object->domain_name = NULL;
277 : } else {
278 0 : object->domain_name = NULL;
279 : {
280 : const char *test_str;
281 : const char *talloc_str;
282 0 : PyObject *unicode = NULL;
283 0 : if (PyUnicode_Check(value)) {
284 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
285 0 : if (unicode == NULL) {
286 0 : PyErr_NoMemory();
287 0 : return -1;
288 : }
289 0 : test_str = PyBytes_AS_STRING(unicode);
290 0 : } else if (PyBytes_Check(value)) {
291 0 : test_str = PyBytes_AS_STRING(value);
292 : } else {
293 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
294 0 : return -1;
295 : }
296 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
297 0 : if (unicode != NULL) {
298 0 : Py_DECREF(unicode);
299 : }
300 0 : if (talloc_str == NULL) {
301 0 : PyErr_NoMemory();
302 0 : return -1;
303 : }
304 0 : object->domain_name = talloc_str;
305 : }
306 : }
307 0 : return 0;
308 : }
309 :
310 0 : static PyObject *py_auth_user_info_get_dns_domain_name(PyObject *obj, void *closure)
311 : {
312 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(obj);
313 : PyObject *py_dns_domain_name;
314 0 : if (object->dns_domain_name == NULL) {
315 0 : Py_RETURN_NONE;
316 : }
317 0 : if (object->dns_domain_name == NULL) {
318 0 : py_dns_domain_name = Py_None;
319 0 : Py_INCREF(py_dns_domain_name);
320 : } else {
321 0 : if (object->dns_domain_name == NULL) {
322 0 : py_dns_domain_name = Py_None;
323 0 : Py_INCREF(py_dns_domain_name);
324 : } else {
325 0 : py_dns_domain_name = PyUnicode_Decode(object->dns_domain_name, strlen(object->dns_domain_name), "utf-8", "ignore");
326 : }
327 : }
328 0 : return py_dns_domain_name;
329 : }
330 :
331 0 : static int py_auth_user_info_set_dns_domain_name(PyObject *py_obj, PyObject *value, void *closure)
332 : {
333 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(py_obj);
334 0 : if (value == NULL) {
335 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->dns_domain_name");
336 0 : return -1;
337 : }
338 0 : if (value == Py_None) {
339 0 : object->dns_domain_name = NULL;
340 : } else {
341 0 : object->dns_domain_name = NULL;
342 : {
343 : const char *test_str;
344 : const char *talloc_str;
345 0 : PyObject *unicode = NULL;
346 0 : if (PyUnicode_Check(value)) {
347 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
348 0 : if (unicode == NULL) {
349 0 : PyErr_NoMemory();
350 0 : return -1;
351 : }
352 0 : test_str = PyBytes_AS_STRING(unicode);
353 0 : } else if (PyBytes_Check(value)) {
354 0 : test_str = PyBytes_AS_STRING(value);
355 : } else {
356 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
357 0 : return -1;
358 : }
359 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
360 0 : if (unicode != NULL) {
361 0 : Py_DECREF(unicode);
362 : }
363 0 : if (talloc_str == NULL) {
364 0 : PyErr_NoMemory();
365 0 : return -1;
366 : }
367 0 : object->dns_domain_name = talloc_str;
368 : }
369 : }
370 0 : return 0;
371 : }
372 :
373 2 : static PyObject *py_auth_user_info_get_full_name(PyObject *obj, void *closure)
374 : {
375 2 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(obj);
376 : PyObject *py_full_name;
377 2 : if (object->full_name == NULL) {
378 0 : Py_RETURN_NONE;
379 : }
380 2 : if (object->full_name == NULL) {
381 0 : py_full_name = Py_None;
382 0 : Py_INCREF(py_full_name);
383 : } else {
384 2 : if (object->full_name == NULL) {
385 0 : py_full_name = Py_None;
386 0 : Py_INCREF(py_full_name);
387 : } else {
388 2 : py_full_name = PyUnicode_Decode(object->full_name, strlen(object->full_name), "utf-8", "ignore");
389 : }
390 : }
391 2 : return py_full_name;
392 : }
393 :
394 0 : static int py_auth_user_info_set_full_name(PyObject *py_obj, PyObject *value, void *closure)
395 : {
396 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(py_obj);
397 0 : if (value == NULL) {
398 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->full_name");
399 0 : return -1;
400 : }
401 0 : if (value == Py_None) {
402 0 : object->full_name = NULL;
403 : } else {
404 0 : object->full_name = NULL;
405 : {
406 : const char *test_str;
407 : const char *talloc_str;
408 0 : PyObject *unicode = NULL;
409 0 : if (PyUnicode_Check(value)) {
410 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
411 0 : if (unicode == NULL) {
412 0 : PyErr_NoMemory();
413 0 : return -1;
414 : }
415 0 : test_str = PyBytes_AS_STRING(unicode);
416 0 : } else if (PyBytes_Check(value)) {
417 0 : test_str = PyBytes_AS_STRING(value);
418 : } else {
419 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
420 0 : return -1;
421 : }
422 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
423 0 : if (unicode != NULL) {
424 0 : Py_DECREF(unicode);
425 : }
426 0 : if (talloc_str == NULL) {
427 0 : PyErr_NoMemory();
428 0 : return -1;
429 : }
430 0 : object->full_name = talloc_str;
431 : }
432 : }
433 0 : return 0;
434 : }
435 :
436 0 : static PyObject *py_auth_user_info_get_logon_script(PyObject *obj, void *closure)
437 : {
438 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(obj);
439 : PyObject *py_logon_script;
440 0 : if (object->logon_script == NULL) {
441 0 : Py_RETURN_NONE;
442 : }
443 0 : if (object->logon_script == NULL) {
444 0 : py_logon_script = Py_None;
445 0 : Py_INCREF(py_logon_script);
446 : } else {
447 0 : if (object->logon_script == NULL) {
448 0 : py_logon_script = Py_None;
449 0 : Py_INCREF(py_logon_script);
450 : } else {
451 0 : py_logon_script = PyUnicode_Decode(object->logon_script, strlen(object->logon_script), "utf-8", "ignore");
452 : }
453 : }
454 0 : return py_logon_script;
455 : }
456 :
457 0 : static int py_auth_user_info_set_logon_script(PyObject *py_obj, PyObject *value, void *closure)
458 : {
459 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(py_obj);
460 0 : if (value == NULL) {
461 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->logon_script");
462 0 : return -1;
463 : }
464 0 : if (value == Py_None) {
465 0 : object->logon_script = NULL;
466 : } else {
467 0 : object->logon_script = NULL;
468 : {
469 : const char *test_str;
470 : const char *talloc_str;
471 0 : PyObject *unicode = NULL;
472 0 : if (PyUnicode_Check(value)) {
473 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
474 0 : if (unicode == NULL) {
475 0 : PyErr_NoMemory();
476 0 : return -1;
477 : }
478 0 : test_str = PyBytes_AS_STRING(unicode);
479 0 : } else if (PyBytes_Check(value)) {
480 0 : test_str = PyBytes_AS_STRING(value);
481 : } else {
482 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
483 0 : return -1;
484 : }
485 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
486 0 : if (unicode != NULL) {
487 0 : Py_DECREF(unicode);
488 : }
489 0 : if (talloc_str == NULL) {
490 0 : PyErr_NoMemory();
491 0 : return -1;
492 : }
493 0 : object->logon_script = talloc_str;
494 : }
495 : }
496 0 : return 0;
497 : }
498 :
499 0 : static PyObject *py_auth_user_info_get_profile_path(PyObject *obj, void *closure)
500 : {
501 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(obj);
502 : PyObject *py_profile_path;
503 0 : if (object->profile_path == NULL) {
504 0 : Py_RETURN_NONE;
505 : }
506 0 : if (object->profile_path == NULL) {
507 0 : py_profile_path = Py_None;
508 0 : Py_INCREF(py_profile_path);
509 : } else {
510 0 : if (object->profile_path == NULL) {
511 0 : py_profile_path = Py_None;
512 0 : Py_INCREF(py_profile_path);
513 : } else {
514 0 : py_profile_path = PyUnicode_Decode(object->profile_path, strlen(object->profile_path), "utf-8", "ignore");
515 : }
516 : }
517 0 : return py_profile_path;
518 : }
519 :
520 0 : static int py_auth_user_info_set_profile_path(PyObject *py_obj, PyObject *value, void *closure)
521 : {
522 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(py_obj);
523 0 : if (value == NULL) {
524 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->profile_path");
525 0 : return -1;
526 : }
527 0 : if (value == Py_None) {
528 0 : object->profile_path = NULL;
529 : } else {
530 0 : object->profile_path = NULL;
531 : {
532 : const char *test_str;
533 : const char *talloc_str;
534 0 : PyObject *unicode = NULL;
535 0 : if (PyUnicode_Check(value)) {
536 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
537 0 : if (unicode == NULL) {
538 0 : PyErr_NoMemory();
539 0 : return -1;
540 : }
541 0 : test_str = PyBytes_AS_STRING(unicode);
542 0 : } else if (PyBytes_Check(value)) {
543 0 : test_str = PyBytes_AS_STRING(value);
544 : } else {
545 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
546 0 : return -1;
547 : }
548 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
549 0 : if (unicode != NULL) {
550 0 : Py_DECREF(unicode);
551 : }
552 0 : if (talloc_str == NULL) {
553 0 : PyErr_NoMemory();
554 0 : return -1;
555 : }
556 0 : object->profile_path = talloc_str;
557 : }
558 : }
559 0 : return 0;
560 : }
561 :
562 0 : static PyObject *py_auth_user_info_get_home_directory(PyObject *obj, void *closure)
563 : {
564 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(obj);
565 : PyObject *py_home_directory;
566 0 : if (object->home_directory == NULL) {
567 0 : Py_RETURN_NONE;
568 : }
569 0 : if (object->home_directory == NULL) {
570 0 : py_home_directory = Py_None;
571 0 : Py_INCREF(py_home_directory);
572 : } else {
573 0 : if (object->home_directory == NULL) {
574 0 : py_home_directory = Py_None;
575 0 : Py_INCREF(py_home_directory);
576 : } else {
577 0 : py_home_directory = PyUnicode_Decode(object->home_directory, strlen(object->home_directory), "utf-8", "ignore");
578 : }
579 : }
580 0 : return py_home_directory;
581 : }
582 :
583 0 : static int py_auth_user_info_set_home_directory(PyObject *py_obj, PyObject *value, void *closure)
584 : {
585 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(py_obj);
586 0 : if (value == NULL) {
587 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->home_directory");
588 0 : return -1;
589 : }
590 0 : if (value == Py_None) {
591 0 : object->home_directory = NULL;
592 : } else {
593 0 : object->home_directory = NULL;
594 : {
595 : const char *test_str;
596 : const char *talloc_str;
597 0 : PyObject *unicode = NULL;
598 0 : if (PyUnicode_Check(value)) {
599 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
600 0 : if (unicode == NULL) {
601 0 : PyErr_NoMemory();
602 0 : return -1;
603 : }
604 0 : test_str = PyBytes_AS_STRING(unicode);
605 0 : } else if (PyBytes_Check(value)) {
606 0 : test_str = PyBytes_AS_STRING(value);
607 : } else {
608 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
609 0 : return -1;
610 : }
611 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
612 0 : if (unicode != NULL) {
613 0 : Py_DECREF(unicode);
614 : }
615 0 : if (talloc_str == NULL) {
616 0 : PyErr_NoMemory();
617 0 : return -1;
618 : }
619 0 : object->home_directory = talloc_str;
620 : }
621 : }
622 0 : return 0;
623 : }
624 :
625 0 : static PyObject *py_auth_user_info_get_home_drive(PyObject *obj, void *closure)
626 : {
627 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(obj);
628 : PyObject *py_home_drive;
629 0 : if (object->home_drive == NULL) {
630 0 : Py_RETURN_NONE;
631 : }
632 0 : if (object->home_drive == NULL) {
633 0 : py_home_drive = Py_None;
634 0 : Py_INCREF(py_home_drive);
635 : } else {
636 0 : if (object->home_drive == NULL) {
637 0 : py_home_drive = Py_None;
638 0 : Py_INCREF(py_home_drive);
639 : } else {
640 0 : py_home_drive = PyUnicode_Decode(object->home_drive, strlen(object->home_drive), "utf-8", "ignore");
641 : }
642 : }
643 0 : return py_home_drive;
644 : }
645 :
646 0 : static int py_auth_user_info_set_home_drive(PyObject *py_obj, PyObject *value, void *closure)
647 : {
648 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(py_obj);
649 0 : if (value == NULL) {
650 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->home_drive");
651 0 : return -1;
652 : }
653 0 : if (value == Py_None) {
654 0 : object->home_drive = NULL;
655 : } else {
656 0 : object->home_drive = NULL;
657 : {
658 : const char *test_str;
659 : const char *talloc_str;
660 0 : PyObject *unicode = NULL;
661 0 : if (PyUnicode_Check(value)) {
662 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
663 0 : if (unicode == NULL) {
664 0 : PyErr_NoMemory();
665 0 : return -1;
666 : }
667 0 : test_str = PyBytes_AS_STRING(unicode);
668 0 : } else if (PyBytes_Check(value)) {
669 0 : test_str = PyBytes_AS_STRING(value);
670 : } else {
671 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
672 0 : return -1;
673 : }
674 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
675 0 : if (unicode != NULL) {
676 0 : Py_DECREF(unicode);
677 : }
678 0 : if (talloc_str == NULL) {
679 0 : PyErr_NoMemory();
680 0 : return -1;
681 : }
682 0 : object->home_drive = talloc_str;
683 : }
684 : }
685 0 : return 0;
686 : }
687 :
688 0 : static PyObject *py_auth_user_info_get_logon_server(PyObject *obj, void *closure)
689 : {
690 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(obj);
691 : PyObject *py_logon_server;
692 0 : if (object->logon_server == NULL) {
693 0 : Py_RETURN_NONE;
694 : }
695 0 : if (object->logon_server == NULL) {
696 0 : py_logon_server = Py_None;
697 0 : Py_INCREF(py_logon_server);
698 : } else {
699 0 : if (object->logon_server == NULL) {
700 0 : py_logon_server = Py_None;
701 0 : Py_INCREF(py_logon_server);
702 : } else {
703 0 : py_logon_server = PyUnicode_Decode(object->logon_server, strlen(object->logon_server), "utf-8", "ignore");
704 : }
705 : }
706 0 : return py_logon_server;
707 : }
708 :
709 0 : static int py_auth_user_info_set_logon_server(PyObject *py_obj, PyObject *value, void *closure)
710 : {
711 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(py_obj);
712 0 : if (value == NULL) {
713 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->logon_server");
714 0 : return -1;
715 : }
716 0 : if (value == Py_None) {
717 0 : object->logon_server = NULL;
718 : } else {
719 0 : object->logon_server = NULL;
720 : {
721 : const char *test_str;
722 : const char *talloc_str;
723 0 : PyObject *unicode = NULL;
724 0 : if (PyUnicode_Check(value)) {
725 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
726 0 : if (unicode == NULL) {
727 0 : PyErr_NoMemory();
728 0 : return -1;
729 : }
730 0 : test_str = PyBytes_AS_STRING(unicode);
731 0 : } else if (PyBytes_Check(value)) {
732 0 : test_str = PyBytes_AS_STRING(value);
733 : } else {
734 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
735 0 : return -1;
736 : }
737 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
738 0 : if (unicode != NULL) {
739 0 : Py_DECREF(unicode);
740 : }
741 0 : if (talloc_str == NULL) {
742 0 : PyErr_NoMemory();
743 0 : return -1;
744 : }
745 0 : object->logon_server = talloc_str;
746 : }
747 : }
748 0 : return 0;
749 : }
750 :
751 0 : static PyObject *py_auth_user_info_get_last_logon(PyObject *obj, void *closure)
752 : {
753 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(obj);
754 : PyObject *py_last_logon;
755 0 : py_last_logon = PyLong_FromUnsignedLongLong(object->last_logon);
756 0 : return py_last_logon;
757 : }
758 :
759 0 : static int py_auth_user_info_set_last_logon(PyObject *py_obj, PyObject *value, void *closure)
760 : {
761 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(py_obj);
762 0 : if (value == NULL) {
763 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->last_logon");
764 0 : return -1;
765 : }
766 : {
767 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->last_logon));
768 0 : if (PyLong_Check(value)) {
769 : unsigned long long test_var;
770 0 : test_var = PyLong_AsUnsignedLongLong(value);
771 0 : if (PyErr_Occurred() != NULL) {
772 0 : return -1;
773 : }
774 0 : if (test_var > uint_max) {
775 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
776 : PyLong_Type.tp_name, uint_max, test_var);
777 0 : return -1;
778 : }
779 0 : object->last_logon = test_var;
780 : } else {
781 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
782 : PyLong_Type.tp_name);
783 0 : return -1;
784 : }
785 : }
786 0 : return 0;
787 : }
788 :
789 0 : static PyObject *py_auth_user_info_get_last_logoff(PyObject *obj, void *closure)
790 : {
791 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(obj);
792 : PyObject *py_last_logoff;
793 0 : py_last_logoff = PyLong_FromUnsignedLongLong(object->last_logoff);
794 0 : return py_last_logoff;
795 : }
796 :
797 0 : static int py_auth_user_info_set_last_logoff(PyObject *py_obj, PyObject *value, void *closure)
798 : {
799 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(py_obj);
800 0 : if (value == NULL) {
801 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->last_logoff");
802 0 : return -1;
803 : }
804 : {
805 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->last_logoff));
806 0 : if (PyLong_Check(value)) {
807 : unsigned long long test_var;
808 0 : test_var = PyLong_AsUnsignedLongLong(value);
809 0 : if (PyErr_Occurred() != NULL) {
810 0 : return -1;
811 : }
812 0 : if (test_var > uint_max) {
813 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
814 : PyLong_Type.tp_name, uint_max, test_var);
815 0 : return -1;
816 : }
817 0 : object->last_logoff = test_var;
818 : } else {
819 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
820 : PyLong_Type.tp_name);
821 0 : return -1;
822 : }
823 : }
824 0 : return 0;
825 : }
826 :
827 0 : static PyObject *py_auth_user_info_get_acct_expiry(PyObject *obj, void *closure)
828 : {
829 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(obj);
830 : PyObject *py_acct_expiry;
831 0 : py_acct_expiry = PyLong_FromUnsignedLongLong(object->acct_expiry);
832 0 : return py_acct_expiry;
833 : }
834 :
835 0 : static int py_auth_user_info_set_acct_expiry(PyObject *py_obj, PyObject *value, void *closure)
836 : {
837 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(py_obj);
838 0 : if (value == NULL) {
839 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->acct_expiry");
840 0 : return -1;
841 : }
842 : {
843 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->acct_expiry));
844 0 : if (PyLong_Check(value)) {
845 : unsigned long long test_var;
846 0 : test_var = PyLong_AsUnsignedLongLong(value);
847 0 : if (PyErr_Occurred() != NULL) {
848 0 : return -1;
849 : }
850 0 : if (test_var > uint_max) {
851 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
852 : PyLong_Type.tp_name, uint_max, test_var);
853 0 : return -1;
854 : }
855 0 : object->acct_expiry = test_var;
856 : } else {
857 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
858 : PyLong_Type.tp_name);
859 0 : return -1;
860 : }
861 : }
862 0 : return 0;
863 : }
864 :
865 0 : static PyObject *py_auth_user_info_get_last_password_change(PyObject *obj, void *closure)
866 : {
867 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(obj);
868 : PyObject *py_last_password_change;
869 0 : py_last_password_change = PyLong_FromUnsignedLongLong(object->last_password_change);
870 0 : return py_last_password_change;
871 : }
872 :
873 0 : static int py_auth_user_info_set_last_password_change(PyObject *py_obj, PyObject *value, void *closure)
874 : {
875 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(py_obj);
876 0 : if (value == NULL) {
877 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->last_password_change");
878 0 : return -1;
879 : }
880 : {
881 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->last_password_change));
882 0 : if (PyLong_Check(value)) {
883 : unsigned long long test_var;
884 0 : test_var = PyLong_AsUnsignedLongLong(value);
885 0 : if (PyErr_Occurred() != NULL) {
886 0 : return -1;
887 : }
888 0 : if (test_var > uint_max) {
889 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
890 : PyLong_Type.tp_name, uint_max, test_var);
891 0 : return -1;
892 : }
893 0 : object->last_password_change = test_var;
894 : } else {
895 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
896 : PyLong_Type.tp_name);
897 0 : return -1;
898 : }
899 : }
900 0 : return 0;
901 : }
902 :
903 0 : static PyObject *py_auth_user_info_get_allow_password_change(PyObject *obj, void *closure)
904 : {
905 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(obj);
906 : PyObject *py_allow_password_change;
907 0 : py_allow_password_change = PyLong_FromUnsignedLongLong(object->allow_password_change);
908 0 : return py_allow_password_change;
909 : }
910 :
911 0 : static int py_auth_user_info_set_allow_password_change(PyObject *py_obj, PyObject *value, void *closure)
912 : {
913 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(py_obj);
914 0 : if (value == NULL) {
915 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->allow_password_change");
916 0 : return -1;
917 : }
918 : {
919 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->allow_password_change));
920 0 : if (PyLong_Check(value)) {
921 : unsigned long long test_var;
922 0 : test_var = PyLong_AsUnsignedLongLong(value);
923 0 : if (PyErr_Occurred() != NULL) {
924 0 : return -1;
925 : }
926 0 : if (test_var > uint_max) {
927 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
928 : PyLong_Type.tp_name, uint_max, test_var);
929 0 : return -1;
930 : }
931 0 : object->allow_password_change = test_var;
932 : } else {
933 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
934 : PyLong_Type.tp_name);
935 0 : return -1;
936 : }
937 : }
938 0 : return 0;
939 : }
940 :
941 0 : static PyObject *py_auth_user_info_get_force_password_change(PyObject *obj, void *closure)
942 : {
943 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(obj);
944 : PyObject *py_force_password_change;
945 0 : py_force_password_change = PyLong_FromUnsignedLongLong(object->force_password_change);
946 0 : return py_force_password_change;
947 : }
948 :
949 0 : static int py_auth_user_info_set_force_password_change(PyObject *py_obj, PyObject *value, void *closure)
950 : {
951 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(py_obj);
952 0 : if (value == NULL) {
953 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->force_password_change");
954 0 : return -1;
955 : }
956 : {
957 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->force_password_change));
958 0 : if (PyLong_Check(value)) {
959 : unsigned long long test_var;
960 0 : test_var = PyLong_AsUnsignedLongLong(value);
961 0 : if (PyErr_Occurred() != NULL) {
962 0 : return -1;
963 : }
964 0 : if (test_var > uint_max) {
965 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
966 : PyLong_Type.tp_name, uint_max, test_var);
967 0 : return -1;
968 : }
969 0 : object->force_password_change = test_var;
970 : } else {
971 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
972 : PyLong_Type.tp_name);
973 0 : return -1;
974 : }
975 : }
976 0 : return 0;
977 : }
978 :
979 0 : static PyObject *py_auth_user_info_get_logon_count(PyObject *obj, void *closure)
980 : {
981 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(obj);
982 : PyObject *py_logon_count;
983 0 : py_logon_count = PyLong_FromLong((uint16_t)object->logon_count);
984 0 : return py_logon_count;
985 : }
986 :
987 0 : static int py_auth_user_info_set_logon_count(PyObject *py_obj, PyObject *value, void *closure)
988 : {
989 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(py_obj);
990 0 : if (value == NULL) {
991 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->logon_count");
992 0 : return -1;
993 : }
994 : {
995 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->logon_count));
996 0 : if (PyLong_Check(value)) {
997 : unsigned long long test_var;
998 0 : test_var = PyLong_AsUnsignedLongLong(value);
999 0 : if (PyErr_Occurred() != NULL) {
1000 0 : return -1;
1001 : }
1002 0 : if (test_var > uint_max) {
1003 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1004 : PyLong_Type.tp_name, uint_max, test_var);
1005 0 : return -1;
1006 : }
1007 0 : object->logon_count = test_var;
1008 : } else {
1009 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1010 : PyLong_Type.tp_name);
1011 0 : return -1;
1012 : }
1013 : }
1014 0 : return 0;
1015 : }
1016 :
1017 0 : static PyObject *py_auth_user_info_get_bad_password_count(PyObject *obj, void *closure)
1018 : {
1019 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(obj);
1020 : PyObject *py_bad_password_count;
1021 0 : py_bad_password_count = PyLong_FromLong((uint16_t)object->bad_password_count);
1022 0 : return py_bad_password_count;
1023 : }
1024 :
1025 0 : static int py_auth_user_info_set_bad_password_count(PyObject *py_obj, PyObject *value, void *closure)
1026 : {
1027 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(py_obj);
1028 0 : if (value == NULL) {
1029 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->bad_password_count");
1030 0 : return -1;
1031 : }
1032 : {
1033 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->bad_password_count));
1034 0 : if (PyLong_Check(value)) {
1035 : unsigned long long test_var;
1036 0 : test_var = PyLong_AsUnsignedLongLong(value);
1037 0 : if (PyErr_Occurred() != NULL) {
1038 0 : return -1;
1039 : }
1040 0 : if (test_var > uint_max) {
1041 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1042 : PyLong_Type.tp_name, uint_max, test_var);
1043 0 : return -1;
1044 : }
1045 0 : object->bad_password_count = test_var;
1046 : } else {
1047 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1048 : PyLong_Type.tp_name);
1049 0 : return -1;
1050 : }
1051 : }
1052 0 : return 0;
1053 : }
1054 :
1055 0 : static PyObject *py_auth_user_info_get_acct_flags(PyObject *obj, void *closure)
1056 : {
1057 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(obj);
1058 : PyObject *py_acct_flags;
1059 0 : py_acct_flags = PyLong_FromUnsignedLongLong((uint32_t)object->acct_flags);
1060 0 : return py_acct_flags;
1061 : }
1062 :
1063 0 : static int py_auth_user_info_set_acct_flags(PyObject *py_obj, PyObject *value, void *closure)
1064 : {
1065 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(py_obj);
1066 0 : if (value == NULL) {
1067 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->acct_flags");
1068 0 : return -1;
1069 : }
1070 : {
1071 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->acct_flags));
1072 0 : if (PyLong_Check(value)) {
1073 : unsigned long long test_var;
1074 0 : test_var = PyLong_AsUnsignedLongLong(value);
1075 0 : if (PyErr_Occurred() != NULL) {
1076 0 : return -1;
1077 : }
1078 0 : if (test_var > uint_max) {
1079 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1080 : PyLong_Type.tp_name, uint_max, test_var);
1081 0 : return -1;
1082 : }
1083 0 : object->acct_flags = test_var;
1084 : } else {
1085 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1086 : PyLong_Type.tp_name);
1087 0 : return -1;
1088 : }
1089 : }
1090 0 : return 0;
1091 : }
1092 :
1093 0 : static PyObject *py_auth_user_info_get_authenticated(PyObject *obj, void *closure)
1094 : {
1095 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(obj);
1096 : PyObject *py_authenticated;
1097 0 : py_authenticated = PyLong_FromLong((uint16_t)object->authenticated);
1098 0 : return py_authenticated;
1099 : }
1100 :
1101 0 : static int py_auth_user_info_set_authenticated(PyObject *py_obj, PyObject *value, void *closure)
1102 : {
1103 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(py_obj);
1104 0 : if (value == NULL) {
1105 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->authenticated");
1106 0 : return -1;
1107 : }
1108 : {
1109 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->authenticated));
1110 0 : if (PyLong_Check(value)) {
1111 : unsigned long long test_var;
1112 0 : test_var = PyLong_AsUnsignedLongLong(value);
1113 0 : if (PyErr_Occurred() != NULL) {
1114 0 : return -1;
1115 : }
1116 0 : if (test_var > uint_max) {
1117 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1118 : PyLong_Type.tp_name, uint_max, test_var);
1119 0 : return -1;
1120 : }
1121 0 : object->authenticated = test_var;
1122 : } else {
1123 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1124 : PyLong_Type.tp_name);
1125 0 : return -1;
1126 : }
1127 : }
1128 0 : return 0;
1129 : }
1130 :
1131 : static PyGetSetDef py_auth_user_info_getsetters[] = {
1132 : {
1133 : .name = discard_const_p(char, "account_name"),
1134 : .get = py_auth_user_info_get_account_name,
1135 : .set = py_auth_user_info_set_account_name,
1136 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
1137 : },
1138 : {
1139 : .name = discard_const_p(char, "user_principal_name"),
1140 : .get = py_auth_user_info_get_user_principal_name,
1141 : .set = py_auth_user_info_set_user_principal_name,
1142 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
1143 : },
1144 : {
1145 : .name = discard_const_p(char, "user_principal_constructed"),
1146 : .get = py_auth_user_info_get_user_principal_constructed,
1147 : .set = py_auth_user_info_set_user_principal_constructed,
1148 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
1149 : },
1150 : {
1151 : .name = discard_const_p(char, "domain_name"),
1152 : .get = py_auth_user_info_get_domain_name,
1153 : .set = py_auth_user_info_set_domain_name,
1154 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
1155 : },
1156 : {
1157 : .name = discard_const_p(char, "dns_domain_name"),
1158 : .get = py_auth_user_info_get_dns_domain_name,
1159 : .set = py_auth_user_info_set_dns_domain_name,
1160 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
1161 : },
1162 : {
1163 : .name = discard_const_p(char, "full_name"),
1164 : .get = py_auth_user_info_get_full_name,
1165 : .set = py_auth_user_info_set_full_name,
1166 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
1167 : },
1168 : {
1169 : .name = discard_const_p(char, "logon_script"),
1170 : .get = py_auth_user_info_get_logon_script,
1171 : .set = py_auth_user_info_set_logon_script,
1172 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
1173 : },
1174 : {
1175 : .name = discard_const_p(char, "profile_path"),
1176 : .get = py_auth_user_info_get_profile_path,
1177 : .set = py_auth_user_info_set_profile_path,
1178 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
1179 : },
1180 : {
1181 : .name = discard_const_p(char, "home_directory"),
1182 : .get = py_auth_user_info_get_home_directory,
1183 : .set = py_auth_user_info_set_home_directory,
1184 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
1185 : },
1186 : {
1187 : .name = discard_const_p(char, "home_drive"),
1188 : .get = py_auth_user_info_get_home_drive,
1189 : .set = py_auth_user_info_set_home_drive,
1190 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
1191 : },
1192 : {
1193 : .name = discard_const_p(char, "logon_server"),
1194 : .get = py_auth_user_info_get_logon_server,
1195 : .set = py_auth_user_info_set_logon_server,
1196 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
1197 : },
1198 : {
1199 : .name = discard_const_p(char, "last_logon"),
1200 : .get = py_auth_user_info_get_last_logon,
1201 : .set = py_auth_user_info_set_last_logon,
1202 : .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
1203 : },
1204 : {
1205 : .name = discard_const_p(char, "last_logoff"),
1206 : .get = py_auth_user_info_get_last_logoff,
1207 : .set = py_auth_user_info_set_last_logoff,
1208 : .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
1209 : },
1210 : {
1211 : .name = discard_const_p(char, "acct_expiry"),
1212 : .get = py_auth_user_info_get_acct_expiry,
1213 : .set = py_auth_user_info_set_acct_expiry,
1214 : .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
1215 : },
1216 : {
1217 : .name = discard_const_p(char, "last_password_change"),
1218 : .get = py_auth_user_info_get_last_password_change,
1219 : .set = py_auth_user_info_set_last_password_change,
1220 : .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
1221 : },
1222 : {
1223 : .name = discard_const_p(char, "allow_password_change"),
1224 : .get = py_auth_user_info_get_allow_password_change,
1225 : .set = py_auth_user_info_set_allow_password_change,
1226 : .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
1227 : },
1228 : {
1229 : .name = discard_const_p(char, "force_password_change"),
1230 : .get = py_auth_user_info_get_force_password_change,
1231 : .set = py_auth_user_info_set_force_password_change,
1232 : .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
1233 : },
1234 : {
1235 : .name = discard_const_p(char, "logon_count"),
1236 : .get = py_auth_user_info_get_logon_count,
1237 : .set = py_auth_user_info_set_logon_count,
1238 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
1239 : },
1240 : {
1241 : .name = discard_const_p(char, "bad_password_count"),
1242 : .get = py_auth_user_info_get_bad_password_count,
1243 : .set = py_auth_user_info_set_bad_password_count,
1244 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
1245 : },
1246 : {
1247 : .name = discard_const_p(char, "acct_flags"),
1248 : .get = py_auth_user_info_get_acct_flags,
1249 : .set = py_auth_user_info_set_acct_flags,
1250 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
1251 : },
1252 : {
1253 : .name = discard_const_p(char, "authenticated"),
1254 : .get = py_auth_user_info_get_authenticated,
1255 : .set = py_auth_user_info_set_authenticated,
1256 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
1257 : },
1258 : { .name = NULL }
1259 : };
1260 :
1261 0 : static PyObject *py_auth_user_info_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1262 : {
1263 0 : return pytalloc_new(struct auth_user_info, type);
1264 : }
1265 :
1266 0 : static PyObject *py_auth_user_info_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
1267 : {
1268 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(py_obj);
1269 0 : PyObject *ret = NULL;
1270 : DATA_BLOB blob;
1271 : enum ndr_err_code err;
1272 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
1273 0 : if (tmp_ctx == NULL) {
1274 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
1275 0 : return NULL;
1276 : }
1277 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_auth_user_info);
1278 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
1279 0 : TALLOC_FREE(tmp_ctx);
1280 0 : PyErr_SetNdrError(err);
1281 0 : return NULL;
1282 : }
1283 :
1284 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
1285 0 : TALLOC_FREE(tmp_ctx);
1286 0 : return ret;
1287 : }
1288 :
1289 0 : static PyObject *py_auth_user_info_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
1290 : {
1291 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(py_obj);
1292 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
1293 0 : Py_ssize_t blob_length = 0;
1294 : enum ndr_err_code err;
1295 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
1296 0 : PyObject *allow_remaining_obj = NULL;
1297 0 : bool allow_remaining = false;
1298 :
1299 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
1300 : discard_const_p(char *, kwnames),
1301 : &blob.data, &blob_length,
1302 : &allow_remaining_obj)) {
1303 0 : return NULL;
1304 : }
1305 0 : blob.length = blob_length;
1306 :
1307 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
1308 0 : allow_remaining = true;
1309 : }
1310 :
1311 0 : if (allow_remaining) {
1312 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_auth_user_info);
1313 : } else {
1314 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_auth_user_info);
1315 : }
1316 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
1317 0 : PyErr_SetNdrError(err);
1318 0 : return NULL;
1319 : }
1320 :
1321 0 : Py_RETURN_NONE;
1322 : }
1323 :
1324 0 : static PyObject *py_auth_user_info_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
1325 : {
1326 0 : struct auth_user_info *object = (struct auth_user_info *)pytalloc_get_ptr(py_obj);
1327 : PyObject *ret;
1328 : char *retstr;
1329 :
1330 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_auth_user_info, "auth_user_info", object);
1331 0 : ret = PyUnicode_FromString(retstr);
1332 0 : talloc_free(retstr);
1333 :
1334 0 : return ret;
1335 : }
1336 :
1337 : static PyMethodDef py_auth_user_info_methods[] = {
1338 : { "__ndr_pack__", (PyCFunction)py_auth_user_info_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
1339 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_auth_user_info_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
1340 : { "__ndr_print__", (PyCFunction)py_auth_user_info_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
1341 : { NULL, NULL, 0, NULL }
1342 : };
1343 :
1344 :
1345 : static PyTypeObject auth_user_info_Type = {
1346 : PyVarObject_HEAD_INIT(NULL, 0)
1347 : .tp_name = "auth.user_info",
1348 : .tp_getset = py_auth_user_info_getsetters,
1349 : .tp_methods = py_auth_user_info_methods,
1350 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1351 : .tp_new = py_auth_user_info_new,
1352 : };
1353 :
1354 :
1355 0 : static PyObject *py_auth_user_info_torture_get_num_dc_sids(PyObject *obj, void *closure)
1356 : {
1357 0 : struct auth_user_info_torture *object = (struct auth_user_info_torture *)pytalloc_get_ptr(obj);
1358 : PyObject *py_num_dc_sids;
1359 0 : py_num_dc_sids = PyLong_FromUnsignedLongLong((uint32_t)object->num_dc_sids);
1360 0 : return py_num_dc_sids;
1361 : }
1362 :
1363 0 : static int py_auth_user_info_torture_set_num_dc_sids(PyObject *py_obj, PyObject *value, void *closure)
1364 : {
1365 0 : struct auth_user_info_torture *object = (struct auth_user_info_torture *)pytalloc_get_ptr(py_obj);
1366 0 : if (value == NULL) {
1367 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->num_dc_sids");
1368 0 : return -1;
1369 : }
1370 : {
1371 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->num_dc_sids));
1372 0 : if (PyLong_Check(value)) {
1373 : unsigned long long test_var;
1374 0 : test_var = PyLong_AsUnsignedLongLong(value);
1375 0 : if (PyErr_Occurred() != NULL) {
1376 0 : return -1;
1377 : }
1378 0 : if (test_var > uint_max) {
1379 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1380 : PyLong_Type.tp_name, uint_max, test_var);
1381 0 : return -1;
1382 : }
1383 0 : object->num_dc_sids = test_var;
1384 : } else {
1385 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1386 : PyLong_Type.tp_name);
1387 0 : return -1;
1388 : }
1389 : }
1390 0 : return 0;
1391 : }
1392 :
1393 0 : static PyObject *py_auth_user_info_torture_get_dc_sids(PyObject *obj, void *closure)
1394 : {
1395 0 : struct auth_user_info_torture *object = (struct auth_user_info_torture *)pytalloc_get_ptr(obj);
1396 : PyObject *py_dc_sids;
1397 0 : py_dc_sids = PyList_New(object->num_dc_sids);
1398 0 : if (py_dc_sids == NULL) {
1399 0 : return NULL;
1400 : }
1401 : {
1402 : int dc_sids_cntr_0;
1403 0 : for (dc_sids_cntr_0 = 0; dc_sids_cntr_0 < (object->num_dc_sids); dc_sids_cntr_0++) {
1404 : PyObject *py_dc_sids_0;
1405 0 : py_dc_sids_0 = pytalloc_reference_ex(dom_sid_Type, object->dc_sids, &object->dc_sids[dc_sids_cntr_0]);
1406 0 : PyList_SetItem(py_dc_sids, dc_sids_cntr_0, py_dc_sids_0);
1407 : }
1408 : }
1409 0 : return py_dc_sids;
1410 : }
1411 :
1412 0 : static int py_auth_user_info_torture_set_dc_sids(PyObject *py_obj, PyObject *value, void *closure)
1413 : {
1414 0 : struct auth_user_info_torture *object = (struct auth_user_info_torture *)pytalloc_get_ptr(py_obj);
1415 0 : if (value == NULL) {
1416 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->dc_sids");
1417 0 : return -1;
1418 : }
1419 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
1420 : {
1421 : int dc_sids_cntr_0;
1422 0 : object->dc_sids = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->dc_sids, PyList_GET_SIZE(value));
1423 0 : if (!object->dc_sids) { return -1;; }
1424 0 : talloc_set_name_const(object->dc_sids, "ARRAY: object->dc_sids");
1425 0 : for (dc_sids_cntr_0 = 0; dc_sids_cntr_0 < PyList_GET_SIZE(value); dc_sids_cntr_0++) {
1426 0 : if (PyList_GET_ITEM(value, dc_sids_cntr_0) == NULL) {
1427 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->dc_sids[dc_sids_cntr_0]");
1428 0 : return -1;
1429 : }
1430 0 : PY_CHECK_TYPE(dom_sid_Type, PyList_GET_ITEM(value, dc_sids_cntr_0), return -1;);
1431 0 : if (talloc_reference(object->dc_sids, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, dc_sids_cntr_0))) == NULL) {
1432 0 : PyErr_NoMemory();
1433 0 : return -1;
1434 : }
1435 0 : object->dc_sids[dc_sids_cntr_0] = *(struct dom_sid *)pytalloc_get_ptr(PyList_GET_ITEM(value, dc_sids_cntr_0));
1436 : }
1437 : }
1438 0 : return 0;
1439 : }
1440 :
1441 : static PyGetSetDef py_auth_user_info_torture_getsetters[] = {
1442 : {
1443 : .name = discard_const_p(char, "num_dc_sids"),
1444 : .get = py_auth_user_info_torture_get_num_dc_sids,
1445 : .set = py_auth_user_info_torture_set_num_dc_sids,
1446 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
1447 : },
1448 : {
1449 : .name = discard_const_p(char, "dc_sids"),
1450 : .get = py_auth_user_info_torture_get_dc_sids,
1451 : .set = py_auth_user_info_torture_set_dc_sids,
1452 : .doc = discard_const_p(char, "PIDL-generated element of base type dom_sid")
1453 : },
1454 : { .name = NULL }
1455 : };
1456 :
1457 0 : static PyObject *py_auth_user_info_torture_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1458 : {
1459 0 : return pytalloc_new(struct auth_user_info_torture, type);
1460 : }
1461 :
1462 0 : static PyObject *py_auth_user_info_torture_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
1463 : {
1464 0 : struct auth_user_info_torture *object = (struct auth_user_info_torture *)pytalloc_get_ptr(py_obj);
1465 0 : PyObject *ret = NULL;
1466 : DATA_BLOB blob;
1467 : enum ndr_err_code err;
1468 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
1469 0 : if (tmp_ctx == NULL) {
1470 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
1471 0 : return NULL;
1472 : }
1473 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_auth_user_info_torture);
1474 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
1475 0 : TALLOC_FREE(tmp_ctx);
1476 0 : PyErr_SetNdrError(err);
1477 0 : return NULL;
1478 : }
1479 :
1480 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
1481 0 : TALLOC_FREE(tmp_ctx);
1482 0 : return ret;
1483 : }
1484 :
1485 0 : static PyObject *py_auth_user_info_torture_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
1486 : {
1487 0 : struct auth_user_info_torture *object = (struct auth_user_info_torture *)pytalloc_get_ptr(py_obj);
1488 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
1489 0 : Py_ssize_t blob_length = 0;
1490 : enum ndr_err_code err;
1491 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
1492 0 : PyObject *allow_remaining_obj = NULL;
1493 0 : bool allow_remaining = false;
1494 :
1495 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
1496 : discard_const_p(char *, kwnames),
1497 : &blob.data, &blob_length,
1498 : &allow_remaining_obj)) {
1499 0 : return NULL;
1500 : }
1501 0 : blob.length = blob_length;
1502 :
1503 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
1504 0 : allow_remaining = true;
1505 : }
1506 :
1507 0 : if (allow_remaining) {
1508 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_auth_user_info_torture);
1509 : } else {
1510 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_auth_user_info_torture);
1511 : }
1512 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
1513 0 : PyErr_SetNdrError(err);
1514 0 : return NULL;
1515 : }
1516 :
1517 0 : Py_RETURN_NONE;
1518 : }
1519 :
1520 0 : static PyObject *py_auth_user_info_torture_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
1521 : {
1522 0 : struct auth_user_info_torture *object = (struct auth_user_info_torture *)pytalloc_get_ptr(py_obj);
1523 : PyObject *ret;
1524 : char *retstr;
1525 :
1526 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_auth_user_info_torture, "auth_user_info_torture", object);
1527 0 : ret = PyUnicode_FromString(retstr);
1528 0 : talloc_free(retstr);
1529 :
1530 0 : return ret;
1531 : }
1532 :
1533 : static PyMethodDef py_auth_user_info_torture_methods[] = {
1534 : { "__ndr_pack__", (PyCFunction)py_auth_user_info_torture_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
1535 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_auth_user_info_torture_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
1536 : { "__ndr_print__", (PyCFunction)py_auth_user_info_torture_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
1537 : { NULL, NULL, 0, NULL }
1538 : };
1539 :
1540 :
1541 : static PyTypeObject auth_user_info_torture_Type = {
1542 : PyVarObject_HEAD_INIT(NULL, 0)
1543 : .tp_name = "auth.user_info_torture",
1544 : .tp_getset = py_auth_user_info_torture_getsetters,
1545 : .tp_methods = py_auth_user_info_torture_methods,
1546 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1547 : .tp_new = py_auth_user_info_torture_new,
1548 : };
1549 :
1550 :
1551 1 : static PyObject *py_auth_user_info_unix_get_unix_name(PyObject *obj, void *closure)
1552 : {
1553 1 : struct auth_user_info_unix *object = (struct auth_user_info_unix *)pytalloc_get_ptr(obj);
1554 : PyObject *py_unix_name;
1555 1 : if (object->unix_name == NULL) {
1556 0 : Py_RETURN_NONE;
1557 : }
1558 1 : if (object->unix_name == NULL) {
1559 0 : py_unix_name = Py_None;
1560 0 : Py_INCREF(py_unix_name);
1561 : } else {
1562 1 : if (object->unix_name == NULL) {
1563 0 : py_unix_name = Py_None;
1564 0 : Py_INCREF(py_unix_name);
1565 : } else {
1566 1 : py_unix_name = PyUnicode_Decode(object->unix_name, strlen(object->unix_name), "utf-8", "ignore");
1567 : }
1568 : }
1569 1 : return py_unix_name;
1570 : }
1571 :
1572 0 : static int py_auth_user_info_unix_set_unix_name(PyObject *py_obj, PyObject *value, void *closure)
1573 : {
1574 0 : struct auth_user_info_unix *object = (struct auth_user_info_unix *)pytalloc_get_ptr(py_obj);
1575 0 : if (value == NULL) {
1576 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->unix_name");
1577 0 : return -1;
1578 : }
1579 0 : if (value == Py_None) {
1580 0 : object->unix_name = NULL;
1581 : } else {
1582 0 : object->unix_name = NULL;
1583 : {
1584 : const char *test_str;
1585 : const char *talloc_str;
1586 0 : PyObject *unicode = NULL;
1587 0 : if (PyUnicode_Check(value)) {
1588 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
1589 0 : if (unicode == NULL) {
1590 0 : PyErr_NoMemory();
1591 0 : return -1;
1592 : }
1593 0 : test_str = PyBytes_AS_STRING(unicode);
1594 0 : } else if (PyBytes_Check(value)) {
1595 0 : test_str = PyBytes_AS_STRING(value);
1596 : } else {
1597 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
1598 0 : return -1;
1599 : }
1600 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
1601 0 : if (unicode != NULL) {
1602 0 : Py_DECREF(unicode);
1603 : }
1604 0 : if (talloc_str == NULL) {
1605 0 : PyErr_NoMemory();
1606 0 : return -1;
1607 : }
1608 0 : object->unix_name = talloc_str;
1609 : }
1610 : }
1611 0 : return 0;
1612 : }
1613 :
1614 1 : static PyObject *py_auth_user_info_unix_get_sanitized_username(PyObject *obj, void *closure)
1615 : {
1616 1 : struct auth_user_info_unix *object = (struct auth_user_info_unix *)pytalloc_get_ptr(obj);
1617 : PyObject *py_sanitized_username;
1618 1 : if (object->sanitized_username == NULL) {
1619 0 : Py_RETURN_NONE;
1620 : }
1621 1 : if (object->sanitized_username == NULL) {
1622 0 : py_sanitized_username = Py_None;
1623 0 : Py_INCREF(py_sanitized_username);
1624 : } else {
1625 1 : if (object->sanitized_username == NULL) {
1626 0 : py_sanitized_username = Py_None;
1627 0 : Py_INCREF(py_sanitized_username);
1628 : } else {
1629 1 : py_sanitized_username = PyUnicode_Decode(object->sanitized_username, strlen(object->sanitized_username), "utf-8", "ignore");
1630 : }
1631 : }
1632 1 : return py_sanitized_username;
1633 : }
1634 :
1635 0 : static int py_auth_user_info_unix_set_sanitized_username(PyObject *py_obj, PyObject *value, void *closure)
1636 : {
1637 0 : struct auth_user_info_unix *object = (struct auth_user_info_unix *)pytalloc_get_ptr(py_obj);
1638 0 : if (value == NULL) {
1639 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->sanitized_username");
1640 0 : return -1;
1641 : }
1642 0 : if (value == Py_None) {
1643 0 : object->sanitized_username = NULL;
1644 : } else {
1645 0 : object->sanitized_username = NULL;
1646 : {
1647 : const char *test_str;
1648 : const char *talloc_str;
1649 0 : PyObject *unicode = NULL;
1650 0 : if (PyUnicode_Check(value)) {
1651 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
1652 0 : if (unicode == NULL) {
1653 0 : PyErr_NoMemory();
1654 0 : return -1;
1655 : }
1656 0 : test_str = PyBytes_AS_STRING(unicode);
1657 0 : } else if (PyBytes_Check(value)) {
1658 0 : test_str = PyBytes_AS_STRING(value);
1659 : } else {
1660 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
1661 0 : return -1;
1662 : }
1663 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
1664 0 : if (unicode != NULL) {
1665 0 : Py_DECREF(unicode);
1666 : }
1667 0 : if (talloc_str == NULL) {
1668 0 : PyErr_NoMemory();
1669 0 : return -1;
1670 : }
1671 0 : object->sanitized_username = talloc_str;
1672 : }
1673 : }
1674 0 : return 0;
1675 : }
1676 :
1677 : static PyGetSetDef py_auth_user_info_unix_getsetters[] = {
1678 : {
1679 : .name = discard_const_p(char, "unix_name"),
1680 : .get = py_auth_user_info_unix_get_unix_name,
1681 : .set = py_auth_user_info_unix_set_unix_name,
1682 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
1683 : },
1684 : {
1685 : .name = discard_const_p(char, "sanitized_username"),
1686 : .get = py_auth_user_info_unix_get_sanitized_username,
1687 : .set = py_auth_user_info_unix_set_sanitized_username,
1688 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
1689 : },
1690 : { .name = NULL }
1691 : };
1692 :
1693 0 : static PyObject *py_auth_user_info_unix_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1694 : {
1695 0 : return pytalloc_new(struct auth_user_info_unix, type);
1696 : }
1697 :
1698 0 : static PyObject *py_auth_user_info_unix_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
1699 : {
1700 0 : struct auth_user_info_unix *object = (struct auth_user_info_unix *)pytalloc_get_ptr(py_obj);
1701 0 : PyObject *ret = NULL;
1702 : DATA_BLOB blob;
1703 : enum ndr_err_code err;
1704 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
1705 0 : if (tmp_ctx == NULL) {
1706 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
1707 0 : return NULL;
1708 : }
1709 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_auth_user_info_unix);
1710 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
1711 0 : TALLOC_FREE(tmp_ctx);
1712 0 : PyErr_SetNdrError(err);
1713 0 : return NULL;
1714 : }
1715 :
1716 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
1717 0 : TALLOC_FREE(tmp_ctx);
1718 0 : return ret;
1719 : }
1720 :
1721 0 : static PyObject *py_auth_user_info_unix_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
1722 : {
1723 0 : struct auth_user_info_unix *object = (struct auth_user_info_unix *)pytalloc_get_ptr(py_obj);
1724 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
1725 0 : Py_ssize_t blob_length = 0;
1726 : enum ndr_err_code err;
1727 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
1728 0 : PyObject *allow_remaining_obj = NULL;
1729 0 : bool allow_remaining = false;
1730 :
1731 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
1732 : discard_const_p(char *, kwnames),
1733 : &blob.data, &blob_length,
1734 : &allow_remaining_obj)) {
1735 0 : return NULL;
1736 : }
1737 0 : blob.length = blob_length;
1738 :
1739 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
1740 0 : allow_remaining = true;
1741 : }
1742 :
1743 0 : if (allow_remaining) {
1744 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_auth_user_info_unix);
1745 : } else {
1746 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_auth_user_info_unix);
1747 : }
1748 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
1749 0 : PyErr_SetNdrError(err);
1750 0 : return NULL;
1751 : }
1752 :
1753 0 : Py_RETURN_NONE;
1754 : }
1755 :
1756 0 : static PyObject *py_auth_user_info_unix_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
1757 : {
1758 0 : struct auth_user_info_unix *object = (struct auth_user_info_unix *)pytalloc_get_ptr(py_obj);
1759 : PyObject *ret;
1760 : char *retstr;
1761 :
1762 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_auth_user_info_unix, "auth_user_info_unix", object);
1763 0 : ret = PyUnicode_FromString(retstr);
1764 0 : talloc_free(retstr);
1765 :
1766 0 : return ret;
1767 : }
1768 :
1769 : static PyMethodDef py_auth_user_info_unix_methods[] = {
1770 : { "__ndr_pack__", (PyCFunction)py_auth_user_info_unix_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
1771 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_auth_user_info_unix_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
1772 : { "__ndr_print__", (PyCFunction)py_auth_user_info_unix_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
1773 : { NULL, NULL, 0, NULL }
1774 : };
1775 :
1776 :
1777 : static PyTypeObject auth_user_info_unix_Type = {
1778 : PyVarObject_HEAD_INIT(NULL, 0)
1779 : .tp_name = "auth.user_info_unix",
1780 : .tp_getset = py_auth_user_info_unix_getsetters,
1781 : .tp_methods = py_auth_user_info_unix_methods,
1782 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1783 : .tp_new = py_auth_user_info_unix_new,
1784 : };
1785 :
1786 :
1787 0 : static PyObject *py_auth_user_info_dc_get_num_sids(PyObject *obj, void *closure)
1788 : {
1789 0 : struct auth_user_info_dc *object = (struct auth_user_info_dc *)pytalloc_get_ptr(obj);
1790 : PyObject *py_num_sids;
1791 0 : py_num_sids = PyLong_FromUnsignedLongLong((uint32_t)object->num_sids);
1792 0 : return py_num_sids;
1793 : }
1794 :
1795 0 : static int py_auth_user_info_dc_set_num_sids(PyObject *py_obj, PyObject *value, void *closure)
1796 : {
1797 0 : struct auth_user_info_dc *object = (struct auth_user_info_dc *)pytalloc_get_ptr(py_obj);
1798 0 : if (value == NULL) {
1799 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->num_sids");
1800 0 : return -1;
1801 : }
1802 : {
1803 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->num_sids));
1804 0 : if (PyLong_Check(value)) {
1805 : unsigned long long test_var;
1806 0 : test_var = PyLong_AsUnsignedLongLong(value);
1807 0 : if (PyErr_Occurred() != NULL) {
1808 0 : return -1;
1809 : }
1810 0 : if (test_var > uint_max) {
1811 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1812 : PyLong_Type.tp_name, uint_max, test_var);
1813 0 : return -1;
1814 : }
1815 0 : object->num_sids = test_var;
1816 : } else {
1817 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1818 : PyLong_Type.tp_name);
1819 0 : return -1;
1820 : }
1821 : }
1822 0 : return 0;
1823 : }
1824 :
1825 0 : static PyObject *py_auth_user_info_dc_get_sids(PyObject *obj, void *closure)
1826 : {
1827 0 : struct auth_user_info_dc *object = (struct auth_user_info_dc *)pytalloc_get_ptr(obj);
1828 : PyObject *py_sids;
1829 0 : py_sids = PyList_New(object->num_sids);
1830 0 : if (py_sids == NULL) {
1831 0 : return NULL;
1832 : }
1833 : {
1834 : int sids_cntr_0;
1835 0 : for (sids_cntr_0 = 0; sids_cntr_0 < (object->num_sids); sids_cntr_0++) {
1836 : PyObject *py_sids_0;
1837 0 : py_sids_0 = pytalloc_reference_ex(dom_sid_Type, object->sids, &object->sids[sids_cntr_0]);
1838 0 : PyList_SetItem(py_sids, sids_cntr_0, py_sids_0);
1839 : }
1840 : }
1841 0 : return py_sids;
1842 : }
1843 :
1844 0 : static int py_auth_user_info_dc_set_sids(PyObject *py_obj, PyObject *value, void *closure)
1845 : {
1846 0 : struct auth_user_info_dc *object = (struct auth_user_info_dc *)pytalloc_get_ptr(py_obj);
1847 0 : if (value == NULL) {
1848 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->sids");
1849 0 : return -1;
1850 : }
1851 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
1852 : {
1853 : int sids_cntr_0;
1854 0 : object->sids = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->sids, PyList_GET_SIZE(value));
1855 0 : if (!object->sids) { return -1;; }
1856 0 : talloc_set_name_const(object->sids, "ARRAY: object->sids");
1857 0 : for (sids_cntr_0 = 0; sids_cntr_0 < PyList_GET_SIZE(value); sids_cntr_0++) {
1858 0 : if (PyList_GET_ITEM(value, sids_cntr_0) == NULL) {
1859 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->sids[sids_cntr_0]");
1860 0 : return -1;
1861 : }
1862 0 : PY_CHECK_TYPE(dom_sid_Type, PyList_GET_ITEM(value, sids_cntr_0), return -1;);
1863 0 : if (talloc_reference(object->sids, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, sids_cntr_0))) == NULL) {
1864 0 : PyErr_NoMemory();
1865 0 : return -1;
1866 : }
1867 0 : object->sids[sids_cntr_0] = *(struct dom_sid *)pytalloc_get_ptr(PyList_GET_ITEM(value, sids_cntr_0));
1868 : }
1869 : }
1870 0 : return 0;
1871 : }
1872 :
1873 0 : static PyObject *py_auth_user_info_dc_get_info(PyObject *obj, void *closure)
1874 : {
1875 0 : struct auth_user_info_dc *object = (struct auth_user_info_dc *)pytalloc_get_ptr(obj);
1876 : PyObject *py_info;
1877 0 : if (object->info == NULL) {
1878 0 : Py_RETURN_NONE;
1879 : }
1880 0 : if (object->info == NULL) {
1881 0 : py_info = Py_None;
1882 0 : Py_INCREF(py_info);
1883 : } else {
1884 0 : py_info = pytalloc_reference_ex(&auth_user_info_Type, object->info, object->info);
1885 : }
1886 0 : return py_info;
1887 : }
1888 :
1889 0 : static int py_auth_user_info_dc_set_info(PyObject *py_obj, PyObject *value, void *closure)
1890 : {
1891 0 : struct auth_user_info_dc *object = (struct auth_user_info_dc *)pytalloc_get_ptr(py_obj);
1892 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->info));
1893 0 : if (value == NULL) {
1894 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->info");
1895 0 : return -1;
1896 : }
1897 0 : if (value == Py_None) {
1898 0 : object->info = NULL;
1899 : } else {
1900 0 : object->info = NULL;
1901 0 : PY_CHECK_TYPE(&auth_user_info_Type, value, return -1;);
1902 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
1903 0 : PyErr_NoMemory();
1904 0 : return -1;
1905 : }
1906 0 : object->info = (struct auth_user_info *)pytalloc_get_ptr(value);
1907 : }
1908 0 : return 0;
1909 : }
1910 :
1911 0 : static PyObject *py_auth_user_info_dc_get_user_session_key(PyObject *obj, void *closure)
1912 : {
1913 0 : struct auth_user_info_dc *object = (struct auth_user_info_dc *)pytalloc_get_ptr(obj);
1914 : PyObject *py_user_session_key;
1915 0 : py_user_session_key = PyBytes_FromStringAndSize((char *)(object->user_session_key).data, (object->user_session_key).length);
1916 0 : return py_user_session_key;
1917 : }
1918 :
1919 0 : static int py_auth_user_info_dc_set_user_session_key(PyObject *py_obj, PyObject *value, void *closure)
1920 : {
1921 0 : struct auth_user_info_dc *object = (struct auth_user_info_dc *)pytalloc_get_ptr(py_obj);
1922 0 : if (value == NULL) {
1923 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->user_session_key");
1924 0 : return -1;
1925 : }
1926 0 : object->user_session_key = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
1927 0 : return 0;
1928 : }
1929 :
1930 0 : static PyObject *py_auth_user_info_dc_get_lm_session_key(PyObject *obj, void *closure)
1931 : {
1932 0 : struct auth_user_info_dc *object = (struct auth_user_info_dc *)pytalloc_get_ptr(obj);
1933 : PyObject *py_lm_session_key;
1934 0 : py_lm_session_key = PyBytes_FromStringAndSize((char *)(object->lm_session_key).data, (object->lm_session_key).length);
1935 0 : return py_lm_session_key;
1936 : }
1937 :
1938 0 : static int py_auth_user_info_dc_set_lm_session_key(PyObject *py_obj, PyObject *value, void *closure)
1939 : {
1940 0 : struct auth_user_info_dc *object = (struct auth_user_info_dc *)pytalloc_get_ptr(py_obj);
1941 0 : if (value == NULL) {
1942 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->lm_session_key");
1943 0 : return -1;
1944 : }
1945 0 : object->lm_session_key = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
1946 0 : return 0;
1947 : }
1948 :
1949 0 : static PyObject *py_auth_user_info_dc_get_ticket_type(PyObject *obj, void *closure)
1950 : {
1951 0 : struct auth_user_info_dc *object = (struct auth_user_info_dc *)pytalloc_get_ptr(obj);
1952 : PyObject *py_ticket_type;
1953 0 : py_ticket_type = PyLong_FromLong((uint16_t)object->ticket_type);
1954 0 : return py_ticket_type;
1955 : }
1956 :
1957 0 : static int py_auth_user_info_dc_set_ticket_type(PyObject *py_obj, PyObject *value, void *closure)
1958 : {
1959 0 : struct auth_user_info_dc *object = (struct auth_user_info_dc *)pytalloc_get_ptr(py_obj);
1960 0 : if (value == NULL) {
1961 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->ticket_type");
1962 0 : return -1;
1963 : }
1964 : {
1965 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->ticket_type));
1966 0 : if (PyLong_Check(value)) {
1967 : unsigned long long test_var;
1968 0 : test_var = PyLong_AsUnsignedLongLong(value);
1969 0 : if (PyErr_Occurred() != NULL) {
1970 0 : return -1;
1971 : }
1972 0 : if (test_var > uint_max) {
1973 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1974 : PyLong_Type.tp_name, uint_max, test_var);
1975 0 : return -1;
1976 : }
1977 0 : object->ticket_type = test_var;
1978 : } else {
1979 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1980 : PyLong_Type.tp_name);
1981 0 : return -1;
1982 : }
1983 : }
1984 0 : return 0;
1985 : }
1986 :
1987 : static PyGetSetDef py_auth_user_info_dc_getsetters[] = {
1988 : {
1989 : .name = discard_const_p(char, "num_sids"),
1990 : .get = py_auth_user_info_dc_get_num_sids,
1991 : .set = py_auth_user_info_dc_set_num_sids,
1992 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
1993 : },
1994 : {
1995 : .name = discard_const_p(char, "sids"),
1996 : .get = py_auth_user_info_dc_get_sids,
1997 : .set = py_auth_user_info_dc_set_sids,
1998 : .doc = discard_const_p(char, "PIDL-generated element of base type dom_sid")
1999 : },
2000 : {
2001 : .name = discard_const_p(char, "info"),
2002 : .get = py_auth_user_info_dc_get_info,
2003 : .set = py_auth_user_info_dc_set_info,
2004 : .doc = discard_const_p(char, "PIDL-generated element of base type auth_user_info")
2005 : },
2006 : {
2007 : .name = discard_const_p(char, "user_session_key"),
2008 : .get = py_auth_user_info_dc_get_user_session_key,
2009 : .set = py_auth_user_info_dc_set_user_session_key,
2010 : .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
2011 : },
2012 : {
2013 : .name = discard_const_p(char, "lm_session_key"),
2014 : .get = py_auth_user_info_dc_get_lm_session_key,
2015 : .set = py_auth_user_info_dc_set_lm_session_key,
2016 : .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
2017 : },
2018 : {
2019 : .name = discard_const_p(char, "ticket_type"),
2020 : .get = py_auth_user_info_dc_get_ticket_type,
2021 : .set = py_auth_user_info_dc_set_ticket_type,
2022 : .doc = discard_const_p(char, "PIDL-generated element of base type ticket_type")
2023 : },
2024 : { .name = NULL }
2025 : };
2026 :
2027 0 : static PyObject *py_auth_user_info_dc_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2028 : {
2029 0 : return pytalloc_new(struct auth_user_info_dc, type);
2030 : }
2031 :
2032 0 : static PyObject *py_auth_user_info_dc_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2033 : {
2034 0 : struct auth_user_info_dc *object = (struct auth_user_info_dc *)pytalloc_get_ptr(py_obj);
2035 0 : PyObject *ret = NULL;
2036 : DATA_BLOB blob;
2037 : enum ndr_err_code err;
2038 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
2039 0 : if (tmp_ctx == NULL) {
2040 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
2041 0 : return NULL;
2042 : }
2043 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_auth_user_info_dc);
2044 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2045 0 : TALLOC_FREE(tmp_ctx);
2046 0 : PyErr_SetNdrError(err);
2047 0 : return NULL;
2048 : }
2049 :
2050 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
2051 0 : TALLOC_FREE(tmp_ctx);
2052 0 : return ret;
2053 : }
2054 :
2055 0 : static PyObject *py_auth_user_info_dc_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
2056 : {
2057 0 : struct auth_user_info_dc *object = (struct auth_user_info_dc *)pytalloc_get_ptr(py_obj);
2058 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
2059 0 : Py_ssize_t blob_length = 0;
2060 : enum ndr_err_code err;
2061 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
2062 0 : PyObject *allow_remaining_obj = NULL;
2063 0 : bool allow_remaining = false;
2064 :
2065 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
2066 : discard_const_p(char *, kwnames),
2067 : &blob.data, &blob_length,
2068 : &allow_remaining_obj)) {
2069 0 : return NULL;
2070 : }
2071 0 : blob.length = blob_length;
2072 :
2073 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
2074 0 : allow_remaining = true;
2075 : }
2076 :
2077 0 : if (allow_remaining) {
2078 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_auth_user_info_dc);
2079 : } else {
2080 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_auth_user_info_dc);
2081 : }
2082 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2083 0 : PyErr_SetNdrError(err);
2084 0 : return NULL;
2085 : }
2086 :
2087 0 : Py_RETURN_NONE;
2088 : }
2089 :
2090 0 : static PyObject *py_auth_user_info_dc_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2091 : {
2092 0 : struct auth_user_info_dc *object = (struct auth_user_info_dc *)pytalloc_get_ptr(py_obj);
2093 : PyObject *ret;
2094 : char *retstr;
2095 :
2096 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_auth_user_info_dc, "auth_user_info_dc", object);
2097 0 : ret = PyUnicode_FromString(retstr);
2098 0 : talloc_free(retstr);
2099 :
2100 0 : return ret;
2101 : }
2102 :
2103 : static PyMethodDef py_auth_user_info_dc_methods[] = {
2104 : { "__ndr_pack__", (PyCFunction)py_auth_user_info_dc_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
2105 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_auth_user_info_dc_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
2106 : { "__ndr_print__", (PyCFunction)py_auth_user_info_dc_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
2107 : { NULL, NULL, 0, NULL }
2108 : };
2109 :
2110 :
2111 : static PyTypeObject auth_user_info_dc_Type = {
2112 : PyVarObject_HEAD_INIT(NULL, 0)
2113 : .tp_name = "auth.user_info_dc",
2114 : .tp_getset = py_auth_user_info_dc_getsetters,
2115 : .tp_methods = py_auth_user_info_dc_methods,
2116 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
2117 : .tp_new = py_auth_user_info_dc_new,
2118 : };
2119 :
2120 :
2121 31 : static PyObject *py_auth_session_info_get_security_token(PyObject *obj, void *closure)
2122 : {
2123 31 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(obj);
2124 : PyObject *py_security_token;
2125 31 : if (object->security_token == NULL) {
2126 0 : Py_RETURN_NONE;
2127 : }
2128 31 : if (object->security_token == NULL) {
2129 0 : py_security_token = Py_None;
2130 0 : Py_INCREF(py_security_token);
2131 : } else {
2132 31 : py_security_token = pytalloc_reference_ex(security_token_Type, object->security_token, object->security_token);
2133 : }
2134 31 : return py_security_token;
2135 : }
2136 :
2137 0 : static int py_auth_session_info_set_security_token(PyObject *py_obj, PyObject *value, void *closure)
2138 : {
2139 0 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(py_obj);
2140 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->security_token));
2141 0 : if (value == NULL) {
2142 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->security_token");
2143 0 : return -1;
2144 : }
2145 0 : if (value == Py_None) {
2146 0 : object->security_token = NULL;
2147 : } else {
2148 0 : object->security_token = NULL;
2149 0 : PY_CHECK_TYPE(security_token_Type, value, return -1;);
2150 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
2151 0 : PyErr_NoMemory();
2152 0 : return -1;
2153 : }
2154 0 : object->security_token = (struct security_token *)pytalloc_get_ptr(value);
2155 : }
2156 0 : return 0;
2157 : }
2158 :
2159 1 : static PyObject *py_auth_session_info_get_unix_token(PyObject *obj, void *closure)
2160 : {
2161 1 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(obj);
2162 : PyObject *py_unix_token;
2163 1 : if (object->unix_token == NULL) {
2164 0 : Py_RETURN_NONE;
2165 : }
2166 1 : if (object->unix_token == NULL) {
2167 0 : py_unix_token = Py_None;
2168 0 : Py_INCREF(py_unix_token);
2169 : } else {
2170 1 : py_unix_token = pytalloc_reference_ex(security_unix_token_Type, object->unix_token, object->unix_token);
2171 : }
2172 1 : return py_unix_token;
2173 : }
2174 :
2175 0 : static int py_auth_session_info_set_unix_token(PyObject *py_obj, PyObject *value, void *closure)
2176 : {
2177 0 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(py_obj);
2178 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->unix_token));
2179 0 : if (value == NULL) {
2180 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->unix_token");
2181 0 : return -1;
2182 : }
2183 0 : if (value == Py_None) {
2184 0 : object->unix_token = NULL;
2185 : } else {
2186 0 : object->unix_token = NULL;
2187 0 : PY_CHECK_TYPE(security_unix_token_Type, value, return -1;);
2188 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
2189 0 : PyErr_NoMemory();
2190 0 : return -1;
2191 : }
2192 0 : object->unix_token = (struct security_unix_token *)pytalloc_get_ptr(value);
2193 : }
2194 0 : return 0;
2195 : }
2196 :
2197 8 : static PyObject *py_auth_session_info_get_info(PyObject *obj, void *closure)
2198 : {
2199 8 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(obj);
2200 : PyObject *py_info;
2201 8 : if (object->info == NULL) {
2202 0 : Py_RETURN_NONE;
2203 : }
2204 8 : if (object->info == NULL) {
2205 0 : py_info = Py_None;
2206 0 : Py_INCREF(py_info);
2207 : } else {
2208 8 : py_info = pytalloc_reference_ex(&auth_user_info_Type, object->info, object->info);
2209 : }
2210 8 : return py_info;
2211 : }
2212 :
2213 0 : static int py_auth_session_info_set_info(PyObject *py_obj, PyObject *value, void *closure)
2214 : {
2215 0 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(py_obj);
2216 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->info));
2217 0 : if (value == NULL) {
2218 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->info");
2219 0 : return -1;
2220 : }
2221 0 : if (value == Py_None) {
2222 0 : object->info = NULL;
2223 : } else {
2224 0 : object->info = NULL;
2225 0 : PY_CHECK_TYPE(&auth_user_info_Type, value, return -1;);
2226 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
2227 0 : PyErr_NoMemory();
2228 0 : return -1;
2229 : }
2230 0 : object->info = (struct auth_user_info *)pytalloc_get_ptr(value);
2231 : }
2232 0 : return 0;
2233 : }
2234 :
2235 2 : static PyObject *py_auth_session_info_get_unix_info(PyObject *obj, void *closure)
2236 : {
2237 2 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(obj);
2238 : PyObject *py_unix_info;
2239 2 : if (object->unix_info == NULL) {
2240 0 : Py_RETURN_NONE;
2241 : }
2242 2 : if (object->unix_info == NULL) {
2243 0 : py_unix_info = Py_None;
2244 0 : Py_INCREF(py_unix_info);
2245 : } else {
2246 2 : py_unix_info = pytalloc_reference_ex(&auth_user_info_unix_Type, object->unix_info, object->unix_info);
2247 : }
2248 2 : return py_unix_info;
2249 : }
2250 :
2251 0 : static int py_auth_session_info_set_unix_info(PyObject *py_obj, PyObject *value, void *closure)
2252 : {
2253 0 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(py_obj);
2254 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->unix_info));
2255 0 : if (value == NULL) {
2256 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->unix_info");
2257 0 : return -1;
2258 : }
2259 0 : if (value == Py_None) {
2260 0 : object->unix_info = NULL;
2261 : } else {
2262 0 : object->unix_info = NULL;
2263 0 : PY_CHECK_TYPE(&auth_user_info_unix_Type, value, return -1;);
2264 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
2265 0 : PyErr_NoMemory();
2266 0 : return -1;
2267 : }
2268 0 : object->unix_info = (struct auth_user_info_unix *)pytalloc_get_ptr(value);
2269 : }
2270 0 : return 0;
2271 : }
2272 :
2273 2 : static PyObject *py_auth_session_info_get_torture(PyObject *obj, void *closure)
2274 : {
2275 2 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(obj);
2276 : PyObject *py_torture;
2277 2 : if (object->torture == NULL) {
2278 0 : Py_RETURN_NONE;
2279 : }
2280 2 : if (object->torture == NULL) {
2281 0 : py_torture = Py_None;
2282 0 : Py_INCREF(py_torture);
2283 : } else {
2284 2 : py_torture = pytalloc_reference_ex(&auth_user_info_torture_Type, object->torture, object->torture);
2285 : }
2286 2 : return py_torture;
2287 : }
2288 :
2289 0 : static int py_auth_session_info_set_torture(PyObject *py_obj, PyObject *value, void *closure)
2290 : {
2291 0 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(py_obj);
2292 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->torture));
2293 0 : if (value == NULL) {
2294 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->torture");
2295 0 : return -1;
2296 : }
2297 0 : if (value == Py_None) {
2298 0 : object->torture = NULL;
2299 : } else {
2300 0 : object->torture = NULL;
2301 0 : PY_CHECK_TYPE(&auth_user_info_torture_Type, value, return -1;);
2302 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
2303 0 : PyErr_NoMemory();
2304 0 : return -1;
2305 : }
2306 0 : object->torture = (struct auth_user_info_torture *)pytalloc_get_ptr(value);
2307 : }
2308 0 : return 0;
2309 : }
2310 :
2311 3 : static PyObject *py_auth_session_info_get_session_key(PyObject *obj, void *closure)
2312 : {
2313 3 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(obj);
2314 : PyObject *py_session_key;
2315 3 : py_session_key = PyBytes_FromStringAndSize((char *)(object->session_key).data, (object->session_key).length);
2316 3 : return py_session_key;
2317 : }
2318 :
2319 0 : static int py_auth_session_info_set_session_key(PyObject *py_obj, PyObject *value, void *closure)
2320 : {
2321 0 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(py_obj);
2322 0 : if (value == NULL) {
2323 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->session_key");
2324 0 : return -1;
2325 : }
2326 0 : object->session_key = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
2327 0 : return 0;
2328 : }
2329 :
2330 0 : static PyObject *py_auth_session_info_get_credentials(PyObject *obj, void *closure)
2331 : {
2332 0 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(obj);
2333 : PyObject *py_credentials;
2334 0 : if (object->credentials == NULL) {
2335 0 : Py_RETURN_NONE;
2336 : }
2337 0 : if (object->credentials == NULL) {
2338 0 : py_credentials = Py_None;
2339 0 : Py_INCREF(py_credentials);
2340 : } else {
2341 0 : py_credentials = NULL;
2342 : }
2343 0 : return py_credentials;
2344 : }
2345 :
2346 0 : static int py_auth_session_info_set_credentials(PyObject *py_obj, PyObject *value, void *closure)
2347 : {
2348 0 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(py_obj);
2349 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->credentials));
2350 0 : if (value == NULL) {
2351 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->credentials");
2352 0 : return -1;
2353 : }
2354 0 : if (value == Py_None) {
2355 0 : object->credentials = NULL;
2356 : } else {
2357 0 : object->credentials = NULL;
2358 0 : PyErr_SetString(PyExc_TypeError, "Can not convert C Type struct cli_credentials from Python");
2359 : }
2360 0 : return 0;
2361 : }
2362 :
2363 0 : static PyObject *py_auth_session_info_get_unique_session_token(PyObject *obj, void *closure)
2364 : {
2365 0 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(obj);
2366 : PyObject *py_unique_session_token;
2367 0 : py_unique_session_token = pytalloc_reference_ex(GUID_Type, pytalloc_get_mem_ctx(obj), &object->unique_session_token);
2368 0 : return py_unique_session_token;
2369 : }
2370 :
2371 0 : static int py_auth_session_info_set_unique_session_token(PyObject *py_obj, PyObject *value, void *closure)
2372 : {
2373 0 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(py_obj);
2374 0 : if (value == NULL) {
2375 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->unique_session_token");
2376 0 : return -1;
2377 : }
2378 0 : PY_CHECK_TYPE(GUID_Type, value, return -1;);
2379 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
2380 0 : PyErr_NoMemory();
2381 0 : return -1;
2382 : }
2383 0 : object->unique_session_token = *(struct GUID *)pytalloc_get_ptr(value);
2384 0 : return 0;
2385 : }
2386 :
2387 0 : static PyObject *py_auth_session_info_get_ticket_type(PyObject *obj, void *closure)
2388 : {
2389 0 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(obj);
2390 : PyObject *py_ticket_type;
2391 0 : py_ticket_type = PyLong_FromLong((uint16_t)object->ticket_type);
2392 0 : return py_ticket_type;
2393 : }
2394 :
2395 0 : static int py_auth_session_info_set_ticket_type(PyObject *py_obj, PyObject *value, void *closure)
2396 : {
2397 0 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(py_obj);
2398 0 : if (value == NULL) {
2399 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->ticket_type");
2400 0 : return -1;
2401 : }
2402 : {
2403 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->ticket_type));
2404 0 : if (PyLong_Check(value)) {
2405 : unsigned long long test_var;
2406 0 : test_var = PyLong_AsUnsignedLongLong(value);
2407 0 : if (PyErr_Occurred() != NULL) {
2408 0 : return -1;
2409 : }
2410 0 : if (test_var > uint_max) {
2411 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2412 : PyLong_Type.tp_name, uint_max, test_var);
2413 0 : return -1;
2414 : }
2415 0 : object->ticket_type = test_var;
2416 : } else {
2417 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2418 : PyLong_Type.tp_name);
2419 0 : return -1;
2420 : }
2421 : }
2422 0 : return 0;
2423 : }
2424 :
2425 : static PyGetSetDef py_auth_session_info_getsetters[] = {
2426 : {
2427 : .name = discard_const_p(char, "security_token"),
2428 : .get = py_auth_session_info_get_security_token,
2429 : .set = py_auth_session_info_set_security_token,
2430 : .doc = discard_const_p(char, "PIDL-generated element of base type security_token")
2431 : },
2432 : {
2433 : .name = discard_const_p(char, "unix_token"),
2434 : .get = py_auth_session_info_get_unix_token,
2435 : .set = py_auth_session_info_set_unix_token,
2436 : .doc = discard_const_p(char, "PIDL-generated element of base type security_unix_token")
2437 : },
2438 : {
2439 : .name = discard_const_p(char, "info"),
2440 : .get = py_auth_session_info_get_info,
2441 : .set = py_auth_session_info_set_info,
2442 : .doc = discard_const_p(char, "PIDL-generated element of base type auth_user_info")
2443 : },
2444 : {
2445 : .name = discard_const_p(char, "unix_info"),
2446 : .get = py_auth_session_info_get_unix_info,
2447 : .set = py_auth_session_info_set_unix_info,
2448 : .doc = discard_const_p(char, "PIDL-generated element of base type auth_user_info_unix")
2449 : },
2450 : {
2451 : .name = discard_const_p(char, "torture"),
2452 : .get = py_auth_session_info_get_torture,
2453 : .set = py_auth_session_info_set_torture,
2454 : .doc = discard_const_p(char, "PIDL-generated element of base type auth_user_info_torture")
2455 : },
2456 : {
2457 : .name = discard_const_p(char, "session_key"),
2458 : .get = py_auth_session_info_get_session_key,
2459 : .set = py_auth_session_info_set_session_key,
2460 : .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
2461 : },
2462 : {
2463 : .name = discard_const_p(char, "credentials"),
2464 : .get = py_auth_session_info_get_credentials,
2465 : .set = py_auth_session_info_set_credentials,
2466 : .doc = discard_const_p(char, "PIDL-generated element of base type cli_credentials")
2467 : },
2468 : {
2469 : .name = discard_const_p(char, "unique_session_token"),
2470 : .get = py_auth_session_info_get_unique_session_token,
2471 : .set = py_auth_session_info_set_unique_session_token,
2472 : .doc = discard_const_p(char, "PIDL-generated element of base type GUID")
2473 : },
2474 : {
2475 : .name = discard_const_p(char, "ticket_type"),
2476 : .get = py_auth_session_info_get_ticket_type,
2477 : .set = py_auth_session_info_set_ticket_type,
2478 : .doc = discard_const_p(char, "PIDL-generated element of base type ticket_type")
2479 : },
2480 : { .name = NULL }
2481 : };
2482 :
2483 0 : static PyObject *py_auth_session_info_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2484 : {
2485 0 : return pytalloc_new(struct auth_session_info, type);
2486 : }
2487 :
2488 0 : static PyObject *py_auth_session_info_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2489 : {
2490 0 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(py_obj);
2491 0 : PyObject *ret = NULL;
2492 : DATA_BLOB blob;
2493 : enum ndr_err_code err;
2494 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
2495 0 : if (tmp_ctx == NULL) {
2496 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
2497 0 : return NULL;
2498 : }
2499 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_auth_session_info);
2500 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2501 0 : TALLOC_FREE(tmp_ctx);
2502 0 : PyErr_SetNdrError(err);
2503 0 : return NULL;
2504 : }
2505 :
2506 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
2507 0 : TALLOC_FREE(tmp_ctx);
2508 0 : return ret;
2509 : }
2510 :
2511 0 : static PyObject *py_auth_session_info_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
2512 : {
2513 0 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(py_obj);
2514 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
2515 0 : Py_ssize_t blob_length = 0;
2516 : enum ndr_err_code err;
2517 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
2518 0 : PyObject *allow_remaining_obj = NULL;
2519 0 : bool allow_remaining = false;
2520 :
2521 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
2522 : discard_const_p(char *, kwnames),
2523 : &blob.data, &blob_length,
2524 : &allow_remaining_obj)) {
2525 0 : return NULL;
2526 : }
2527 0 : blob.length = blob_length;
2528 :
2529 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
2530 0 : allow_remaining = true;
2531 : }
2532 :
2533 0 : if (allow_remaining) {
2534 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_auth_session_info);
2535 : } else {
2536 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_auth_session_info);
2537 : }
2538 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2539 0 : PyErr_SetNdrError(err);
2540 0 : return NULL;
2541 : }
2542 :
2543 0 : Py_RETURN_NONE;
2544 : }
2545 :
2546 0 : static PyObject *py_auth_session_info_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2547 : {
2548 0 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(py_obj);
2549 : PyObject *ret;
2550 : char *retstr;
2551 :
2552 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_auth_session_info, "auth_session_info", object);
2553 0 : ret = PyUnicode_FromString(retstr);
2554 0 : talloc_free(retstr);
2555 :
2556 0 : return ret;
2557 : }
2558 :
2559 : static PyMethodDef py_auth_session_info_methods[] = {
2560 : { "__ndr_pack__", (PyCFunction)py_auth_session_info_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
2561 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_auth_session_info_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
2562 : { "__ndr_print__", (PyCFunction)py_auth_session_info_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
2563 : { NULL, NULL, 0, NULL }
2564 : };
2565 :
2566 :
2567 : static PyTypeObject auth_session_info_Type = {
2568 : PyVarObject_HEAD_INIT(NULL, 0)
2569 : .tp_name = "auth.session_info",
2570 : .tp_getset = py_auth_session_info_getsetters,
2571 : .tp_methods = py_auth_session_info_methods,
2572 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
2573 : .tp_new = py_auth_session_info_new,
2574 : };
2575 :
2576 :
2577 0 : static PyObject *py_auth_session_info_transport_get_session_info(PyObject *obj, void *closure)
2578 : {
2579 0 : struct auth_session_info_transport *object = (struct auth_session_info_transport *)pytalloc_get_ptr(obj);
2580 : PyObject *py_session_info;
2581 0 : if (object->session_info == NULL) {
2582 0 : Py_RETURN_NONE;
2583 : }
2584 0 : if (object->session_info == NULL) {
2585 0 : py_session_info = Py_None;
2586 0 : Py_INCREF(py_session_info);
2587 : } else {
2588 0 : py_session_info = pytalloc_reference_ex(&auth_session_info_Type, object->session_info, object->session_info);
2589 : }
2590 0 : return py_session_info;
2591 : }
2592 :
2593 0 : static int py_auth_session_info_transport_set_session_info(PyObject *py_obj, PyObject *value, void *closure)
2594 : {
2595 0 : struct auth_session_info_transport *object = (struct auth_session_info_transport *)pytalloc_get_ptr(py_obj);
2596 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->session_info));
2597 0 : if (value == NULL) {
2598 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->session_info");
2599 0 : return -1;
2600 : }
2601 0 : if (value == Py_None) {
2602 0 : object->session_info = NULL;
2603 : } else {
2604 0 : object->session_info = NULL;
2605 0 : PY_CHECK_TYPE(&auth_session_info_Type, value, return -1;);
2606 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
2607 0 : PyErr_NoMemory();
2608 0 : return -1;
2609 : }
2610 0 : object->session_info = (struct auth_session_info *)pytalloc_get_ptr(value);
2611 : }
2612 0 : return 0;
2613 : }
2614 :
2615 0 : static PyObject *py_auth_session_info_transport_get_exported_gssapi_credentials(PyObject *obj, void *closure)
2616 : {
2617 0 : struct auth_session_info_transport *object = (struct auth_session_info_transport *)pytalloc_get_ptr(obj);
2618 : PyObject *py_exported_gssapi_credentials;
2619 0 : py_exported_gssapi_credentials = PyBytes_FromStringAndSize((char *)(object->exported_gssapi_credentials).data, (object->exported_gssapi_credentials).length);
2620 0 : return py_exported_gssapi_credentials;
2621 : }
2622 :
2623 0 : static int py_auth_session_info_transport_set_exported_gssapi_credentials(PyObject *py_obj, PyObject *value, void *closure)
2624 : {
2625 0 : struct auth_session_info_transport *object = (struct auth_session_info_transport *)pytalloc_get_ptr(py_obj);
2626 0 : if (value == NULL) {
2627 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->exported_gssapi_credentials");
2628 0 : return -1;
2629 : }
2630 0 : object->exported_gssapi_credentials = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
2631 0 : return 0;
2632 : }
2633 :
2634 : static PyGetSetDef py_auth_session_info_transport_getsetters[] = {
2635 : {
2636 : .name = discard_const_p(char, "session_info"),
2637 : .get = py_auth_session_info_transport_get_session_info,
2638 : .set = py_auth_session_info_transport_set_session_info,
2639 : .doc = discard_const_p(char, "PIDL-generated element of base type auth_session_info")
2640 : },
2641 : {
2642 : .name = discard_const_p(char, "exported_gssapi_credentials"),
2643 : .get = py_auth_session_info_transport_get_exported_gssapi_credentials,
2644 : .set = py_auth_session_info_transport_set_exported_gssapi_credentials,
2645 : .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
2646 : },
2647 : { .name = NULL }
2648 : };
2649 :
2650 0 : static PyObject *py_auth_session_info_transport_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2651 : {
2652 0 : return pytalloc_new(struct auth_session_info_transport, type);
2653 : }
2654 :
2655 0 : static PyObject *py_auth_session_info_transport_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2656 : {
2657 0 : struct auth_session_info_transport *object = (struct auth_session_info_transport *)pytalloc_get_ptr(py_obj);
2658 0 : PyObject *ret = NULL;
2659 : DATA_BLOB blob;
2660 : enum ndr_err_code err;
2661 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
2662 0 : if (tmp_ctx == NULL) {
2663 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
2664 0 : return NULL;
2665 : }
2666 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_auth_session_info_transport);
2667 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2668 0 : TALLOC_FREE(tmp_ctx);
2669 0 : PyErr_SetNdrError(err);
2670 0 : return NULL;
2671 : }
2672 :
2673 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
2674 0 : TALLOC_FREE(tmp_ctx);
2675 0 : return ret;
2676 : }
2677 :
2678 0 : static PyObject *py_auth_session_info_transport_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
2679 : {
2680 0 : struct auth_session_info_transport *object = (struct auth_session_info_transport *)pytalloc_get_ptr(py_obj);
2681 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
2682 0 : Py_ssize_t blob_length = 0;
2683 : enum ndr_err_code err;
2684 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
2685 0 : PyObject *allow_remaining_obj = NULL;
2686 0 : bool allow_remaining = false;
2687 :
2688 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
2689 : discard_const_p(char *, kwnames),
2690 : &blob.data, &blob_length,
2691 : &allow_remaining_obj)) {
2692 0 : return NULL;
2693 : }
2694 0 : blob.length = blob_length;
2695 :
2696 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
2697 0 : allow_remaining = true;
2698 : }
2699 :
2700 0 : if (allow_remaining) {
2701 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_auth_session_info_transport);
2702 : } else {
2703 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_auth_session_info_transport);
2704 : }
2705 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2706 0 : PyErr_SetNdrError(err);
2707 0 : return NULL;
2708 : }
2709 :
2710 0 : Py_RETURN_NONE;
2711 : }
2712 :
2713 0 : static PyObject *py_auth_session_info_transport_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2714 : {
2715 0 : struct auth_session_info_transport *object = (struct auth_session_info_transport *)pytalloc_get_ptr(py_obj);
2716 : PyObject *ret;
2717 : char *retstr;
2718 :
2719 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_auth_session_info_transport, "auth_session_info_transport", object);
2720 0 : ret = PyUnicode_FromString(retstr);
2721 0 : talloc_free(retstr);
2722 :
2723 0 : return ret;
2724 : }
2725 :
2726 : static PyMethodDef py_auth_session_info_transport_methods[] = {
2727 : { "__ndr_pack__", (PyCFunction)py_auth_session_info_transport_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
2728 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_auth_session_info_transport_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
2729 : { "__ndr_print__", (PyCFunction)py_auth_session_info_transport_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
2730 : { NULL, NULL, 0, NULL }
2731 : };
2732 :
2733 :
2734 : static PyTypeObject auth_session_info_transport_Type = {
2735 : PyVarObject_HEAD_INIT(NULL, 0)
2736 : .tp_name = "auth.session_info_transport",
2737 : .tp_getset = py_auth_session_info_transport_getsetters,
2738 : .tp_methods = py_auth_session_info_transport_methods,
2739 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
2740 : .tp_new = py_auth_session_info_transport_new,
2741 : };
2742 :
2743 : static PyMethodDef auth_methods[] = {
2744 : { NULL, NULL, 0, NULL }
2745 : };
2746 :
2747 : static struct PyModuleDef moduledef = {
2748 : PyModuleDef_HEAD_INIT,
2749 : .m_name = "auth",
2750 : .m_doc = "auth DCE/RPC",
2751 : .m_size = -1,
2752 : .m_methods = auth_methods,
2753 : };
2754 2598 : MODULE_INIT_FUNC(auth)
2755 : {
2756 2598 : PyObject *m = NULL;
2757 2598 : PyObject *dep_samba_dcerpc_misc = NULL;
2758 2598 : PyObject *dep_samba_dcerpc_security = NULL;
2759 2598 : PyObject *dep_samba_dcerpc_lsa = NULL;
2760 2598 : PyObject *dep_samba_dcerpc_krb5pac = NULL;
2761 2598 : PyObject *dep_talloc = NULL;
2762 :
2763 2598 : dep_samba_dcerpc_misc = PyImport_ImportModule("samba.dcerpc.misc");
2764 2598 : if (dep_samba_dcerpc_misc == NULL)
2765 0 : goto out;
2766 :
2767 2598 : dep_samba_dcerpc_security = PyImport_ImportModule("samba.dcerpc.security");
2768 2598 : if (dep_samba_dcerpc_security == NULL)
2769 0 : goto out;
2770 :
2771 2598 : dep_samba_dcerpc_lsa = PyImport_ImportModule("samba.dcerpc.lsa");
2772 2598 : if (dep_samba_dcerpc_lsa == NULL)
2773 0 : goto out;
2774 :
2775 2598 : dep_samba_dcerpc_krb5pac = PyImport_ImportModule("samba.dcerpc.krb5pac");
2776 2598 : if (dep_samba_dcerpc_krb5pac == NULL)
2777 0 : goto out;
2778 :
2779 2598 : dep_talloc = PyImport_ImportModule("talloc");
2780 2598 : if (dep_talloc == NULL)
2781 0 : goto out;
2782 :
2783 2598 : BaseObject_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "BaseObject");
2784 2598 : if (BaseObject_Type == NULL)
2785 0 : goto out;
2786 :
2787 2598 : dom_sid_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_security, "dom_sid");
2788 2598 : if (dom_sid_Type == NULL)
2789 0 : goto out;
2790 :
2791 2598 : security_token_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_security, "token");
2792 2598 : if (security_token_Type == NULL)
2793 0 : goto out;
2794 :
2795 2598 : security_unix_token_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_security, "unix_token");
2796 2598 : if (security_unix_token_Type == NULL)
2797 0 : goto out;
2798 :
2799 2598 : GUID_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_misc, "GUID");
2800 2598 : if (GUID_Type == NULL)
2801 0 : goto out;
2802 :
2803 2598 : auth_user_info_Type.tp_base = BaseObject_Type;
2804 2598 : auth_user_info_Type.tp_basicsize = pytalloc_BaseObject_size();
2805 :
2806 2598 : auth_user_info_torture_Type.tp_base = BaseObject_Type;
2807 2598 : auth_user_info_torture_Type.tp_basicsize = pytalloc_BaseObject_size();
2808 :
2809 2598 : auth_user_info_unix_Type.tp_base = BaseObject_Type;
2810 2598 : auth_user_info_unix_Type.tp_basicsize = pytalloc_BaseObject_size();
2811 :
2812 2598 : auth_user_info_dc_Type.tp_base = BaseObject_Type;
2813 2598 : auth_user_info_dc_Type.tp_basicsize = pytalloc_BaseObject_size();
2814 :
2815 2598 : auth_session_info_Type.tp_base = BaseObject_Type;
2816 2598 : auth_session_info_Type.tp_basicsize = pytalloc_BaseObject_size();
2817 :
2818 2598 : auth_session_info_transport_Type.tp_base = BaseObject_Type;
2819 2598 : auth_session_info_transport_Type.tp_basicsize = pytalloc_BaseObject_size();
2820 :
2821 2598 : if (PyType_Ready(&auth_user_info_Type) < 0)
2822 0 : goto out;
2823 2598 : if (PyType_Ready(&auth_user_info_torture_Type) < 0)
2824 0 : goto out;
2825 2598 : if (PyType_Ready(&auth_user_info_unix_Type) < 0)
2826 0 : goto out;
2827 2598 : if (PyType_Ready(&auth_user_info_dc_Type) < 0)
2828 0 : goto out;
2829 2598 : if (PyType_Ready(&auth_session_info_Type) < 0)
2830 0 : goto out;
2831 2598 : if (PyType_Ready(&auth_session_info_transport_Type) < 0)
2832 0 : goto out;
2833 : #ifdef PY_USER_INFO_PATCH
2834 : PY_USER_INFO_PATCH(&auth_user_info_Type);
2835 : #endif
2836 : #ifdef PY_USER_INFO_TORTURE_PATCH
2837 : PY_USER_INFO_TORTURE_PATCH(&auth_user_info_torture_Type);
2838 : #endif
2839 : #ifdef PY_USER_INFO_UNIX_PATCH
2840 : PY_USER_INFO_UNIX_PATCH(&auth_user_info_unix_Type);
2841 : #endif
2842 : #ifdef PY_USER_INFO_DC_PATCH
2843 : PY_USER_INFO_DC_PATCH(&auth_user_info_dc_Type);
2844 : #endif
2845 : #ifdef PY_SESSION_INFO_PATCH
2846 2598 : PY_SESSION_INFO_PATCH(&auth_session_info_Type);
2847 : #endif
2848 : #ifdef PY_SESSION_INFO_TRANSPORT_PATCH
2849 : PY_SESSION_INFO_TRANSPORT_PATCH(&auth_session_info_transport_Type);
2850 : #endif
2851 :
2852 2598 : m = PyModule_Create(&moduledef);
2853 2598 : if (m == NULL)
2854 0 : goto out;
2855 :
2856 2598 : PyModule_AddObject(m, "SEC_AUTH_METHOD_UNAUTHENTICATED", PyLong_FromLong((uint16_t)SEC_AUTH_METHOD_UNAUTHENTICATED));
2857 2598 : PyModule_AddObject(m, "SEC_AUTH_METHOD_NTLM", PyLong_FromLong((uint16_t)SEC_AUTH_METHOD_NTLM));
2858 2598 : PyModule_AddObject(m, "SEC_AUTH_METHOD_KERBEROS", PyLong_FromLong((uint16_t)SEC_AUTH_METHOD_KERBEROS));
2859 2598 : PyModule_AddObject(m, "TICKET_TYPE_UNKNOWN", PyLong_FromLong((uint16_t)TICKET_TYPE_UNKNOWN));
2860 2598 : PyModule_AddObject(m, "TICKET_TYPE_TGT", PyLong_FromLong((uint16_t)TICKET_TYPE_TGT));
2861 2598 : PyModule_AddObject(m, "TICKET_TYPE_NON_TGT", PyLong_FromLong((uint16_t)TICKET_TYPE_NON_TGT));
2862 2598 : Py_INCREF((PyObject *)(void *)&auth_user_info_Type);
2863 2598 : PyModule_AddObject(m, "user_info", (PyObject *)(void *)&auth_user_info_Type);
2864 2598 : Py_INCREF((PyObject *)(void *)&auth_user_info_torture_Type);
2865 2598 : PyModule_AddObject(m, "user_info_torture", (PyObject *)(void *)&auth_user_info_torture_Type);
2866 2598 : Py_INCREF((PyObject *)(void *)&auth_user_info_unix_Type);
2867 2598 : PyModule_AddObject(m, "user_info_unix", (PyObject *)(void *)&auth_user_info_unix_Type);
2868 2598 : Py_INCREF((PyObject *)(void *)&auth_user_info_dc_Type);
2869 2598 : PyModule_AddObject(m, "user_info_dc", (PyObject *)(void *)&auth_user_info_dc_Type);
2870 2598 : Py_INCREF((PyObject *)(void *)&auth_session_info_Type);
2871 2598 : PyModule_AddObject(m, "session_info", (PyObject *)(void *)&auth_session_info_Type);
2872 2598 : Py_INCREF((PyObject *)(void *)&auth_session_info_transport_Type);
2873 2598 : PyModule_AddObject(m, "session_info_transport", (PyObject *)(void *)&auth_session_info_transport_Type);
2874 : #ifdef PY_MOD_AUTH_PATCH
2875 : PY_MOD_AUTH_PATCH(m);
2876 : #endif
2877 2598 : out:
2878 2598 : Py_XDECREF(dep_samba_dcerpc_misc);
2879 2598 : Py_XDECREF(dep_samba_dcerpc_security);
2880 2598 : Py_XDECREF(dep_samba_dcerpc_lsa);
2881 2598 : Py_XDECREF(dep_samba_dcerpc_krb5pac);
2882 2598 : Py_XDECREF(dep_talloc);
2883 2598 : return m;
2884 :
2885 : }
|