Line data Source code
1 :
2 : /* Python wrapper functions auto-generated by pidl */
3 : #define PY_SSIZE_T_CLEAN 1 /* We use Py_ssize_t for PyArg_ParseTupleAndKeywords */
4 : #include "lib/replace/system/python.h"
5 : #include "python/py3compat.h"
6 : #include "includes.h"
7 : #include "python/modules.h"
8 : #include <pytalloc.h>
9 : #include "librpc/rpc/pyrpc.h"
10 : #include "librpc/rpc/pyrpc_util.h"
11 : #include "bin/default/librpc/gen_ndr/ndr_xattr.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 886 : static inline unsigned long long ndr_sizeof2uintmax(size_t var_size)
33 : {
34 886 : switch (var_size) {
35 0 : case 8:
36 0 : return UINT64_MAX;
37 0 : case 4:
38 0 : return UINT32_MAX;
39 886 : case 2:
40 886 : return UINT16_MAX;
41 0 : case 1:
42 0 : return UINT8_MAX;
43 : }
44 :
45 0 : return 0;
46 : }
47 :
48 : static inline _MAYBE_UNUSED_ long long ndr_sizeof2intmax(size_t var_size)
49 : {
50 : switch (var_size) {
51 : case 8:
52 : return INT64_MAX;
53 : case 4:
54 : return INT32_MAX;
55 : case 2:
56 : return INT16_MAX;
57 : case 1:
58 : return INT8_MAX;
59 : }
60 :
61 : return 0;
62 : }
63 :
64 : #include "librpc/gen_ndr/security.h"
65 : static PyTypeObject xattr_DosInfoFFFFCompat_Type;
66 : static PyTypeObject xattr_DosInfo1_Type;
67 : static PyTypeObject xattr_DosInfo2Old_Type;
68 : static PyTypeObject xattr_DosInfo3_Type;
69 : static PyTypeObject xattr_DosInfo4_Type;
70 : static PyTypeObject xattr_DosInfo5_Type;
71 : static PyTypeObject xattr_DosInfo_Type;
72 : static PyTypeObject xattr_DosAttrib_Type;
73 : static PyTypeObject xattr_DOSATTRIB_Type;
74 : static PyTypeObject xattr_EA_Type;
75 : static PyTypeObject xattr_DosEAs_Type;
76 : static PyTypeObject tdb_xattrs_Type;
77 : static PyTypeObject xattr_DosStream_Type;
78 : static PyTypeObject xattr_DosStreams_Type;
79 : static PyTypeObject security_descriptor_hash_v2_Type;
80 : static PyTypeObject security_descriptor_hash_v3_Type;
81 : static PyTypeObject security_descriptor_hash_v4_Type;
82 : static PyTypeObject xattr_NTACL_Info_Type;
83 : static PyTypeObject xattr_NTACL_Type;
84 : static PyTypeObject xattr_sys_acl_hash_wrapper_Type;
85 :
86 : static PyTypeObject *BaseObject_Type;
87 : static PyTypeObject *security_descriptor_Type;
88 : #include "librpc/ndr/py_xattr.c"
89 :
90 :
91 0 : static PyObject *py_xattr_DosInfoFFFFCompat_get_attrib(PyObject *obj, void *closure)
92 : {
93 0 : struct xattr_DosInfoFFFFCompat *object = pytalloc_get_ptr(obj);
94 0 : PyObject *py_attrib;
95 0 : py_attrib = PyLong_FromUnsignedLongLong((uint32_t)(object->attrib));
96 0 : return py_attrib;
97 : }
98 :
99 0 : static int py_xattr_DosInfoFFFFCompat_set_attrib(PyObject *py_obj, PyObject *value, void *closure)
100 : {
101 0 : struct xattr_DosInfoFFFFCompat *object = pytalloc_get_ptr(py_obj);
102 0 : if (value == NULL) {
103 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->attrib");
104 0 : return -1;
105 : }
106 : {
107 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->attrib));
108 0 : if (PyLong_Check(value)) {
109 0 : unsigned long long test_var;
110 0 : test_var = PyLong_AsUnsignedLongLong(value);
111 0 : if (PyErr_Occurred() != NULL) {
112 0 : return -1;
113 : }
114 0 : if (test_var > uint_max) {
115 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
116 : PyLong_Type.tp_name, uint_max, test_var);
117 0 : return -1;
118 : }
119 0 : object->attrib = test_var;
120 : } else {
121 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
122 : PyLong_Type.tp_name);
123 0 : return -1;
124 : }
125 : }
126 0 : return 0;
127 : }
128 :
129 : static PyGetSetDef py_xattr_DosInfoFFFFCompat_getsetters[] = {
130 : {
131 : .name = discard_const_p(char, "attrib"),
132 : .get = py_xattr_DosInfoFFFFCompat_get_attrib,
133 : .set = py_xattr_DosInfoFFFFCompat_set_attrib,
134 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
135 : },
136 : { .name = NULL }
137 : };
138 :
139 0 : static PyObject *py_xattr_DosInfoFFFFCompat_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
140 : {
141 0 : return pytalloc_new(struct xattr_DosInfoFFFFCompat, type);
142 : }
143 :
144 :
145 : static PyTypeObject xattr_DosInfoFFFFCompat_Type = {
146 : PyVarObject_HEAD_INIT(NULL, 0)
147 : .tp_name = "xattr.DosInfoFFFFCompat",
148 : .tp_getset = py_xattr_DosInfoFFFFCompat_getsetters,
149 : .tp_methods = NULL,
150 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
151 : .tp_new = py_xattr_DosInfoFFFFCompat_new,
152 : };
153 :
154 :
155 0 : static PyObject *py_xattr_DosInfo1_get_attrib(PyObject *obj, void *closure)
156 : {
157 0 : struct xattr_DosInfo1 *object = pytalloc_get_ptr(obj);
158 0 : PyObject *py_attrib;
159 0 : py_attrib = PyLong_FromUnsignedLongLong((uint32_t)(object->attrib));
160 0 : return py_attrib;
161 : }
162 :
163 0 : static int py_xattr_DosInfo1_set_attrib(PyObject *py_obj, PyObject *value, void *closure)
164 : {
165 0 : struct xattr_DosInfo1 *object = pytalloc_get_ptr(py_obj);
166 0 : if (value == NULL) {
167 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->attrib");
168 0 : return -1;
169 : }
170 : {
171 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->attrib));
172 0 : if (PyLong_Check(value)) {
173 0 : unsigned long long test_var;
174 0 : test_var = PyLong_AsUnsignedLongLong(value);
175 0 : if (PyErr_Occurred() != NULL) {
176 0 : return -1;
177 : }
178 0 : if (test_var > uint_max) {
179 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
180 : PyLong_Type.tp_name, uint_max, test_var);
181 0 : return -1;
182 : }
183 0 : object->attrib = test_var;
184 : } else {
185 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
186 : PyLong_Type.tp_name);
187 0 : return -1;
188 : }
189 : }
190 0 : return 0;
191 : }
192 :
193 0 : static PyObject *py_xattr_DosInfo1_get_ea_size(PyObject *obj, void *closure)
194 : {
195 0 : struct xattr_DosInfo1 *object = pytalloc_get_ptr(obj);
196 0 : PyObject *py_ea_size;
197 0 : py_ea_size = PyLong_FromUnsignedLongLong((uint32_t)(object->ea_size));
198 0 : return py_ea_size;
199 : }
200 :
201 0 : static int py_xattr_DosInfo1_set_ea_size(PyObject *py_obj, PyObject *value, void *closure)
202 : {
203 0 : struct xattr_DosInfo1 *object = pytalloc_get_ptr(py_obj);
204 0 : if (value == NULL) {
205 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->ea_size");
206 0 : return -1;
207 : }
208 : {
209 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->ea_size));
210 0 : if (PyLong_Check(value)) {
211 0 : unsigned long long test_var;
212 0 : test_var = PyLong_AsUnsignedLongLong(value);
213 0 : if (PyErr_Occurred() != NULL) {
214 0 : return -1;
215 : }
216 0 : if (test_var > uint_max) {
217 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
218 : PyLong_Type.tp_name, uint_max, test_var);
219 0 : return -1;
220 : }
221 0 : object->ea_size = test_var;
222 : } else {
223 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
224 : PyLong_Type.tp_name);
225 0 : return -1;
226 : }
227 : }
228 0 : return 0;
229 : }
230 :
231 0 : static PyObject *py_xattr_DosInfo1_get_size(PyObject *obj, void *closure)
232 : {
233 0 : struct xattr_DosInfo1 *object = pytalloc_get_ptr(obj);
234 0 : PyObject *py_size;
235 0 : py_size = PyLong_FromUnsignedLongLong(object->size);
236 0 : return py_size;
237 : }
238 :
239 0 : static int py_xattr_DosInfo1_set_size(PyObject *py_obj, PyObject *value, void *closure)
240 : {
241 0 : struct xattr_DosInfo1 *object = pytalloc_get_ptr(py_obj);
242 0 : if (value == NULL) {
243 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->size");
244 0 : return -1;
245 : }
246 : {
247 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->size));
248 0 : if (PyLong_Check(value)) {
249 0 : unsigned long long test_var;
250 0 : test_var = PyLong_AsUnsignedLongLong(value);
251 0 : if (PyErr_Occurred() != NULL) {
252 0 : return -1;
253 : }
254 0 : if (test_var > uint_max) {
255 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
256 : PyLong_Type.tp_name, uint_max, test_var);
257 0 : return -1;
258 : }
259 0 : object->size = test_var;
260 : } else {
261 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
262 : PyLong_Type.tp_name);
263 0 : return -1;
264 : }
265 : }
266 0 : return 0;
267 : }
268 :
269 0 : static PyObject *py_xattr_DosInfo1_get_alloc_size(PyObject *obj, void *closure)
270 : {
271 0 : struct xattr_DosInfo1 *object = pytalloc_get_ptr(obj);
272 0 : PyObject *py_alloc_size;
273 0 : py_alloc_size = PyLong_FromUnsignedLongLong(object->alloc_size);
274 0 : return py_alloc_size;
275 : }
276 :
277 0 : static int py_xattr_DosInfo1_set_alloc_size(PyObject *py_obj, PyObject *value, void *closure)
278 : {
279 0 : struct xattr_DosInfo1 *object = pytalloc_get_ptr(py_obj);
280 0 : if (value == NULL) {
281 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->alloc_size");
282 0 : return -1;
283 : }
284 : {
285 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->alloc_size));
286 0 : if (PyLong_Check(value)) {
287 0 : unsigned long long test_var;
288 0 : test_var = PyLong_AsUnsignedLongLong(value);
289 0 : if (PyErr_Occurred() != NULL) {
290 0 : return -1;
291 : }
292 0 : if (test_var > uint_max) {
293 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
294 : PyLong_Type.tp_name, uint_max, test_var);
295 0 : return -1;
296 : }
297 0 : object->alloc_size = test_var;
298 : } else {
299 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
300 : PyLong_Type.tp_name);
301 0 : return -1;
302 : }
303 : }
304 0 : return 0;
305 : }
306 :
307 0 : static PyObject *py_xattr_DosInfo1_get_create_time(PyObject *obj, void *closure)
308 : {
309 0 : struct xattr_DosInfo1 *object = pytalloc_get_ptr(obj);
310 0 : PyObject *py_create_time;
311 0 : py_create_time = PyLong_FromUnsignedLongLong(object->create_time);
312 0 : return py_create_time;
313 : }
314 :
315 0 : static int py_xattr_DosInfo1_set_create_time(PyObject *py_obj, PyObject *value, void *closure)
316 : {
317 0 : struct xattr_DosInfo1 *object = pytalloc_get_ptr(py_obj);
318 0 : if (value == NULL) {
319 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->create_time");
320 0 : return -1;
321 : }
322 : {
323 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->create_time));
324 0 : if (PyLong_Check(value)) {
325 0 : unsigned long long test_var;
326 0 : test_var = PyLong_AsUnsignedLongLong(value);
327 0 : if (PyErr_Occurred() != NULL) {
328 0 : return -1;
329 : }
330 0 : if (test_var > uint_max) {
331 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
332 : PyLong_Type.tp_name, uint_max, test_var);
333 0 : return -1;
334 : }
335 0 : object->create_time = test_var;
336 : } else {
337 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
338 : PyLong_Type.tp_name);
339 0 : return -1;
340 : }
341 : }
342 0 : return 0;
343 : }
344 :
345 0 : static PyObject *py_xattr_DosInfo1_get_change_time(PyObject *obj, void *closure)
346 : {
347 0 : struct xattr_DosInfo1 *object = pytalloc_get_ptr(obj);
348 0 : PyObject *py_change_time;
349 0 : py_change_time = PyLong_FromUnsignedLongLong(object->change_time);
350 0 : return py_change_time;
351 : }
352 :
353 0 : static int py_xattr_DosInfo1_set_change_time(PyObject *py_obj, PyObject *value, void *closure)
354 : {
355 0 : struct xattr_DosInfo1 *object = pytalloc_get_ptr(py_obj);
356 0 : if (value == NULL) {
357 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->change_time");
358 0 : return -1;
359 : }
360 : {
361 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->change_time));
362 0 : if (PyLong_Check(value)) {
363 0 : unsigned long long test_var;
364 0 : test_var = PyLong_AsUnsignedLongLong(value);
365 0 : if (PyErr_Occurred() != NULL) {
366 0 : return -1;
367 : }
368 0 : if (test_var > uint_max) {
369 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
370 : PyLong_Type.tp_name, uint_max, test_var);
371 0 : return -1;
372 : }
373 0 : object->change_time = test_var;
374 : } else {
375 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
376 : PyLong_Type.tp_name);
377 0 : return -1;
378 : }
379 : }
380 0 : return 0;
381 : }
382 :
383 : static PyGetSetDef py_xattr_DosInfo1_getsetters[] = {
384 : {
385 : .name = discard_const_p(char, "attrib"),
386 : .get = py_xattr_DosInfo1_get_attrib,
387 : .set = py_xattr_DosInfo1_set_attrib,
388 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
389 : },
390 : {
391 : .name = discard_const_p(char, "ea_size"),
392 : .get = py_xattr_DosInfo1_get_ea_size,
393 : .set = py_xattr_DosInfo1_set_ea_size,
394 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
395 : },
396 : {
397 : .name = discard_const_p(char, "size"),
398 : .get = py_xattr_DosInfo1_get_size,
399 : .set = py_xattr_DosInfo1_set_size,
400 : .doc = discard_const_p(char, "PIDL-generated element of base type udlong")
401 : },
402 : {
403 : .name = discard_const_p(char, "alloc_size"),
404 : .get = py_xattr_DosInfo1_get_alloc_size,
405 : .set = py_xattr_DosInfo1_set_alloc_size,
406 : .doc = discard_const_p(char, "PIDL-generated element of base type udlong")
407 : },
408 : {
409 : .name = discard_const_p(char, "create_time"),
410 : .get = py_xattr_DosInfo1_get_create_time,
411 : .set = py_xattr_DosInfo1_set_create_time,
412 : .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
413 : },
414 : {
415 : .name = discard_const_p(char, "change_time"),
416 : .get = py_xattr_DosInfo1_get_change_time,
417 : .set = py_xattr_DosInfo1_set_change_time,
418 : .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
419 : },
420 : { .name = NULL }
421 : };
422 :
423 0 : static PyObject *py_xattr_DosInfo1_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
424 : {
425 0 : return pytalloc_new(struct xattr_DosInfo1, type);
426 : }
427 :
428 :
429 : static PyTypeObject xattr_DosInfo1_Type = {
430 : PyVarObject_HEAD_INIT(NULL, 0)
431 : .tp_name = "xattr.DosInfo1",
432 : .tp_getset = py_xattr_DosInfo1_getsetters,
433 : .tp_methods = NULL,
434 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
435 : .tp_new = py_xattr_DosInfo1_new,
436 : };
437 :
438 :
439 0 : static PyObject *py_xattr_DosInfo2Old_get_flags(PyObject *obj, void *closure)
440 : {
441 0 : struct xattr_DosInfo2Old *object = pytalloc_get_ptr(obj);
442 0 : PyObject *py_flags;
443 0 : py_flags = PyLong_FromUnsignedLongLong((uint32_t)(object->flags));
444 0 : return py_flags;
445 : }
446 :
447 0 : static int py_xattr_DosInfo2Old_set_flags(PyObject *py_obj, PyObject *value, void *closure)
448 : {
449 0 : struct xattr_DosInfo2Old *object = pytalloc_get_ptr(py_obj);
450 0 : if (value == NULL) {
451 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->flags");
452 0 : return -1;
453 : }
454 : {
455 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->flags));
456 0 : if (PyLong_Check(value)) {
457 0 : unsigned long long test_var;
458 0 : test_var = PyLong_AsUnsignedLongLong(value);
459 0 : if (PyErr_Occurred() != NULL) {
460 0 : return -1;
461 : }
462 0 : if (test_var > uint_max) {
463 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
464 : PyLong_Type.tp_name, uint_max, test_var);
465 0 : return -1;
466 : }
467 0 : object->flags = test_var;
468 : } else {
469 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
470 : PyLong_Type.tp_name);
471 0 : return -1;
472 : }
473 : }
474 0 : return 0;
475 : }
476 :
477 0 : static PyObject *py_xattr_DosInfo2Old_get_attrib(PyObject *obj, void *closure)
478 : {
479 0 : struct xattr_DosInfo2Old *object = pytalloc_get_ptr(obj);
480 0 : PyObject *py_attrib;
481 0 : py_attrib = PyLong_FromUnsignedLongLong((uint32_t)(object->attrib));
482 0 : return py_attrib;
483 : }
484 :
485 0 : static int py_xattr_DosInfo2Old_set_attrib(PyObject *py_obj, PyObject *value, void *closure)
486 : {
487 0 : struct xattr_DosInfo2Old *object = pytalloc_get_ptr(py_obj);
488 0 : if (value == NULL) {
489 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->attrib");
490 0 : return -1;
491 : }
492 : {
493 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->attrib));
494 0 : if (PyLong_Check(value)) {
495 0 : unsigned long long test_var;
496 0 : test_var = PyLong_AsUnsignedLongLong(value);
497 0 : if (PyErr_Occurred() != NULL) {
498 0 : return -1;
499 : }
500 0 : if (test_var > uint_max) {
501 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
502 : PyLong_Type.tp_name, uint_max, test_var);
503 0 : return -1;
504 : }
505 0 : object->attrib = test_var;
506 : } else {
507 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
508 : PyLong_Type.tp_name);
509 0 : return -1;
510 : }
511 : }
512 0 : return 0;
513 : }
514 :
515 0 : static PyObject *py_xattr_DosInfo2Old_get_ea_size(PyObject *obj, void *closure)
516 : {
517 0 : struct xattr_DosInfo2Old *object = pytalloc_get_ptr(obj);
518 0 : PyObject *py_ea_size;
519 0 : py_ea_size = PyLong_FromUnsignedLongLong((uint32_t)(object->ea_size));
520 0 : return py_ea_size;
521 : }
522 :
523 0 : static int py_xattr_DosInfo2Old_set_ea_size(PyObject *py_obj, PyObject *value, void *closure)
524 : {
525 0 : struct xattr_DosInfo2Old *object = pytalloc_get_ptr(py_obj);
526 0 : if (value == NULL) {
527 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->ea_size");
528 0 : return -1;
529 : }
530 : {
531 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->ea_size));
532 0 : if (PyLong_Check(value)) {
533 0 : unsigned long long test_var;
534 0 : test_var = PyLong_AsUnsignedLongLong(value);
535 0 : if (PyErr_Occurred() != NULL) {
536 0 : return -1;
537 : }
538 0 : if (test_var > uint_max) {
539 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
540 : PyLong_Type.tp_name, uint_max, test_var);
541 0 : return -1;
542 : }
543 0 : object->ea_size = test_var;
544 : } else {
545 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
546 : PyLong_Type.tp_name);
547 0 : return -1;
548 : }
549 : }
550 0 : return 0;
551 : }
552 :
553 0 : static PyObject *py_xattr_DosInfo2Old_get_size(PyObject *obj, void *closure)
554 : {
555 0 : struct xattr_DosInfo2Old *object = pytalloc_get_ptr(obj);
556 0 : PyObject *py_size;
557 0 : py_size = PyLong_FromUnsignedLongLong(object->size);
558 0 : return py_size;
559 : }
560 :
561 0 : static int py_xattr_DosInfo2Old_set_size(PyObject *py_obj, PyObject *value, void *closure)
562 : {
563 0 : struct xattr_DosInfo2Old *object = pytalloc_get_ptr(py_obj);
564 0 : if (value == NULL) {
565 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->size");
566 0 : return -1;
567 : }
568 : {
569 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->size));
570 0 : if (PyLong_Check(value)) {
571 0 : unsigned long long test_var;
572 0 : test_var = PyLong_AsUnsignedLongLong(value);
573 0 : if (PyErr_Occurred() != NULL) {
574 0 : return -1;
575 : }
576 0 : if (test_var > uint_max) {
577 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
578 : PyLong_Type.tp_name, uint_max, test_var);
579 0 : return -1;
580 : }
581 0 : object->size = test_var;
582 : } else {
583 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
584 : PyLong_Type.tp_name);
585 0 : return -1;
586 : }
587 : }
588 0 : return 0;
589 : }
590 :
591 0 : static PyObject *py_xattr_DosInfo2Old_get_alloc_size(PyObject *obj, void *closure)
592 : {
593 0 : struct xattr_DosInfo2Old *object = pytalloc_get_ptr(obj);
594 0 : PyObject *py_alloc_size;
595 0 : py_alloc_size = PyLong_FromUnsignedLongLong(object->alloc_size);
596 0 : return py_alloc_size;
597 : }
598 :
599 0 : static int py_xattr_DosInfo2Old_set_alloc_size(PyObject *py_obj, PyObject *value, void *closure)
600 : {
601 0 : struct xattr_DosInfo2Old *object = pytalloc_get_ptr(py_obj);
602 0 : if (value == NULL) {
603 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->alloc_size");
604 0 : return -1;
605 : }
606 : {
607 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->alloc_size));
608 0 : if (PyLong_Check(value)) {
609 0 : unsigned long long test_var;
610 0 : test_var = PyLong_AsUnsignedLongLong(value);
611 0 : if (PyErr_Occurred() != NULL) {
612 0 : return -1;
613 : }
614 0 : if (test_var > uint_max) {
615 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
616 : PyLong_Type.tp_name, uint_max, test_var);
617 0 : return -1;
618 : }
619 0 : object->alloc_size = test_var;
620 : } else {
621 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
622 : PyLong_Type.tp_name);
623 0 : return -1;
624 : }
625 : }
626 0 : return 0;
627 : }
628 :
629 0 : static PyObject *py_xattr_DosInfo2Old_get_create_time(PyObject *obj, void *closure)
630 : {
631 0 : struct xattr_DosInfo2Old *object = pytalloc_get_ptr(obj);
632 0 : PyObject *py_create_time;
633 0 : py_create_time = PyLong_FromUnsignedLongLong(object->create_time);
634 0 : return py_create_time;
635 : }
636 :
637 0 : static int py_xattr_DosInfo2Old_set_create_time(PyObject *py_obj, PyObject *value, void *closure)
638 : {
639 0 : struct xattr_DosInfo2Old *object = pytalloc_get_ptr(py_obj);
640 0 : if (value == NULL) {
641 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->create_time");
642 0 : return -1;
643 : }
644 : {
645 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->create_time));
646 0 : if (PyLong_Check(value)) {
647 0 : unsigned long long test_var;
648 0 : test_var = PyLong_AsUnsignedLongLong(value);
649 0 : if (PyErr_Occurred() != NULL) {
650 0 : return -1;
651 : }
652 0 : if (test_var > uint_max) {
653 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
654 : PyLong_Type.tp_name, uint_max, test_var);
655 0 : return -1;
656 : }
657 0 : object->create_time = test_var;
658 : } else {
659 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
660 : PyLong_Type.tp_name);
661 0 : return -1;
662 : }
663 : }
664 0 : return 0;
665 : }
666 :
667 0 : static PyObject *py_xattr_DosInfo2Old_get_change_time(PyObject *obj, void *closure)
668 : {
669 0 : struct xattr_DosInfo2Old *object = pytalloc_get_ptr(obj);
670 0 : PyObject *py_change_time;
671 0 : py_change_time = PyLong_FromUnsignedLongLong(object->change_time);
672 0 : return py_change_time;
673 : }
674 :
675 0 : static int py_xattr_DosInfo2Old_set_change_time(PyObject *py_obj, PyObject *value, void *closure)
676 : {
677 0 : struct xattr_DosInfo2Old *object = pytalloc_get_ptr(py_obj);
678 0 : if (value == NULL) {
679 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->change_time");
680 0 : return -1;
681 : }
682 : {
683 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->change_time));
684 0 : if (PyLong_Check(value)) {
685 0 : unsigned long long test_var;
686 0 : test_var = PyLong_AsUnsignedLongLong(value);
687 0 : if (PyErr_Occurred() != NULL) {
688 0 : return -1;
689 : }
690 0 : if (test_var > uint_max) {
691 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
692 : PyLong_Type.tp_name, uint_max, test_var);
693 0 : return -1;
694 : }
695 0 : object->change_time = test_var;
696 : } else {
697 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
698 : PyLong_Type.tp_name);
699 0 : return -1;
700 : }
701 : }
702 0 : return 0;
703 : }
704 :
705 0 : static PyObject *py_xattr_DosInfo2Old_get_write_time(PyObject *obj, void *closure)
706 : {
707 0 : struct xattr_DosInfo2Old *object = pytalloc_get_ptr(obj);
708 0 : PyObject *py_write_time;
709 0 : py_write_time = PyLong_FromUnsignedLongLong(object->write_time);
710 0 : return py_write_time;
711 : }
712 :
713 0 : static int py_xattr_DosInfo2Old_set_write_time(PyObject *py_obj, PyObject *value, void *closure)
714 : {
715 0 : struct xattr_DosInfo2Old *object = pytalloc_get_ptr(py_obj);
716 0 : if (value == NULL) {
717 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->write_time");
718 0 : return -1;
719 : }
720 : {
721 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->write_time));
722 0 : if (PyLong_Check(value)) {
723 0 : unsigned long long test_var;
724 0 : test_var = PyLong_AsUnsignedLongLong(value);
725 0 : if (PyErr_Occurred() != NULL) {
726 0 : return -1;
727 : }
728 0 : if (test_var > uint_max) {
729 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
730 : PyLong_Type.tp_name, uint_max, test_var);
731 0 : return -1;
732 : }
733 0 : object->write_time = test_var;
734 : } else {
735 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
736 : PyLong_Type.tp_name);
737 0 : return -1;
738 : }
739 : }
740 0 : return 0;
741 : }
742 :
743 0 : static PyObject *py_xattr_DosInfo2Old_get_name(PyObject *obj, void *closure)
744 : {
745 0 : struct xattr_DosInfo2Old *object = pytalloc_get_ptr(obj);
746 0 : PyObject *py_name;
747 0 : py_name = PyString_FromStringOrNULL(object->name);
748 0 : return py_name;
749 : }
750 :
751 0 : static int py_xattr_DosInfo2Old_set_name(PyObject *py_obj, PyObject *value, void *closure)
752 : {
753 0 : struct xattr_DosInfo2Old *object = pytalloc_get_ptr(py_obj);
754 0 : if (value == NULL) {
755 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->name");
756 0 : return -1;
757 : }
758 : {
759 0 : const char *test_str;
760 0 : const char *talloc_str;
761 0 : PyObject *unicode = NULL;
762 0 : if (PyUnicode_Check(value)) {
763 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
764 0 : if (unicode == NULL) {
765 0 : return -1;
766 : }
767 0 : test_str = PyBytes_AS_STRING(unicode);
768 0 : } else if (PyBytes_Check(value)) {
769 0 : test_str = PyBytes_AS_STRING(value);
770 : } else {
771 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
772 0 : return -1;
773 : }
774 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
775 0 : if (unicode != NULL) {
776 0 : Py_DECREF(unicode);
777 : }
778 0 : if (talloc_str == NULL) {
779 0 : PyErr_NoMemory();
780 0 : return -1;
781 : }
782 0 : object->name = talloc_str;
783 : }
784 0 : return 0;
785 : }
786 :
787 : static PyGetSetDef py_xattr_DosInfo2Old_getsetters[] = {
788 : {
789 : .name = discard_const_p(char, "flags"),
790 : .get = py_xattr_DosInfo2Old_get_flags,
791 : .set = py_xattr_DosInfo2Old_set_flags,
792 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
793 : },
794 : {
795 : .name = discard_const_p(char, "attrib"),
796 : .get = py_xattr_DosInfo2Old_get_attrib,
797 : .set = py_xattr_DosInfo2Old_set_attrib,
798 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
799 : },
800 : {
801 : .name = discard_const_p(char, "ea_size"),
802 : .get = py_xattr_DosInfo2Old_get_ea_size,
803 : .set = py_xattr_DosInfo2Old_set_ea_size,
804 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
805 : },
806 : {
807 : .name = discard_const_p(char, "size"),
808 : .get = py_xattr_DosInfo2Old_get_size,
809 : .set = py_xattr_DosInfo2Old_set_size,
810 : .doc = discard_const_p(char, "PIDL-generated element of base type udlong")
811 : },
812 : {
813 : .name = discard_const_p(char, "alloc_size"),
814 : .get = py_xattr_DosInfo2Old_get_alloc_size,
815 : .set = py_xattr_DosInfo2Old_set_alloc_size,
816 : .doc = discard_const_p(char, "PIDL-generated element of base type udlong")
817 : },
818 : {
819 : .name = discard_const_p(char, "create_time"),
820 : .get = py_xattr_DosInfo2Old_get_create_time,
821 : .set = py_xattr_DosInfo2Old_set_create_time,
822 : .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
823 : },
824 : {
825 : .name = discard_const_p(char, "change_time"),
826 : .get = py_xattr_DosInfo2Old_get_change_time,
827 : .set = py_xattr_DosInfo2Old_set_change_time,
828 : .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
829 : },
830 : {
831 : .name = discard_const_p(char, "write_time"),
832 : .get = py_xattr_DosInfo2Old_get_write_time,
833 : .set = py_xattr_DosInfo2Old_set_write_time,
834 : .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
835 : },
836 : {
837 : .name = discard_const_p(char, "name"),
838 : .get = py_xattr_DosInfo2Old_get_name,
839 : .set = py_xattr_DosInfo2Old_set_name,
840 : .doc = discard_const_p(char, "PIDL-generated element of base type string")
841 : },
842 : { .name = NULL }
843 : };
844 :
845 0 : static PyObject *py_xattr_DosInfo2Old_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
846 : {
847 0 : return pytalloc_new(struct xattr_DosInfo2Old, type);
848 : }
849 :
850 :
851 : static PyTypeObject xattr_DosInfo2Old_Type = {
852 : PyVarObject_HEAD_INIT(NULL, 0)
853 : .tp_name = "xattr.DosInfo2Old",
854 : .tp_getset = py_xattr_DosInfo2Old_getsetters,
855 : .tp_methods = NULL,
856 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
857 : .tp_new = py_xattr_DosInfo2Old_new,
858 : };
859 :
860 :
861 0 : static PyObject *py_xattr_DosInfo3_get_valid_flags(PyObject *obj, void *closure)
862 : {
863 0 : struct xattr_DosInfo3 *object = pytalloc_get_ptr(obj);
864 0 : PyObject *py_valid_flags;
865 0 : py_valid_flags = PyLong_FromUnsignedLongLong((uint32_t)(object->valid_flags));
866 0 : return py_valid_flags;
867 : }
868 :
869 0 : static int py_xattr_DosInfo3_set_valid_flags(PyObject *py_obj, PyObject *value, void *closure)
870 : {
871 0 : struct xattr_DosInfo3 *object = pytalloc_get_ptr(py_obj);
872 0 : if (value == NULL) {
873 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->valid_flags");
874 0 : return -1;
875 : }
876 : {
877 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->valid_flags));
878 0 : if (PyLong_Check(value)) {
879 0 : unsigned long long test_var;
880 0 : test_var = PyLong_AsUnsignedLongLong(value);
881 0 : if (PyErr_Occurred() != NULL) {
882 0 : return -1;
883 : }
884 0 : if (test_var > uint_max) {
885 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
886 : PyLong_Type.tp_name, uint_max, test_var);
887 0 : return -1;
888 : }
889 0 : object->valid_flags = test_var;
890 : } else {
891 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
892 : PyLong_Type.tp_name);
893 0 : return -1;
894 : }
895 : }
896 0 : return 0;
897 : }
898 :
899 0 : static PyObject *py_xattr_DosInfo3_get_attrib(PyObject *obj, void *closure)
900 : {
901 0 : struct xattr_DosInfo3 *object = pytalloc_get_ptr(obj);
902 0 : PyObject *py_attrib;
903 0 : py_attrib = PyLong_FromUnsignedLongLong((uint32_t)(object->attrib));
904 0 : return py_attrib;
905 : }
906 :
907 0 : static int py_xattr_DosInfo3_set_attrib(PyObject *py_obj, PyObject *value, void *closure)
908 : {
909 0 : struct xattr_DosInfo3 *object = pytalloc_get_ptr(py_obj);
910 0 : if (value == NULL) {
911 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->attrib");
912 0 : return -1;
913 : }
914 : {
915 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->attrib));
916 0 : if (PyLong_Check(value)) {
917 0 : unsigned long long test_var;
918 0 : test_var = PyLong_AsUnsignedLongLong(value);
919 0 : if (PyErr_Occurred() != NULL) {
920 0 : return -1;
921 : }
922 0 : if (test_var > uint_max) {
923 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
924 : PyLong_Type.tp_name, uint_max, test_var);
925 0 : return -1;
926 : }
927 0 : object->attrib = test_var;
928 : } else {
929 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
930 : PyLong_Type.tp_name);
931 0 : return -1;
932 : }
933 : }
934 0 : return 0;
935 : }
936 :
937 0 : static PyObject *py_xattr_DosInfo3_get_ea_size(PyObject *obj, void *closure)
938 : {
939 0 : struct xattr_DosInfo3 *object = pytalloc_get_ptr(obj);
940 0 : PyObject *py_ea_size;
941 0 : py_ea_size = PyLong_FromUnsignedLongLong((uint32_t)(object->ea_size));
942 0 : return py_ea_size;
943 : }
944 :
945 0 : static int py_xattr_DosInfo3_set_ea_size(PyObject *py_obj, PyObject *value, void *closure)
946 : {
947 0 : struct xattr_DosInfo3 *object = pytalloc_get_ptr(py_obj);
948 0 : if (value == NULL) {
949 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->ea_size");
950 0 : return -1;
951 : }
952 : {
953 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->ea_size));
954 0 : if (PyLong_Check(value)) {
955 0 : unsigned long long test_var;
956 0 : test_var = PyLong_AsUnsignedLongLong(value);
957 0 : if (PyErr_Occurred() != NULL) {
958 0 : return -1;
959 : }
960 0 : if (test_var > uint_max) {
961 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
962 : PyLong_Type.tp_name, uint_max, test_var);
963 0 : return -1;
964 : }
965 0 : object->ea_size = test_var;
966 : } else {
967 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
968 : PyLong_Type.tp_name);
969 0 : return -1;
970 : }
971 : }
972 0 : return 0;
973 : }
974 :
975 0 : static PyObject *py_xattr_DosInfo3_get_size(PyObject *obj, void *closure)
976 : {
977 0 : struct xattr_DosInfo3 *object = pytalloc_get_ptr(obj);
978 0 : PyObject *py_size;
979 0 : py_size = PyLong_FromUnsignedLongLong(object->size);
980 0 : return py_size;
981 : }
982 :
983 0 : static int py_xattr_DosInfo3_set_size(PyObject *py_obj, PyObject *value, void *closure)
984 : {
985 0 : struct xattr_DosInfo3 *object = pytalloc_get_ptr(py_obj);
986 0 : if (value == NULL) {
987 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->size");
988 0 : return -1;
989 : }
990 : {
991 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->size));
992 0 : if (PyLong_Check(value)) {
993 0 : unsigned long long test_var;
994 0 : test_var = PyLong_AsUnsignedLongLong(value);
995 0 : if (PyErr_Occurred() != NULL) {
996 0 : return -1;
997 : }
998 0 : if (test_var > uint_max) {
999 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1000 : PyLong_Type.tp_name, uint_max, test_var);
1001 0 : return -1;
1002 : }
1003 0 : object->size = test_var;
1004 : } else {
1005 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1006 : PyLong_Type.tp_name);
1007 0 : return -1;
1008 : }
1009 : }
1010 0 : return 0;
1011 : }
1012 :
1013 0 : static PyObject *py_xattr_DosInfo3_get_alloc_size(PyObject *obj, void *closure)
1014 : {
1015 0 : struct xattr_DosInfo3 *object = pytalloc_get_ptr(obj);
1016 0 : PyObject *py_alloc_size;
1017 0 : py_alloc_size = PyLong_FromUnsignedLongLong(object->alloc_size);
1018 0 : return py_alloc_size;
1019 : }
1020 :
1021 0 : static int py_xattr_DosInfo3_set_alloc_size(PyObject *py_obj, PyObject *value, void *closure)
1022 : {
1023 0 : struct xattr_DosInfo3 *object = pytalloc_get_ptr(py_obj);
1024 0 : if (value == NULL) {
1025 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->alloc_size");
1026 0 : return -1;
1027 : }
1028 : {
1029 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->alloc_size));
1030 0 : if (PyLong_Check(value)) {
1031 0 : unsigned long long test_var;
1032 0 : test_var = PyLong_AsUnsignedLongLong(value);
1033 0 : if (PyErr_Occurred() != NULL) {
1034 0 : return -1;
1035 : }
1036 0 : if (test_var > uint_max) {
1037 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1038 : PyLong_Type.tp_name, uint_max, test_var);
1039 0 : return -1;
1040 : }
1041 0 : object->alloc_size = test_var;
1042 : } else {
1043 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1044 : PyLong_Type.tp_name);
1045 0 : return -1;
1046 : }
1047 : }
1048 0 : return 0;
1049 : }
1050 :
1051 0 : static PyObject *py_xattr_DosInfo3_get_create_time(PyObject *obj, void *closure)
1052 : {
1053 0 : struct xattr_DosInfo3 *object = pytalloc_get_ptr(obj);
1054 0 : PyObject *py_create_time;
1055 0 : py_create_time = PyLong_FromUnsignedLongLong(object->create_time);
1056 0 : return py_create_time;
1057 : }
1058 :
1059 0 : static int py_xattr_DosInfo3_set_create_time(PyObject *py_obj, PyObject *value, void *closure)
1060 : {
1061 0 : struct xattr_DosInfo3 *object = pytalloc_get_ptr(py_obj);
1062 0 : if (value == NULL) {
1063 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->create_time");
1064 0 : return -1;
1065 : }
1066 : {
1067 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->create_time));
1068 0 : if (PyLong_Check(value)) {
1069 0 : unsigned long long test_var;
1070 0 : test_var = PyLong_AsUnsignedLongLong(value);
1071 0 : if (PyErr_Occurred() != NULL) {
1072 0 : return -1;
1073 : }
1074 0 : if (test_var > uint_max) {
1075 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1076 : PyLong_Type.tp_name, uint_max, test_var);
1077 0 : return -1;
1078 : }
1079 0 : object->create_time = test_var;
1080 : } else {
1081 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1082 : PyLong_Type.tp_name);
1083 0 : return -1;
1084 : }
1085 : }
1086 0 : return 0;
1087 : }
1088 :
1089 0 : static PyObject *py_xattr_DosInfo3_get_change_time(PyObject *obj, void *closure)
1090 : {
1091 0 : struct xattr_DosInfo3 *object = pytalloc_get_ptr(obj);
1092 0 : PyObject *py_change_time;
1093 0 : py_change_time = PyLong_FromUnsignedLongLong(object->change_time);
1094 0 : return py_change_time;
1095 : }
1096 :
1097 0 : static int py_xattr_DosInfo3_set_change_time(PyObject *py_obj, PyObject *value, void *closure)
1098 : {
1099 0 : struct xattr_DosInfo3 *object = pytalloc_get_ptr(py_obj);
1100 0 : if (value == NULL) {
1101 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->change_time");
1102 0 : return -1;
1103 : }
1104 : {
1105 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->change_time));
1106 0 : if (PyLong_Check(value)) {
1107 0 : unsigned long long test_var;
1108 0 : test_var = PyLong_AsUnsignedLongLong(value);
1109 0 : if (PyErr_Occurred() != NULL) {
1110 0 : return -1;
1111 : }
1112 0 : if (test_var > uint_max) {
1113 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1114 : PyLong_Type.tp_name, uint_max, test_var);
1115 0 : return -1;
1116 : }
1117 0 : object->change_time = test_var;
1118 : } else {
1119 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1120 : PyLong_Type.tp_name);
1121 0 : return -1;
1122 : }
1123 : }
1124 0 : return 0;
1125 : }
1126 :
1127 : static PyGetSetDef py_xattr_DosInfo3_getsetters[] = {
1128 : {
1129 : .name = discard_const_p(char, "valid_flags"),
1130 : .get = py_xattr_DosInfo3_get_valid_flags,
1131 : .set = py_xattr_DosInfo3_set_valid_flags,
1132 : .doc = discard_const_p(char, "PIDL-generated element of base type xattr_DosInfoValidFlags")
1133 : },
1134 : {
1135 : .name = discard_const_p(char, "attrib"),
1136 : .get = py_xattr_DosInfo3_get_attrib,
1137 : .set = py_xattr_DosInfo3_set_attrib,
1138 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
1139 : },
1140 : {
1141 : .name = discard_const_p(char, "ea_size"),
1142 : .get = py_xattr_DosInfo3_get_ea_size,
1143 : .set = py_xattr_DosInfo3_set_ea_size,
1144 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
1145 : },
1146 : {
1147 : .name = discard_const_p(char, "size"),
1148 : .get = py_xattr_DosInfo3_get_size,
1149 : .set = py_xattr_DosInfo3_set_size,
1150 : .doc = discard_const_p(char, "PIDL-generated element of base type udlong")
1151 : },
1152 : {
1153 : .name = discard_const_p(char, "alloc_size"),
1154 : .get = py_xattr_DosInfo3_get_alloc_size,
1155 : .set = py_xattr_DosInfo3_set_alloc_size,
1156 : .doc = discard_const_p(char, "PIDL-generated element of base type udlong")
1157 : },
1158 : {
1159 : .name = discard_const_p(char, "create_time"),
1160 : .get = py_xattr_DosInfo3_get_create_time,
1161 : .set = py_xattr_DosInfo3_set_create_time,
1162 : .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
1163 : },
1164 : {
1165 : .name = discard_const_p(char, "change_time"),
1166 : .get = py_xattr_DosInfo3_get_change_time,
1167 : .set = py_xattr_DosInfo3_set_change_time,
1168 : .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
1169 : },
1170 : { .name = NULL }
1171 : };
1172 :
1173 0 : static PyObject *py_xattr_DosInfo3_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1174 : {
1175 0 : return pytalloc_new(struct xattr_DosInfo3, type);
1176 : }
1177 :
1178 :
1179 : static PyTypeObject xattr_DosInfo3_Type = {
1180 : PyVarObject_HEAD_INIT(NULL, 0)
1181 : .tp_name = "xattr.DosInfo3",
1182 : .tp_getset = py_xattr_DosInfo3_getsetters,
1183 : .tp_methods = NULL,
1184 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1185 : .tp_new = py_xattr_DosInfo3_new,
1186 : };
1187 :
1188 :
1189 0 : static PyObject *py_xattr_DosInfo4_get_valid_flags(PyObject *obj, void *closure)
1190 : {
1191 0 : struct xattr_DosInfo4 *object = pytalloc_get_ptr(obj);
1192 0 : PyObject *py_valid_flags;
1193 0 : py_valid_flags = PyLong_FromUnsignedLongLong((uint32_t)(object->valid_flags));
1194 0 : return py_valid_flags;
1195 : }
1196 :
1197 0 : static int py_xattr_DosInfo4_set_valid_flags(PyObject *py_obj, PyObject *value, void *closure)
1198 : {
1199 0 : struct xattr_DosInfo4 *object = pytalloc_get_ptr(py_obj);
1200 0 : if (value == NULL) {
1201 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->valid_flags");
1202 0 : return -1;
1203 : }
1204 : {
1205 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->valid_flags));
1206 0 : if (PyLong_Check(value)) {
1207 0 : unsigned long long test_var;
1208 0 : test_var = PyLong_AsUnsignedLongLong(value);
1209 0 : if (PyErr_Occurred() != NULL) {
1210 0 : return -1;
1211 : }
1212 0 : if (test_var > uint_max) {
1213 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1214 : PyLong_Type.tp_name, uint_max, test_var);
1215 0 : return -1;
1216 : }
1217 0 : object->valid_flags = test_var;
1218 : } else {
1219 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1220 : PyLong_Type.tp_name);
1221 0 : return -1;
1222 : }
1223 : }
1224 0 : return 0;
1225 : }
1226 :
1227 0 : static PyObject *py_xattr_DosInfo4_get_attrib(PyObject *obj, void *closure)
1228 : {
1229 0 : struct xattr_DosInfo4 *object = pytalloc_get_ptr(obj);
1230 0 : PyObject *py_attrib;
1231 0 : py_attrib = PyLong_FromUnsignedLongLong((uint32_t)(object->attrib));
1232 0 : return py_attrib;
1233 : }
1234 :
1235 0 : static int py_xattr_DosInfo4_set_attrib(PyObject *py_obj, PyObject *value, void *closure)
1236 : {
1237 0 : struct xattr_DosInfo4 *object = pytalloc_get_ptr(py_obj);
1238 0 : if (value == NULL) {
1239 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->attrib");
1240 0 : return -1;
1241 : }
1242 : {
1243 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->attrib));
1244 0 : if (PyLong_Check(value)) {
1245 0 : unsigned long long test_var;
1246 0 : test_var = PyLong_AsUnsignedLongLong(value);
1247 0 : if (PyErr_Occurred() != NULL) {
1248 0 : return -1;
1249 : }
1250 0 : if (test_var > uint_max) {
1251 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1252 : PyLong_Type.tp_name, uint_max, test_var);
1253 0 : return -1;
1254 : }
1255 0 : object->attrib = test_var;
1256 : } else {
1257 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1258 : PyLong_Type.tp_name);
1259 0 : return -1;
1260 : }
1261 : }
1262 0 : return 0;
1263 : }
1264 :
1265 0 : static PyObject *py_xattr_DosInfo4_get_itime(PyObject *obj, void *closure)
1266 : {
1267 0 : struct xattr_DosInfo4 *object = pytalloc_get_ptr(obj);
1268 0 : PyObject *py_itime;
1269 0 : py_itime = PyLong_FromUnsignedLongLong(object->itime);
1270 0 : return py_itime;
1271 : }
1272 :
1273 0 : static int py_xattr_DosInfo4_set_itime(PyObject *py_obj, PyObject *value, void *closure)
1274 : {
1275 0 : struct xattr_DosInfo4 *object = pytalloc_get_ptr(py_obj);
1276 0 : if (value == NULL) {
1277 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->itime");
1278 0 : return -1;
1279 : }
1280 : {
1281 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->itime));
1282 0 : if (PyLong_Check(value)) {
1283 0 : unsigned long long test_var;
1284 0 : test_var = PyLong_AsUnsignedLongLong(value);
1285 0 : if (PyErr_Occurred() != NULL) {
1286 0 : return -1;
1287 : }
1288 0 : if (test_var > uint_max) {
1289 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1290 : PyLong_Type.tp_name, uint_max, test_var);
1291 0 : return -1;
1292 : }
1293 0 : object->itime = test_var;
1294 : } else {
1295 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1296 : PyLong_Type.tp_name);
1297 0 : return -1;
1298 : }
1299 : }
1300 0 : return 0;
1301 : }
1302 :
1303 0 : static PyObject *py_xattr_DosInfo4_get_create_time(PyObject *obj, void *closure)
1304 : {
1305 0 : struct xattr_DosInfo4 *object = pytalloc_get_ptr(obj);
1306 0 : PyObject *py_create_time;
1307 0 : py_create_time = PyLong_FromUnsignedLongLong(object->create_time);
1308 0 : return py_create_time;
1309 : }
1310 :
1311 0 : static int py_xattr_DosInfo4_set_create_time(PyObject *py_obj, PyObject *value, void *closure)
1312 : {
1313 0 : struct xattr_DosInfo4 *object = pytalloc_get_ptr(py_obj);
1314 0 : if (value == NULL) {
1315 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->create_time");
1316 0 : return -1;
1317 : }
1318 : {
1319 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->create_time));
1320 0 : if (PyLong_Check(value)) {
1321 0 : unsigned long long test_var;
1322 0 : test_var = PyLong_AsUnsignedLongLong(value);
1323 0 : if (PyErr_Occurred() != NULL) {
1324 0 : return -1;
1325 : }
1326 0 : if (test_var > uint_max) {
1327 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1328 : PyLong_Type.tp_name, uint_max, test_var);
1329 0 : return -1;
1330 : }
1331 0 : object->create_time = test_var;
1332 : } else {
1333 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1334 : PyLong_Type.tp_name);
1335 0 : return -1;
1336 : }
1337 : }
1338 0 : return 0;
1339 : }
1340 :
1341 : static PyGetSetDef py_xattr_DosInfo4_getsetters[] = {
1342 : {
1343 : .name = discard_const_p(char, "valid_flags"),
1344 : .get = py_xattr_DosInfo4_get_valid_flags,
1345 : .set = py_xattr_DosInfo4_set_valid_flags,
1346 : .doc = discard_const_p(char, "PIDL-generated element of base type xattr_DosInfoValidFlags")
1347 : },
1348 : {
1349 : .name = discard_const_p(char, "attrib"),
1350 : .get = py_xattr_DosInfo4_get_attrib,
1351 : .set = py_xattr_DosInfo4_set_attrib,
1352 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
1353 : },
1354 : {
1355 : .name = discard_const_p(char, "itime"),
1356 : .get = py_xattr_DosInfo4_get_itime,
1357 : .set = py_xattr_DosInfo4_set_itime,
1358 : .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
1359 : },
1360 : {
1361 : .name = discard_const_p(char, "create_time"),
1362 : .get = py_xattr_DosInfo4_get_create_time,
1363 : .set = py_xattr_DosInfo4_set_create_time,
1364 : .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
1365 : },
1366 : { .name = NULL }
1367 : };
1368 :
1369 0 : static PyObject *py_xattr_DosInfo4_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1370 : {
1371 0 : return pytalloc_new(struct xattr_DosInfo4, type);
1372 : }
1373 :
1374 :
1375 : static PyTypeObject xattr_DosInfo4_Type = {
1376 : PyVarObject_HEAD_INIT(NULL, 0)
1377 : .tp_name = "xattr.DosInfo4",
1378 : .tp_getset = py_xattr_DosInfo4_getsetters,
1379 : .tp_methods = NULL,
1380 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1381 : .tp_new = py_xattr_DosInfo4_new,
1382 : };
1383 :
1384 :
1385 0 : static PyObject *py_xattr_DosInfo5_get_valid_flags(PyObject *obj, void *closure)
1386 : {
1387 0 : struct xattr_DosInfo5 *object = pytalloc_get_ptr(obj);
1388 0 : PyObject *py_valid_flags;
1389 0 : py_valid_flags = PyLong_FromUnsignedLongLong((uint32_t)(object->valid_flags));
1390 0 : return py_valid_flags;
1391 : }
1392 :
1393 0 : static int py_xattr_DosInfo5_set_valid_flags(PyObject *py_obj, PyObject *value, void *closure)
1394 : {
1395 0 : struct xattr_DosInfo5 *object = pytalloc_get_ptr(py_obj);
1396 0 : if (value == NULL) {
1397 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->valid_flags");
1398 0 : return -1;
1399 : }
1400 : {
1401 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->valid_flags));
1402 0 : if (PyLong_Check(value)) {
1403 0 : unsigned long long test_var;
1404 0 : test_var = PyLong_AsUnsignedLongLong(value);
1405 0 : if (PyErr_Occurred() != NULL) {
1406 0 : return -1;
1407 : }
1408 0 : if (test_var > uint_max) {
1409 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1410 : PyLong_Type.tp_name, uint_max, test_var);
1411 0 : return -1;
1412 : }
1413 0 : object->valid_flags = test_var;
1414 : } else {
1415 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1416 : PyLong_Type.tp_name);
1417 0 : return -1;
1418 : }
1419 : }
1420 0 : return 0;
1421 : }
1422 :
1423 0 : static PyObject *py_xattr_DosInfo5_get_attrib(PyObject *obj, void *closure)
1424 : {
1425 0 : struct xattr_DosInfo5 *object = pytalloc_get_ptr(obj);
1426 0 : PyObject *py_attrib;
1427 0 : py_attrib = PyLong_FromUnsignedLongLong((uint32_t)(object->attrib));
1428 0 : return py_attrib;
1429 : }
1430 :
1431 0 : static int py_xattr_DosInfo5_set_attrib(PyObject *py_obj, PyObject *value, void *closure)
1432 : {
1433 0 : struct xattr_DosInfo5 *object = pytalloc_get_ptr(py_obj);
1434 0 : if (value == NULL) {
1435 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->attrib");
1436 0 : return -1;
1437 : }
1438 : {
1439 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->attrib));
1440 0 : if (PyLong_Check(value)) {
1441 0 : unsigned long long test_var;
1442 0 : test_var = PyLong_AsUnsignedLongLong(value);
1443 0 : if (PyErr_Occurred() != NULL) {
1444 0 : return -1;
1445 : }
1446 0 : if (test_var > uint_max) {
1447 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1448 : PyLong_Type.tp_name, uint_max, test_var);
1449 0 : return -1;
1450 : }
1451 0 : object->attrib = test_var;
1452 : } else {
1453 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1454 : PyLong_Type.tp_name);
1455 0 : return -1;
1456 : }
1457 : }
1458 0 : return 0;
1459 : }
1460 :
1461 0 : static PyObject *py_xattr_DosInfo5_get_create_time(PyObject *obj, void *closure)
1462 : {
1463 0 : struct xattr_DosInfo5 *object = pytalloc_get_ptr(obj);
1464 0 : PyObject *py_create_time;
1465 0 : py_create_time = PyLong_FromUnsignedLongLong(object->create_time);
1466 0 : return py_create_time;
1467 : }
1468 :
1469 0 : static int py_xattr_DosInfo5_set_create_time(PyObject *py_obj, PyObject *value, void *closure)
1470 : {
1471 0 : struct xattr_DosInfo5 *object = pytalloc_get_ptr(py_obj);
1472 0 : if (value == NULL) {
1473 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->create_time");
1474 0 : return -1;
1475 : }
1476 : {
1477 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->create_time));
1478 0 : if (PyLong_Check(value)) {
1479 0 : unsigned long long test_var;
1480 0 : test_var = PyLong_AsUnsignedLongLong(value);
1481 0 : if (PyErr_Occurred() != NULL) {
1482 0 : return -1;
1483 : }
1484 0 : if (test_var > uint_max) {
1485 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1486 : PyLong_Type.tp_name, uint_max, test_var);
1487 0 : return -1;
1488 : }
1489 0 : object->create_time = test_var;
1490 : } else {
1491 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1492 : PyLong_Type.tp_name);
1493 0 : return -1;
1494 : }
1495 : }
1496 0 : return 0;
1497 : }
1498 :
1499 : static PyGetSetDef py_xattr_DosInfo5_getsetters[] = {
1500 : {
1501 : .name = discard_const_p(char, "valid_flags"),
1502 : .get = py_xattr_DosInfo5_get_valid_flags,
1503 : .set = py_xattr_DosInfo5_set_valid_flags,
1504 : .doc = discard_const_p(char, "PIDL-generated element of base type xattr_DosInfoValidFlags")
1505 : },
1506 : {
1507 : .name = discard_const_p(char, "attrib"),
1508 : .get = py_xattr_DosInfo5_get_attrib,
1509 : .set = py_xattr_DosInfo5_set_attrib,
1510 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
1511 : },
1512 : {
1513 : .name = discard_const_p(char, "create_time"),
1514 : .get = py_xattr_DosInfo5_get_create_time,
1515 : .set = py_xattr_DosInfo5_set_create_time,
1516 : .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
1517 : },
1518 : { .name = NULL }
1519 : };
1520 :
1521 0 : static PyObject *py_xattr_DosInfo5_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1522 : {
1523 0 : return pytalloc_new(struct xattr_DosInfo5, type);
1524 : }
1525 :
1526 :
1527 : static PyTypeObject xattr_DosInfo5_Type = {
1528 : PyVarObject_HEAD_INIT(NULL, 0)
1529 : .tp_name = "xattr.DosInfo5",
1530 : .tp_getset = py_xattr_DosInfo5_getsetters,
1531 : .tp_methods = NULL,
1532 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1533 : .tp_new = py_xattr_DosInfo5_new,
1534 : };
1535 :
1536 0 : static PyObject *py_import_xattr_DosInfo(TALLOC_CTX *mem_ctx, int level, union xattr_DosInfo *in)
1537 : {
1538 0 : PyObject *ret;
1539 :
1540 0 : switch (level) {
1541 0 : case 0xFFFF:
1542 0 : ret = pytalloc_reference_ex(&xattr_DosInfoFFFFCompat_Type, mem_ctx, &in->compatinfoFFFF);
1543 0 : return ret;
1544 :
1545 0 : case 1:
1546 0 : ret = pytalloc_reference_ex(&xattr_DosInfo1_Type, mem_ctx, &in->info1);
1547 0 : return ret;
1548 :
1549 0 : case 2:
1550 0 : ret = pytalloc_reference_ex(&xattr_DosInfo2Old_Type, mem_ctx, &in->oldinfo2);
1551 0 : return ret;
1552 :
1553 0 : case 3:
1554 0 : ret = pytalloc_reference_ex(&xattr_DosInfo3_Type, mem_ctx, &in->info3);
1555 0 : return ret;
1556 :
1557 0 : case 4:
1558 0 : ret = pytalloc_reference_ex(&xattr_DosInfo4_Type, mem_ctx, &in->info4);
1559 0 : return ret;
1560 :
1561 0 : case 5:
1562 0 : ret = pytalloc_reference_ex(&xattr_DosInfo5_Type, mem_ctx, &in->info5);
1563 0 : return ret;
1564 :
1565 : }
1566 0 : PyErr_SetString(PyExc_TypeError, "unknown union level");
1567 0 : return NULL;
1568 : }
1569 :
1570 0 : static union xattr_DosInfo *py_export_xattr_DosInfo(TALLOC_CTX *mem_ctx, int level, PyObject *in)
1571 : {
1572 0 : union xattr_DosInfo *ret = talloc_zero(mem_ctx, union xattr_DosInfo);
1573 0 : switch (level) {
1574 0 : case 0xFFFF:
1575 0 : if (in == NULL) {
1576 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->compatinfoFFFF");
1577 0 : talloc_free(ret); return NULL;
1578 : }
1579 0 : PY_CHECK_TYPE(&xattr_DosInfoFFFFCompat_Type, in, talloc_free(ret); return NULL;);
1580 0 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
1581 0 : PyErr_NoMemory();
1582 0 : talloc_free(ret); return NULL;
1583 : }
1584 0 : ret->compatinfoFFFF = *(struct xattr_DosInfoFFFFCompat *)pytalloc_get_ptr(in);
1585 0 : break;
1586 :
1587 0 : case 1:
1588 0 : if (in == NULL) {
1589 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->info1");
1590 0 : talloc_free(ret); return NULL;
1591 : }
1592 0 : PY_CHECK_TYPE(&xattr_DosInfo1_Type, in, talloc_free(ret); return NULL;);
1593 0 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
1594 0 : PyErr_NoMemory();
1595 0 : talloc_free(ret); return NULL;
1596 : }
1597 0 : ret->info1 = *(struct xattr_DosInfo1 *)pytalloc_get_ptr(in);
1598 0 : break;
1599 :
1600 0 : case 2:
1601 0 : if (in == NULL) {
1602 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->oldinfo2");
1603 0 : talloc_free(ret); return NULL;
1604 : }
1605 0 : PY_CHECK_TYPE(&xattr_DosInfo2Old_Type, in, talloc_free(ret); return NULL;);
1606 0 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
1607 0 : PyErr_NoMemory();
1608 0 : talloc_free(ret); return NULL;
1609 : }
1610 0 : ret->oldinfo2 = *(struct xattr_DosInfo2Old *)pytalloc_get_ptr(in);
1611 0 : break;
1612 :
1613 0 : case 3:
1614 0 : if (in == NULL) {
1615 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->info3");
1616 0 : talloc_free(ret); return NULL;
1617 : }
1618 0 : PY_CHECK_TYPE(&xattr_DosInfo3_Type, in, talloc_free(ret); return NULL;);
1619 0 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
1620 0 : PyErr_NoMemory();
1621 0 : talloc_free(ret); return NULL;
1622 : }
1623 0 : ret->info3 = *(struct xattr_DosInfo3 *)pytalloc_get_ptr(in);
1624 0 : break;
1625 :
1626 0 : case 4:
1627 0 : if (in == NULL) {
1628 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->info4");
1629 0 : talloc_free(ret); return NULL;
1630 : }
1631 0 : PY_CHECK_TYPE(&xattr_DosInfo4_Type, in, talloc_free(ret); return NULL;);
1632 0 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
1633 0 : PyErr_NoMemory();
1634 0 : talloc_free(ret); return NULL;
1635 : }
1636 0 : ret->info4 = *(struct xattr_DosInfo4 *)pytalloc_get_ptr(in);
1637 0 : break;
1638 :
1639 0 : case 5:
1640 0 : if (in == NULL) {
1641 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->info5");
1642 0 : talloc_free(ret); return NULL;
1643 : }
1644 0 : PY_CHECK_TYPE(&xattr_DosInfo5_Type, in, talloc_free(ret); return NULL;);
1645 0 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
1646 0 : PyErr_NoMemory();
1647 0 : talloc_free(ret); return NULL;
1648 : }
1649 0 : ret->info5 = *(struct xattr_DosInfo5 *)pytalloc_get_ptr(in);
1650 0 : break;
1651 :
1652 0 : default:
1653 0 : PyErr_SetString(PyExc_TypeError, "invalid union level value");
1654 0 : talloc_free(ret);
1655 0 : ret = NULL;
1656 : }
1657 :
1658 0 : return ret;
1659 : }
1660 :
1661 0 : static PyObject *py_xattr_DosInfo_import(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1662 : {
1663 0 : const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
1664 0 : PyObject *mem_ctx_obj = NULL;
1665 0 : TALLOC_CTX *mem_ctx = NULL;
1666 0 : int level = 0;
1667 0 : PyObject *in_obj = NULL;
1668 0 : union xattr_DosInfo *in = NULL;
1669 :
1670 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:import",
1671 : discard_const_p(char *, kwnames),
1672 : &mem_ctx_obj,
1673 : &level,
1674 : &in_obj)) {
1675 0 : return NULL;
1676 : }
1677 0 : mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
1678 0 : if (mem_ctx == NULL) {
1679 0 : PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
1680 0 : return NULL;
1681 : }
1682 0 : in = (union xattr_DosInfo *)pytalloc_get_ptr(in_obj);
1683 0 : if (in == NULL) {
1684 0 : PyErr_Format(PyExc_TypeError, "in needs to be a pointer to union xattr_DosInfo!");
1685 0 : return NULL;
1686 : }
1687 :
1688 0 : return py_import_xattr_DosInfo(mem_ctx, level, in);
1689 : }
1690 :
1691 0 : static PyObject *py_xattr_DosInfo_export(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1692 : {
1693 0 : const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
1694 0 : PyObject *mem_ctx_obj = NULL;
1695 0 : TALLOC_CTX *mem_ctx = NULL;
1696 0 : int level = 0;
1697 0 : PyObject *in = NULL;
1698 0 : union xattr_DosInfo *out = NULL;
1699 :
1700 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:export",
1701 : discard_const_p(char *, kwnames),
1702 : &mem_ctx_obj,
1703 : &level,
1704 : &in)) {
1705 0 : return NULL;
1706 : }
1707 0 : mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
1708 0 : if (mem_ctx == NULL) {
1709 0 : PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
1710 0 : return NULL;
1711 : }
1712 :
1713 0 : out = py_export_xattr_DosInfo(mem_ctx, level, in);
1714 0 : if (out == NULL) {
1715 0 : return NULL;
1716 : }
1717 :
1718 0 : return pytalloc_GenericObject_reference(out);
1719 : }
1720 :
1721 : static PyMethodDef py_xattr_DosInfo_methods[] = {
1722 : { "__import__", PY_DISCARD_FUNC_SIG(PyCFunction,py_xattr_DosInfo_import),
1723 : METH_VARARGS|METH_KEYWORDS|METH_CLASS,
1724 : "T.__import__(mem_ctx, level, in) => ret." },
1725 : { "__export__", PY_DISCARD_FUNC_SIG(PyCFunction,py_xattr_DosInfo_export),
1726 : METH_VARARGS|METH_KEYWORDS|METH_CLASS,
1727 : "T.__export__(mem_ctx, level, in) => ret." },
1728 : { NULL, NULL, 0, NULL }
1729 : };
1730 :
1731 0 : static PyObject *py_xattr_DosInfo_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1732 : {
1733 0 : PyErr_Format(PyExc_TypeError, "New %s Objects are not supported", type->tp_name);
1734 0 : return NULL;
1735 : }
1736 :
1737 :
1738 : static PyTypeObject xattr_DosInfo_Type = {
1739 : PyVarObject_HEAD_INIT(NULL, 0)
1740 : .tp_name = "xattr.DosInfo",
1741 : .tp_getset = NULL,
1742 : .tp_methods = py_xattr_DosInfo_methods,
1743 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1744 : .tp_new = py_xattr_DosInfo_new,
1745 : };
1746 :
1747 :
1748 0 : static PyObject *py_xattr_DosAttrib_get_version(PyObject *obj, void *closure)
1749 : {
1750 0 : struct xattr_DosAttrib *object = pytalloc_get_ptr(obj);
1751 0 : PyObject *py_version;
1752 0 : py_version = PyLong_FromLong((uint16_t)(object->version));
1753 0 : return py_version;
1754 : }
1755 :
1756 0 : static int py_xattr_DosAttrib_set_version(PyObject *py_obj, PyObject *value, void *closure)
1757 : {
1758 0 : struct xattr_DosAttrib *object = pytalloc_get_ptr(py_obj);
1759 0 : if (value == NULL) {
1760 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->version");
1761 0 : return -1;
1762 : }
1763 : {
1764 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->version));
1765 0 : if (PyLong_Check(value)) {
1766 0 : unsigned long long test_var;
1767 0 : test_var = PyLong_AsUnsignedLongLong(value);
1768 0 : if (PyErr_Occurred() != NULL) {
1769 0 : return -1;
1770 : }
1771 0 : if (test_var > uint_max) {
1772 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1773 : PyLong_Type.tp_name, uint_max, test_var);
1774 0 : return -1;
1775 : }
1776 0 : object->version = test_var;
1777 : } else {
1778 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
1779 : PyLong_Type.tp_name);
1780 0 : return -1;
1781 : }
1782 : }
1783 0 : return 0;
1784 : }
1785 :
1786 0 : static PyObject *py_xattr_DosAttrib_get_info(PyObject *obj, void *closure)
1787 : {
1788 0 : struct xattr_DosAttrib *object = pytalloc_get_ptr(obj);
1789 0 : PyObject *py_info;
1790 0 : py_info = pyrpc_import_union(&xattr_DosInfo_Type, pytalloc_get_mem_ctx(obj), object->version, &object->info, "union xattr_DosInfo");
1791 0 : if (py_info == NULL) {
1792 0 : return NULL;
1793 : }
1794 0 : return py_info;
1795 : }
1796 :
1797 0 : static int py_xattr_DosAttrib_set_info(PyObject *py_obj, PyObject *value, void *closure)
1798 : {
1799 0 : struct xattr_DosAttrib *object = pytalloc_get_ptr(py_obj);
1800 0 : if (value == NULL) {
1801 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->info");
1802 0 : return -1;
1803 : }
1804 : {
1805 0 : union xattr_DosInfo *info_switch_0;
1806 0 : info_switch_0 = (union xattr_DosInfo *)pyrpc_export_union(&xattr_DosInfo_Type, pytalloc_get_mem_ctx(py_obj), object->version, value, "union xattr_DosInfo");
1807 0 : if (info_switch_0 == NULL) {
1808 0 : return -1;
1809 : }
1810 0 : object->info = *info_switch_0;
1811 : }
1812 0 : return 0;
1813 : }
1814 :
1815 : static PyGetSetDef py_xattr_DosAttrib_getsetters[] = {
1816 : {
1817 : .name = discard_const_p(char, "version"),
1818 : .get = py_xattr_DosAttrib_get_version,
1819 : .set = py_xattr_DosAttrib_set_version,
1820 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
1821 : },
1822 : {
1823 : .name = discard_const_p(char, "info"),
1824 : .get = py_xattr_DosAttrib_get_info,
1825 : .set = py_xattr_DosAttrib_set_info,
1826 : .doc = discard_const_p(char, "PIDL-generated element of base type xattr_DosInfo")
1827 : },
1828 : { .name = NULL }
1829 : };
1830 :
1831 0 : static PyObject *py_xattr_DosAttrib_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
1832 : {
1833 0 : return pytalloc_new(struct xattr_DosAttrib, type);
1834 : }
1835 :
1836 0 : static PyObject *py_xattr_DosAttrib_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
1837 : {
1838 0 : struct xattr_DosAttrib *object = pytalloc_get_ptr(py_obj);
1839 0 : PyObject *ret = NULL;
1840 0 : DATA_BLOB blob;
1841 0 : enum ndr_err_code err;
1842 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
1843 0 : if (tmp_ctx == NULL) {
1844 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
1845 0 : return NULL;
1846 : }
1847 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_xattr_DosAttrib);
1848 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
1849 0 : TALLOC_FREE(tmp_ctx);
1850 0 : PyErr_SetNdrError(err);
1851 0 : return NULL;
1852 : }
1853 :
1854 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
1855 0 : TALLOC_FREE(tmp_ctx);
1856 0 : return ret;
1857 : }
1858 :
1859 0 : static PyObject *py_xattr_DosAttrib_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
1860 : {
1861 0 : struct xattr_DosAttrib *object = pytalloc_get_ptr(py_obj);
1862 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
1863 0 : Py_ssize_t blob_length = 0;
1864 0 : enum ndr_err_code err;
1865 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
1866 0 : PyObject *allow_remaining_obj = NULL;
1867 0 : bool allow_remaining = false;
1868 :
1869 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
1870 : discard_const_p(char *, kwnames),
1871 : &blob.data, &blob_length,
1872 : &allow_remaining_obj)) {
1873 0 : return NULL;
1874 : }
1875 0 : blob.length = blob_length;
1876 :
1877 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
1878 0 : allow_remaining = true;
1879 : }
1880 :
1881 0 : if (allow_remaining) {
1882 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_xattr_DosAttrib);
1883 : } else {
1884 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_xattr_DosAttrib);
1885 : }
1886 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
1887 0 : PyErr_SetNdrError(err);
1888 0 : return NULL;
1889 : }
1890 :
1891 0 : Py_RETURN_NONE;
1892 : }
1893 :
1894 0 : static PyObject *py_xattr_DosAttrib_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
1895 : {
1896 0 : struct xattr_DosAttrib *object = pytalloc_get_ptr(py_obj);
1897 0 : PyObject *ret;
1898 0 : char *retstr;
1899 :
1900 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_xattr_DosAttrib, "xattr_DosAttrib", object);
1901 0 : ret = PyUnicode_FromString(retstr);
1902 0 : talloc_free(retstr);
1903 :
1904 0 : return ret;
1905 : }
1906 :
1907 : static PyMethodDef py_xattr_DosAttrib_methods[] = {
1908 : { "__ndr_pack__", (PyCFunction)py_xattr_DosAttrib_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
1909 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_xattr_DosAttrib_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
1910 : { "__ndr_print__", (PyCFunction)py_xattr_DosAttrib_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
1911 : { NULL, NULL, 0, NULL }
1912 : };
1913 :
1914 :
1915 : static PyTypeObject xattr_DosAttrib_Type = {
1916 : PyVarObject_HEAD_INIT(NULL, 0)
1917 : .tp_name = "xattr.DosAttrib",
1918 : .tp_getset = py_xattr_DosAttrib_getsetters,
1919 : .tp_methods = py_xattr_DosAttrib_methods,
1920 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
1921 : .tp_new = py_xattr_DosAttrib_new,
1922 : };
1923 :
1924 :
1925 0 : static PyObject *py_xattr_DOSATTRIB_get_attrib_hex(PyObject *obj, void *closure)
1926 : {
1927 0 : struct xattr_DOSATTRIB *object = pytalloc_get_ptr(obj);
1928 0 : PyObject *py_attrib_hex;
1929 0 : py_attrib_hex = PyString_FromStringOrNULL(object->attrib_hex);
1930 0 : return py_attrib_hex;
1931 : }
1932 :
1933 0 : static int py_xattr_DOSATTRIB_set_attrib_hex(PyObject *py_obj, PyObject *value, void *closure)
1934 : {
1935 0 : struct xattr_DOSATTRIB *object = pytalloc_get_ptr(py_obj);
1936 0 : if (value == NULL) {
1937 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->attrib_hex");
1938 0 : return -1;
1939 : }
1940 : {
1941 0 : const char *test_str;
1942 0 : const char *talloc_str;
1943 0 : PyObject *unicode = NULL;
1944 0 : if (PyUnicode_Check(value)) {
1945 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
1946 0 : if (unicode == NULL) {
1947 0 : return -1;
1948 : }
1949 0 : test_str = PyBytes_AS_STRING(unicode);
1950 0 : } else if (PyBytes_Check(value)) {
1951 0 : test_str = PyBytes_AS_STRING(value);
1952 : } else {
1953 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
1954 0 : return -1;
1955 : }
1956 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
1957 0 : if (unicode != NULL) {
1958 0 : Py_DECREF(unicode);
1959 : }
1960 0 : if (talloc_str == NULL) {
1961 0 : PyErr_NoMemory();
1962 0 : return -1;
1963 : }
1964 0 : object->attrib_hex = talloc_str;
1965 : }
1966 0 : return 0;
1967 : }
1968 :
1969 0 : static PyObject *py_xattr_DOSATTRIB_get_version(PyObject *obj, void *closure)
1970 : {
1971 0 : struct xattr_DOSATTRIB *object = pytalloc_get_ptr(obj);
1972 0 : PyObject *py_version;
1973 0 : py_version = PyLong_FromLong((uint16_t)(object->version));
1974 0 : return py_version;
1975 : }
1976 :
1977 0 : static int py_xattr_DOSATTRIB_set_version(PyObject *py_obj, PyObject *value, void *closure)
1978 : {
1979 0 : struct xattr_DOSATTRIB *object = pytalloc_get_ptr(py_obj);
1980 0 : if (value == NULL) {
1981 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->version");
1982 0 : return -1;
1983 : }
1984 : {
1985 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->version));
1986 0 : if (PyLong_Check(value)) {
1987 0 : unsigned long long test_var;
1988 0 : test_var = PyLong_AsUnsignedLongLong(value);
1989 0 : if (PyErr_Occurred() != NULL) {
1990 0 : return -1;
1991 : }
1992 0 : if (test_var > uint_max) {
1993 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
1994 : PyLong_Type.tp_name, uint_max, test_var);
1995 0 : return -1;
1996 : }
1997 0 : object->version = test_var;
1998 : } else {
1999 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2000 : PyLong_Type.tp_name);
2001 0 : return -1;
2002 : }
2003 : }
2004 0 : return 0;
2005 : }
2006 :
2007 0 : static PyObject *py_xattr_DOSATTRIB_get_info(PyObject *obj, void *closure)
2008 : {
2009 0 : struct xattr_DOSATTRIB *object = pytalloc_get_ptr(obj);
2010 0 : PyObject *py_info;
2011 0 : py_info = pyrpc_import_union(&xattr_DosInfo_Type, pytalloc_get_mem_ctx(obj), object->version, &object->info, "union xattr_DosInfo");
2012 0 : if (py_info == NULL) {
2013 0 : return NULL;
2014 : }
2015 0 : return py_info;
2016 : }
2017 :
2018 0 : static int py_xattr_DOSATTRIB_set_info(PyObject *py_obj, PyObject *value, void *closure)
2019 : {
2020 0 : struct xattr_DOSATTRIB *object = pytalloc_get_ptr(py_obj);
2021 0 : if (value == NULL) {
2022 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->info");
2023 0 : return -1;
2024 : }
2025 : {
2026 0 : union xattr_DosInfo *info_switch_0;
2027 0 : info_switch_0 = (union xattr_DosInfo *)pyrpc_export_union(&xattr_DosInfo_Type, pytalloc_get_mem_ctx(py_obj), object->version, value, "union xattr_DosInfo");
2028 0 : if (info_switch_0 == NULL) {
2029 0 : return -1;
2030 : }
2031 0 : object->info = *info_switch_0;
2032 : }
2033 0 : return 0;
2034 : }
2035 :
2036 : static PyGetSetDef py_xattr_DOSATTRIB_getsetters[] = {
2037 : {
2038 : .name = discard_const_p(char, "attrib_hex"),
2039 : .get = py_xattr_DOSATTRIB_get_attrib_hex,
2040 : .set = py_xattr_DOSATTRIB_set_attrib_hex,
2041 : .doc = discard_const_p(char, "PIDL-generated element of base type string")
2042 : },
2043 : {
2044 : .name = discard_const_p(char, "version"),
2045 : .get = py_xattr_DOSATTRIB_get_version,
2046 : .set = py_xattr_DOSATTRIB_set_version,
2047 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
2048 : },
2049 : {
2050 : .name = discard_const_p(char, "info"),
2051 : .get = py_xattr_DOSATTRIB_get_info,
2052 : .set = py_xattr_DOSATTRIB_set_info,
2053 : .doc = discard_const_p(char, "PIDL-generated element of base type xattr_DosInfo")
2054 : },
2055 : { .name = NULL }
2056 : };
2057 :
2058 0 : static PyObject *py_xattr_DOSATTRIB_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2059 : {
2060 0 : return pytalloc_new(struct xattr_DOSATTRIB, type);
2061 : }
2062 :
2063 0 : static PyObject *py_xattr_DOSATTRIB_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2064 : {
2065 0 : struct xattr_DOSATTRIB *object = pytalloc_get_ptr(py_obj);
2066 0 : PyObject *ret = NULL;
2067 0 : DATA_BLOB blob;
2068 0 : enum ndr_err_code err;
2069 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
2070 0 : if (tmp_ctx == NULL) {
2071 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
2072 0 : return NULL;
2073 : }
2074 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_xattr_DOSATTRIB);
2075 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2076 0 : TALLOC_FREE(tmp_ctx);
2077 0 : PyErr_SetNdrError(err);
2078 0 : return NULL;
2079 : }
2080 :
2081 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
2082 0 : TALLOC_FREE(tmp_ctx);
2083 0 : return ret;
2084 : }
2085 :
2086 0 : static PyObject *py_xattr_DOSATTRIB_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
2087 : {
2088 0 : struct xattr_DOSATTRIB *object = pytalloc_get_ptr(py_obj);
2089 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
2090 0 : Py_ssize_t blob_length = 0;
2091 0 : enum ndr_err_code err;
2092 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
2093 0 : PyObject *allow_remaining_obj = NULL;
2094 0 : bool allow_remaining = false;
2095 :
2096 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
2097 : discard_const_p(char *, kwnames),
2098 : &blob.data, &blob_length,
2099 : &allow_remaining_obj)) {
2100 0 : return NULL;
2101 : }
2102 0 : blob.length = blob_length;
2103 :
2104 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
2105 0 : allow_remaining = true;
2106 : }
2107 :
2108 0 : if (allow_remaining) {
2109 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_xattr_DOSATTRIB);
2110 : } else {
2111 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_xattr_DOSATTRIB);
2112 : }
2113 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2114 0 : PyErr_SetNdrError(err);
2115 0 : return NULL;
2116 : }
2117 :
2118 0 : Py_RETURN_NONE;
2119 : }
2120 :
2121 0 : static PyObject *py_xattr_DOSATTRIB_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2122 : {
2123 0 : struct xattr_DOSATTRIB *object = pytalloc_get_ptr(py_obj);
2124 0 : PyObject *ret;
2125 0 : char *retstr;
2126 :
2127 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_xattr_DOSATTRIB, "xattr_DOSATTRIB", object);
2128 0 : ret = PyUnicode_FromString(retstr);
2129 0 : talloc_free(retstr);
2130 :
2131 0 : return ret;
2132 : }
2133 :
2134 : static PyMethodDef py_xattr_DOSATTRIB_methods[] = {
2135 : { "__ndr_pack__", (PyCFunction)py_xattr_DOSATTRIB_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
2136 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_xattr_DOSATTRIB_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
2137 : { "__ndr_print__", (PyCFunction)py_xattr_DOSATTRIB_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
2138 : { NULL, NULL, 0, NULL }
2139 : };
2140 :
2141 :
2142 : static PyTypeObject xattr_DOSATTRIB_Type = {
2143 : PyVarObject_HEAD_INIT(NULL, 0)
2144 : .tp_name = "xattr.DOSATTRIB",
2145 : .tp_getset = py_xattr_DOSATTRIB_getsetters,
2146 : .tp_methods = py_xattr_DOSATTRIB_methods,
2147 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
2148 : .tp_new = py_xattr_DOSATTRIB_new,
2149 : };
2150 :
2151 :
2152 0 : static PyObject *py_xattr_EA_get_name(PyObject *obj, void *closure)
2153 : {
2154 0 : struct xattr_EA *object = pytalloc_get_ptr(obj);
2155 0 : PyObject *py_name;
2156 0 : py_name = PyString_FromStringOrNULL(object->name);
2157 0 : return py_name;
2158 : }
2159 :
2160 0 : static int py_xattr_EA_set_name(PyObject *py_obj, PyObject *value, void *closure)
2161 : {
2162 0 : struct xattr_EA *object = pytalloc_get_ptr(py_obj);
2163 0 : if (value == NULL) {
2164 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->name");
2165 0 : return -1;
2166 : }
2167 : {
2168 0 : const char *test_str;
2169 0 : const char *talloc_str;
2170 0 : PyObject *unicode = NULL;
2171 0 : if (PyUnicode_Check(value)) {
2172 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
2173 0 : if (unicode == NULL) {
2174 0 : return -1;
2175 : }
2176 0 : test_str = PyBytes_AS_STRING(unicode);
2177 0 : } else if (PyBytes_Check(value)) {
2178 0 : test_str = PyBytes_AS_STRING(value);
2179 : } else {
2180 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
2181 0 : return -1;
2182 : }
2183 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
2184 0 : if (unicode != NULL) {
2185 0 : Py_DECREF(unicode);
2186 : }
2187 0 : if (talloc_str == NULL) {
2188 0 : PyErr_NoMemory();
2189 0 : return -1;
2190 : }
2191 0 : object->name = talloc_str;
2192 : }
2193 0 : return 0;
2194 : }
2195 :
2196 0 : static PyObject *py_xattr_EA_get_value(PyObject *obj, void *closure)
2197 : {
2198 0 : struct xattr_EA *object = pytalloc_get_ptr(obj);
2199 0 : PyObject *py_value;
2200 0 : py_value = PyBytes_FromStringAndSize((char *)(object->value).data, (object->value).length);
2201 0 : return py_value;
2202 : }
2203 :
2204 0 : static int py_xattr_EA_set_value(PyObject *py_obj, PyObject *value, void *closure)
2205 : {
2206 0 : struct xattr_EA *object = pytalloc_get_ptr(py_obj);
2207 0 : if (value == NULL) {
2208 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->value");
2209 0 : return -1;
2210 : }
2211 0 : object->value = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
2212 0 : return 0;
2213 : }
2214 :
2215 : static PyGetSetDef py_xattr_EA_getsetters[] = {
2216 : {
2217 : .name = discard_const_p(char, "name"),
2218 : .get = py_xattr_EA_get_name,
2219 : .set = py_xattr_EA_set_name,
2220 : .doc = discard_const_p(char, "PIDL-generated element of base type string")
2221 : },
2222 : {
2223 : .name = discard_const_p(char, "value"),
2224 : .get = py_xattr_EA_get_value,
2225 : .set = py_xattr_EA_set_value,
2226 : .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
2227 : },
2228 : { .name = NULL }
2229 : };
2230 :
2231 0 : static PyObject *py_xattr_EA_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2232 : {
2233 0 : return pytalloc_new(struct xattr_EA, type);
2234 : }
2235 :
2236 :
2237 : static PyTypeObject xattr_EA_Type = {
2238 : PyVarObject_HEAD_INIT(NULL, 0)
2239 : .tp_name = "xattr.EA",
2240 : .tp_getset = py_xattr_EA_getsetters,
2241 : .tp_methods = NULL,
2242 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
2243 : .tp_new = py_xattr_EA_new,
2244 : };
2245 :
2246 :
2247 0 : static PyObject *py_xattr_DosEAs_get_num_eas(PyObject *obj, void *closure)
2248 : {
2249 0 : struct xattr_DosEAs *object = pytalloc_get_ptr(obj);
2250 0 : PyObject *py_num_eas;
2251 0 : py_num_eas = PyLong_FromLong((uint16_t)(object->num_eas));
2252 0 : return py_num_eas;
2253 : }
2254 :
2255 0 : static int py_xattr_DosEAs_set_num_eas(PyObject *py_obj, PyObject *value, void *closure)
2256 : {
2257 0 : struct xattr_DosEAs *object = pytalloc_get_ptr(py_obj);
2258 0 : if (value == NULL) {
2259 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->num_eas");
2260 0 : return -1;
2261 : }
2262 : {
2263 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->num_eas));
2264 0 : if (PyLong_Check(value)) {
2265 0 : unsigned long long test_var;
2266 0 : test_var = PyLong_AsUnsignedLongLong(value);
2267 0 : if (PyErr_Occurred() != NULL) {
2268 0 : return -1;
2269 : }
2270 0 : if (test_var > uint_max) {
2271 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2272 : PyLong_Type.tp_name, uint_max, test_var);
2273 0 : return -1;
2274 : }
2275 0 : object->num_eas = test_var;
2276 : } else {
2277 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2278 : PyLong_Type.tp_name);
2279 0 : return -1;
2280 : }
2281 : }
2282 0 : return 0;
2283 : }
2284 :
2285 0 : static PyObject *py_xattr_DosEAs_get_eas(PyObject *obj, void *closure)
2286 : {
2287 0 : struct xattr_DosEAs *object = pytalloc_get_ptr(obj);
2288 0 : PyObject *py_eas;
2289 0 : if (object->eas == NULL) {
2290 0 : Py_RETURN_NONE;
2291 : }
2292 0 : if (object->eas == NULL) {
2293 0 : py_eas = Py_None;
2294 0 : Py_INCREF(py_eas);
2295 : } else {
2296 0 : py_eas = PyList_New(object->num_eas);
2297 0 : if (py_eas == NULL) {
2298 0 : return NULL;
2299 : }
2300 : {
2301 : int eas_cntr_1;
2302 0 : for (eas_cntr_1 = 0; eas_cntr_1 < (object->num_eas); eas_cntr_1++) {
2303 0 : PyObject *py_eas_1;
2304 0 : py_eas_1 = pytalloc_reference_ex(&xattr_EA_Type, object->eas, &(object->eas)[eas_cntr_1]);
2305 0 : PyList_SetItem(py_eas, eas_cntr_1, py_eas_1);
2306 : }
2307 : }
2308 : }
2309 0 : return py_eas;
2310 : }
2311 :
2312 0 : static int py_xattr_DosEAs_set_eas(PyObject *py_obj, PyObject *value, void *closure)
2313 : {
2314 0 : struct xattr_DosEAs *object = pytalloc_get_ptr(py_obj);
2315 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->eas));
2316 0 : if (value == NULL) {
2317 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->eas");
2318 0 : return -1;
2319 : }
2320 0 : if (value == Py_None) {
2321 0 : object->eas = NULL;
2322 : } else {
2323 0 : object->eas = NULL;
2324 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
2325 : {
2326 0 : int eas_cntr_1;
2327 0 : object->eas = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->eas, PyList_GET_SIZE(value));
2328 0 : if (!object->eas) { return -1; }
2329 0 : talloc_set_name_const(object->eas, "ARRAY: object->eas");
2330 0 : for (eas_cntr_1 = 0; eas_cntr_1 < PyList_GET_SIZE(value); eas_cntr_1++) {
2331 0 : if (PyList_GET_ITEM(value, eas_cntr_1) == NULL) {
2332 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->eas)[eas_cntr_1]");
2333 0 : return -1;
2334 : }
2335 0 : PY_CHECK_TYPE(&xattr_EA_Type, PyList_GET_ITEM(value, eas_cntr_1), return -1;);
2336 0 : if (talloc_reference(object->eas, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, eas_cntr_1))) == NULL) {
2337 0 : PyErr_NoMemory();
2338 0 : return -1;
2339 : }
2340 0 : (object->eas)[eas_cntr_1] = *(struct xattr_EA *)pytalloc_get_ptr(PyList_GET_ITEM(value, eas_cntr_1));
2341 : }
2342 : }
2343 : }
2344 0 : return 0;
2345 : }
2346 :
2347 : static PyGetSetDef py_xattr_DosEAs_getsetters[] = {
2348 : {
2349 : .name = discard_const_p(char, "num_eas"),
2350 : .get = py_xattr_DosEAs_get_num_eas,
2351 : .set = py_xattr_DosEAs_set_num_eas,
2352 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
2353 : },
2354 : {
2355 : .name = discard_const_p(char, "eas"),
2356 : .get = py_xattr_DosEAs_get_eas,
2357 : .set = py_xattr_DosEAs_set_eas,
2358 : .doc = discard_const_p(char, "PIDL-generated element of base type xattr_EA")
2359 : },
2360 : { .name = NULL }
2361 : };
2362 :
2363 0 : static PyObject *py_xattr_DosEAs_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2364 : {
2365 0 : return pytalloc_new(struct xattr_DosEAs, type);
2366 : }
2367 :
2368 0 : static PyObject *py_xattr_DosEAs_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2369 : {
2370 0 : struct xattr_DosEAs *object = pytalloc_get_ptr(py_obj);
2371 0 : PyObject *ret = NULL;
2372 0 : DATA_BLOB blob;
2373 0 : enum ndr_err_code err;
2374 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
2375 0 : if (tmp_ctx == NULL) {
2376 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
2377 0 : return NULL;
2378 : }
2379 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_xattr_DosEAs);
2380 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2381 0 : TALLOC_FREE(tmp_ctx);
2382 0 : PyErr_SetNdrError(err);
2383 0 : return NULL;
2384 : }
2385 :
2386 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
2387 0 : TALLOC_FREE(tmp_ctx);
2388 0 : return ret;
2389 : }
2390 :
2391 0 : static PyObject *py_xattr_DosEAs_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
2392 : {
2393 0 : struct xattr_DosEAs *object = pytalloc_get_ptr(py_obj);
2394 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
2395 0 : Py_ssize_t blob_length = 0;
2396 0 : enum ndr_err_code err;
2397 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
2398 0 : PyObject *allow_remaining_obj = NULL;
2399 0 : bool allow_remaining = false;
2400 :
2401 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
2402 : discard_const_p(char *, kwnames),
2403 : &blob.data, &blob_length,
2404 : &allow_remaining_obj)) {
2405 0 : return NULL;
2406 : }
2407 0 : blob.length = blob_length;
2408 :
2409 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
2410 0 : allow_remaining = true;
2411 : }
2412 :
2413 0 : if (allow_remaining) {
2414 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_xattr_DosEAs);
2415 : } else {
2416 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_xattr_DosEAs);
2417 : }
2418 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2419 0 : PyErr_SetNdrError(err);
2420 0 : return NULL;
2421 : }
2422 :
2423 0 : Py_RETURN_NONE;
2424 : }
2425 :
2426 0 : static PyObject *py_xattr_DosEAs_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2427 : {
2428 0 : struct xattr_DosEAs *object = pytalloc_get_ptr(py_obj);
2429 0 : PyObject *ret;
2430 0 : char *retstr;
2431 :
2432 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_xattr_DosEAs, "xattr_DosEAs", object);
2433 0 : ret = PyUnicode_FromString(retstr);
2434 0 : talloc_free(retstr);
2435 :
2436 0 : return ret;
2437 : }
2438 :
2439 : static PyMethodDef py_xattr_DosEAs_methods[] = {
2440 : { "__ndr_pack__", (PyCFunction)py_xattr_DosEAs_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
2441 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_xattr_DosEAs_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
2442 : { "__ndr_print__", (PyCFunction)py_xattr_DosEAs_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
2443 : { NULL, NULL, 0, NULL }
2444 : };
2445 :
2446 :
2447 : static PyTypeObject xattr_DosEAs_Type = {
2448 : PyVarObject_HEAD_INIT(NULL, 0)
2449 : .tp_name = "xattr.DosEAs",
2450 : .tp_getset = py_xattr_DosEAs_getsetters,
2451 : .tp_methods = py_xattr_DosEAs_methods,
2452 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
2453 : .tp_new = py_xattr_DosEAs_new,
2454 : };
2455 :
2456 :
2457 0 : static PyObject *py_tdb_xattrs_get_num_eas(PyObject *obj, void *closure)
2458 : {
2459 0 : struct tdb_xattrs *object = pytalloc_get_ptr(obj);
2460 0 : PyObject *py_num_eas;
2461 0 : py_num_eas = PyLong_FromUnsignedLongLong((uint32_t)(object->num_eas));
2462 0 : return py_num_eas;
2463 : }
2464 :
2465 0 : static int py_tdb_xattrs_set_num_eas(PyObject *py_obj, PyObject *value, void *closure)
2466 : {
2467 0 : struct tdb_xattrs *object = pytalloc_get_ptr(py_obj);
2468 0 : if (value == NULL) {
2469 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->num_eas");
2470 0 : return -1;
2471 : }
2472 : {
2473 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->num_eas));
2474 0 : if (PyLong_Check(value)) {
2475 0 : unsigned long long test_var;
2476 0 : test_var = PyLong_AsUnsignedLongLong(value);
2477 0 : if (PyErr_Occurred() != NULL) {
2478 0 : return -1;
2479 : }
2480 0 : if (test_var > uint_max) {
2481 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2482 : PyLong_Type.tp_name, uint_max, test_var);
2483 0 : return -1;
2484 : }
2485 0 : object->num_eas = test_var;
2486 : } else {
2487 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2488 : PyLong_Type.tp_name);
2489 0 : return -1;
2490 : }
2491 : }
2492 0 : return 0;
2493 : }
2494 :
2495 0 : static PyObject *py_tdb_xattrs_get_eas(PyObject *obj, void *closure)
2496 : {
2497 0 : struct tdb_xattrs *object = pytalloc_get_ptr(obj);
2498 0 : PyObject *py_eas;
2499 0 : py_eas = PyList_New(object->num_eas);
2500 0 : if (py_eas == NULL) {
2501 0 : return NULL;
2502 : }
2503 : {
2504 : int eas_cntr_0;
2505 0 : for (eas_cntr_0 = 0; eas_cntr_0 < (object->num_eas); eas_cntr_0++) {
2506 0 : PyObject *py_eas_0;
2507 0 : py_eas_0 = pytalloc_reference_ex(&xattr_EA_Type, object->eas, &(object->eas)[eas_cntr_0]);
2508 0 : PyList_SetItem(py_eas, eas_cntr_0, py_eas_0);
2509 : }
2510 : }
2511 0 : return py_eas;
2512 : }
2513 :
2514 0 : static int py_tdb_xattrs_set_eas(PyObject *py_obj, PyObject *value, void *closure)
2515 : {
2516 0 : struct tdb_xattrs *object = pytalloc_get_ptr(py_obj);
2517 0 : if (value == NULL) {
2518 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->eas");
2519 0 : return -1;
2520 : }
2521 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
2522 : {
2523 0 : int eas_cntr_0;
2524 0 : object->eas = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->eas, PyList_GET_SIZE(value));
2525 0 : if (!object->eas) { return -1; }
2526 0 : talloc_set_name_const(object->eas, "ARRAY: object->eas");
2527 0 : for (eas_cntr_0 = 0; eas_cntr_0 < PyList_GET_SIZE(value); eas_cntr_0++) {
2528 0 : if (PyList_GET_ITEM(value, eas_cntr_0) == NULL) {
2529 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->eas)[eas_cntr_0]");
2530 0 : return -1;
2531 : }
2532 0 : PY_CHECK_TYPE(&xattr_EA_Type, PyList_GET_ITEM(value, eas_cntr_0), return -1;);
2533 0 : if (talloc_reference(object->eas, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, eas_cntr_0))) == NULL) {
2534 0 : PyErr_NoMemory();
2535 0 : return -1;
2536 : }
2537 0 : (object->eas)[eas_cntr_0] = *(struct xattr_EA *)pytalloc_get_ptr(PyList_GET_ITEM(value, eas_cntr_0));
2538 : }
2539 : }
2540 0 : return 0;
2541 : }
2542 :
2543 : static PyGetSetDef py_tdb_xattrs_getsetters[] = {
2544 : {
2545 : .name = discard_const_p(char, "num_eas"),
2546 : .get = py_tdb_xattrs_get_num_eas,
2547 : .set = py_tdb_xattrs_set_num_eas,
2548 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
2549 : },
2550 : {
2551 : .name = discard_const_p(char, "eas"),
2552 : .get = py_tdb_xattrs_get_eas,
2553 : .set = py_tdb_xattrs_set_eas,
2554 : .doc = discard_const_p(char, "PIDL-generated element of base type xattr_EA")
2555 : },
2556 : { .name = NULL }
2557 : };
2558 :
2559 0 : static PyObject *py_tdb_xattrs_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2560 : {
2561 0 : return pytalloc_new(struct tdb_xattrs, type);
2562 : }
2563 :
2564 0 : static PyObject *py_tdb_xattrs_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2565 : {
2566 0 : struct tdb_xattrs *object = pytalloc_get_ptr(py_obj);
2567 0 : PyObject *ret = NULL;
2568 0 : DATA_BLOB blob;
2569 0 : enum ndr_err_code err;
2570 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
2571 0 : if (tmp_ctx == NULL) {
2572 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
2573 0 : return NULL;
2574 : }
2575 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_tdb_xattrs);
2576 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2577 0 : TALLOC_FREE(tmp_ctx);
2578 0 : PyErr_SetNdrError(err);
2579 0 : return NULL;
2580 : }
2581 :
2582 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
2583 0 : TALLOC_FREE(tmp_ctx);
2584 0 : return ret;
2585 : }
2586 :
2587 0 : static PyObject *py_tdb_xattrs_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
2588 : {
2589 0 : struct tdb_xattrs *object = pytalloc_get_ptr(py_obj);
2590 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
2591 0 : Py_ssize_t blob_length = 0;
2592 0 : enum ndr_err_code err;
2593 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
2594 0 : PyObject *allow_remaining_obj = NULL;
2595 0 : bool allow_remaining = false;
2596 :
2597 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
2598 : discard_const_p(char *, kwnames),
2599 : &blob.data, &blob_length,
2600 : &allow_remaining_obj)) {
2601 0 : return NULL;
2602 : }
2603 0 : blob.length = blob_length;
2604 :
2605 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
2606 0 : allow_remaining = true;
2607 : }
2608 :
2609 0 : if (allow_remaining) {
2610 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_tdb_xattrs);
2611 : } else {
2612 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_tdb_xattrs);
2613 : }
2614 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2615 0 : PyErr_SetNdrError(err);
2616 0 : return NULL;
2617 : }
2618 :
2619 0 : Py_RETURN_NONE;
2620 : }
2621 :
2622 0 : static PyObject *py_tdb_xattrs_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2623 : {
2624 0 : struct tdb_xattrs *object = pytalloc_get_ptr(py_obj);
2625 0 : PyObject *ret;
2626 0 : char *retstr;
2627 :
2628 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_tdb_xattrs, "tdb_xattrs", object);
2629 0 : ret = PyUnicode_FromString(retstr);
2630 0 : talloc_free(retstr);
2631 :
2632 0 : return ret;
2633 : }
2634 :
2635 : static PyMethodDef py_tdb_xattrs_methods[] = {
2636 : { "__ndr_pack__", (PyCFunction)py_tdb_xattrs_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
2637 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_tdb_xattrs_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
2638 : { "__ndr_print__", (PyCFunction)py_tdb_xattrs_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
2639 : { NULL, NULL, 0, NULL }
2640 : };
2641 :
2642 :
2643 : static PyTypeObject tdb_xattrs_Type = {
2644 : PyVarObject_HEAD_INIT(NULL, 0)
2645 : .tp_name = "xattr.tdb_xattrs",
2646 : .tp_getset = py_tdb_xattrs_getsetters,
2647 : .tp_methods = py_tdb_xattrs_methods,
2648 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
2649 : .tp_new = py_tdb_xattrs_new,
2650 : };
2651 :
2652 :
2653 0 : static PyObject *py_xattr_DosStream_get_flags(PyObject *obj, void *closure)
2654 : {
2655 0 : struct xattr_DosStream *object = pytalloc_get_ptr(obj);
2656 0 : PyObject *py_flags;
2657 0 : py_flags = PyLong_FromUnsignedLongLong((uint32_t)(object->flags));
2658 0 : return py_flags;
2659 : }
2660 :
2661 0 : static int py_xattr_DosStream_set_flags(PyObject *py_obj, PyObject *value, void *closure)
2662 : {
2663 0 : struct xattr_DosStream *object = pytalloc_get_ptr(py_obj);
2664 0 : if (value == NULL) {
2665 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->flags");
2666 0 : return -1;
2667 : }
2668 : {
2669 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->flags));
2670 0 : if (PyLong_Check(value)) {
2671 0 : unsigned long long test_var;
2672 0 : test_var = PyLong_AsUnsignedLongLong(value);
2673 0 : if (PyErr_Occurred() != NULL) {
2674 0 : return -1;
2675 : }
2676 0 : if (test_var > uint_max) {
2677 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2678 : PyLong_Type.tp_name, uint_max, test_var);
2679 0 : return -1;
2680 : }
2681 0 : object->flags = test_var;
2682 : } else {
2683 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2684 : PyLong_Type.tp_name);
2685 0 : return -1;
2686 : }
2687 : }
2688 0 : return 0;
2689 : }
2690 :
2691 0 : static PyObject *py_xattr_DosStream_get_size(PyObject *obj, void *closure)
2692 : {
2693 0 : struct xattr_DosStream *object = pytalloc_get_ptr(obj);
2694 0 : PyObject *py_size;
2695 0 : py_size = PyLong_FromUnsignedLongLong(object->size);
2696 0 : return py_size;
2697 : }
2698 :
2699 0 : static int py_xattr_DosStream_set_size(PyObject *py_obj, PyObject *value, void *closure)
2700 : {
2701 0 : struct xattr_DosStream *object = pytalloc_get_ptr(py_obj);
2702 0 : if (value == NULL) {
2703 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->size");
2704 0 : return -1;
2705 : }
2706 : {
2707 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->size));
2708 0 : if (PyLong_Check(value)) {
2709 0 : unsigned long long test_var;
2710 0 : test_var = PyLong_AsUnsignedLongLong(value);
2711 0 : if (PyErr_Occurred() != NULL) {
2712 0 : return -1;
2713 : }
2714 0 : if (test_var > uint_max) {
2715 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2716 : PyLong_Type.tp_name, uint_max, test_var);
2717 0 : return -1;
2718 : }
2719 0 : object->size = test_var;
2720 : } else {
2721 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2722 : PyLong_Type.tp_name);
2723 0 : return -1;
2724 : }
2725 : }
2726 0 : return 0;
2727 : }
2728 :
2729 0 : static PyObject *py_xattr_DosStream_get_alloc_size(PyObject *obj, void *closure)
2730 : {
2731 0 : struct xattr_DosStream *object = pytalloc_get_ptr(obj);
2732 0 : PyObject *py_alloc_size;
2733 0 : py_alloc_size = PyLong_FromUnsignedLongLong(object->alloc_size);
2734 0 : return py_alloc_size;
2735 : }
2736 :
2737 0 : static int py_xattr_DosStream_set_alloc_size(PyObject *py_obj, PyObject *value, void *closure)
2738 : {
2739 0 : struct xattr_DosStream *object = pytalloc_get_ptr(py_obj);
2740 0 : if (value == NULL) {
2741 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->alloc_size");
2742 0 : return -1;
2743 : }
2744 : {
2745 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->alloc_size));
2746 0 : if (PyLong_Check(value)) {
2747 0 : unsigned long long test_var;
2748 0 : test_var = PyLong_AsUnsignedLongLong(value);
2749 0 : if (PyErr_Occurred() != NULL) {
2750 0 : return -1;
2751 : }
2752 0 : if (test_var > uint_max) {
2753 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2754 : PyLong_Type.tp_name, uint_max, test_var);
2755 0 : return -1;
2756 : }
2757 0 : object->alloc_size = test_var;
2758 : } else {
2759 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2760 : PyLong_Type.tp_name);
2761 0 : return -1;
2762 : }
2763 : }
2764 0 : return 0;
2765 : }
2766 :
2767 0 : static PyObject *py_xattr_DosStream_get_name(PyObject *obj, void *closure)
2768 : {
2769 0 : struct xattr_DosStream *object = pytalloc_get_ptr(obj);
2770 0 : PyObject *py_name;
2771 0 : py_name = PyString_FromStringOrNULL(object->name);
2772 0 : return py_name;
2773 : }
2774 :
2775 0 : static int py_xattr_DosStream_set_name(PyObject *py_obj, PyObject *value, void *closure)
2776 : {
2777 0 : struct xattr_DosStream *object = pytalloc_get_ptr(py_obj);
2778 0 : if (value == NULL) {
2779 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->name");
2780 0 : return -1;
2781 : }
2782 : {
2783 0 : const char *test_str;
2784 0 : const char *talloc_str;
2785 0 : PyObject *unicode = NULL;
2786 0 : if (PyUnicode_Check(value)) {
2787 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
2788 0 : if (unicode == NULL) {
2789 0 : return -1;
2790 : }
2791 0 : test_str = PyBytes_AS_STRING(unicode);
2792 0 : } else if (PyBytes_Check(value)) {
2793 0 : test_str = PyBytes_AS_STRING(value);
2794 : } else {
2795 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
2796 0 : return -1;
2797 : }
2798 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
2799 0 : if (unicode != NULL) {
2800 0 : Py_DECREF(unicode);
2801 : }
2802 0 : if (talloc_str == NULL) {
2803 0 : PyErr_NoMemory();
2804 0 : return -1;
2805 : }
2806 0 : object->name = talloc_str;
2807 : }
2808 0 : return 0;
2809 : }
2810 :
2811 : static PyGetSetDef py_xattr_DosStream_getsetters[] = {
2812 : {
2813 : .name = discard_const_p(char, "flags"),
2814 : .get = py_xattr_DosStream_get_flags,
2815 : .set = py_xattr_DosStream_set_flags,
2816 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
2817 : },
2818 : {
2819 : .name = discard_const_p(char, "size"),
2820 : .get = py_xattr_DosStream_get_size,
2821 : .set = py_xattr_DosStream_set_size,
2822 : .doc = discard_const_p(char, "PIDL-generated element of base type udlong")
2823 : },
2824 : {
2825 : .name = discard_const_p(char, "alloc_size"),
2826 : .get = py_xattr_DosStream_get_alloc_size,
2827 : .set = py_xattr_DosStream_set_alloc_size,
2828 : .doc = discard_const_p(char, "PIDL-generated element of base type udlong")
2829 : },
2830 : {
2831 : .name = discard_const_p(char, "name"),
2832 : .get = py_xattr_DosStream_get_name,
2833 : .set = py_xattr_DosStream_set_name,
2834 : .doc = discard_const_p(char, "PIDL-generated element of base type string")
2835 : },
2836 : { .name = NULL }
2837 : };
2838 :
2839 0 : static PyObject *py_xattr_DosStream_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2840 : {
2841 0 : return pytalloc_new(struct xattr_DosStream, type);
2842 : }
2843 :
2844 :
2845 : static PyTypeObject xattr_DosStream_Type = {
2846 : PyVarObject_HEAD_INIT(NULL, 0)
2847 : .tp_name = "xattr.DosStream",
2848 : .tp_getset = py_xattr_DosStream_getsetters,
2849 : .tp_methods = NULL,
2850 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
2851 : .tp_new = py_xattr_DosStream_new,
2852 : };
2853 :
2854 :
2855 0 : static PyObject *py_xattr_DosStreams_get_num_streams(PyObject *obj, void *closure)
2856 : {
2857 0 : struct xattr_DosStreams *object = pytalloc_get_ptr(obj);
2858 0 : PyObject *py_num_streams;
2859 0 : py_num_streams = PyLong_FromUnsignedLongLong((uint32_t)(object->num_streams));
2860 0 : return py_num_streams;
2861 : }
2862 :
2863 0 : static int py_xattr_DosStreams_set_num_streams(PyObject *py_obj, PyObject *value, void *closure)
2864 : {
2865 0 : struct xattr_DosStreams *object = pytalloc_get_ptr(py_obj);
2866 0 : if (value == NULL) {
2867 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->num_streams");
2868 0 : return -1;
2869 : }
2870 : {
2871 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->num_streams));
2872 0 : if (PyLong_Check(value)) {
2873 0 : unsigned long long test_var;
2874 0 : test_var = PyLong_AsUnsignedLongLong(value);
2875 0 : if (PyErr_Occurred() != NULL) {
2876 0 : return -1;
2877 : }
2878 0 : if (test_var > uint_max) {
2879 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
2880 : PyLong_Type.tp_name, uint_max, test_var);
2881 0 : return -1;
2882 : }
2883 0 : object->num_streams = test_var;
2884 : } else {
2885 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
2886 : PyLong_Type.tp_name);
2887 0 : return -1;
2888 : }
2889 : }
2890 0 : return 0;
2891 : }
2892 :
2893 0 : static PyObject *py_xattr_DosStreams_get_streams(PyObject *obj, void *closure)
2894 : {
2895 0 : struct xattr_DosStreams *object = pytalloc_get_ptr(obj);
2896 0 : PyObject *py_streams;
2897 0 : if (object->streams == NULL) {
2898 0 : Py_RETURN_NONE;
2899 : }
2900 0 : if (object->streams == NULL) {
2901 0 : py_streams = Py_None;
2902 0 : Py_INCREF(py_streams);
2903 : } else {
2904 0 : py_streams = PyList_New(object->num_streams);
2905 0 : if (py_streams == NULL) {
2906 0 : return NULL;
2907 : }
2908 : {
2909 : int streams_cntr_1;
2910 0 : for (streams_cntr_1 = 0; streams_cntr_1 < (object->num_streams); streams_cntr_1++) {
2911 0 : PyObject *py_streams_1;
2912 0 : py_streams_1 = pytalloc_reference_ex(&xattr_DosStream_Type, object->streams, &(object->streams)[streams_cntr_1]);
2913 0 : PyList_SetItem(py_streams, streams_cntr_1, py_streams_1);
2914 : }
2915 : }
2916 : }
2917 0 : return py_streams;
2918 : }
2919 :
2920 0 : static int py_xattr_DosStreams_set_streams(PyObject *py_obj, PyObject *value, void *closure)
2921 : {
2922 0 : struct xattr_DosStreams *object = pytalloc_get_ptr(py_obj);
2923 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->streams));
2924 0 : if (value == NULL) {
2925 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->streams");
2926 0 : return -1;
2927 : }
2928 0 : if (value == Py_None) {
2929 0 : object->streams = NULL;
2930 : } else {
2931 0 : object->streams = NULL;
2932 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
2933 : {
2934 0 : int streams_cntr_1;
2935 0 : object->streams = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->streams, PyList_GET_SIZE(value));
2936 0 : if (!object->streams) { return -1; }
2937 0 : talloc_set_name_const(object->streams, "ARRAY: object->streams");
2938 0 : for (streams_cntr_1 = 0; streams_cntr_1 < PyList_GET_SIZE(value); streams_cntr_1++) {
2939 0 : if (PyList_GET_ITEM(value, streams_cntr_1) == NULL) {
2940 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->streams)[streams_cntr_1]");
2941 0 : return -1;
2942 : }
2943 0 : PY_CHECK_TYPE(&xattr_DosStream_Type, PyList_GET_ITEM(value, streams_cntr_1), return -1;);
2944 0 : if (talloc_reference(object->streams, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, streams_cntr_1))) == NULL) {
2945 0 : PyErr_NoMemory();
2946 0 : return -1;
2947 : }
2948 0 : (object->streams)[streams_cntr_1] = *(struct xattr_DosStream *)pytalloc_get_ptr(PyList_GET_ITEM(value, streams_cntr_1));
2949 : }
2950 : }
2951 : }
2952 0 : return 0;
2953 : }
2954 :
2955 : static PyGetSetDef py_xattr_DosStreams_getsetters[] = {
2956 : {
2957 : .name = discard_const_p(char, "num_streams"),
2958 : .get = py_xattr_DosStreams_get_num_streams,
2959 : .set = py_xattr_DosStreams_set_num_streams,
2960 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
2961 : },
2962 : {
2963 : .name = discard_const_p(char, "streams"),
2964 : .get = py_xattr_DosStreams_get_streams,
2965 : .set = py_xattr_DosStreams_set_streams,
2966 : .doc = discard_const_p(char, "PIDL-generated element of base type xattr_DosStream")
2967 : },
2968 : { .name = NULL }
2969 : };
2970 :
2971 0 : static PyObject *py_xattr_DosStreams_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
2972 : {
2973 0 : return pytalloc_new(struct xattr_DosStreams, type);
2974 : }
2975 :
2976 0 : static PyObject *py_xattr_DosStreams_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
2977 : {
2978 0 : struct xattr_DosStreams *object = pytalloc_get_ptr(py_obj);
2979 0 : PyObject *ret = NULL;
2980 0 : DATA_BLOB blob;
2981 0 : enum ndr_err_code err;
2982 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
2983 0 : if (tmp_ctx == NULL) {
2984 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
2985 0 : return NULL;
2986 : }
2987 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_xattr_DosStreams);
2988 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
2989 0 : TALLOC_FREE(tmp_ctx);
2990 0 : PyErr_SetNdrError(err);
2991 0 : return NULL;
2992 : }
2993 :
2994 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
2995 0 : TALLOC_FREE(tmp_ctx);
2996 0 : return ret;
2997 : }
2998 :
2999 0 : static PyObject *py_xattr_DosStreams_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
3000 : {
3001 0 : struct xattr_DosStreams *object = pytalloc_get_ptr(py_obj);
3002 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
3003 0 : Py_ssize_t blob_length = 0;
3004 0 : enum ndr_err_code err;
3005 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
3006 0 : PyObject *allow_remaining_obj = NULL;
3007 0 : bool allow_remaining = false;
3008 :
3009 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
3010 : discard_const_p(char *, kwnames),
3011 : &blob.data, &blob_length,
3012 : &allow_remaining_obj)) {
3013 0 : return NULL;
3014 : }
3015 0 : blob.length = blob_length;
3016 :
3017 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
3018 0 : allow_remaining = true;
3019 : }
3020 :
3021 0 : if (allow_remaining) {
3022 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_xattr_DosStreams);
3023 : } else {
3024 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_xattr_DosStreams);
3025 : }
3026 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
3027 0 : PyErr_SetNdrError(err);
3028 0 : return NULL;
3029 : }
3030 :
3031 0 : Py_RETURN_NONE;
3032 : }
3033 :
3034 0 : static PyObject *py_xattr_DosStreams_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
3035 : {
3036 0 : struct xattr_DosStreams *object = pytalloc_get_ptr(py_obj);
3037 0 : PyObject *ret;
3038 0 : char *retstr;
3039 :
3040 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_xattr_DosStreams, "xattr_DosStreams", object);
3041 0 : ret = PyUnicode_FromString(retstr);
3042 0 : talloc_free(retstr);
3043 :
3044 0 : return ret;
3045 : }
3046 :
3047 : static PyMethodDef py_xattr_DosStreams_methods[] = {
3048 : { "__ndr_pack__", (PyCFunction)py_xattr_DosStreams_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
3049 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_xattr_DosStreams_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
3050 : { "__ndr_print__", (PyCFunction)py_xattr_DosStreams_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
3051 : { NULL, NULL, 0, NULL }
3052 : };
3053 :
3054 :
3055 : static PyTypeObject xattr_DosStreams_Type = {
3056 : PyVarObject_HEAD_INIT(NULL, 0)
3057 : .tp_name = "xattr.DosStreams",
3058 : .tp_getset = py_xattr_DosStreams_getsetters,
3059 : .tp_methods = py_xattr_DosStreams_methods,
3060 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
3061 : .tp_new = py_xattr_DosStreams_new,
3062 : };
3063 :
3064 :
3065 0 : static PyObject *py_security_descriptor_hash_v2_get_sd(PyObject *obj, void *closure)
3066 : {
3067 0 : struct security_descriptor_hash_v2 *object = pytalloc_get_ptr(obj);
3068 0 : PyObject *py_sd;
3069 0 : if (object->sd == NULL) {
3070 0 : Py_RETURN_NONE;
3071 : }
3072 0 : if (object->sd == NULL) {
3073 0 : py_sd = Py_None;
3074 0 : Py_INCREF(py_sd);
3075 : } else {
3076 0 : py_sd = pytalloc_reference_ex(security_descriptor_Type, object->sd, object->sd);
3077 : }
3078 0 : return py_sd;
3079 : }
3080 :
3081 0 : static int py_security_descriptor_hash_v2_set_sd(PyObject *py_obj, PyObject *value, void *closure)
3082 : {
3083 0 : struct security_descriptor_hash_v2 *object = pytalloc_get_ptr(py_obj);
3084 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->sd));
3085 0 : if (value == NULL) {
3086 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->sd");
3087 0 : return -1;
3088 : }
3089 0 : if (value == Py_None) {
3090 0 : object->sd = NULL;
3091 : } else {
3092 0 : object->sd = NULL;
3093 0 : PY_CHECK_TYPE(security_descriptor_Type, value, return -1;);
3094 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
3095 0 : PyErr_NoMemory();
3096 0 : return -1;
3097 : }
3098 0 : object->sd = (struct security_descriptor *)pytalloc_get_ptr(value);
3099 : }
3100 0 : return 0;
3101 : }
3102 :
3103 0 : static PyObject *py_security_descriptor_hash_v2_get_hash(PyObject *obj, void *closure)
3104 : {
3105 0 : struct security_descriptor_hash_v2 *object = pytalloc_get_ptr(obj);
3106 0 : PyObject *py_hash;
3107 0 : py_hash = PyList_New(16);
3108 0 : if (py_hash == NULL) {
3109 0 : return NULL;
3110 : }
3111 : {
3112 : int hash_cntr_0;
3113 0 : for (hash_cntr_0 = 0; hash_cntr_0 < (16); hash_cntr_0++) {
3114 0 : PyObject *py_hash_0;
3115 0 : py_hash_0 = PyLong_FromLong((uint16_t)((object->hash)[hash_cntr_0]));
3116 0 : PyList_SetItem(py_hash, hash_cntr_0, py_hash_0);
3117 : }
3118 : }
3119 0 : return py_hash;
3120 : }
3121 :
3122 0 : static int py_security_descriptor_hash_v2_set_hash(PyObject *py_obj, PyObject *value, void *closure)
3123 : {
3124 0 : struct security_descriptor_hash_v2 *object = pytalloc_get_ptr(py_obj);
3125 0 : if (value == NULL) {
3126 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->hash");
3127 0 : return -1;
3128 : }
3129 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
3130 : {
3131 0 : int hash_cntr_0;
3132 0 : if (ARRAY_SIZE(object->hash) != PyList_GET_SIZE(value)) {
3133 0 : PyErr_Format(PyExc_TypeError, "Expected list of type %s, length %zu, got %zd", Py_TYPE(value)->tp_name, ARRAY_SIZE(object->hash), PyList_GET_SIZE(value));
3134 0 : return -1;
3135 : }
3136 0 : for (hash_cntr_0 = 0; hash_cntr_0 < PyList_GET_SIZE(value); hash_cntr_0++) {
3137 0 : if (PyList_GET_ITEM(value, hash_cntr_0) == NULL) {
3138 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->hash)[hash_cntr_0]");
3139 0 : return -1;
3140 : }
3141 : {
3142 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((object->hash)[hash_cntr_0]));
3143 0 : if (PyLong_Check(PyList_GET_ITEM(value, hash_cntr_0))) {
3144 0 : unsigned long long test_var;
3145 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, hash_cntr_0));
3146 0 : if (PyErr_Occurred() != NULL) {
3147 0 : return -1;
3148 : }
3149 0 : if (test_var > uint_max) {
3150 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3151 : PyLong_Type.tp_name, uint_max, test_var);
3152 0 : return -1;
3153 : }
3154 0 : (object->hash)[hash_cntr_0] = test_var;
3155 : } else {
3156 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3157 : PyLong_Type.tp_name);
3158 0 : return -1;
3159 : }
3160 : }
3161 : }
3162 : }
3163 0 : return 0;
3164 : }
3165 :
3166 : static PyGetSetDef py_security_descriptor_hash_v2_getsetters[] = {
3167 : {
3168 : .name = discard_const_p(char, "sd"),
3169 : .get = py_security_descriptor_hash_v2_get_sd,
3170 : .set = py_security_descriptor_hash_v2_set_sd,
3171 : .doc = discard_const_p(char, "PIDL-generated element of base type security_descriptor")
3172 : },
3173 : {
3174 : .name = discard_const_p(char, "hash"),
3175 : .get = py_security_descriptor_hash_v2_get_hash,
3176 : .set = py_security_descriptor_hash_v2_set_hash,
3177 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
3178 : },
3179 : { .name = NULL }
3180 : };
3181 :
3182 0 : static PyObject *py_security_descriptor_hash_v2_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
3183 : {
3184 0 : return pytalloc_new(struct security_descriptor_hash_v2, type);
3185 : }
3186 :
3187 0 : static PyObject *py_security_descriptor_hash_v2_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
3188 : {
3189 0 : struct security_descriptor_hash_v2 *object = pytalloc_get_ptr(py_obj);
3190 0 : PyObject *ret = NULL;
3191 0 : DATA_BLOB blob;
3192 0 : enum ndr_err_code err;
3193 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
3194 0 : if (tmp_ctx == NULL) {
3195 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
3196 0 : return NULL;
3197 : }
3198 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_security_descriptor_hash_v2);
3199 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
3200 0 : TALLOC_FREE(tmp_ctx);
3201 0 : PyErr_SetNdrError(err);
3202 0 : return NULL;
3203 : }
3204 :
3205 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
3206 0 : TALLOC_FREE(tmp_ctx);
3207 0 : return ret;
3208 : }
3209 :
3210 0 : static PyObject *py_security_descriptor_hash_v2_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
3211 : {
3212 0 : struct security_descriptor_hash_v2 *object = pytalloc_get_ptr(py_obj);
3213 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
3214 0 : Py_ssize_t blob_length = 0;
3215 0 : enum ndr_err_code err;
3216 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
3217 0 : PyObject *allow_remaining_obj = NULL;
3218 0 : bool allow_remaining = false;
3219 :
3220 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
3221 : discard_const_p(char *, kwnames),
3222 : &blob.data, &blob_length,
3223 : &allow_remaining_obj)) {
3224 0 : return NULL;
3225 : }
3226 0 : blob.length = blob_length;
3227 :
3228 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
3229 0 : allow_remaining = true;
3230 : }
3231 :
3232 0 : if (allow_remaining) {
3233 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_security_descriptor_hash_v2);
3234 : } else {
3235 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_security_descriptor_hash_v2);
3236 : }
3237 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
3238 0 : PyErr_SetNdrError(err);
3239 0 : return NULL;
3240 : }
3241 :
3242 0 : Py_RETURN_NONE;
3243 : }
3244 :
3245 0 : static PyObject *py_security_descriptor_hash_v2_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
3246 : {
3247 0 : struct security_descriptor_hash_v2 *object = pytalloc_get_ptr(py_obj);
3248 0 : PyObject *ret;
3249 0 : char *retstr;
3250 :
3251 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_security_descriptor_hash_v2, "security_descriptor_hash_v2", object);
3252 0 : ret = PyUnicode_FromString(retstr);
3253 0 : talloc_free(retstr);
3254 :
3255 0 : return ret;
3256 : }
3257 :
3258 : static PyMethodDef py_security_descriptor_hash_v2_methods[] = {
3259 : { "__ndr_pack__", (PyCFunction)py_security_descriptor_hash_v2_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
3260 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_security_descriptor_hash_v2_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
3261 : { "__ndr_print__", (PyCFunction)py_security_descriptor_hash_v2_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
3262 : { NULL, NULL, 0, NULL }
3263 : };
3264 :
3265 :
3266 : static PyTypeObject security_descriptor_hash_v2_Type = {
3267 : PyVarObject_HEAD_INIT(NULL, 0)
3268 : .tp_name = "xattr.security_descriptor_hash_v2",
3269 : .tp_getset = py_security_descriptor_hash_v2_getsetters,
3270 : .tp_methods = py_security_descriptor_hash_v2_methods,
3271 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
3272 : .tp_new = py_security_descriptor_hash_v2_new,
3273 : };
3274 :
3275 :
3276 0 : static PyObject *py_security_descriptor_hash_v3_get_sd(PyObject *obj, void *closure)
3277 : {
3278 0 : struct security_descriptor_hash_v3 *object = pytalloc_get_ptr(obj);
3279 0 : PyObject *py_sd;
3280 0 : if (object->sd == NULL) {
3281 0 : Py_RETURN_NONE;
3282 : }
3283 0 : if (object->sd == NULL) {
3284 0 : py_sd = Py_None;
3285 0 : Py_INCREF(py_sd);
3286 : } else {
3287 0 : py_sd = pytalloc_reference_ex(security_descriptor_Type, object->sd, object->sd);
3288 : }
3289 0 : return py_sd;
3290 : }
3291 :
3292 0 : static int py_security_descriptor_hash_v3_set_sd(PyObject *py_obj, PyObject *value, void *closure)
3293 : {
3294 0 : struct security_descriptor_hash_v3 *object = pytalloc_get_ptr(py_obj);
3295 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->sd));
3296 0 : if (value == NULL) {
3297 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->sd");
3298 0 : return -1;
3299 : }
3300 0 : if (value == Py_None) {
3301 0 : object->sd = NULL;
3302 : } else {
3303 0 : object->sd = NULL;
3304 0 : PY_CHECK_TYPE(security_descriptor_Type, value, return -1;);
3305 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
3306 0 : PyErr_NoMemory();
3307 0 : return -1;
3308 : }
3309 0 : object->sd = (struct security_descriptor *)pytalloc_get_ptr(value);
3310 : }
3311 0 : return 0;
3312 : }
3313 :
3314 0 : static PyObject *py_security_descriptor_hash_v3_get_hash_type(PyObject *obj, void *closure)
3315 : {
3316 0 : struct security_descriptor_hash_v3 *object = pytalloc_get_ptr(obj);
3317 0 : PyObject *py_hash_type;
3318 0 : py_hash_type = PyLong_FromLong((uint16_t)(object->hash_type));
3319 0 : return py_hash_type;
3320 : }
3321 :
3322 0 : static int py_security_descriptor_hash_v3_set_hash_type(PyObject *py_obj, PyObject *value, void *closure)
3323 : {
3324 0 : struct security_descriptor_hash_v3 *object = pytalloc_get_ptr(py_obj);
3325 0 : if (value == NULL) {
3326 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->hash_type");
3327 0 : return -1;
3328 : }
3329 : {
3330 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->hash_type));
3331 0 : if (PyLong_Check(value)) {
3332 0 : unsigned long long test_var;
3333 0 : test_var = PyLong_AsUnsignedLongLong(value);
3334 0 : if (PyErr_Occurred() != NULL) {
3335 0 : return -1;
3336 : }
3337 0 : if (test_var > uint_max) {
3338 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3339 : PyLong_Type.tp_name, uint_max, test_var);
3340 0 : return -1;
3341 : }
3342 0 : object->hash_type = test_var;
3343 : } else {
3344 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3345 : PyLong_Type.tp_name);
3346 0 : return -1;
3347 : }
3348 : }
3349 0 : return 0;
3350 : }
3351 :
3352 0 : static PyObject *py_security_descriptor_hash_v3_get_hash(PyObject *obj, void *closure)
3353 : {
3354 0 : struct security_descriptor_hash_v3 *object = pytalloc_get_ptr(obj);
3355 0 : PyObject *py_hash;
3356 0 : py_hash = PyList_New(64);
3357 0 : if (py_hash == NULL) {
3358 0 : return NULL;
3359 : }
3360 : {
3361 : int hash_cntr_0;
3362 0 : for (hash_cntr_0 = 0; hash_cntr_0 < (64); hash_cntr_0++) {
3363 0 : PyObject *py_hash_0;
3364 0 : py_hash_0 = PyLong_FromLong((uint16_t)((object->hash)[hash_cntr_0]));
3365 0 : PyList_SetItem(py_hash, hash_cntr_0, py_hash_0);
3366 : }
3367 : }
3368 0 : return py_hash;
3369 : }
3370 :
3371 0 : static int py_security_descriptor_hash_v3_set_hash(PyObject *py_obj, PyObject *value, void *closure)
3372 : {
3373 0 : struct security_descriptor_hash_v3 *object = pytalloc_get_ptr(py_obj);
3374 0 : if (value == NULL) {
3375 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->hash");
3376 0 : return -1;
3377 : }
3378 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
3379 : {
3380 0 : int hash_cntr_0;
3381 0 : if (ARRAY_SIZE(object->hash) != PyList_GET_SIZE(value)) {
3382 0 : PyErr_Format(PyExc_TypeError, "Expected list of type %s, length %zu, got %zd", Py_TYPE(value)->tp_name, ARRAY_SIZE(object->hash), PyList_GET_SIZE(value));
3383 0 : return -1;
3384 : }
3385 0 : for (hash_cntr_0 = 0; hash_cntr_0 < PyList_GET_SIZE(value); hash_cntr_0++) {
3386 0 : if (PyList_GET_ITEM(value, hash_cntr_0) == NULL) {
3387 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->hash)[hash_cntr_0]");
3388 0 : return -1;
3389 : }
3390 : {
3391 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((object->hash)[hash_cntr_0]));
3392 0 : if (PyLong_Check(PyList_GET_ITEM(value, hash_cntr_0))) {
3393 0 : unsigned long long test_var;
3394 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, hash_cntr_0));
3395 0 : if (PyErr_Occurred() != NULL) {
3396 0 : return -1;
3397 : }
3398 0 : if (test_var > uint_max) {
3399 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3400 : PyLong_Type.tp_name, uint_max, test_var);
3401 0 : return -1;
3402 : }
3403 0 : (object->hash)[hash_cntr_0] = test_var;
3404 : } else {
3405 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3406 : PyLong_Type.tp_name);
3407 0 : return -1;
3408 : }
3409 : }
3410 : }
3411 : }
3412 0 : return 0;
3413 : }
3414 :
3415 : static PyGetSetDef py_security_descriptor_hash_v3_getsetters[] = {
3416 : {
3417 : .name = discard_const_p(char, "sd"),
3418 : .get = py_security_descriptor_hash_v3_get_sd,
3419 : .set = py_security_descriptor_hash_v3_set_sd,
3420 : .doc = discard_const_p(char, "PIDL-generated element of base type security_descriptor")
3421 : },
3422 : {
3423 : .name = discard_const_p(char, "hash_type"),
3424 : .get = py_security_descriptor_hash_v3_get_hash_type,
3425 : .set = py_security_descriptor_hash_v3_set_hash_type,
3426 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
3427 : },
3428 : {
3429 : .name = discard_const_p(char, "hash"),
3430 : .get = py_security_descriptor_hash_v3_get_hash,
3431 : .set = py_security_descriptor_hash_v3_set_hash,
3432 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
3433 : },
3434 : { .name = NULL }
3435 : };
3436 :
3437 0 : static PyObject *py_security_descriptor_hash_v3_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
3438 : {
3439 0 : return pytalloc_new(struct security_descriptor_hash_v3, type);
3440 : }
3441 :
3442 0 : static PyObject *py_security_descriptor_hash_v3_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
3443 : {
3444 0 : struct security_descriptor_hash_v3 *object = pytalloc_get_ptr(py_obj);
3445 0 : PyObject *ret = NULL;
3446 0 : DATA_BLOB blob;
3447 0 : enum ndr_err_code err;
3448 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
3449 0 : if (tmp_ctx == NULL) {
3450 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
3451 0 : return NULL;
3452 : }
3453 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_security_descriptor_hash_v3);
3454 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
3455 0 : TALLOC_FREE(tmp_ctx);
3456 0 : PyErr_SetNdrError(err);
3457 0 : return NULL;
3458 : }
3459 :
3460 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
3461 0 : TALLOC_FREE(tmp_ctx);
3462 0 : return ret;
3463 : }
3464 :
3465 0 : static PyObject *py_security_descriptor_hash_v3_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
3466 : {
3467 0 : struct security_descriptor_hash_v3 *object = pytalloc_get_ptr(py_obj);
3468 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
3469 0 : Py_ssize_t blob_length = 0;
3470 0 : enum ndr_err_code err;
3471 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
3472 0 : PyObject *allow_remaining_obj = NULL;
3473 0 : bool allow_remaining = false;
3474 :
3475 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
3476 : discard_const_p(char *, kwnames),
3477 : &blob.data, &blob_length,
3478 : &allow_remaining_obj)) {
3479 0 : return NULL;
3480 : }
3481 0 : blob.length = blob_length;
3482 :
3483 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
3484 0 : allow_remaining = true;
3485 : }
3486 :
3487 0 : if (allow_remaining) {
3488 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_security_descriptor_hash_v3);
3489 : } else {
3490 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_security_descriptor_hash_v3);
3491 : }
3492 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
3493 0 : PyErr_SetNdrError(err);
3494 0 : return NULL;
3495 : }
3496 :
3497 0 : Py_RETURN_NONE;
3498 : }
3499 :
3500 0 : static PyObject *py_security_descriptor_hash_v3_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
3501 : {
3502 0 : struct security_descriptor_hash_v3 *object = pytalloc_get_ptr(py_obj);
3503 0 : PyObject *ret;
3504 0 : char *retstr;
3505 :
3506 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_security_descriptor_hash_v3, "security_descriptor_hash_v3", object);
3507 0 : ret = PyUnicode_FromString(retstr);
3508 0 : talloc_free(retstr);
3509 :
3510 0 : return ret;
3511 : }
3512 :
3513 : static PyMethodDef py_security_descriptor_hash_v3_methods[] = {
3514 : { "__ndr_pack__", (PyCFunction)py_security_descriptor_hash_v3_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
3515 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_security_descriptor_hash_v3_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
3516 : { "__ndr_print__", (PyCFunction)py_security_descriptor_hash_v3_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
3517 : { NULL, NULL, 0, NULL }
3518 : };
3519 :
3520 :
3521 : static PyTypeObject security_descriptor_hash_v3_Type = {
3522 : PyVarObject_HEAD_INIT(NULL, 0)
3523 : .tp_name = "xattr.security_descriptor_hash_v3",
3524 : .tp_getset = py_security_descriptor_hash_v3_getsetters,
3525 : .tp_methods = py_security_descriptor_hash_v3_methods,
3526 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
3527 : .tp_new = py_security_descriptor_hash_v3_new,
3528 : };
3529 :
3530 :
3531 109 : static PyObject *py_security_descriptor_hash_v4_get_sd(PyObject *obj, void *closure)
3532 : {
3533 109 : struct security_descriptor_hash_v4 *object = pytalloc_get_ptr(obj);
3534 0 : PyObject *py_sd;
3535 109 : if (object->sd == NULL) {
3536 0 : Py_RETURN_NONE;
3537 : }
3538 109 : if (object->sd == NULL) {
3539 0 : py_sd = Py_None;
3540 0 : Py_INCREF(py_sd);
3541 : } else {
3542 109 : py_sd = pytalloc_reference_ex(security_descriptor_Type, object->sd, object->sd);
3543 : }
3544 109 : return py_sd;
3545 : }
3546 :
3547 0 : static int py_security_descriptor_hash_v4_set_sd(PyObject *py_obj, PyObject *value, void *closure)
3548 : {
3549 0 : struct security_descriptor_hash_v4 *object = pytalloc_get_ptr(py_obj);
3550 0 : talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->sd));
3551 0 : if (value == NULL) {
3552 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->sd");
3553 0 : return -1;
3554 : }
3555 0 : if (value == Py_None) {
3556 0 : object->sd = NULL;
3557 : } else {
3558 0 : object->sd = NULL;
3559 0 : PY_CHECK_TYPE(security_descriptor_Type, value, return -1;);
3560 0 : if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
3561 0 : PyErr_NoMemory();
3562 0 : return -1;
3563 : }
3564 0 : object->sd = (struct security_descriptor *)pytalloc_get_ptr(value);
3565 : }
3566 0 : return 0;
3567 : }
3568 :
3569 0 : static PyObject *py_security_descriptor_hash_v4_get_hash_type(PyObject *obj, void *closure)
3570 : {
3571 0 : struct security_descriptor_hash_v4 *object = pytalloc_get_ptr(obj);
3572 0 : PyObject *py_hash_type;
3573 0 : py_hash_type = PyLong_FromLong((uint16_t)(object->hash_type));
3574 0 : return py_hash_type;
3575 : }
3576 :
3577 0 : static int py_security_descriptor_hash_v4_set_hash_type(PyObject *py_obj, PyObject *value, void *closure)
3578 : {
3579 0 : struct security_descriptor_hash_v4 *object = pytalloc_get_ptr(py_obj);
3580 0 : if (value == NULL) {
3581 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->hash_type");
3582 0 : return -1;
3583 : }
3584 : {
3585 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->hash_type));
3586 0 : if (PyLong_Check(value)) {
3587 0 : unsigned long long test_var;
3588 0 : test_var = PyLong_AsUnsignedLongLong(value);
3589 0 : if (PyErr_Occurred() != NULL) {
3590 0 : return -1;
3591 : }
3592 0 : if (test_var > uint_max) {
3593 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3594 : PyLong_Type.tp_name, uint_max, test_var);
3595 0 : return -1;
3596 : }
3597 0 : object->hash_type = test_var;
3598 : } else {
3599 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3600 : PyLong_Type.tp_name);
3601 0 : return -1;
3602 : }
3603 : }
3604 0 : return 0;
3605 : }
3606 :
3607 0 : static PyObject *py_security_descriptor_hash_v4_get_hash(PyObject *obj, void *closure)
3608 : {
3609 0 : struct security_descriptor_hash_v4 *object = pytalloc_get_ptr(obj);
3610 0 : PyObject *py_hash;
3611 0 : py_hash = PyList_New(64);
3612 0 : if (py_hash == NULL) {
3613 0 : return NULL;
3614 : }
3615 : {
3616 : int hash_cntr_0;
3617 0 : for (hash_cntr_0 = 0; hash_cntr_0 < (64); hash_cntr_0++) {
3618 0 : PyObject *py_hash_0;
3619 0 : py_hash_0 = PyLong_FromLong((uint16_t)((object->hash)[hash_cntr_0]));
3620 0 : PyList_SetItem(py_hash, hash_cntr_0, py_hash_0);
3621 : }
3622 : }
3623 0 : return py_hash;
3624 : }
3625 :
3626 0 : static int py_security_descriptor_hash_v4_set_hash(PyObject *py_obj, PyObject *value, void *closure)
3627 : {
3628 0 : struct security_descriptor_hash_v4 *object = pytalloc_get_ptr(py_obj);
3629 0 : if (value == NULL) {
3630 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->hash");
3631 0 : return -1;
3632 : }
3633 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
3634 : {
3635 0 : int hash_cntr_0;
3636 0 : if (ARRAY_SIZE(object->hash) != PyList_GET_SIZE(value)) {
3637 0 : PyErr_Format(PyExc_TypeError, "Expected list of type %s, length %zu, got %zd", Py_TYPE(value)->tp_name, ARRAY_SIZE(object->hash), PyList_GET_SIZE(value));
3638 0 : return -1;
3639 : }
3640 0 : for (hash_cntr_0 = 0; hash_cntr_0 < PyList_GET_SIZE(value); hash_cntr_0++) {
3641 0 : if (PyList_GET_ITEM(value, hash_cntr_0) == NULL) {
3642 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->hash)[hash_cntr_0]");
3643 0 : return -1;
3644 : }
3645 : {
3646 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((object->hash)[hash_cntr_0]));
3647 0 : if (PyLong_Check(PyList_GET_ITEM(value, hash_cntr_0))) {
3648 0 : unsigned long long test_var;
3649 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, hash_cntr_0));
3650 0 : if (PyErr_Occurred() != NULL) {
3651 0 : return -1;
3652 : }
3653 0 : if (test_var > uint_max) {
3654 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3655 : PyLong_Type.tp_name, uint_max, test_var);
3656 0 : return -1;
3657 : }
3658 0 : (object->hash)[hash_cntr_0] = test_var;
3659 : } else {
3660 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3661 : PyLong_Type.tp_name);
3662 0 : return -1;
3663 : }
3664 : }
3665 : }
3666 : }
3667 0 : return 0;
3668 : }
3669 :
3670 0 : static PyObject *py_security_descriptor_hash_v4_get_description(PyObject *obj, void *closure)
3671 : {
3672 0 : struct security_descriptor_hash_v4 *object = pytalloc_get_ptr(obj);
3673 0 : PyObject *py_description;
3674 0 : py_description = PyString_FromStringOrNULL(object->description);
3675 0 : return py_description;
3676 : }
3677 :
3678 0 : static int py_security_descriptor_hash_v4_set_description(PyObject *py_obj, PyObject *value, void *closure)
3679 : {
3680 0 : struct security_descriptor_hash_v4 *object = pytalloc_get_ptr(py_obj);
3681 0 : if (value == NULL) {
3682 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->description");
3683 0 : return -1;
3684 : }
3685 : {
3686 0 : const char *test_str;
3687 0 : const char *talloc_str;
3688 0 : PyObject *unicode = NULL;
3689 0 : if (PyUnicode_Check(value)) {
3690 0 : unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore");
3691 0 : if (unicode == NULL) {
3692 0 : return -1;
3693 : }
3694 0 : test_str = PyBytes_AS_STRING(unicode);
3695 0 : } else if (PyBytes_Check(value)) {
3696 0 : test_str = PyBytes_AS_STRING(value);
3697 : } else {
3698 0 : PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name);
3699 0 : return -1;
3700 : }
3701 0 : talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str);
3702 0 : if (unicode != NULL) {
3703 0 : Py_DECREF(unicode);
3704 : }
3705 0 : if (talloc_str == NULL) {
3706 0 : PyErr_NoMemory();
3707 0 : return -1;
3708 : }
3709 0 : object->description = talloc_str;
3710 : }
3711 0 : return 0;
3712 : }
3713 :
3714 0 : static PyObject *py_security_descriptor_hash_v4_get_time(PyObject *obj, void *closure)
3715 : {
3716 0 : struct security_descriptor_hash_v4 *object = pytalloc_get_ptr(obj);
3717 0 : PyObject *py_time;
3718 0 : py_time = PyLong_FromUnsignedLongLong(object->time);
3719 0 : return py_time;
3720 : }
3721 :
3722 0 : static int py_security_descriptor_hash_v4_set_time(PyObject *py_obj, PyObject *value, void *closure)
3723 : {
3724 0 : struct security_descriptor_hash_v4 *object = pytalloc_get_ptr(py_obj);
3725 0 : if (value == NULL) {
3726 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->time");
3727 0 : return -1;
3728 : }
3729 : {
3730 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->time));
3731 0 : if (PyLong_Check(value)) {
3732 0 : unsigned long long test_var;
3733 0 : test_var = PyLong_AsUnsignedLongLong(value);
3734 0 : if (PyErr_Occurred() != NULL) {
3735 0 : return -1;
3736 : }
3737 0 : if (test_var > uint_max) {
3738 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3739 : PyLong_Type.tp_name, uint_max, test_var);
3740 0 : return -1;
3741 : }
3742 0 : object->time = test_var;
3743 : } else {
3744 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3745 : PyLong_Type.tp_name);
3746 0 : return -1;
3747 : }
3748 : }
3749 0 : return 0;
3750 : }
3751 :
3752 0 : static PyObject *py_security_descriptor_hash_v4_get_sys_acl_hash(PyObject *obj, void *closure)
3753 : {
3754 0 : struct security_descriptor_hash_v4 *object = pytalloc_get_ptr(obj);
3755 0 : PyObject *py_sys_acl_hash;
3756 0 : py_sys_acl_hash = PyList_New(64);
3757 0 : if (py_sys_acl_hash == NULL) {
3758 0 : return NULL;
3759 : }
3760 : {
3761 : int sys_acl_hash_cntr_0;
3762 0 : for (sys_acl_hash_cntr_0 = 0; sys_acl_hash_cntr_0 < (64); sys_acl_hash_cntr_0++) {
3763 0 : PyObject *py_sys_acl_hash_0;
3764 0 : py_sys_acl_hash_0 = PyLong_FromLong((uint16_t)((object->sys_acl_hash)[sys_acl_hash_cntr_0]));
3765 0 : PyList_SetItem(py_sys_acl_hash, sys_acl_hash_cntr_0, py_sys_acl_hash_0);
3766 : }
3767 : }
3768 0 : return py_sys_acl_hash;
3769 : }
3770 :
3771 0 : static int py_security_descriptor_hash_v4_set_sys_acl_hash(PyObject *py_obj, PyObject *value, void *closure)
3772 : {
3773 0 : struct security_descriptor_hash_v4 *object = pytalloc_get_ptr(py_obj);
3774 0 : if (value == NULL) {
3775 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->sys_acl_hash");
3776 0 : return -1;
3777 : }
3778 0 : PY_CHECK_TYPE(&PyList_Type, value, return -1;);
3779 : {
3780 0 : int sys_acl_hash_cntr_0;
3781 0 : if (ARRAY_SIZE(object->sys_acl_hash) != PyList_GET_SIZE(value)) {
3782 0 : PyErr_Format(PyExc_TypeError, "Expected list of type %s, length %zu, got %zd", Py_TYPE(value)->tp_name, ARRAY_SIZE(object->sys_acl_hash), PyList_GET_SIZE(value));
3783 0 : return -1;
3784 : }
3785 0 : for (sys_acl_hash_cntr_0 = 0; sys_acl_hash_cntr_0 < PyList_GET_SIZE(value); sys_acl_hash_cntr_0++) {
3786 0 : if (PyList_GET_ITEM(value, sys_acl_hash_cntr_0) == NULL) {
3787 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: (object->sys_acl_hash)[sys_acl_hash_cntr_0]");
3788 0 : return -1;
3789 : }
3790 : {
3791 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof((object->sys_acl_hash)[sys_acl_hash_cntr_0]));
3792 0 : if (PyLong_Check(PyList_GET_ITEM(value, sys_acl_hash_cntr_0))) {
3793 0 : unsigned long long test_var;
3794 0 : test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, sys_acl_hash_cntr_0));
3795 0 : if (PyErr_Occurred() != NULL) {
3796 0 : return -1;
3797 : }
3798 0 : if (test_var > uint_max) {
3799 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
3800 : PyLong_Type.tp_name, uint_max, test_var);
3801 0 : return -1;
3802 : }
3803 0 : (object->sys_acl_hash)[sys_acl_hash_cntr_0] = test_var;
3804 : } else {
3805 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
3806 : PyLong_Type.tp_name);
3807 0 : return -1;
3808 : }
3809 : }
3810 : }
3811 : }
3812 0 : return 0;
3813 : }
3814 :
3815 : static PyGetSetDef py_security_descriptor_hash_v4_getsetters[] = {
3816 : {
3817 : .name = discard_const_p(char, "sd"),
3818 : .get = py_security_descriptor_hash_v4_get_sd,
3819 : .set = py_security_descriptor_hash_v4_set_sd,
3820 : .doc = discard_const_p(char, "PIDL-generated element of base type security_descriptor")
3821 : },
3822 : {
3823 : .name = discard_const_p(char, "hash_type"),
3824 : .get = py_security_descriptor_hash_v4_get_hash_type,
3825 : .set = py_security_descriptor_hash_v4_set_hash_type,
3826 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
3827 : },
3828 : {
3829 : .name = discard_const_p(char, "hash"),
3830 : .get = py_security_descriptor_hash_v4_get_hash,
3831 : .set = py_security_descriptor_hash_v4_set_hash,
3832 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
3833 : },
3834 : {
3835 : .name = discard_const_p(char, "description"),
3836 : .get = py_security_descriptor_hash_v4_get_description,
3837 : .set = py_security_descriptor_hash_v4_set_description,
3838 : .doc = discard_const_p(char, "PIDL-generated element of base type string")
3839 : },
3840 : {
3841 : .name = discard_const_p(char, "time"),
3842 : .get = py_security_descriptor_hash_v4_get_time,
3843 : .set = py_security_descriptor_hash_v4_set_time,
3844 : .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME")
3845 : },
3846 : {
3847 : .name = discard_const_p(char, "sys_acl_hash"),
3848 : .get = py_security_descriptor_hash_v4_get_sys_acl_hash,
3849 : .set = py_security_descriptor_hash_v4_set_sys_acl_hash,
3850 : .doc = discard_const_p(char, "PIDL-generated element of base type uint8")
3851 : },
3852 : { .name = NULL }
3853 : };
3854 :
3855 0 : static PyObject *py_security_descriptor_hash_v4_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
3856 : {
3857 0 : return pytalloc_new(struct security_descriptor_hash_v4, type);
3858 : }
3859 :
3860 0 : static PyObject *py_security_descriptor_hash_v4_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
3861 : {
3862 0 : struct security_descriptor_hash_v4 *object = pytalloc_get_ptr(py_obj);
3863 0 : PyObject *ret = NULL;
3864 0 : DATA_BLOB blob;
3865 0 : enum ndr_err_code err;
3866 0 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
3867 0 : if (tmp_ctx == NULL) {
3868 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
3869 0 : return NULL;
3870 : }
3871 0 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_security_descriptor_hash_v4);
3872 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
3873 0 : TALLOC_FREE(tmp_ctx);
3874 0 : PyErr_SetNdrError(err);
3875 0 : return NULL;
3876 : }
3877 :
3878 0 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
3879 0 : TALLOC_FREE(tmp_ctx);
3880 0 : return ret;
3881 : }
3882 :
3883 0 : static PyObject *py_security_descriptor_hash_v4_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
3884 : {
3885 0 : struct security_descriptor_hash_v4 *object = pytalloc_get_ptr(py_obj);
3886 0 : DATA_BLOB blob = {.data = NULL, .length = 0};
3887 0 : Py_ssize_t blob_length = 0;
3888 0 : enum ndr_err_code err;
3889 0 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
3890 0 : PyObject *allow_remaining_obj = NULL;
3891 0 : bool allow_remaining = false;
3892 :
3893 0 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
3894 : discard_const_p(char *, kwnames),
3895 : &blob.data, &blob_length,
3896 : &allow_remaining_obj)) {
3897 0 : return NULL;
3898 : }
3899 0 : blob.length = blob_length;
3900 :
3901 0 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
3902 0 : allow_remaining = true;
3903 : }
3904 :
3905 0 : if (allow_remaining) {
3906 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_security_descriptor_hash_v4);
3907 : } else {
3908 0 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_security_descriptor_hash_v4);
3909 : }
3910 0 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
3911 0 : PyErr_SetNdrError(err);
3912 0 : return NULL;
3913 : }
3914 :
3915 0 : Py_RETURN_NONE;
3916 : }
3917 :
3918 0 : static PyObject *py_security_descriptor_hash_v4_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
3919 : {
3920 0 : struct security_descriptor_hash_v4 *object = pytalloc_get_ptr(py_obj);
3921 0 : PyObject *ret;
3922 0 : char *retstr;
3923 :
3924 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_security_descriptor_hash_v4, "security_descriptor_hash_v4", object);
3925 0 : ret = PyUnicode_FromString(retstr);
3926 0 : talloc_free(retstr);
3927 :
3928 0 : return ret;
3929 : }
3930 :
3931 : static PyMethodDef py_security_descriptor_hash_v4_methods[] = {
3932 : { "__ndr_pack__", (PyCFunction)py_security_descriptor_hash_v4_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
3933 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_security_descriptor_hash_v4_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
3934 : { "__ndr_print__", (PyCFunction)py_security_descriptor_hash_v4_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
3935 : { NULL, NULL, 0, NULL }
3936 : };
3937 :
3938 :
3939 : static PyTypeObject security_descriptor_hash_v4_Type = {
3940 : PyVarObject_HEAD_INIT(NULL, 0)
3941 : .tp_name = "xattr.security_descriptor_hash_v4",
3942 : .tp_getset = py_security_descriptor_hash_v4_getsetters,
3943 : .tp_methods = py_security_descriptor_hash_v4_methods,
3944 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
3945 : .tp_new = py_security_descriptor_hash_v4_new,
3946 : };
3947 :
3948 177 : static PyObject *py_import_xattr_NTACL_Info(TALLOC_CTX *mem_ctx, int level, union xattr_NTACL_Info *in)
3949 : {
3950 2 : PyObject *ret;
3951 :
3952 177 : switch (level) {
3953 68 : case 1:
3954 68 : if (in->sd == NULL) {
3955 0 : ret = Py_None;
3956 0 : Py_INCREF(ret);
3957 : } else {
3958 68 : ret = pytalloc_reference_ex(security_descriptor_Type, in->sd, in->sd);
3959 : }
3960 66 : return ret;
3961 :
3962 0 : case 2:
3963 0 : if (in->sd_hs2 == NULL) {
3964 0 : ret = Py_None;
3965 0 : Py_INCREF(ret);
3966 : } else {
3967 0 : ret = pytalloc_reference_ex(&security_descriptor_hash_v2_Type, in->sd_hs2, in->sd_hs2);
3968 : }
3969 0 : return ret;
3970 :
3971 0 : case 3:
3972 0 : if (in->sd_hs3 == NULL) {
3973 0 : ret = Py_None;
3974 0 : Py_INCREF(ret);
3975 : } else {
3976 0 : ret = pytalloc_reference_ex(&security_descriptor_hash_v3_Type, in->sd_hs3, in->sd_hs3);
3977 : }
3978 0 : return ret;
3979 :
3980 109 : case 4:
3981 109 : if (in->sd_hs4 == NULL) {
3982 0 : ret = Py_None;
3983 0 : Py_INCREF(ret);
3984 : } else {
3985 109 : ret = pytalloc_reference_ex(&security_descriptor_hash_v4_Type, in->sd_hs4, in->sd_hs4);
3986 : }
3987 109 : return ret;
3988 :
3989 : }
3990 0 : PyErr_SetString(PyExc_TypeError, "unknown union level");
3991 0 : return NULL;
3992 : }
3993 :
3994 1221 : static union xattr_NTACL_Info *py_export_xattr_NTACL_Info(TALLOC_CTX *mem_ctx, int level, PyObject *in)
3995 : {
3996 1221 : union xattr_NTACL_Info *ret = talloc_zero(mem_ctx, union xattr_NTACL_Info);
3997 1221 : switch (level) {
3998 1221 : case 1:
3999 1221 : if (in == NULL) {
4000 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->sd");
4001 0 : talloc_free(ret); return NULL;
4002 : }
4003 1221 : if (in == Py_None) {
4004 0 : ret->sd = NULL;
4005 : } else {
4006 1221 : ret->sd = NULL;
4007 1221 : PY_CHECK_TYPE(security_descriptor_Type, in, talloc_free(ret); return NULL;);
4008 1221 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
4009 0 : PyErr_NoMemory();
4010 0 : talloc_free(ret); return NULL;
4011 : }
4012 1221 : ret->sd = (struct security_descriptor *)pytalloc_get_ptr(in);
4013 : }
4014 886 : break;
4015 :
4016 0 : case 2:
4017 0 : if (in == NULL) {
4018 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->sd_hs2");
4019 0 : talloc_free(ret); return NULL;
4020 : }
4021 0 : if (in == Py_None) {
4022 0 : ret->sd_hs2 = NULL;
4023 : } else {
4024 0 : ret->sd_hs2 = NULL;
4025 0 : PY_CHECK_TYPE(&security_descriptor_hash_v2_Type, in, talloc_free(ret); return NULL;);
4026 0 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
4027 0 : PyErr_NoMemory();
4028 0 : talloc_free(ret); return NULL;
4029 : }
4030 0 : ret->sd_hs2 = (struct security_descriptor_hash_v2 *)pytalloc_get_ptr(in);
4031 : }
4032 0 : break;
4033 :
4034 0 : case 3:
4035 0 : if (in == NULL) {
4036 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->sd_hs3");
4037 0 : talloc_free(ret); return NULL;
4038 : }
4039 0 : if (in == Py_None) {
4040 0 : ret->sd_hs3 = NULL;
4041 : } else {
4042 0 : ret->sd_hs3 = NULL;
4043 0 : PY_CHECK_TYPE(&security_descriptor_hash_v3_Type, in, talloc_free(ret); return NULL;);
4044 0 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
4045 0 : PyErr_NoMemory();
4046 0 : talloc_free(ret); return NULL;
4047 : }
4048 0 : ret->sd_hs3 = (struct security_descriptor_hash_v3 *)pytalloc_get_ptr(in);
4049 : }
4050 0 : break;
4051 :
4052 0 : case 4:
4053 0 : if (in == NULL) {
4054 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: ret->sd_hs4");
4055 0 : talloc_free(ret); return NULL;
4056 : }
4057 0 : if (in == Py_None) {
4058 0 : ret->sd_hs4 = NULL;
4059 : } else {
4060 0 : ret->sd_hs4 = NULL;
4061 0 : PY_CHECK_TYPE(&security_descriptor_hash_v4_Type, in, talloc_free(ret); return NULL;);
4062 0 : if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
4063 0 : PyErr_NoMemory();
4064 0 : talloc_free(ret); return NULL;
4065 : }
4066 0 : ret->sd_hs4 = (struct security_descriptor_hash_v4 *)pytalloc_get_ptr(in);
4067 : }
4068 0 : break;
4069 :
4070 0 : default:
4071 0 : PyErr_SetString(PyExc_TypeError, "invalid union level value");
4072 0 : talloc_free(ret);
4073 0 : ret = NULL;
4074 : }
4075 :
4076 886 : return ret;
4077 : }
4078 :
4079 177 : static PyObject *py_xattr_NTACL_Info_import(PyTypeObject *type, PyObject *args, PyObject *kwargs)
4080 : {
4081 177 : const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
4082 177 : PyObject *mem_ctx_obj = NULL;
4083 177 : TALLOC_CTX *mem_ctx = NULL;
4084 177 : int level = 0;
4085 177 : PyObject *in_obj = NULL;
4086 177 : union xattr_NTACL_Info *in = NULL;
4087 :
4088 177 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:import",
4089 : discard_const_p(char *, kwnames),
4090 : &mem_ctx_obj,
4091 : &level,
4092 : &in_obj)) {
4093 0 : return NULL;
4094 : }
4095 177 : mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
4096 177 : if (mem_ctx == NULL) {
4097 0 : PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
4098 0 : return NULL;
4099 : }
4100 177 : in = (union xattr_NTACL_Info *)pytalloc_get_ptr(in_obj);
4101 177 : if (in == NULL) {
4102 0 : PyErr_Format(PyExc_TypeError, "in needs to be a pointer to union xattr_NTACL_Info!");
4103 0 : return NULL;
4104 : }
4105 :
4106 177 : return py_import_xattr_NTACL_Info(mem_ctx, level, in);
4107 : }
4108 :
4109 1221 : static PyObject *py_xattr_NTACL_Info_export(PyTypeObject *type, PyObject *args, PyObject *kwargs)
4110 : {
4111 1221 : const char * const kwnames[] = { "mem_ctx", "level", "in", NULL };
4112 1221 : PyObject *mem_ctx_obj = NULL;
4113 1221 : TALLOC_CTX *mem_ctx = NULL;
4114 1221 : int level = 0;
4115 1221 : PyObject *in = NULL;
4116 1221 : union xattr_NTACL_Info *out = NULL;
4117 :
4118 1221 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:export",
4119 : discard_const_p(char *, kwnames),
4120 : &mem_ctx_obj,
4121 : &level,
4122 : &in)) {
4123 0 : return NULL;
4124 : }
4125 1221 : mem_ctx = pytalloc_get_ptr(mem_ctx_obj);
4126 1221 : if (mem_ctx == NULL) {
4127 0 : PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!");
4128 0 : return NULL;
4129 : }
4130 :
4131 1221 : out = py_export_xattr_NTACL_Info(mem_ctx, level, in);
4132 1221 : if (out == NULL) {
4133 0 : return NULL;
4134 : }
4135 :
4136 1221 : return pytalloc_GenericObject_reference(out);
4137 : }
4138 :
4139 : static PyMethodDef py_xattr_NTACL_Info_methods[] = {
4140 : { "__import__", PY_DISCARD_FUNC_SIG(PyCFunction,py_xattr_NTACL_Info_import),
4141 : METH_VARARGS|METH_KEYWORDS|METH_CLASS,
4142 : "T.__import__(mem_ctx, level, in) => ret." },
4143 : { "__export__", PY_DISCARD_FUNC_SIG(PyCFunction,py_xattr_NTACL_Info_export),
4144 : METH_VARARGS|METH_KEYWORDS|METH_CLASS,
4145 : "T.__export__(mem_ctx, level, in) => ret." },
4146 : { NULL, NULL, 0, NULL }
4147 : };
4148 :
4149 0 : static PyObject *py_xattr_NTACL_Info_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
4150 : {
4151 0 : PyErr_Format(PyExc_TypeError, "New %s Objects are not supported", type->tp_name);
4152 0 : return NULL;
4153 : }
4154 :
4155 :
4156 : static PyTypeObject xattr_NTACL_Info_Type = {
4157 : PyVarObject_HEAD_INIT(NULL, 0)
4158 : .tp_name = "xattr.NTACL_Info",
4159 : .tp_getset = NULL,
4160 : .tp_methods = py_xattr_NTACL_Info_methods,
4161 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
4162 : .tp_new = py_xattr_NTACL_Info_new,
4163 : };
4164 :
4165 :
4166 504 : static PyObject *py_xattr_NTACL_get_version(PyObject *obj, void *closure)
4167 : {
4168 504 : struct xattr_NTACL *object = pytalloc_get_ptr(obj);
4169 2 : PyObject *py_version;
4170 504 : py_version = PyLong_FromLong((uint16_t)(object->version));
4171 504 : return py_version;
4172 : }
4173 :
4174 1225 : static int py_xattr_NTACL_set_version(PyObject *py_obj, PyObject *value, void *closure)
4175 : {
4176 1225 : struct xattr_NTACL *object = pytalloc_get_ptr(py_obj);
4177 1225 : if (value == NULL) {
4178 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->version");
4179 0 : return -1;
4180 : }
4181 : {
4182 1225 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->version));
4183 1225 : if (PyLong_Check(value)) {
4184 339 : unsigned long long test_var;
4185 1225 : test_var = PyLong_AsUnsignedLongLong(value);
4186 1225 : if (PyErr_Occurred() != NULL) {
4187 0 : return -1;
4188 : }
4189 1225 : if (test_var > uint_max) {
4190 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4191 : PyLong_Type.tp_name, uint_max, test_var);
4192 0 : return -1;
4193 : }
4194 1225 : object->version = test_var;
4195 : } else {
4196 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4197 : PyLong_Type.tp_name);
4198 0 : return -1;
4199 : }
4200 : }
4201 1225 : return 0;
4202 : }
4203 :
4204 177 : static PyObject *py_xattr_NTACL_get_info(PyObject *obj, void *closure)
4205 : {
4206 177 : struct xattr_NTACL *object = pytalloc_get_ptr(obj);
4207 2 : PyObject *py_info;
4208 177 : py_info = pyrpc_import_union(&xattr_NTACL_Info_Type, pytalloc_get_mem_ctx(obj), object->version, &object->info, "union xattr_NTACL_Info");
4209 177 : if (py_info == NULL) {
4210 0 : return NULL;
4211 : }
4212 175 : return py_info;
4213 : }
4214 :
4215 1221 : static int py_xattr_NTACL_set_info(PyObject *py_obj, PyObject *value, void *closure)
4216 : {
4217 1221 : struct xattr_NTACL *object = pytalloc_get_ptr(py_obj);
4218 1221 : if (value == NULL) {
4219 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->info");
4220 0 : return -1;
4221 : }
4222 : {
4223 335 : union xattr_NTACL_Info *info_switch_0;
4224 1221 : info_switch_0 = (union xattr_NTACL_Info *)pyrpc_export_union(&xattr_NTACL_Info_Type, pytalloc_get_mem_ctx(py_obj), object->version, value, "union xattr_NTACL_Info");
4225 1221 : if (info_switch_0 == NULL) {
4226 0 : return -1;
4227 : }
4228 1221 : object->info = *info_switch_0;
4229 : }
4230 1221 : return 0;
4231 : }
4232 :
4233 : static PyGetSetDef py_xattr_NTACL_getsetters[] = {
4234 : {
4235 : .name = discard_const_p(char, "version"),
4236 : .get = py_xattr_NTACL_get_version,
4237 : .set = py_xattr_NTACL_set_version,
4238 : .doc = discard_const_p(char, "PIDL-generated element of base type uint16")
4239 : },
4240 : {
4241 : .name = discard_const_p(char, "info"),
4242 : .get = py_xattr_NTACL_get_info,
4243 : .set = py_xattr_NTACL_set_info,
4244 : .doc = discard_const_p(char, "PIDL-generated element of base type xattr_NTACL_Info")
4245 : },
4246 : { .name = NULL }
4247 : };
4248 :
4249 1402 : static PyObject *py_xattr_NTACL_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
4250 : {
4251 1402 : return pytalloc_new(struct xattr_NTACL, type);
4252 : }
4253 :
4254 1227 : static PyObject *py_xattr_NTACL_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
4255 : {
4256 1227 : struct xattr_NTACL *object = pytalloc_get_ptr(py_obj);
4257 1227 : PyObject *ret = NULL;
4258 339 : DATA_BLOB blob;
4259 339 : enum ndr_err_code err;
4260 1227 : TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj));
4261 1227 : if (tmp_ctx == NULL) {
4262 0 : PyErr_SetNdrError(NDR_ERR_ALLOC);
4263 0 : return NULL;
4264 : }
4265 1227 : err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_xattr_NTACL);
4266 1227 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
4267 0 : TALLOC_FREE(tmp_ctx);
4268 0 : PyErr_SetNdrError(err);
4269 0 : return NULL;
4270 : }
4271 :
4272 1227 : ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length);
4273 1227 : TALLOC_FREE(tmp_ctx);
4274 1227 : return ret;
4275 : }
4276 :
4277 177 : static PyObject *py_xattr_NTACL_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
4278 : {
4279 177 : struct xattr_NTACL *object = pytalloc_get_ptr(py_obj);
4280 177 : DATA_BLOB blob = {.data = NULL, .length = 0};
4281 177 : Py_ssize_t blob_length = 0;
4282 2 : enum ndr_err_code err;
4283 177 : const char * const kwnames[] = { "data_blob", "allow_remaining", NULL };
4284 177 : PyObject *allow_remaining_obj = NULL;
4285 177 : bool allow_remaining = false;
4286 :
4287 177 : if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__",
4288 : discard_const_p(char *, kwnames),
4289 : &blob.data, &blob_length,
4290 : &allow_remaining_obj)) {
4291 0 : return NULL;
4292 : }
4293 177 : blob.length = blob_length;
4294 :
4295 177 : if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) {
4296 0 : allow_remaining = true;
4297 : }
4298 :
4299 175 : if (allow_remaining) {
4300 0 : err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_xattr_NTACL);
4301 : } else {
4302 177 : err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_xattr_NTACL);
4303 : }
4304 177 : if (!NDR_ERR_CODE_IS_SUCCESS(err)) {
4305 0 : PyErr_SetNdrError(err);
4306 0 : return NULL;
4307 : }
4308 :
4309 177 : Py_RETURN_NONE;
4310 : }
4311 :
4312 0 : static PyObject *py_xattr_NTACL_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored))
4313 : {
4314 0 : struct xattr_NTACL *object = pytalloc_get_ptr(py_obj);
4315 0 : PyObject *ret;
4316 0 : char *retstr;
4317 :
4318 0 : retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_xattr_NTACL, "xattr_NTACL", object);
4319 0 : ret = PyUnicode_FromString(retstr);
4320 0 : talloc_free(retstr);
4321 :
4322 0 : return ret;
4323 : }
4324 :
4325 : static PyMethodDef py_xattr_NTACL_methods[] = {
4326 : { "__ndr_pack__", (PyCFunction)py_xattr_NTACL_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" },
4327 : { "__ndr_unpack__", PY_DISCARD_FUNC_SIG(PyCFunction,py_xattr_NTACL_ndr_unpack), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack(class, blob, allow_remaining=False) -> None\nNDR unpack" },
4328 : { "__ndr_print__", (PyCFunction)py_xattr_NTACL_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" },
4329 : { NULL, NULL, 0, NULL }
4330 : };
4331 :
4332 :
4333 : static PyTypeObject xattr_NTACL_Type = {
4334 : PyVarObject_HEAD_INIT(NULL, 0)
4335 : .tp_name = "xattr.NTACL",
4336 : .tp_getset = py_xattr_NTACL_getsetters,
4337 : .tp_methods = py_xattr_NTACL_methods,
4338 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
4339 : .tp_new = py_xattr_NTACL_new,
4340 : };
4341 :
4342 :
4343 0 : static PyObject *py_xattr_sys_acl_hash_wrapper_get_acl_as_blob(PyObject *obj, void *closure)
4344 : {
4345 0 : struct xattr_sys_acl_hash_wrapper *object = pytalloc_get_ptr(obj);
4346 0 : PyObject *py_acl_as_blob;
4347 0 : py_acl_as_blob = PyBytes_FromStringAndSize((char *)(object->acl_as_blob).data, (object->acl_as_blob).length);
4348 0 : return py_acl_as_blob;
4349 : }
4350 :
4351 0 : static int py_xattr_sys_acl_hash_wrapper_set_acl_as_blob(PyObject *py_obj, PyObject *value, void *closure)
4352 : {
4353 0 : struct xattr_sys_acl_hash_wrapper *object = pytalloc_get_ptr(py_obj);
4354 0 : if (value == NULL) {
4355 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->acl_as_blob");
4356 0 : return -1;
4357 : }
4358 0 : object->acl_as_blob = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value));
4359 0 : return 0;
4360 : }
4361 :
4362 0 : static PyObject *py_xattr_sys_acl_hash_wrapper_get_owner(PyObject *obj, void *closure)
4363 : {
4364 0 : struct xattr_sys_acl_hash_wrapper *object = pytalloc_get_ptr(obj);
4365 0 : PyObject *py_owner;
4366 0 : py_owner = PyLong_FromUnsignedLongLong(object->owner);
4367 0 : return py_owner;
4368 : }
4369 :
4370 0 : static int py_xattr_sys_acl_hash_wrapper_set_owner(PyObject *py_obj, PyObject *value, void *closure)
4371 : {
4372 0 : struct xattr_sys_acl_hash_wrapper *object = pytalloc_get_ptr(py_obj);
4373 0 : if (value == NULL) {
4374 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->owner");
4375 0 : return -1;
4376 : }
4377 : {
4378 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->owner));
4379 0 : if (PyLong_Check(value)) {
4380 0 : unsigned long long test_var;
4381 0 : test_var = PyLong_AsUnsignedLongLong(value);
4382 0 : if (PyErr_Occurred() != NULL) {
4383 0 : return -1;
4384 : }
4385 0 : if (test_var > uint_max) {
4386 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4387 : PyLong_Type.tp_name, uint_max, test_var);
4388 0 : return -1;
4389 : }
4390 0 : object->owner = test_var;
4391 : } else {
4392 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4393 : PyLong_Type.tp_name);
4394 0 : return -1;
4395 : }
4396 : }
4397 0 : return 0;
4398 : }
4399 :
4400 0 : static PyObject *py_xattr_sys_acl_hash_wrapper_get_group(PyObject *obj, void *closure)
4401 : {
4402 0 : struct xattr_sys_acl_hash_wrapper *object = pytalloc_get_ptr(obj);
4403 0 : PyObject *py_group;
4404 0 : py_group = PyLong_FromUnsignedLongLong(object->group);
4405 0 : return py_group;
4406 : }
4407 :
4408 0 : static int py_xattr_sys_acl_hash_wrapper_set_group(PyObject *py_obj, PyObject *value, void *closure)
4409 : {
4410 0 : struct xattr_sys_acl_hash_wrapper *object = pytalloc_get_ptr(py_obj);
4411 0 : if (value == NULL) {
4412 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->group");
4413 0 : return -1;
4414 : }
4415 : {
4416 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->group));
4417 0 : if (PyLong_Check(value)) {
4418 0 : unsigned long long test_var;
4419 0 : test_var = PyLong_AsUnsignedLongLong(value);
4420 0 : if (PyErr_Occurred() != NULL) {
4421 0 : return -1;
4422 : }
4423 0 : if (test_var > uint_max) {
4424 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4425 : PyLong_Type.tp_name, uint_max, test_var);
4426 0 : return -1;
4427 : }
4428 0 : object->group = test_var;
4429 : } else {
4430 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4431 : PyLong_Type.tp_name);
4432 0 : return -1;
4433 : }
4434 : }
4435 0 : return 0;
4436 : }
4437 :
4438 0 : static PyObject *py_xattr_sys_acl_hash_wrapper_get_mode(PyObject *obj, void *closure)
4439 : {
4440 0 : struct xattr_sys_acl_hash_wrapper *object = pytalloc_get_ptr(obj);
4441 0 : PyObject *py_mode;
4442 0 : py_mode = PyLong_FromUnsignedLongLong((uint32_t)(object->mode));
4443 0 : return py_mode;
4444 : }
4445 :
4446 0 : static int py_xattr_sys_acl_hash_wrapper_set_mode(PyObject *py_obj, PyObject *value, void *closure)
4447 : {
4448 0 : struct xattr_sys_acl_hash_wrapper *object = pytalloc_get_ptr(py_obj);
4449 0 : if (value == NULL) {
4450 0 : PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: object->mode");
4451 0 : return -1;
4452 : }
4453 : {
4454 0 : const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->mode));
4455 0 : if (PyLong_Check(value)) {
4456 0 : unsigned long long test_var;
4457 0 : test_var = PyLong_AsUnsignedLongLong(value);
4458 0 : if (PyErr_Occurred() != NULL) {
4459 0 : return -1;
4460 : }
4461 0 : if (test_var > uint_max) {
4462 0 : PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",
4463 : PyLong_Type.tp_name, uint_max, test_var);
4464 0 : return -1;
4465 : }
4466 0 : object->mode = test_var;
4467 : } else {
4468 0 : PyErr_Format(PyExc_TypeError, "Expected type %s",
4469 : PyLong_Type.tp_name);
4470 0 : return -1;
4471 : }
4472 : }
4473 0 : return 0;
4474 : }
4475 :
4476 : static PyGetSetDef py_xattr_sys_acl_hash_wrapper_getsetters[] = {
4477 : {
4478 : .name = discard_const_p(char, "acl_as_blob"),
4479 : .get = py_xattr_sys_acl_hash_wrapper_get_acl_as_blob,
4480 : .set = py_xattr_sys_acl_hash_wrapper_set_acl_as_blob,
4481 : .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB")
4482 : },
4483 : {
4484 : .name = discard_const_p(char, "owner"),
4485 : .get = py_xattr_sys_acl_hash_wrapper_get_owner,
4486 : .set = py_xattr_sys_acl_hash_wrapper_set_owner,
4487 : .doc = discard_const_p(char, "PIDL-generated element of base type uid_t")
4488 : },
4489 : {
4490 : .name = discard_const_p(char, "group"),
4491 : .get = py_xattr_sys_acl_hash_wrapper_get_group,
4492 : .set = py_xattr_sys_acl_hash_wrapper_set_group,
4493 : .doc = discard_const_p(char, "PIDL-generated element of base type gid_t")
4494 : },
4495 : {
4496 : .name = discard_const_p(char, "mode"),
4497 : .get = py_xattr_sys_acl_hash_wrapper_get_mode,
4498 : .set = py_xattr_sys_acl_hash_wrapper_set_mode,
4499 : .doc = discard_const_p(char, "PIDL-generated element of base type uint32")
4500 : },
4501 : { .name = NULL }
4502 : };
4503 :
4504 0 : static PyObject *py_xattr_sys_acl_hash_wrapper_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
4505 : {
4506 0 : return pytalloc_new(struct xattr_sys_acl_hash_wrapper, type);
4507 : }
4508 :
4509 :
4510 : static PyTypeObject xattr_sys_acl_hash_wrapper_Type = {
4511 : PyVarObject_HEAD_INIT(NULL, 0)
4512 : .tp_name = "xattr.sys_acl_hash_wrapper",
4513 : .tp_getset = py_xattr_sys_acl_hash_wrapper_getsetters,
4514 : .tp_methods = NULL,
4515 : .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
4516 : .tp_new = py_xattr_sys_acl_hash_wrapper_new,
4517 : };
4518 :
4519 : static PyMethodDef xattr_methods[] = {
4520 : { NULL, NULL, 0, NULL }
4521 : };
4522 :
4523 : static struct PyModuleDef moduledef = {
4524 : PyModuleDef_HEAD_INIT,
4525 : .m_name = "xattr",
4526 : .m_doc = "xattr DCE/RPC",
4527 : .m_size = -1,
4528 : .m_methods = xattr_methods,
4529 : };
4530 1732 : MODULE_INIT_FUNC(xattr)
4531 : {
4532 1732 : PyObject *m = NULL;
4533 1732 : PyObject *dep_samba_dcerpc_security = NULL;
4534 1732 : PyObject *dep_talloc = NULL;
4535 :
4536 1732 : dep_samba_dcerpc_security = PyImport_ImportModule("samba.dcerpc.security");
4537 1732 : if (dep_samba_dcerpc_security == NULL)
4538 0 : goto out;
4539 :
4540 1732 : dep_talloc = PyImport_ImportModule("talloc");
4541 1732 : if (dep_talloc == NULL)
4542 0 : goto out;
4543 :
4544 1732 : BaseObject_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "BaseObject");
4545 1732 : if (BaseObject_Type == NULL)
4546 0 : goto out;
4547 :
4548 1732 : security_descriptor_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_security, "descriptor");
4549 1732 : if (security_descriptor_Type == NULL)
4550 0 : goto out;
4551 :
4552 1732 : xattr_DosInfoFFFFCompat_Type.tp_base = BaseObject_Type;
4553 1732 : xattr_DosInfoFFFFCompat_Type.tp_basicsize = pytalloc_BaseObject_size();
4554 :
4555 1732 : xattr_DosInfo1_Type.tp_base = BaseObject_Type;
4556 1732 : xattr_DosInfo1_Type.tp_basicsize = pytalloc_BaseObject_size();
4557 :
4558 1732 : xattr_DosInfo2Old_Type.tp_base = BaseObject_Type;
4559 1732 : xattr_DosInfo2Old_Type.tp_basicsize = pytalloc_BaseObject_size();
4560 :
4561 1732 : xattr_DosInfo3_Type.tp_base = BaseObject_Type;
4562 1732 : xattr_DosInfo3_Type.tp_basicsize = pytalloc_BaseObject_size();
4563 :
4564 1732 : xattr_DosInfo4_Type.tp_base = BaseObject_Type;
4565 1732 : xattr_DosInfo4_Type.tp_basicsize = pytalloc_BaseObject_size();
4566 :
4567 1732 : xattr_DosInfo5_Type.tp_base = BaseObject_Type;
4568 1732 : xattr_DosInfo5_Type.tp_basicsize = pytalloc_BaseObject_size();
4569 :
4570 1732 : xattr_DosInfo_Type.tp_base = BaseObject_Type;
4571 1732 : xattr_DosInfo_Type.tp_basicsize = pytalloc_BaseObject_size();
4572 :
4573 1732 : xattr_DosAttrib_Type.tp_base = BaseObject_Type;
4574 1732 : xattr_DosAttrib_Type.tp_basicsize = pytalloc_BaseObject_size();
4575 :
4576 1732 : xattr_DOSATTRIB_Type.tp_base = BaseObject_Type;
4577 1732 : xattr_DOSATTRIB_Type.tp_basicsize = pytalloc_BaseObject_size();
4578 :
4579 1732 : xattr_EA_Type.tp_base = BaseObject_Type;
4580 1732 : xattr_EA_Type.tp_basicsize = pytalloc_BaseObject_size();
4581 :
4582 1732 : xattr_DosEAs_Type.tp_base = BaseObject_Type;
4583 1732 : xattr_DosEAs_Type.tp_basicsize = pytalloc_BaseObject_size();
4584 :
4585 1732 : tdb_xattrs_Type.tp_base = BaseObject_Type;
4586 1732 : tdb_xattrs_Type.tp_basicsize = pytalloc_BaseObject_size();
4587 :
4588 1732 : xattr_DosStream_Type.tp_base = BaseObject_Type;
4589 1732 : xattr_DosStream_Type.tp_basicsize = pytalloc_BaseObject_size();
4590 :
4591 1732 : xattr_DosStreams_Type.tp_base = BaseObject_Type;
4592 1732 : xattr_DosStreams_Type.tp_basicsize = pytalloc_BaseObject_size();
4593 :
4594 1732 : security_descriptor_hash_v2_Type.tp_base = BaseObject_Type;
4595 1732 : security_descriptor_hash_v2_Type.tp_basicsize = pytalloc_BaseObject_size();
4596 :
4597 1732 : security_descriptor_hash_v3_Type.tp_base = BaseObject_Type;
4598 1732 : security_descriptor_hash_v3_Type.tp_basicsize = pytalloc_BaseObject_size();
4599 :
4600 1732 : security_descriptor_hash_v4_Type.tp_base = BaseObject_Type;
4601 1732 : security_descriptor_hash_v4_Type.tp_basicsize = pytalloc_BaseObject_size();
4602 :
4603 1732 : xattr_NTACL_Info_Type.tp_base = BaseObject_Type;
4604 1732 : xattr_NTACL_Info_Type.tp_basicsize = pytalloc_BaseObject_size();
4605 :
4606 1732 : xattr_NTACL_Type.tp_base = BaseObject_Type;
4607 1732 : xattr_NTACL_Type.tp_basicsize = pytalloc_BaseObject_size();
4608 :
4609 1732 : xattr_sys_acl_hash_wrapper_Type.tp_base = BaseObject_Type;
4610 1732 : xattr_sys_acl_hash_wrapper_Type.tp_basicsize = pytalloc_BaseObject_size();
4611 :
4612 1732 : if (PyType_Ready(&xattr_DosInfoFFFFCompat_Type) < 0)
4613 0 : goto out;
4614 1732 : if (PyType_Ready(&xattr_DosInfo1_Type) < 0)
4615 0 : goto out;
4616 1732 : if (PyType_Ready(&xattr_DosInfo2Old_Type) < 0)
4617 0 : goto out;
4618 1732 : if (PyType_Ready(&xattr_DosInfo3_Type) < 0)
4619 0 : goto out;
4620 1732 : if (PyType_Ready(&xattr_DosInfo4_Type) < 0)
4621 0 : goto out;
4622 1732 : if (PyType_Ready(&xattr_DosInfo5_Type) < 0)
4623 0 : goto out;
4624 1732 : if (PyType_Ready(&xattr_DosInfo_Type) < 0)
4625 0 : goto out;
4626 1732 : if (PyType_Ready(&xattr_DosAttrib_Type) < 0)
4627 0 : goto out;
4628 1732 : if (PyType_Ready(&xattr_DOSATTRIB_Type) < 0)
4629 0 : goto out;
4630 1732 : if (PyType_Ready(&xattr_EA_Type) < 0)
4631 0 : goto out;
4632 1732 : if (PyType_Ready(&xattr_DosEAs_Type) < 0)
4633 0 : goto out;
4634 1732 : if (PyType_Ready(&tdb_xattrs_Type) < 0)
4635 0 : goto out;
4636 1732 : if (PyType_Ready(&xattr_DosStream_Type) < 0)
4637 0 : goto out;
4638 1732 : if (PyType_Ready(&xattr_DosStreams_Type) < 0)
4639 0 : goto out;
4640 1732 : if (PyType_Ready(&security_descriptor_hash_v2_Type) < 0)
4641 0 : goto out;
4642 1732 : if (PyType_Ready(&security_descriptor_hash_v3_Type) < 0)
4643 0 : goto out;
4644 1732 : if (PyType_Ready(&security_descriptor_hash_v4_Type) < 0)
4645 0 : goto out;
4646 1732 : if (PyType_Ready(&xattr_NTACL_Info_Type) < 0)
4647 0 : goto out;
4648 1732 : if (PyType_Ready(&xattr_NTACL_Type) < 0)
4649 0 : goto out;
4650 1732 : if (PyType_Ready(&xattr_sys_acl_hash_wrapper_Type) < 0)
4651 0 : goto out;
4652 : #ifdef PY_DOSINFOFFFFCOMPAT_PATCH
4653 : PY_DOSINFOFFFFCOMPAT_PATCH(&xattr_DosInfoFFFFCompat_Type);
4654 : #endif
4655 : #ifdef PY_DOSINFO1_PATCH
4656 : PY_DOSINFO1_PATCH(&xattr_DosInfo1_Type);
4657 : #endif
4658 : #ifdef PY_DOSINFO2OLD_PATCH
4659 : PY_DOSINFO2OLD_PATCH(&xattr_DosInfo2Old_Type);
4660 : #endif
4661 : #ifdef PY_DOSINFO3_PATCH
4662 : PY_DOSINFO3_PATCH(&xattr_DosInfo3_Type);
4663 : #endif
4664 : #ifdef PY_DOSINFO4_PATCH
4665 : PY_DOSINFO4_PATCH(&xattr_DosInfo4_Type);
4666 : #endif
4667 : #ifdef PY_DOSINFO5_PATCH
4668 : PY_DOSINFO5_PATCH(&xattr_DosInfo5_Type);
4669 : #endif
4670 : #ifdef PY_DOSINFO_PATCH
4671 : PY_DOSINFO_PATCH(&xattr_DosInfo_Type);
4672 : #endif
4673 : #ifdef PY_DOSATTRIB_PATCH
4674 : PY_DOSATTRIB_PATCH(&xattr_DosAttrib_Type);
4675 : #endif
4676 : #ifdef PY_DOSATTRIB_PATCH
4677 : PY_DOSATTRIB_PATCH(&xattr_DOSATTRIB_Type);
4678 : #endif
4679 : #ifdef PY_EA_PATCH
4680 : PY_EA_PATCH(&xattr_EA_Type);
4681 : #endif
4682 : #ifdef PY_DOSEAS_PATCH
4683 : PY_DOSEAS_PATCH(&xattr_DosEAs_Type);
4684 : #endif
4685 : #ifdef PY_TDB_XATTRS_PATCH
4686 : PY_TDB_XATTRS_PATCH(&tdb_xattrs_Type);
4687 : #endif
4688 : #ifdef PY_DOSSTREAM_PATCH
4689 : PY_DOSSTREAM_PATCH(&xattr_DosStream_Type);
4690 : #endif
4691 : #ifdef PY_DOSSTREAMS_PATCH
4692 : PY_DOSSTREAMS_PATCH(&xattr_DosStreams_Type);
4693 : #endif
4694 : #ifdef PY_SECURITY_DESCRIPTOR_HASH_V2_PATCH
4695 : PY_SECURITY_DESCRIPTOR_HASH_V2_PATCH(&security_descriptor_hash_v2_Type);
4696 : #endif
4697 : #ifdef PY_SECURITY_DESCRIPTOR_HASH_V3_PATCH
4698 : PY_SECURITY_DESCRIPTOR_HASH_V3_PATCH(&security_descriptor_hash_v3_Type);
4699 : #endif
4700 : #ifdef PY_SECURITY_DESCRIPTOR_HASH_V4_PATCH
4701 : PY_SECURITY_DESCRIPTOR_HASH_V4_PATCH(&security_descriptor_hash_v4_Type);
4702 : #endif
4703 : #ifdef PY_NTACL_INFO_PATCH
4704 : PY_NTACL_INFO_PATCH(&xattr_NTACL_Info_Type);
4705 : #endif
4706 : #ifdef PY_NTACL_PATCH
4707 1732 : PY_NTACL_PATCH(&xattr_NTACL_Type);
4708 : #endif
4709 : #ifdef PY_SYS_ACL_HASH_WRAPPER_PATCH
4710 : PY_SYS_ACL_HASH_WRAPPER_PATCH(&xattr_sys_acl_hash_wrapper_Type);
4711 : #endif
4712 :
4713 1732 : m = PyModule_Create(&moduledef);
4714 1732 : if (m == NULL)
4715 0 : goto out;
4716 :
4717 1732 : PyModule_AddObject(m, "XATTR_DOSATTRIB_NAME", PyUnicode_FromString("user.DosAttrib"));
4718 1732 : PyModule_AddObject(m, "XATTR_DOSATTRIB_NAME_S3", PyUnicode_FromString("user.DOSATTRIB"));
4719 1732 : PyModule_AddObject(m, "XATTR_DOSATTRIB_ESTIMATED_SIZE", PyLong_FromUnsignedLongLong(64));
4720 1732 : PyModule_AddObject(m, "XATTR_DOSEAS_NAME", PyUnicode_FromString("user.DosEAs"));
4721 1732 : PyModule_AddObject(m, "XATTR_DOSSTREAMS_NAME", PyUnicode_FromString("user.DosStreams"));
4722 1732 : PyModule_AddObject(m, "XATTR_STREAM_FLAG_INTERNAL", PyLong_FromUnsignedLongLong(0x00000001));
4723 1732 : PyModule_AddObject(m, "XATTR_DOSSTREAM_PREFIX", PyUnicode_FromString("user.DosStream."));
4724 1732 : PyModule_AddObject(m, "XATTR_MAX_STREAM_SIZE", PyLong_FromUnsignedLongLong(0x4000));
4725 1732 : PyModule_AddObject(m, "XATTR_MAX_STREAM_SIZE_TDB", PyLong_FromUnsignedLongLong(0x100000));
4726 1732 : PyModule_AddObject(m, "XATTR_NTACL_NAME", PyUnicode_FromString("security.NTACL"));
4727 1732 : PyModule_AddObject(m, "XATTR_SD_HASH_SIZE", PyLong_FromUnsignedLongLong(64));
4728 1732 : PyModule_AddObject(m, "XATTR_SD_HASH_TYPE_NONE", PyLong_FromUnsignedLongLong(0x0));
4729 1732 : PyModule_AddObject(m, "XATTR_SD_HASH_TYPE_SHA256", PyLong_FromUnsignedLongLong(0x1));
4730 1732 : PyModule_AddObject(m, "XATTR_DOSINFO_ATTRIB", PyLong_FromUnsignedLongLong((uint32_t)(XATTR_DOSINFO_ATTRIB)));
4731 1732 : PyModule_AddObject(m, "XATTR_DOSINFO_EA_SIZE", PyLong_FromUnsignedLongLong((uint32_t)(XATTR_DOSINFO_EA_SIZE)));
4732 1732 : PyModule_AddObject(m, "XATTR_DOSINFO_SIZE", PyLong_FromUnsignedLongLong((uint32_t)(XATTR_DOSINFO_SIZE)));
4733 1732 : PyModule_AddObject(m, "XATTR_DOSINFO_ALLOC_SIZE", PyLong_FromUnsignedLongLong((uint32_t)(XATTR_DOSINFO_ALLOC_SIZE)));
4734 1732 : PyModule_AddObject(m, "XATTR_DOSINFO_CREATE_TIME", PyLong_FromUnsignedLongLong((uint32_t)(XATTR_DOSINFO_CREATE_TIME)));
4735 1732 : PyModule_AddObject(m, "XATTR_DOSINFO_CHANGE_TIME", PyLong_FromUnsignedLongLong((uint32_t)(XATTR_DOSINFO_CHANGE_TIME)));
4736 1732 : PyModule_AddObject(m, "XATTR_DOSINFO_ITIME", PyLong_FromUnsignedLongLong((uint32_t)(XATTR_DOSINFO_ITIME)));
4737 1451 : Py_INCREF((PyObject *)(void *)&xattr_DosInfoFFFFCompat_Type);
4738 1732 : PyModule_AddObject(m, "DosInfoFFFFCompat", (PyObject *)(void *)&xattr_DosInfoFFFFCompat_Type);
4739 1451 : Py_INCREF((PyObject *)(void *)&xattr_DosInfo1_Type);
4740 1732 : PyModule_AddObject(m, "DosInfo1", (PyObject *)(void *)&xattr_DosInfo1_Type);
4741 1451 : Py_INCREF((PyObject *)(void *)&xattr_DosInfo2Old_Type);
4742 1732 : PyModule_AddObject(m, "DosInfo2Old", (PyObject *)(void *)&xattr_DosInfo2Old_Type);
4743 1451 : Py_INCREF((PyObject *)(void *)&xattr_DosInfo3_Type);
4744 1732 : PyModule_AddObject(m, "DosInfo3", (PyObject *)(void *)&xattr_DosInfo3_Type);
4745 1451 : Py_INCREF((PyObject *)(void *)&xattr_DosInfo4_Type);
4746 1732 : PyModule_AddObject(m, "DosInfo4", (PyObject *)(void *)&xattr_DosInfo4_Type);
4747 1451 : Py_INCREF((PyObject *)(void *)&xattr_DosInfo5_Type);
4748 1732 : PyModule_AddObject(m, "DosInfo5", (PyObject *)(void *)&xattr_DosInfo5_Type);
4749 1451 : Py_INCREF((PyObject *)(void *)&xattr_DosInfo_Type);
4750 1732 : PyModule_AddObject(m, "DosInfo", (PyObject *)(void *)&xattr_DosInfo_Type);
4751 1451 : Py_INCREF((PyObject *)(void *)&xattr_DosAttrib_Type);
4752 1732 : PyModule_AddObject(m, "DosAttrib", (PyObject *)(void *)&xattr_DosAttrib_Type);
4753 1451 : Py_INCREF((PyObject *)(void *)&xattr_DOSATTRIB_Type);
4754 1732 : PyModule_AddObject(m, "DOSATTRIB", (PyObject *)(void *)&xattr_DOSATTRIB_Type);
4755 1451 : Py_INCREF((PyObject *)(void *)&xattr_EA_Type);
4756 1732 : PyModule_AddObject(m, "EA", (PyObject *)(void *)&xattr_EA_Type);
4757 1451 : Py_INCREF((PyObject *)(void *)&xattr_DosEAs_Type);
4758 1732 : PyModule_AddObject(m, "DosEAs", (PyObject *)(void *)&xattr_DosEAs_Type);
4759 1451 : Py_INCREF((PyObject *)(void *)&tdb_xattrs_Type);
4760 1732 : PyModule_AddObject(m, "tdb_xattrs", (PyObject *)(void *)&tdb_xattrs_Type);
4761 1451 : Py_INCREF((PyObject *)(void *)&xattr_DosStream_Type);
4762 1732 : PyModule_AddObject(m, "DosStream", (PyObject *)(void *)&xattr_DosStream_Type);
4763 1451 : Py_INCREF((PyObject *)(void *)&xattr_DosStreams_Type);
4764 1732 : PyModule_AddObject(m, "DosStreams", (PyObject *)(void *)&xattr_DosStreams_Type);
4765 1451 : Py_INCREF((PyObject *)(void *)&security_descriptor_hash_v2_Type);
4766 1732 : PyModule_AddObject(m, "security_descriptor_hash_v2", (PyObject *)(void *)&security_descriptor_hash_v2_Type);
4767 1451 : Py_INCREF((PyObject *)(void *)&security_descriptor_hash_v3_Type);
4768 1732 : PyModule_AddObject(m, "security_descriptor_hash_v3", (PyObject *)(void *)&security_descriptor_hash_v3_Type);
4769 1451 : Py_INCREF((PyObject *)(void *)&security_descriptor_hash_v4_Type);
4770 1732 : PyModule_AddObject(m, "security_descriptor_hash_v4", (PyObject *)(void *)&security_descriptor_hash_v4_Type);
4771 1451 : Py_INCREF((PyObject *)(void *)&xattr_NTACL_Info_Type);
4772 1732 : PyModule_AddObject(m, "NTACL_Info", (PyObject *)(void *)&xattr_NTACL_Info_Type);
4773 1451 : Py_INCREF((PyObject *)(void *)&xattr_NTACL_Type);
4774 1732 : PyModule_AddObject(m, "NTACL", (PyObject *)(void *)&xattr_NTACL_Type);
4775 1451 : Py_INCREF((PyObject *)(void *)&xattr_sys_acl_hash_wrapper_Type);
4776 1732 : PyModule_AddObject(m, "sys_acl_hash_wrapper", (PyObject *)(void *)&xattr_sys_acl_hash_wrapper_Type);
4777 : #ifdef PY_MOD_XATTR_PATCH
4778 : PY_MOD_XATTR_PATCH(m);
4779 : #endif
4780 1732 : out:
4781 1732 : Py_XDECREF(dep_samba_dcerpc_security);
4782 1732 : Py_XDECREF(dep_talloc);
4783 1732 : return m;
4784 :
4785 : }
|