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 : static PyGetSetDef py_auth_user_info_dc_getsetters[] = {
1950 : {
1951 : .name = discard_const_p(char, "num_sids"),
1952 : .get = py_auth_user_info_dc_get_num_sids,
1953 : .set = py_auth_user_info_dc_set_num_sids,
1954 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
1955 : },
1956 : {
1957 : .name = discard_const_p(char, "sids"),
1958 : .get = py_auth_user_info_dc_get_sids,
1959 : .set = py_auth_user_info_dc_set_sids,
1960 : .doc = discard_const_p(char, "PIDL-generated element of base type dom_sid")
1961 : },
1962 : {
1963 : .name = discard_const_p(char, "info"),
1964 : .get = py_auth_user_info_dc_get_info,
1965 : .set = py_auth_user_info_dc_set_info,
1966 : .doc = discard_const_p(char, "PIDL-generated element of base type auth_user_info")
1967 : },
1968 : {
1969 : .name = discard_const_p(char, "user_session_key"),
1970 : .get = py_auth_user_info_dc_get_user_session_key,
1971 : .set = py_auth_user_info_dc_set_user_session_key,
1972 : .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
1973 : },
1974 : {
1975 : .name = discard_const_p(char, "lm_session_key"),
1976 : .get = py_auth_user_info_dc_get_lm_session_key,
1977 : .set = py_auth_user_info_dc_set_lm_session_key,
1978 : .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
1979 : },
1980 : { .name = NULL }
1981 : };
1982 :
1983 0 : static PyObject *py_auth_user_info_dc_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1984 : {
1985 0 : return pytalloc_new(struct auth_user_info_dc, type);
1986 : }
1987 :
1988 0 : static PyObject *py_auth_user_info_dc_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
1989 : {
1990 0 : struct auth_user_info_dc *object = (struct auth_user_info_dc *)pytalloc_get_ptr(py_obj);
1991 0 : PyObject *ret = NULL;
1992 : DATA_BLOB blob;
1993 : enum ndr_err_code err;
1994 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
1995 0 : if (tmp_ctx == NULL) {
1996 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
1997 0 : return NULL;
1998 : }
1999 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_auth_user_info_dc);
2000 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2001 0 : TALLOC_FREE(tmp_ctx);
2002 0 : PyErr_SetNdrError(err);
2003 0 : return NULL;
2004 : }
2005 :
2006 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
2007 0 : TALLOC_FREE(tmp_ctx);
2008 0 : return ret;
2009 : }
2010 :
2011 0 : static PyObject *py_auth_user_info_dc_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
2012 : {
2013 0 : struct auth_user_info_dc *object = (struct auth_user_info_dc *)pytalloc_get_ptr(py_obj);
2014 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
2015 0 : Py_ssize_t blob_length = 0;
2016 : enum ndr_err_code err;
2017 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
2018 0 : PyObject *allow_remaining_obj = NULL;
2019 0 : bool allow_remaining = false;
2020 :
2021 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
2022 : discard_const_p(char *, kwnames),
2023 : &blob.data, &blob_length,
2024 : &allow_remaining_obj)) {
2025 0 : return NULL;
2026 : }
2027 0 : blob.length = blob_length;
2028 :
2029 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
2030 0 : allow_remaining = true;
2031 : }
2032 :
2033 0 : if (allow_remaining) {
2034 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);
2035 : } else {
2036 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);
2037 : }
2038 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2039 0 : PyErr_SetNdrError(err);
2040 0 : return NULL;
2041 : }
2042 :
2043 0 : Py_RETURN_NONE;
2044 : }
2045 :
2046 0 : static PyObject *py_auth_user_info_dc_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2047 : {
2048 0 : struct auth_user_info_dc *object = (struct auth_user_info_dc *)pytalloc_get_ptr(py_obj);
2049 : PyObject *ret;
2050 : char *retstr;
2051 :
2052 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);
2053 0 : ret = PyUnicode_FromString(retstr);
2054 0 : talloc_free(retstr);
2055 :
2056 0 : return ret;
2057 : }
2058 :
2059 : static PyMethodDef py_auth_user_info_dc_methods[] = {
2060 : { "__ndr_pack__", (PyCFunction)py_auth_user_info_dc_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
2061 : { "__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" },
2062 : { "__ndr_print__", (PyCFunction)py_auth_user_info_dc_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
2063 : { NULL, NULL, 0, NULL }
2064 : };
2065 :
2066 :
2067 : static PyTypeObject auth_user_info_dc_Type = {
2068 : PyVarObject_HEAD_INIT(NULL, 0)
2069 : .tp_name = "auth.user_info_dc",
2070 : .tp_getset = py_auth_user_info_dc_getsetters,
2071 : .tp_methods = py_auth_user_info_dc_methods,
2072 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
2073 : .tp_new = py_auth_user_info_dc_new,
2074 : };
2075 :
2076 :
2077 55 : static PyObject *py_auth_session_info_get_security_token(PyObject *obj, void *closure)
2078 : {
2079 55 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(obj);
2080 : PyObject *py_security_token;
2081 55 : if (object->security_token == NULL) {
2082 0 : Py_RETURN_NONE;
2083 : }
2084 55 : if (object->security_token == NULL) {
2085 0 : py_security_token = Py_None;
2086 0 : Py_INCREF(py_security_token);
2087 : } else {
2088 55 : py_security_token = pytalloc_reference_ex(security_token_Type, object->security_token, object->security_token);
2089 : }
2090 55 : return py_security_token;
2091 : }
2092 :
2093 0 : static int py_auth_session_info_set_security_token(PyObject *py_obj, PyObject *value, void *closure)
2094 : {
2095 0 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(py_obj);
2096 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->security_token));
2097 0 : if (value == NULL) {
2098 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->security_token");
2099 0 : return -1;
2100 : }
2101 0 : if (value == Py_None) {
2102 0 : object->security_token = NULL;
2103 : } else {
2104 0 : object->security_token = NULL;
2105 0 : PY_CHECK_TYPE(security_token_Type, value, return -1;);
2106 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
2107 0 : PyErr_NoMemory();
2108 0 : return -1;
2109 : }
2110 0 : object->security_token = (struct security_token *)pytalloc_get_ptr(value);
2111 : }
2112 0 : return 0;
2113 : }
2114 :
2115 1 : static PyObject *py_auth_session_info_get_unix_token(PyObject *obj, void *closure)
2116 : {
2117 1 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(obj);
2118 : PyObject *py_unix_token;
2119 1 : if (object->unix_token == NULL) {
2120 0 : Py_RETURN_NONE;
2121 : }
2122 1 : if (object->unix_token == NULL) {
2123 0 : py_unix_token = Py_None;
2124 0 : Py_INCREF(py_unix_token);
2125 : } else {
2126 1 : py_unix_token = pytalloc_reference_ex(security_unix_token_Type, object->unix_token, object->unix_token);
2127 : }
2128 1 : return py_unix_token;
2129 : }
2130 :
2131 0 : static int py_auth_session_info_set_unix_token(PyObject *py_obj, PyObject *value, void *closure)
2132 : {
2133 0 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(py_obj);
2134 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->unix_token));
2135 0 : if (value == NULL) {
2136 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->unix_token");
2137 0 : return -1;
2138 : }
2139 0 : if (value == Py_None) {
2140 0 : object->unix_token = NULL;
2141 : } else {
2142 0 : object->unix_token = NULL;
2143 0 : PY_CHECK_TYPE(security_unix_token_Type, value, return -1;);
2144 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
2145 0 : PyErr_NoMemory();
2146 0 : return -1;
2147 : }
2148 0 : object->unix_token = (struct security_unix_token *)pytalloc_get_ptr(value);
2149 : }
2150 0 : return 0;
2151 : }
2152 :
2153 8 : static PyObject *py_auth_session_info_get_info(PyObject *obj, void *closure)
2154 : {
2155 8 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(obj);
2156 : PyObject *py_info;
2157 8 : if (object->info == NULL) {
2158 0 : Py_RETURN_NONE;
2159 : }
2160 8 : if (object->info == NULL) {
2161 0 : py_info = Py_None;
2162 0 : Py_INCREF(py_info);
2163 : } else {
2164 8 : py_info = pytalloc_reference_ex(&auth_user_info_Type, object->info, object->info);
2165 : }
2166 8 : return py_info;
2167 : }
2168 :
2169 0 : static int py_auth_session_info_set_info(PyObject *py_obj, PyObject *value, void *closure)
2170 : {
2171 0 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(py_obj);
2172 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->info));
2173 0 : if (value == NULL) {
2174 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->info");
2175 0 : return -1;
2176 : }
2177 0 : if (value == Py_None) {
2178 0 : object->info = NULL;
2179 : } else {
2180 0 : object->info = NULL;
2181 0 : PY_CHECK_TYPE(&auth_user_info_Type, value, return -1;);
2182 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
2183 0 : PyErr_NoMemory();
2184 0 : return -1;
2185 : }
2186 0 : object->info = (struct auth_user_info *)pytalloc_get_ptr(value);
2187 : }
2188 0 : return 0;
2189 : }
2190 :
2191 2 : static PyObject *py_auth_session_info_get_unix_info(PyObject *obj, void *closure)
2192 : {
2193 2 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(obj);
2194 : PyObject *py_unix_info;
2195 2 : if (object->unix_info == NULL) {
2196 0 : Py_RETURN_NONE;
2197 : }
2198 2 : if (object->unix_info == NULL) {
2199 0 : py_unix_info = Py_None;
2200 0 : Py_INCREF(py_unix_info);
2201 : } else {
2202 2 : py_unix_info = pytalloc_reference_ex(&auth_user_info_unix_Type, object->unix_info, object->unix_info);
2203 : }
2204 2 : return py_unix_info;
2205 : }
2206 :
2207 0 : static int py_auth_session_info_set_unix_info(PyObject *py_obj, PyObject *value, void *closure)
2208 : {
2209 0 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(py_obj);
2210 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->unix_info));
2211 0 : if (value == NULL) {
2212 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->unix_info");
2213 0 : return -1;
2214 : }
2215 0 : if (value == Py_None) {
2216 0 : object->unix_info = NULL;
2217 : } else {
2218 0 : object->unix_info = NULL;
2219 0 : PY_CHECK_TYPE(&auth_user_info_unix_Type, value, return -1;);
2220 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
2221 0 : PyErr_NoMemory();
2222 0 : return -1;
2223 : }
2224 0 : object->unix_info = (struct auth_user_info_unix *)pytalloc_get_ptr(value);
2225 : }
2226 0 : return 0;
2227 : }
2228 :
2229 2 : static PyObject *py_auth_session_info_get_torture(PyObject *obj, void *closure)
2230 : {
2231 2 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(obj);
2232 : PyObject *py_torture;
2233 2 : if (object->torture == NULL) {
2234 0 : Py_RETURN_NONE;
2235 : }
2236 2 : if (object->torture == NULL) {
2237 0 : py_torture = Py_None;
2238 0 : Py_INCREF(py_torture);
2239 : } else {
2240 2 : py_torture = pytalloc_reference_ex(&auth_user_info_torture_Type, object->torture, object->torture);
2241 : }
2242 2 : return py_torture;
2243 : }
2244 :
2245 0 : static int py_auth_session_info_set_torture(PyObject *py_obj, PyObject *value, void *closure)
2246 : {
2247 0 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(py_obj);
2248 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->torture));
2249 0 : if (value == NULL) {
2250 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->torture");
2251 0 : return -1;
2252 : }
2253 0 : if (value == Py_None) {
2254 0 : object->torture = NULL;
2255 : } else {
2256 0 : object->torture = NULL;
2257 0 : PY_CHECK_TYPE(&auth_user_info_torture_Type, value, return -1;);
2258 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
2259 0 : PyErr_NoMemory();
2260 0 : return -1;
2261 : }
2262 0 : object->torture = (struct auth_user_info_torture *)pytalloc_get_ptr(value);
2263 : }
2264 0 : return 0;
2265 : }
2266 :
2267 3 : static PyObject *py_auth_session_info_get_session_key(PyObject *obj, void *closure)
2268 : {
2269 3 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(obj);
2270 : PyObject *py_session_key;
2271 3 : py_session_key = PyBytes_FromStringAndSize((char *)(object->session_key).data, (object->session_key).length);
2272 3 : return py_session_key;
2273 : }
2274 :
2275 0 : static int py_auth_session_info_set_session_key(PyObject *py_obj, PyObject *value, void *closure)
2276 : {
2277 0 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(py_obj);
2278 0 : if (value == NULL) {
2279 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->session_key");
2280 0 : return -1;
2281 : }
2282 0 : object->session_key = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
2283 0 : return 0;
2284 : }
2285 :
2286 0 : static PyObject *py_auth_session_info_get_credentials(PyObject *obj, void *closure)
2287 : {
2288 0 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(obj);
2289 : PyObject *py_credentials;
2290 0 : if (object->credentials == NULL) {
2291 0 : Py_RETURN_NONE;
2292 : }
2293 0 : if (object->credentials == NULL) {
2294 0 : py_credentials = Py_None;
2295 0 : Py_INCREF(py_credentials);
2296 : } else {
2297 0 : py_credentials = NULL;
2298 : }
2299 0 : return py_credentials;
2300 : }
2301 :
2302 0 : static int py_auth_session_info_set_credentials(PyObject *py_obj, PyObject *value, void *closure)
2303 : {
2304 0 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(py_obj);
2305 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->credentials));
2306 0 : if (value == NULL) {
2307 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->credentials");
2308 0 : return -1;
2309 : }
2310 0 : if (value == Py_None) {
2311 0 : object->credentials = NULL;
2312 : } else {
2313 0 : object->credentials = NULL;
2314 0 : PyErr_SetString(PyExc_TypeError, "Can not convert C Type struct cli_credentials from Python");
2315 : }
2316 0 : return 0;
2317 : }
2318 :
2319 0 : static PyObject *py_auth_session_info_get_unique_session_token(PyObject *obj, void *closure)
2320 : {
2321 0 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(obj);
2322 : PyObject *py_unique_session_token;
2323 0 : py_unique_session_token = pytalloc_reference_ex(GUID_Type, pytalloc_get_mem_ctx(obj), &object->unique_session_token);
2324 0 : return py_unique_session_token;
2325 : }
2326 :
2327 0 : static int py_auth_session_info_set_unique_session_token(PyObject *py_obj, PyObject *value, void *closure)
2328 : {
2329 0 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(py_obj);
2330 0 : if (value == NULL) {
2331 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->unique_session_token");
2332 0 : return -1;
2333 : }
2334 0 : PY_CHECK_TYPE(GUID_Type, value, return -1;);
2335 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
2336 0 : PyErr_NoMemory();
2337 0 : return -1;
2338 : }
2339 0 : object->unique_session_token = *(struct GUID *)pytalloc_get_ptr(value);
2340 0 : return 0;
2341 : }
2342 :
2343 : static PyGetSetDef py_auth_session_info_getsetters[] = {
2344 : {
2345 : .name = discard_const_p(char, "security_token"),
2346 : .get = py_auth_session_info_get_security_token,
2347 : .set = py_auth_session_info_set_security_token,
2348 : .doc = discard_const_p(char, "PIDL-generated element of base type security_token")
2349 : },
2350 : {
2351 : .name = discard_const_p(char, "unix_token"),
2352 : .get = py_auth_session_info_get_unix_token,
2353 : .set = py_auth_session_info_set_unix_token,
2354 : .doc = discard_const_p(char, "PIDL-generated element of base type security_unix_token")
2355 : },
2356 : {
2357 : .name = discard_const_p(char, "info"),
2358 : .get = py_auth_session_info_get_info,
2359 : .set = py_auth_session_info_set_info,
2360 : .doc = discard_const_p(char, "PIDL-generated element of base type auth_user_info")
2361 : },
2362 : {
2363 : .name = discard_const_p(char, "unix_info"),
2364 : .get = py_auth_session_info_get_unix_info,
2365 : .set = py_auth_session_info_set_unix_info,
2366 : .doc = discard_const_p(char, "PIDL-generated element of base type auth_user_info_unix")
2367 : },
2368 : {
2369 : .name = discard_const_p(char, "torture"),
2370 : .get = py_auth_session_info_get_torture,
2371 : .set = py_auth_session_info_set_torture,
2372 : .doc = discard_const_p(char, "PIDL-generated element of base type auth_user_info_torture")
2373 : },
2374 : {
2375 : .name = discard_const_p(char, "session_key"),
2376 : .get = py_auth_session_info_get_session_key,
2377 : .set = py_auth_session_info_set_session_key,
2378 : .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
2379 : },
2380 : {
2381 : .name = discard_const_p(char, "credentials"),
2382 : .get = py_auth_session_info_get_credentials,
2383 : .set = py_auth_session_info_set_credentials,
2384 : .doc = discard_const_p(char, "PIDL-generated element of base type cli_credentials")
2385 : },
2386 : {
2387 : .name = discard_const_p(char, "unique_session_token"),
2388 : .get = py_auth_session_info_get_unique_session_token,
2389 : .set = py_auth_session_info_set_unique_session_token,
2390 : .doc = discard_const_p(char, "PIDL-generated element of base type GUID")
2391 : },
2392 : { .name = NULL }
2393 : };
2394 :
2395 0 : static PyObject *py_auth_session_info_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2396 : {
2397 0 : return pytalloc_new(struct auth_session_info, type);
2398 : }
2399 :
2400 0 : static PyObject *py_auth_session_info_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2401 : {
2402 0 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(py_obj);
2403 0 : PyObject *ret = NULL;
2404 : DATA_BLOB blob;
2405 : enum ndr_err_code err;
2406 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
2407 0 : if (tmp_ctx == NULL) {
2408 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
2409 0 : return NULL;
2410 : }
2411 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_auth_session_info);
2412 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2413 0 : TALLOC_FREE(tmp_ctx);
2414 0 : PyErr_SetNdrError(err);
2415 0 : return NULL;
2416 : }
2417 :
2418 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
2419 0 : TALLOC_FREE(tmp_ctx);
2420 0 : return ret;
2421 : }
2422 :
2423 0 : static PyObject *py_auth_session_info_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
2424 : {
2425 0 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(py_obj);
2426 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
2427 0 : Py_ssize_t blob_length = 0;
2428 : enum ndr_err_code err;
2429 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
2430 0 : PyObject *allow_remaining_obj = NULL;
2431 0 : bool allow_remaining = false;
2432 :
2433 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
2434 : discard_const_p(char *, kwnames),
2435 : &blob.data, &blob_length,
2436 : &allow_remaining_obj)) {
2437 0 : return NULL;
2438 : }
2439 0 : blob.length = blob_length;
2440 :
2441 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
2442 0 : allow_remaining = true;
2443 : }
2444 :
2445 0 : if (allow_remaining) {
2446 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_auth_session_info);
2447 : } else {
2448 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);
2449 : }
2450 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2451 0 : PyErr_SetNdrError(err);
2452 0 : return NULL;
2453 : }
2454 :
2455 0 : Py_RETURN_NONE;
2456 : }
2457 :
2458 0 : static PyObject *py_auth_session_info_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2459 : {
2460 0 : struct auth_session_info *object = (struct auth_session_info *)pytalloc_get_ptr(py_obj);
2461 : PyObject *ret;
2462 : char *retstr;
2463 :
2464 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);
2465 0 : ret = PyUnicode_FromString(retstr);
2466 0 : talloc_free(retstr);
2467 :
2468 0 : return ret;
2469 : }
2470 :
2471 : static PyMethodDef py_auth_session_info_methods[] = {
2472 : { "__ndr_pack__", (PyCFunction)py_auth_session_info_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
2473 : { "__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" },
2474 : { "__ndr_print__", (PyCFunction)py_auth_session_info_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
2475 : { NULL, NULL, 0, NULL }
2476 : };
2477 :
2478 :
2479 : static PyTypeObject auth_session_info_Type = {
2480 : PyVarObject_HEAD_INIT(NULL, 0)
2481 : .tp_name = "auth.session_info",
2482 : .tp_getset = py_auth_session_info_getsetters,
2483 : .tp_methods = py_auth_session_info_methods,
2484 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
2485 : .tp_new = py_auth_session_info_new,
2486 : };
2487 :
2488 :
2489 0 : static PyObject *py_auth_session_info_transport_get_session_info(PyObject *obj, void *closure)
2490 : {
2491 0 : struct auth_session_info_transport *object = (struct auth_session_info_transport *)pytalloc_get_ptr(obj);
2492 : PyObject *py_session_info;
2493 0 : if (object->session_info == NULL) {
2494 0 : Py_RETURN_NONE;
2495 : }
2496 0 : if (object->session_info == NULL) {
2497 0 : py_session_info = Py_None;
2498 0 : Py_INCREF(py_session_info);
2499 : } else {
2500 0 : py_session_info = pytalloc_reference_ex(&auth_session_info_Type, object->session_info, object->session_info);
2501 : }
2502 0 : return py_session_info;
2503 : }
2504 :
2505 0 : static int py_auth_session_info_transport_set_session_info(PyObject *py_obj, PyObject *value, void *closure)
2506 : {
2507 0 : struct auth_session_info_transport *object = (struct auth_session_info_transport *)pytalloc_get_ptr(py_obj);
2508 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->session_info));
2509 0 : if (value == NULL) {
2510 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->session_info");
2511 0 : return -1;
2512 : }
2513 0 : if (value == Py_None) {
2514 0 : object->session_info = NULL;
2515 : } else {
2516 0 : object->session_info = NULL;
2517 0 : PY_CHECK_TYPE(&auth_session_info_Type, value, return -1;);
2518 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
2519 0 : PyErr_NoMemory();
2520 0 : return -1;
2521 : }
2522 0 : object->session_info = (struct auth_session_info *)pytalloc_get_ptr(value);
2523 : }
2524 0 : return 0;
2525 : }
2526 :
2527 0 : static PyObject *py_auth_session_info_transport_get_exported_gssapi_credentials(PyObject *obj, void *closure)
2528 : {
2529 0 : struct auth_session_info_transport *object = (struct auth_session_info_transport *)pytalloc_get_ptr(obj);
2530 : PyObject *py_exported_gssapi_credentials;
2531 0 : py_exported_gssapi_credentials = PyBytes_FromStringAndSize((char *)(object->exported_gssapi_credentials).data, (object->exported_gssapi_credentials).length);
2532 0 : return py_exported_gssapi_credentials;
2533 : }
2534 :
2535 0 : static int py_auth_session_info_transport_set_exported_gssapi_credentials(PyObject *py_obj, PyObject *value, void *closure)
2536 : {
2537 0 : struct auth_session_info_transport *object = (struct auth_session_info_transport *)pytalloc_get_ptr(py_obj);
2538 0 : if (value == NULL) {
2539 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->exported_gssapi_credentials");
2540 0 : return -1;
2541 : }
2542 0 : object->exported_gssapi_credentials = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
2543 0 : return 0;
2544 : }
2545 :
2546 : static PyGetSetDef py_auth_session_info_transport_getsetters[] = {
2547 : {
2548 : .name = discard_const_p(char, "session_info"),
2549 : .get = py_auth_session_info_transport_get_session_info,
2550 : .set = py_auth_session_info_transport_set_session_info,
2551 : .doc = discard_const_p(char, "PIDL-generated element of base type auth_session_info")
2552 : },
2553 : {
2554 : .name = discard_const_p(char, "exported_gssapi_credentials"),
2555 : .get = py_auth_session_info_transport_get_exported_gssapi_credentials,
2556 : .set = py_auth_session_info_transport_set_exported_gssapi_credentials,
2557 : .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
2558 : },
2559 : { .name = NULL }
2560 : };
2561 :
2562 0 : static PyObject *py_auth_session_info_transport_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2563 : {
2564 0 : return pytalloc_new(struct auth_session_info_transport, type);
2565 : }
2566 :
2567 0 : static PyObject *py_auth_session_info_transport_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2568 : {
2569 0 : struct auth_session_info_transport *object = (struct auth_session_info_transport *)pytalloc_get_ptr(py_obj);
2570 0 : PyObject *ret = NULL;
2571 : DATA_BLOB blob;
2572 : enum ndr_err_code err;
2573 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
2574 0 : if (tmp_ctx == NULL) {
2575 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
2576 0 : return NULL;
2577 : }
2578 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_auth_session_info_transport);
2579 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2580 0 : TALLOC_FREE(tmp_ctx);
2581 0 : PyErr_SetNdrError(err);
2582 0 : return NULL;
2583 : }
2584 :
2585 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
2586 0 : TALLOC_FREE(tmp_ctx);
2587 0 : return ret;
2588 : }
2589 :
2590 0 : static PyObject *py_auth_session_info_transport_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
2591 : {
2592 0 : struct auth_session_info_transport *object = (struct auth_session_info_transport *)pytalloc_get_ptr(py_obj);
2593 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
2594 0 : Py_ssize_t blob_length = 0;
2595 : enum ndr_err_code err;
2596 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
2597 0 : PyObject *allow_remaining_obj = NULL;
2598 0 : bool allow_remaining = false;
2599 :
2600 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
2601 : discard_const_p(char *, kwnames),
2602 : &blob.data, &blob_length,
2603 : &allow_remaining_obj)) {
2604 0 : return NULL;
2605 : }
2606 0 : blob.length = blob_length;
2607 :
2608 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
2609 0 : allow_remaining = true;
2610 : }
2611 :
2612 0 : if (allow_remaining) {
2613 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);
2614 : } else {
2615 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);
2616 : }
2617 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2618 0 : PyErr_SetNdrError(err);
2619 0 : return NULL;
2620 : }
2621 :
2622 0 : Py_RETURN_NONE;
2623 : }
2624 :
2625 0 : static PyObject *py_auth_session_info_transport_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2626 : {
2627 0 : struct auth_session_info_transport *object = (struct auth_session_info_transport *)pytalloc_get_ptr(py_obj);
2628 : PyObject *ret;
2629 : char *retstr;
2630 :
2631 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);
2632 0 : ret = PyUnicode_FromString(retstr);
2633 0 : talloc_free(retstr);
2634 :
2635 0 : return ret;
2636 : }
2637 :
2638 : static PyMethodDef py_auth_session_info_transport_methods[] = {
2639 : { "__ndr_pack__", (PyCFunction)py_auth_session_info_transport_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
2640 : { "__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" },
2641 : { "__ndr_print__", (PyCFunction)py_auth_session_info_transport_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
2642 : { NULL, NULL, 0, NULL }
2643 : };
2644 :
2645 :
2646 : static PyTypeObject auth_session_info_transport_Type = {
2647 : PyVarObject_HEAD_INIT(NULL, 0)
2648 : .tp_name = "auth.session_info_transport",
2649 : .tp_getset = py_auth_session_info_transport_getsetters,
2650 : .tp_methods = py_auth_session_info_transport_methods,
2651 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
2652 : .tp_new = py_auth_session_info_transport_new,
2653 : };
2654 :
2655 : static PyMethodDef auth_methods[] = {
2656 : { NULL, NULL, 0, NULL }
2657 : };
2658 :
2659 : static struct PyModuleDef moduledef = {
2660 : PyModuleDef_HEAD_INIT,
2661 : .m_name = "auth",
2662 : .m_doc = "auth DCE/RPC",
2663 : .m_size = -1,
2664 : .m_methods = auth_methods,
2665 : };
2666 3211 : MODULE_INIT_FUNC(auth)
2667 : {
2668 3211 : PyObject *m = NULL;
2669 3211 : PyObject *dep_samba_dcerpc_misc = NULL;
2670 3211 : PyObject *dep_samba_dcerpc_security = NULL;
2671 3211 : PyObject *dep_samba_dcerpc_lsa = NULL;
2672 3211 : PyObject *dep_samba_dcerpc_krb5pac = NULL;
2673 3211 : PyObject *dep_talloc = NULL;
2674 :
2675 3211 : dep_samba_dcerpc_misc = PyImport_ImportModule("samba.dcerpc.misc");
2676 3211 : if (dep_samba_dcerpc_misc == NULL)
2677 0 : goto out;
2678 :
2679 3211 : dep_samba_dcerpc_security = PyImport_ImportModule("samba.dcerpc.security");
2680 3211 : if (dep_samba_dcerpc_security == NULL)
2681 0 : goto out;
2682 :
2683 3211 : dep_samba_dcerpc_lsa = PyImport_ImportModule("samba.dcerpc.lsa");
2684 3211 : if (dep_samba_dcerpc_lsa == NULL)
2685 0 : goto out;
2686 :
2687 3211 : dep_samba_dcerpc_krb5pac = PyImport_ImportModule("samba.dcerpc.krb5pac");
2688 3211 : if (dep_samba_dcerpc_krb5pac == NULL)
2689 0 : goto out;
2690 :
2691 3211 : dep_talloc = PyImport_ImportModule("talloc");
2692 3211 : if (dep_talloc == NULL)
2693 0 : goto out;
2694 :
2695 3211 : BaseObject_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "BaseObject");
2696 3211 : if (BaseObject_Type == NULL)
2697 0 : goto out;
2698 :
2699 3211 : dom_sid_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_security, "dom_sid");
2700 3211 : if (dom_sid_Type == NULL)
2701 0 : goto out;
2702 :
2703 3211 : security_token_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_security, "token");
2704 3211 : if (security_token_Type == NULL)
2705 0 : goto out;
2706 :
2707 3211 : security_unix_token_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_security, "unix_token");
2708 3211 : if (security_unix_token_Type == NULL)
2709 0 : goto out;
2710 :
2711 3211 : GUID_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_misc, "GUID");
2712 3211 : if (GUID_Type == NULL)
2713 0 : goto out;
2714 :
2715 3211 : auth_user_info_Type.tp_base = BaseObject_Type;
2716 3211 : auth_user_info_Type.tp_basicsize = pytalloc_BaseObject_size();
2717 :
2718 3211 : auth_user_info_torture_Type.tp_base = BaseObject_Type;
2719 3211 : auth_user_info_torture_Type.tp_basicsize = pytalloc_BaseObject_size();
2720 :
2721 3211 : auth_user_info_unix_Type.tp_base = BaseObject_Type;
2722 3211 : auth_user_info_unix_Type.tp_basicsize = pytalloc_BaseObject_size();
2723 :
2724 3211 : auth_user_info_dc_Type.tp_base = BaseObject_Type;
2725 3211 : auth_user_info_dc_Type.tp_basicsize = pytalloc_BaseObject_size();
2726 :
2727 3211 : auth_session_info_Type.tp_base = BaseObject_Type;
2728 3211 : auth_session_info_Type.tp_basicsize = pytalloc_BaseObject_size();
2729 :
2730 3211 : auth_session_info_transport_Type.tp_base = BaseObject_Type;
2731 3211 : auth_session_info_transport_Type.tp_basicsize = pytalloc_BaseObject_size();
2732 :
2733 3211 : if (PyType_Ready(&auth_user_info_Type) < 0)
2734 0 : goto out;
2735 3211 : if (PyType_Ready(&auth_user_info_torture_Type) < 0)
2736 0 : goto out;
2737 3211 : if (PyType_Ready(&auth_user_info_unix_Type) < 0)
2738 0 : goto out;
2739 3211 : if (PyType_Ready(&auth_user_info_dc_Type) < 0)
2740 0 : goto out;
2741 3211 : if (PyType_Ready(&auth_session_info_Type) < 0)
2742 0 : goto out;
2743 3211 : if (PyType_Ready(&auth_session_info_transport_Type) < 0)
2744 0 : goto out;
2745 : #ifdef PY_USER_INFO_PATCH
2746 : PY_USER_INFO_PATCH(&auth_user_info_Type);
2747 : #endif
2748 : #ifdef PY_USER_INFO_TORTURE_PATCH
2749 : PY_USER_INFO_TORTURE_PATCH(&auth_user_info_torture_Type);
2750 : #endif
2751 : #ifdef PY_USER_INFO_UNIX_PATCH
2752 : PY_USER_INFO_UNIX_PATCH(&auth_user_info_unix_Type);
2753 : #endif
2754 : #ifdef PY_USER_INFO_DC_PATCH
2755 : PY_USER_INFO_DC_PATCH(&auth_user_info_dc_Type);
2756 : #endif
2757 : #ifdef PY_SESSION_INFO_PATCH
2758 3211 : PY_SESSION_INFO_PATCH(&auth_session_info_Type);
2759 : #endif
2760 : #ifdef PY_SESSION_INFO_TRANSPORT_PATCH
2761 : PY_SESSION_INFO_TRANSPORT_PATCH(&auth_session_info_transport_Type);
2762 : #endif
2763 :
2764 3211 : m = PyModule_Create(&moduledef);
2765 3211 : if (m == NULL)
2766 0 : goto out;
2767 :
2768 3211 : PyModule_AddObject(m, "SEC_AUTH_METHOD_UNAUTHENTICATED", PyLong_FromLong((uint16_t)SEC_AUTH_METHOD_UNAUTHENTICATED));
2769 3211 : PyModule_AddObject(m, "SEC_AUTH_METHOD_NTLM", PyLong_FromLong((uint16_t)SEC_AUTH_METHOD_NTLM));
2770 3211 : PyModule_AddObject(m, "SEC_AUTH_METHOD_KERBEROS", PyLong_FromLong((uint16_t)SEC_AUTH_METHOD_KERBEROS));
2771 3211 : Py_INCREF((PyObject *)(void *)&auth_user_info_Type);
2772 3211 : PyModule_AddObject(m, "user_info", (PyObject *)(void *)&auth_user_info_Type);
2773 3211 : Py_INCREF((PyObject *)(void *)&auth_user_info_torture_Type);
2774 3211 : PyModule_AddObject(m, "user_info_torture", (PyObject *)(void *)&auth_user_info_torture_Type);
2775 3211 : Py_INCREF((PyObject *)(void *)&auth_user_info_unix_Type);
2776 3211 : PyModule_AddObject(m, "user_info_unix", (PyObject *)(void *)&auth_user_info_unix_Type);
2777 3211 : Py_INCREF((PyObject *)(void *)&auth_user_info_dc_Type);
2778 3211 : PyModule_AddObject(m, "user_info_dc", (PyObject *)(void *)&auth_user_info_dc_Type);
2779 3211 : Py_INCREF((PyObject *)(void *)&auth_session_info_Type);
2780 3211 : PyModule_AddObject(m, "session_info", (PyObject *)(void *)&auth_session_info_Type);
2781 3211 : Py_INCREF((PyObject *)(void *)&auth_session_info_transport_Type);
2782 3211 : PyModule_AddObject(m, "session_info_transport", (PyObject *)(void *)&auth_session_info_transport_Type);
2783 : #ifdef PY_MOD_AUTH_PATCH
2784 : PY_MOD_AUTH_PATCH(m);
2785 : #endif
2786 3211 : out:
2787 3211 : Py_XDECREF(dep_samba_dcerpc_misc);
2788 3211 : Py_XDECREF(dep_samba_dcerpc_security);
2789 3211 : Py_XDECREF(dep_samba_dcerpc_lsa);
2790 3211 : Py_XDECREF(dep_samba_dcerpc_krb5pac);
2791 3211 : Py_XDECREF(dep_talloc);
2792 3211 : return m;
2793 :
2794 : }
|