/* Python wrapper functions auto-generated by pidl */ #define PY_SSIZE_T_CLEAN 1 /* We use Py_ssize_t for PyArg_ParseTupleAndKeywords */ #include #include "python/py3compat.h" #include "includes.h" #include "python/modules.h" #include #include "librpc/rpc/pyrpc.h" #include "librpc/rpc/pyrpc_util.h" #include "bin/default/librpc/gen_ndr/ndr_xattr.h" /* * Suppress compiler warnings if the generated code does not call these * functions */ #ifndef _MAYBE_UNUSED_ #ifdef __has_attribute #if __has_attribute(unused) #define _MAYBE_UNUSED_ __attribute__ ((unused)) #else #define _MAYBE_UNUSED_ #endif #endif #endif /* * These functions are here to ensure they can be optimized out by * the compiler based on the constant input values */ static inline unsigned long long ndr_sizeof2uintmax(size_t var_size) { switch (var_size) { case 8: return UINT64_MAX; case 4: return UINT32_MAX; case 2: return UINT16_MAX; case 1: return UINT8_MAX; } return 0; } static inline _MAYBE_UNUSED_ long long ndr_sizeof2intmax(size_t var_size) { switch (var_size) { case 8: return INT64_MAX; case 4: return INT32_MAX; case 2: return INT16_MAX; case 1: return INT8_MAX; } return 0; } #include "librpc/gen_ndr/security.h" static PyTypeObject xattr_DosInfoFFFFCompat_Type; static PyTypeObject xattr_DosInfo1_Type; static PyTypeObject xattr_DosInfo2Old_Type; static PyTypeObject xattr_DosInfo3_Type; static PyTypeObject xattr_DosInfo4_Type; static PyTypeObject xattr_DosInfo_Type; static PyTypeObject xattr_DosAttrib_Type; static PyTypeObject xattr_DOSATTRIB_Type; static PyTypeObject xattr_EA_Type; static PyTypeObject xattr_DosEAs_Type; static PyTypeObject tdb_xattrs_Type; static PyTypeObject xattr_DosStream_Type; static PyTypeObject xattr_DosStreams_Type; static PyTypeObject security_descriptor_hash_v2_Type; static PyTypeObject security_descriptor_hash_v3_Type; static PyTypeObject security_descriptor_hash_v4_Type; static PyTypeObject xattr_NTACL_Info_Type; static PyTypeObject xattr_NTACL_Type; static PyTypeObject xattr_sys_acl_hash_wrapper_Type; static PyTypeObject *BaseObject_Type; static PyTypeObject *security_descriptor_Type; #include "librpc/ndr/py_xattr.c" static PyObject *py_xattr_DosInfoFFFFCompat_get_attrib(PyObject *obj, void *closure) { struct xattr_DosInfoFFFFCompat *object = (struct xattr_DosInfoFFFFCompat *)pytalloc_get_ptr(obj); PyObject *py_attrib; py_attrib = PyLong_FromUnsignedLongLong((uint32_t)object->attrib); return py_attrib; } static int py_xattr_DosInfoFFFFCompat_set_attrib(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DosInfoFFFFCompat *object = (struct xattr_DosInfoFFFFCompat *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->attrib"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->attrib)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->attrib = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyGetSetDef py_xattr_DosInfoFFFFCompat_getsetters[] = { { .name = discard_const_p(char, "attrib"), .get = py_xattr_DosInfoFFFFCompat_get_attrib, .set = py_xattr_DosInfoFFFFCompat_set_attrib, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = NULL } }; static PyObject *py_xattr_DosInfoFFFFCompat_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return pytalloc_new(struct xattr_DosInfoFFFFCompat, type); } static PyTypeObject xattr_DosInfoFFFFCompat_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "xattr.DosInfoFFFFCompat", .tp_getset = py_xattr_DosInfoFFFFCompat_getsetters, .tp_methods = NULL, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_xattr_DosInfoFFFFCompat_new, }; static PyObject *py_xattr_DosInfo1_get_attrib(PyObject *obj, void *closure) { struct xattr_DosInfo1 *object = (struct xattr_DosInfo1 *)pytalloc_get_ptr(obj); PyObject *py_attrib; py_attrib = PyLong_FromUnsignedLongLong((uint32_t)object->attrib); return py_attrib; } static int py_xattr_DosInfo1_set_attrib(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DosInfo1 *object = (struct xattr_DosInfo1 *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->attrib"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->attrib)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->attrib = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_xattr_DosInfo1_get_ea_size(PyObject *obj, void *closure) { struct xattr_DosInfo1 *object = (struct xattr_DosInfo1 *)pytalloc_get_ptr(obj); PyObject *py_ea_size; py_ea_size = PyLong_FromUnsignedLongLong((uint32_t)object->ea_size); return py_ea_size; } static int py_xattr_DosInfo1_set_ea_size(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DosInfo1 *object = (struct xattr_DosInfo1 *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->ea_size"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->ea_size)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->ea_size = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_xattr_DosInfo1_get_size(PyObject *obj, void *closure) { struct xattr_DosInfo1 *object = (struct xattr_DosInfo1 *)pytalloc_get_ptr(obj); PyObject *py_size; py_size = PyLong_FromUnsignedLongLong(object->size); return py_size; } static int py_xattr_DosInfo1_set_size(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DosInfo1 *object = (struct xattr_DosInfo1 *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->size"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->size)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->size = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_xattr_DosInfo1_get_alloc_size(PyObject *obj, void *closure) { struct xattr_DosInfo1 *object = (struct xattr_DosInfo1 *)pytalloc_get_ptr(obj); PyObject *py_alloc_size; py_alloc_size = PyLong_FromUnsignedLongLong(object->alloc_size); return py_alloc_size; } static int py_xattr_DosInfo1_set_alloc_size(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DosInfo1 *object = (struct xattr_DosInfo1 *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->alloc_size"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->alloc_size)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->alloc_size = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_xattr_DosInfo1_get_create_time(PyObject *obj, void *closure) { struct xattr_DosInfo1 *object = (struct xattr_DosInfo1 *)pytalloc_get_ptr(obj); PyObject *py_create_time; py_create_time = PyLong_FromUnsignedLongLong(object->create_time); return py_create_time; } static int py_xattr_DosInfo1_set_create_time(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DosInfo1 *object = (struct xattr_DosInfo1 *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->create_time"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->create_time)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->create_time = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_xattr_DosInfo1_get_change_time(PyObject *obj, void *closure) { struct xattr_DosInfo1 *object = (struct xattr_DosInfo1 *)pytalloc_get_ptr(obj); PyObject *py_change_time; py_change_time = PyLong_FromUnsignedLongLong(object->change_time); return py_change_time; } static int py_xattr_DosInfo1_set_change_time(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DosInfo1 *object = (struct xattr_DosInfo1 *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->change_time"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->change_time)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->change_time = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyGetSetDef py_xattr_DosInfo1_getsetters[] = { { .name = discard_const_p(char, "attrib"), .get = py_xattr_DosInfo1_get_attrib, .set = py_xattr_DosInfo1_set_attrib, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "ea_size"), .get = py_xattr_DosInfo1_get_ea_size, .set = py_xattr_DosInfo1_set_ea_size, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "size"), .get = py_xattr_DosInfo1_get_size, .set = py_xattr_DosInfo1_set_size, .doc = discard_const_p(char, "PIDL-generated element of base type udlong") }, { .name = discard_const_p(char, "alloc_size"), .get = py_xattr_DosInfo1_get_alloc_size, .set = py_xattr_DosInfo1_set_alloc_size, .doc = discard_const_p(char, "PIDL-generated element of base type udlong") }, { .name = discard_const_p(char, "create_time"), .get = py_xattr_DosInfo1_get_create_time, .set = py_xattr_DosInfo1_set_create_time, .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME") }, { .name = discard_const_p(char, "change_time"), .get = py_xattr_DosInfo1_get_change_time, .set = py_xattr_DosInfo1_set_change_time, .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME") }, { .name = NULL } }; static PyObject *py_xattr_DosInfo1_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return pytalloc_new(struct xattr_DosInfo1, type); } static PyTypeObject xattr_DosInfo1_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "xattr.DosInfo1", .tp_getset = py_xattr_DosInfo1_getsetters, .tp_methods = NULL, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_xattr_DosInfo1_new, }; static PyObject *py_xattr_DosInfo2Old_get_flags(PyObject *obj, void *closure) { struct xattr_DosInfo2Old *object = (struct xattr_DosInfo2Old *)pytalloc_get_ptr(obj); PyObject *py_flags; py_flags = PyLong_FromUnsignedLongLong((uint32_t)object->flags); return py_flags; } static int py_xattr_DosInfo2Old_set_flags(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DosInfo2Old *object = (struct xattr_DosInfo2Old *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->flags"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->flags)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->flags = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_xattr_DosInfo2Old_get_attrib(PyObject *obj, void *closure) { struct xattr_DosInfo2Old *object = (struct xattr_DosInfo2Old *)pytalloc_get_ptr(obj); PyObject *py_attrib; py_attrib = PyLong_FromUnsignedLongLong((uint32_t)object->attrib); return py_attrib; } static int py_xattr_DosInfo2Old_set_attrib(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DosInfo2Old *object = (struct xattr_DosInfo2Old *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->attrib"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->attrib)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->attrib = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_xattr_DosInfo2Old_get_ea_size(PyObject *obj, void *closure) { struct xattr_DosInfo2Old *object = (struct xattr_DosInfo2Old *)pytalloc_get_ptr(obj); PyObject *py_ea_size; py_ea_size = PyLong_FromUnsignedLongLong((uint32_t)object->ea_size); return py_ea_size; } static int py_xattr_DosInfo2Old_set_ea_size(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DosInfo2Old *object = (struct xattr_DosInfo2Old *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->ea_size"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->ea_size)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->ea_size = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_xattr_DosInfo2Old_get_size(PyObject *obj, void *closure) { struct xattr_DosInfo2Old *object = (struct xattr_DosInfo2Old *)pytalloc_get_ptr(obj); PyObject *py_size; py_size = PyLong_FromUnsignedLongLong(object->size); return py_size; } static int py_xattr_DosInfo2Old_set_size(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DosInfo2Old *object = (struct xattr_DosInfo2Old *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->size"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->size)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->size = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_xattr_DosInfo2Old_get_alloc_size(PyObject *obj, void *closure) { struct xattr_DosInfo2Old *object = (struct xattr_DosInfo2Old *)pytalloc_get_ptr(obj); PyObject *py_alloc_size; py_alloc_size = PyLong_FromUnsignedLongLong(object->alloc_size); return py_alloc_size; } static int py_xattr_DosInfo2Old_set_alloc_size(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DosInfo2Old *object = (struct xattr_DosInfo2Old *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->alloc_size"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->alloc_size)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->alloc_size = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_xattr_DosInfo2Old_get_create_time(PyObject *obj, void *closure) { struct xattr_DosInfo2Old *object = (struct xattr_DosInfo2Old *)pytalloc_get_ptr(obj); PyObject *py_create_time; py_create_time = PyLong_FromUnsignedLongLong(object->create_time); return py_create_time; } static int py_xattr_DosInfo2Old_set_create_time(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DosInfo2Old *object = (struct xattr_DosInfo2Old *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->create_time"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->create_time)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->create_time = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_xattr_DosInfo2Old_get_change_time(PyObject *obj, void *closure) { struct xattr_DosInfo2Old *object = (struct xattr_DosInfo2Old *)pytalloc_get_ptr(obj); PyObject *py_change_time; py_change_time = PyLong_FromUnsignedLongLong(object->change_time); return py_change_time; } static int py_xattr_DosInfo2Old_set_change_time(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DosInfo2Old *object = (struct xattr_DosInfo2Old *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->change_time"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->change_time)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->change_time = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_xattr_DosInfo2Old_get_write_time(PyObject *obj, void *closure) { struct xattr_DosInfo2Old *object = (struct xattr_DosInfo2Old *)pytalloc_get_ptr(obj); PyObject *py_write_time; py_write_time = PyLong_FromUnsignedLongLong(object->write_time); return py_write_time; } static int py_xattr_DosInfo2Old_set_write_time(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DosInfo2Old *object = (struct xattr_DosInfo2Old *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->write_time"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->write_time)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->write_time = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_xattr_DosInfo2Old_get_name(PyObject *obj, void *closure) { struct xattr_DosInfo2Old *object = (struct xattr_DosInfo2Old *)pytalloc_get_ptr(obj); PyObject *py_name; py_name = PyString_FromStringOrNULL(object->name); return py_name; } static int py_xattr_DosInfo2Old_set_name(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DosInfo2Old *object = (struct xattr_DosInfo2Old *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->name"); return -1; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(value)) { unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return -1; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(value)) { test_str = PyBytes_AS_STRING(value); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name); return -1; } talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str); if (unicode != NULL) { Py_DECREF(unicode); } if (talloc_str == NULL) { PyErr_NoMemory(); return -1; } object->name = talloc_str; } return 0; } static PyGetSetDef py_xattr_DosInfo2Old_getsetters[] = { { .name = discard_const_p(char, "flags"), .get = py_xattr_DosInfo2Old_get_flags, .set = py_xattr_DosInfo2Old_set_flags, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "attrib"), .get = py_xattr_DosInfo2Old_get_attrib, .set = py_xattr_DosInfo2Old_set_attrib, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "ea_size"), .get = py_xattr_DosInfo2Old_get_ea_size, .set = py_xattr_DosInfo2Old_set_ea_size, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "size"), .get = py_xattr_DosInfo2Old_get_size, .set = py_xattr_DosInfo2Old_set_size, .doc = discard_const_p(char, "PIDL-generated element of base type udlong") }, { .name = discard_const_p(char, "alloc_size"), .get = py_xattr_DosInfo2Old_get_alloc_size, .set = py_xattr_DosInfo2Old_set_alloc_size, .doc = discard_const_p(char, "PIDL-generated element of base type udlong") }, { .name = discard_const_p(char, "create_time"), .get = py_xattr_DosInfo2Old_get_create_time, .set = py_xattr_DosInfo2Old_set_create_time, .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME") }, { .name = discard_const_p(char, "change_time"), .get = py_xattr_DosInfo2Old_get_change_time, .set = py_xattr_DosInfo2Old_set_change_time, .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME") }, { .name = discard_const_p(char, "write_time"), .get = py_xattr_DosInfo2Old_get_write_time, .set = py_xattr_DosInfo2Old_set_write_time, .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME") }, { .name = discard_const_p(char, "name"), .get = py_xattr_DosInfo2Old_get_name, .set = py_xattr_DosInfo2Old_set_name, .doc = discard_const_p(char, "PIDL-generated element of base type string") }, { .name = NULL } }; static PyObject *py_xattr_DosInfo2Old_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return pytalloc_new(struct xattr_DosInfo2Old, type); } static PyTypeObject xattr_DosInfo2Old_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "xattr.DosInfo2Old", .tp_getset = py_xattr_DosInfo2Old_getsetters, .tp_methods = NULL, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_xattr_DosInfo2Old_new, }; static PyObject *py_xattr_DosInfo3_get_valid_flags(PyObject *obj, void *closure) { struct xattr_DosInfo3 *object = (struct xattr_DosInfo3 *)pytalloc_get_ptr(obj); PyObject *py_valid_flags; py_valid_flags = PyLong_FromUnsignedLongLong((uint32_t)object->valid_flags); return py_valid_flags; } static int py_xattr_DosInfo3_set_valid_flags(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DosInfo3 *object = (struct xattr_DosInfo3 *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->valid_flags"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->valid_flags)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->valid_flags = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_xattr_DosInfo3_get_attrib(PyObject *obj, void *closure) { struct xattr_DosInfo3 *object = (struct xattr_DosInfo3 *)pytalloc_get_ptr(obj); PyObject *py_attrib; py_attrib = PyLong_FromUnsignedLongLong((uint32_t)object->attrib); return py_attrib; } static int py_xattr_DosInfo3_set_attrib(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DosInfo3 *object = (struct xattr_DosInfo3 *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->attrib"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->attrib)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->attrib = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_xattr_DosInfo3_get_ea_size(PyObject *obj, void *closure) { struct xattr_DosInfo3 *object = (struct xattr_DosInfo3 *)pytalloc_get_ptr(obj); PyObject *py_ea_size; py_ea_size = PyLong_FromUnsignedLongLong((uint32_t)object->ea_size); return py_ea_size; } static int py_xattr_DosInfo3_set_ea_size(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DosInfo3 *object = (struct xattr_DosInfo3 *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->ea_size"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->ea_size)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->ea_size = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_xattr_DosInfo3_get_size(PyObject *obj, void *closure) { struct xattr_DosInfo3 *object = (struct xattr_DosInfo3 *)pytalloc_get_ptr(obj); PyObject *py_size; py_size = PyLong_FromUnsignedLongLong(object->size); return py_size; } static int py_xattr_DosInfo3_set_size(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DosInfo3 *object = (struct xattr_DosInfo3 *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->size"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->size)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->size = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_xattr_DosInfo3_get_alloc_size(PyObject *obj, void *closure) { struct xattr_DosInfo3 *object = (struct xattr_DosInfo3 *)pytalloc_get_ptr(obj); PyObject *py_alloc_size; py_alloc_size = PyLong_FromUnsignedLongLong(object->alloc_size); return py_alloc_size; } static int py_xattr_DosInfo3_set_alloc_size(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DosInfo3 *object = (struct xattr_DosInfo3 *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->alloc_size"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->alloc_size)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->alloc_size = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_xattr_DosInfo3_get_create_time(PyObject *obj, void *closure) { struct xattr_DosInfo3 *object = (struct xattr_DosInfo3 *)pytalloc_get_ptr(obj); PyObject *py_create_time; py_create_time = PyLong_FromUnsignedLongLong(object->create_time); return py_create_time; } static int py_xattr_DosInfo3_set_create_time(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DosInfo3 *object = (struct xattr_DosInfo3 *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->create_time"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->create_time)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->create_time = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_xattr_DosInfo3_get_change_time(PyObject *obj, void *closure) { struct xattr_DosInfo3 *object = (struct xattr_DosInfo3 *)pytalloc_get_ptr(obj); PyObject *py_change_time; py_change_time = PyLong_FromUnsignedLongLong(object->change_time); return py_change_time; } static int py_xattr_DosInfo3_set_change_time(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DosInfo3 *object = (struct xattr_DosInfo3 *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->change_time"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->change_time)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->change_time = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyGetSetDef py_xattr_DosInfo3_getsetters[] = { { .name = discard_const_p(char, "valid_flags"), .get = py_xattr_DosInfo3_get_valid_flags, .set = py_xattr_DosInfo3_set_valid_flags, .doc = discard_const_p(char, "PIDL-generated element of base type xattr_DosInfoValidFlags") }, { .name = discard_const_p(char, "attrib"), .get = py_xattr_DosInfo3_get_attrib, .set = py_xattr_DosInfo3_set_attrib, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "ea_size"), .get = py_xattr_DosInfo3_get_ea_size, .set = py_xattr_DosInfo3_set_ea_size, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "size"), .get = py_xattr_DosInfo3_get_size, .set = py_xattr_DosInfo3_set_size, .doc = discard_const_p(char, "PIDL-generated element of base type udlong") }, { .name = discard_const_p(char, "alloc_size"), .get = py_xattr_DosInfo3_get_alloc_size, .set = py_xattr_DosInfo3_set_alloc_size, .doc = discard_const_p(char, "PIDL-generated element of base type udlong") }, { .name = discard_const_p(char, "create_time"), .get = py_xattr_DosInfo3_get_create_time, .set = py_xattr_DosInfo3_set_create_time, .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME") }, { .name = discard_const_p(char, "change_time"), .get = py_xattr_DosInfo3_get_change_time, .set = py_xattr_DosInfo3_set_change_time, .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME") }, { .name = NULL } }; static PyObject *py_xattr_DosInfo3_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return pytalloc_new(struct xattr_DosInfo3, type); } static PyTypeObject xattr_DosInfo3_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "xattr.DosInfo3", .tp_getset = py_xattr_DosInfo3_getsetters, .tp_methods = NULL, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_xattr_DosInfo3_new, }; static PyObject *py_xattr_DosInfo4_get_valid_flags(PyObject *obj, void *closure) { struct xattr_DosInfo4 *object = (struct xattr_DosInfo4 *)pytalloc_get_ptr(obj); PyObject *py_valid_flags; py_valid_flags = PyLong_FromUnsignedLongLong((uint32_t)object->valid_flags); return py_valid_flags; } static int py_xattr_DosInfo4_set_valid_flags(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DosInfo4 *object = (struct xattr_DosInfo4 *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->valid_flags"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->valid_flags)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->valid_flags = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_xattr_DosInfo4_get_attrib(PyObject *obj, void *closure) { struct xattr_DosInfo4 *object = (struct xattr_DosInfo4 *)pytalloc_get_ptr(obj); PyObject *py_attrib; py_attrib = PyLong_FromUnsignedLongLong((uint32_t)object->attrib); return py_attrib; } static int py_xattr_DosInfo4_set_attrib(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DosInfo4 *object = (struct xattr_DosInfo4 *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->attrib"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->attrib)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->attrib = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_xattr_DosInfo4_get_itime(PyObject *obj, void *closure) { struct xattr_DosInfo4 *object = (struct xattr_DosInfo4 *)pytalloc_get_ptr(obj); PyObject *py_itime; py_itime = PyLong_FromUnsignedLongLong(object->itime); return py_itime; } static int py_xattr_DosInfo4_set_itime(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DosInfo4 *object = (struct xattr_DosInfo4 *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->itime"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->itime)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->itime = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_xattr_DosInfo4_get_create_time(PyObject *obj, void *closure) { struct xattr_DosInfo4 *object = (struct xattr_DosInfo4 *)pytalloc_get_ptr(obj); PyObject *py_create_time; py_create_time = PyLong_FromUnsignedLongLong(object->create_time); return py_create_time; } static int py_xattr_DosInfo4_set_create_time(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DosInfo4 *object = (struct xattr_DosInfo4 *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->create_time"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->create_time)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->create_time = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyGetSetDef py_xattr_DosInfo4_getsetters[] = { { .name = discard_const_p(char, "valid_flags"), .get = py_xattr_DosInfo4_get_valid_flags, .set = py_xattr_DosInfo4_set_valid_flags, .doc = discard_const_p(char, "PIDL-generated element of base type xattr_DosInfoValidFlags") }, { .name = discard_const_p(char, "attrib"), .get = py_xattr_DosInfo4_get_attrib, .set = py_xattr_DosInfo4_set_attrib, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "itime"), .get = py_xattr_DosInfo4_get_itime, .set = py_xattr_DosInfo4_set_itime, .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME") }, { .name = discard_const_p(char, "create_time"), .get = py_xattr_DosInfo4_get_create_time, .set = py_xattr_DosInfo4_set_create_time, .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME") }, { .name = NULL } }; static PyObject *py_xattr_DosInfo4_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return pytalloc_new(struct xattr_DosInfo4, type); } static PyTypeObject xattr_DosInfo4_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "xattr.DosInfo4", .tp_getset = py_xattr_DosInfo4_getsetters, .tp_methods = NULL, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_xattr_DosInfo4_new, }; static PyObject *py_import_xattr_DosInfo(TALLOC_CTX *mem_ctx, int level, union xattr_DosInfo *in) { PyObject *ret; switch (level) { case 0xFFFF: ret = pytalloc_reference_ex(&xattr_DosInfoFFFFCompat_Type, mem_ctx, &in->compatinfoFFFF); return ret; case 1: ret = pytalloc_reference_ex(&xattr_DosInfo1_Type, mem_ctx, &in->info1); return ret; case 2: ret = pytalloc_reference_ex(&xattr_DosInfo2Old_Type, mem_ctx, &in->oldinfo2); return ret; case 3: ret = pytalloc_reference_ex(&xattr_DosInfo3_Type, mem_ctx, &in->info3); return ret; case 4: ret = pytalloc_reference_ex(&xattr_DosInfo4_Type, mem_ctx, &in->info4); return ret; } PyErr_SetString(PyExc_TypeError, "unknown union level"); return NULL; } static union xattr_DosInfo *py_export_xattr_DosInfo(TALLOC_CTX *mem_ctx, int level, PyObject *in) { union xattr_DosInfo *ret = talloc_zero(mem_ctx, union xattr_DosInfo); switch (level) { case 0xFFFF: if (in == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->compatinfoFFFF"); talloc_free(ret); return NULL; } PY_CHECK_TYPE(&xattr_DosInfoFFFFCompat_Type, in, talloc_free(ret); return NULL;); if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) { PyErr_NoMemory(); talloc_free(ret); return NULL; } ret->compatinfoFFFF = *(struct xattr_DosInfoFFFFCompat *)pytalloc_get_ptr(in); break; case 1: if (in == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->info1"); talloc_free(ret); return NULL; } PY_CHECK_TYPE(&xattr_DosInfo1_Type, in, talloc_free(ret); return NULL;); if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) { PyErr_NoMemory(); talloc_free(ret); return NULL; } ret->info1 = *(struct xattr_DosInfo1 *)pytalloc_get_ptr(in); break; case 2: if (in == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->oldinfo2"); talloc_free(ret); return NULL; } PY_CHECK_TYPE(&xattr_DosInfo2Old_Type, in, talloc_free(ret); return NULL;); if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) { PyErr_NoMemory(); talloc_free(ret); return NULL; } ret->oldinfo2 = *(struct xattr_DosInfo2Old *)pytalloc_get_ptr(in); break; case 3: if (in == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->info3"); talloc_free(ret); return NULL; } PY_CHECK_TYPE(&xattr_DosInfo3_Type, in, talloc_free(ret); return NULL;); if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) { PyErr_NoMemory(); talloc_free(ret); return NULL; } ret->info3 = *(struct xattr_DosInfo3 *)pytalloc_get_ptr(in); break; case 4: if (in == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->info4"); talloc_free(ret); return NULL; } PY_CHECK_TYPE(&xattr_DosInfo4_Type, in, talloc_free(ret); return NULL;); if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) { PyErr_NoMemory(); talloc_free(ret); return NULL; } ret->info4 = *(struct xattr_DosInfo4 *)pytalloc_get_ptr(in); break; default: PyErr_SetString(PyExc_TypeError, "invalid union level value"); talloc_free(ret); ret = NULL; } return ret; } static PyObject *py_xattr_DosInfo_import(PyTypeObject *type, PyObject *args, PyObject *kwargs) { const char * const kwnames[] = { "mem_ctx", "level", "in", NULL }; PyObject *mem_ctx_obj = NULL; TALLOC_CTX *mem_ctx = NULL; int level = 0; PyObject *in_obj = NULL; union xattr_DosInfo *in = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:import", discard_const_p(char *, kwnames), &mem_ctx_obj, &level, &in_obj)) { return NULL; } mem_ctx = pytalloc_get_ptr(mem_ctx_obj); if (mem_ctx == NULL) { PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!"); return NULL; } in = (union xattr_DosInfo *)pytalloc_get_ptr(in_obj); if (in == NULL) { PyErr_Format(PyExc_TypeError, "in needs to be a pointer to union xattr_DosInfo!"); return NULL; } return py_import_xattr_DosInfo(mem_ctx, level, in); } static PyObject *py_xattr_DosInfo_export(PyTypeObject *type, PyObject *args, PyObject *kwargs) { const char * const kwnames[] = { "mem_ctx", "level", "in", NULL }; PyObject *mem_ctx_obj = NULL; TALLOC_CTX *mem_ctx = NULL; int level = 0; PyObject *in = NULL; union xattr_DosInfo *out = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:export", discard_const_p(char *, kwnames), &mem_ctx_obj, &level, &in)) { return NULL; } mem_ctx = pytalloc_get_ptr(mem_ctx_obj); if (mem_ctx == NULL) { PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!"); return NULL; } out = py_export_xattr_DosInfo(mem_ctx, level, in); if (out == NULL) { return NULL; } return pytalloc_GenericObject_reference(out); } static PyMethodDef py_xattr_DosInfo_methods[] = { { "__import__", PY_DISCARD_FUNC_SIG(PyCFunction,py_xattr_DosInfo_import), METH_VARARGS|METH_KEYWORDS|METH_CLASS, "T.__import__(mem_ctx, level, in) => ret." }, { "__export__", PY_DISCARD_FUNC_SIG(PyCFunction,py_xattr_DosInfo_export), METH_VARARGS|METH_KEYWORDS|METH_CLASS, "T.__export__(mem_ctx, level, in) => ret." }, { NULL, NULL, 0, NULL } }; static PyObject *py_xattr_DosInfo_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyErr_Format(PyExc_TypeError, "New %s Objects are not supported", type->tp_name); return NULL; } static PyTypeObject xattr_DosInfo_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "xattr.DosInfo", .tp_getset = NULL, .tp_methods = py_xattr_DosInfo_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_xattr_DosInfo_new, }; static PyObject *py_xattr_DosAttrib_get_version(PyObject *obj, void *closure) { struct xattr_DosAttrib *object = (struct xattr_DosAttrib *)pytalloc_get_ptr(obj); PyObject *py_version; py_version = PyLong_FromLong((uint16_t)object->version); return py_version; } static int py_xattr_DosAttrib_set_version(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DosAttrib *object = (struct xattr_DosAttrib *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->version"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->version)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->version = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_xattr_DosAttrib_get_info(PyObject *obj, void *closure) { struct xattr_DosAttrib *object = (struct xattr_DosAttrib *)pytalloc_get_ptr(obj); PyObject *py_info; py_info = pyrpc_import_union(&xattr_DosInfo_Type, pytalloc_get_mem_ctx(obj), object->version, &object->info, "union xattr_DosInfo"); if (py_info == NULL) { return NULL; } return py_info; } static int py_xattr_DosAttrib_set_info(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DosAttrib *object = (struct xattr_DosAttrib *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->info"); return -1; } { union xattr_DosInfo *info_switch_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"); if (info_switch_0 == NULL) { return -1; } object->info = *info_switch_0; } return 0; } static PyGetSetDef py_xattr_DosAttrib_getsetters[] = { { .name = discard_const_p(char, "version"), .get = py_xattr_DosAttrib_get_version, .set = py_xattr_DosAttrib_set_version, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "info"), .get = py_xattr_DosAttrib_get_info, .set = py_xattr_DosAttrib_set_info, .doc = discard_const_p(char, "PIDL-generated element of base type xattr_DosInfo") }, { .name = NULL } }; static PyObject *py_xattr_DosAttrib_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return pytalloc_new(struct xattr_DosAttrib, type); } static PyObject *py_xattr_DosAttrib_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { struct xattr_DosAttrib *object = (struct xattr_DosAttrib *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; DATA_BLOB blob; enum ndr_err_code err; TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj)); if (tmp_ctx == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_xattr_DosAttrib); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(tmp_ctx); PyErr_SetNdrError(err); return NULL; } ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length); TALLOC_FREE(tmp_ctx); return ret; } static PyObject *py_xattr_DosAttrib_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs) { struct xattr_DosAttrib *object = (struct xattr_DosAttrib *)pytalloc_get_ptr(py_obj); DATA_BLOB blob = {.data = NULL, .length = 0}; Py_ssize_t blob_length = 0; enum ndr_err_code err; const char * const kwnames[] = { "data_blob", "allow_remaining", NULL }; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } if (allow_remaining) { err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_xattr_DosAttrib); } else { err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_xattr_DosAttrib); } if (!NDR_ERR_CODE_IS_SUCCESS(err)) { PyErr_SetNdrError(err); return NULL; } Py_RETURN_NONE; } static PyObject *py_xattr_DosAttrib_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { struct xattr_DosAttrib *object = (struct xattr_DosAttrib *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_xattr_DosAttrib, "xattr_DosAttrib", object); ret = PyUnicode_FromString(retstr); talloc_free(retstr); return ret; } static PyMethodDef py_xattr_DosAttrib_methods[] = { { "__ndr_pack__", (PyCFunction)py_xattr_DosAttrib_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" }, { "__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" }, { "__ndr_print__", (PyCFunction)py_xattr_DosAttrib_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" }, { NULL, NULL, 0, NULL } }; static PyTypeObject xattr_DosAttrib_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "xattr.DosAttrib", .tp_getset = py_xattr_DosAttrib_getsetters, .tp_methods = py_xattr_DosAttrib_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_xattr_DosAttrib_new, }; static PyObject *py_xattr_DOSATTRIB_get_attrib_hex(PyObject *obj, void *closure) { struct xattr_DOSATTRIB *object = (struct xattr_DOSATTRIB *)pytalloc_get_ptr(obj); PyObject *py_attrib_hex; py_attrib_hex = PyString_FromStringOrNULL(object->attrib_hex); return py_attrib_hex; } static int py_xattr_DOSATTRIB_set_attrib_hex(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DOSATTRIB *object = (struct xattr_DOSATTRIB *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->attrib_hex"); return -1; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(value)) { unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return -1; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(value)) { test_str = PyBytes_AS_STRING(value); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name); return -1; } talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str); if (unicode != NULL) { Py_DECREF(unicode); } if (talloc_str == NULL) { PyErr_NoMemory(); return -1; } object->attrib_hex = talloc_str; } return 0; } static PyObject *py_xattr_DOSATTRIB_get_version(PyObject *obj, void *closure) { struct xattr_DOSATTRIB *object = (struct xattr_DOSATTRIB *)pytalloc_get_ptr(obj); PyObject *py_version; py_version = PyLong_FromLong((uint16_t)object->version); return py_version; } static int py_xattr_DOSATTRIB_set_version(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DOSATTRIB *object = (struct xattr_DOSATTRIB *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->version"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->version)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->version = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_xattr_DOSATTRIB_get_info(PyObject *obj, void *closure) { struct xattr_DOSATTRIB *object = (struct xattr_DOSATTRIB *)pytalloc_get_ptr(obj); PyObject *py_info; py_info = pyrpc_import_union(&xattr_DosInfo_Type, pytalloc_get_mem_ctx(obj), object->version, &object->info, "union xattr_DosInfo"); if (py_info == NULL) { return NULL; } return py_info; } static int py_xattr_DOSATTRIB_set_info(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DOSATTRIB *object = (struct xattr_DOSATTRIB *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->info"); return -1; } { union xattr_DosInfo *info_switch_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"); if (info_switch_0 == NULL) { return -1; } object->info = *info_switch_0; } return 0; } static PyGetSetDef py_xattr_DOSATTRIB_getsetters[] = { { .name = discard_const_p(char, "attrib_hex"), .get = py_xattr_DOSATTRIB_get_attrib_hex, .set = py_xattr_DOSATTRIB_set_attrib_hex, .doc = discard_const_p(char, "PIDL-generated element of base type string") }, { .name = discard_const_p(char, "version"), .get = py_xattr_DOSATTRIB_get_version, .set = py_xattr_DOSATTRIB_set_version, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "info"), .get = py_xattr_DOSATTRIB_get_info, .set = py_xattr_DOSATTRIB_set_info, .doc = discard_const_p(char, "PIDL-generated element of base type xattr_DosInfo") }, { .name = NULL } }; static PyObject *py_xattr_DOSATTRIB_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return pytalloc_new(struct xattr_DOSATTRIB, type); } static PyObject *py_xattr_DOSATTRIB_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { struct xattr_DOSATTRIB *object = (struct xattr_DOSATTRIB *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; DATA_BLOB blob; enum ndr_err_code err; TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj)); if (tmp_ctx == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_xattr_DOSATTRIB); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(tmp_ctx); PyErr_SetNdrError(err); return NULL; } ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length); TALLOC_FREE(tmp_ctx); return ret; } static PyObject *py_xattr_DOSATTRIB_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs) { struct xattr_DOSATTRIB *object = (struct xattr_DOSATTRIB *)pytalloc_get_ptr(py_obj); DATA_BLOB blob = {.data = NULL, .length = 0}; Py_ssize_t blob_length = 0; enum ndr_err_code err; const char * const kwnames[] = { "data_blob", "allow_remaining", NULL }; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } if (allow_remaining) { err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_xattr_DOSATTRIB); } else { err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_xattr_DOSATTRIB); } if (!NDR_ERR_CODE_IS_SUCCESS(err)) { PyErr_SetNdrError(err); return NULL; } Py_RETURN_NONE; } static PyObject *py_xattr_DOSATTRIB_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { struct xattr_DOSATTRIB *object = (struct xattr_DOSATTRIB *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_xattr_DOSATTRIB, "xattr_DOSATTRIB", object); ret = PyUnicode_FromString(retstr); talloc_free(retstr); return ret; } static PyMethodDef py_xattr_DOSATTRIB_methods[] = { { "__ndr_pack__", (PyCFunction)py_xattr_DOSATTRIB_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" }, { "__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" }, { "__ndr_print__", (PyCFunction)py_xattr_DOSATTRIB_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" }, { NULL, NULL, 0, NULL } }; static PyTypeObject xattr_DOSATTRIB_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "xattr.DOSATTRIB", .tp_getset = py_xattr_DOSATTRIB_getsetters, .tp_methods = py_xattr_DOSATTRIB_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_xattr_DOSATTRIB_new, }; static PyObject *py_xattr_EA_get_name(PyObject *obj, void *closure) { struct xattr_EA *object = (struct xattr_EA *)pytalloc_get_ptr(obj); PyObject *py_name; py_name = PyString_FromStringOrNULL(object->name); return py_name; } static int py_xattr_EA_set_name(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_EA *object = (struct xattr_EA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->name"); return -1; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(value)) { unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return -1; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(value)) { test_str = PyBytes_AS_STRING(value); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name); return -1; } talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str); if (unicode != NULL) { Py_DECREF(unicode); } if (talloc_str == NULL) { PyErr_NoMemory(); return -1; } object->name = talloc_str; } return 0; } static PyObject *py_xattr_EA_get_value(PyObject *obj, void *closure) { struct xattr_EA *object = (struct xattr_EA *)pytalloc_get_ptr(obj); PyObject *py_value; py_value = PyBytes_FromStringAndSize((char *)(object->value).data, (object->value).length); return py_value; } static int py_xattr_EA_set_value(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_EA *object = (struct xattr_EA *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->value"); return -1; } object->value = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value)); return 0; } static PyGetSetDef py_xattr_EA_getsetters[] = { { .name = discard_const_p(char, "name"), .get = py_xattr_EA_get_name, .set = py_xattr_EA_set_name, .doc = discard_const_p(char, "PIDL-generated element of base type string") }, { .name = discard_const_p(char, "value"), .get = py_xattr_EA_get_value, .set = py_xattr_EA_set_value, .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB") }, { .name = NULL } }; static PyObject *py_xattr_EA_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return pytalloc_new(struct xattr_EA, type); } static PyTypeObject xattr_EA_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "xattr.EA", .tp_getset = py_xattr_EA_getsetters, .tp_methods = NULL, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_xattr_EA_new, }; static PyObject *py_xattr_DosEAs_get_num_eas(PyObject *obj, void *closure) { struct xattr_DosEAs *object = (struct xattr_DosEAs *)pytalloc_get_ptr(obj); PyObject *py_num_eas; py_num_eas = PyLong_FromLong((uint16_t)object->num_eas); return py_num_eas; } static int py_xattr_DosEAs_set_num_eas(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DosEAs *object = (struct xattr_DosEAs *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->num_eas"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->num_eas)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->num_eas = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_xattr_DosEAs_get_eas(PyObject *obj, void *closure) { struct xattr_DosEAs *object = (struct xattr_DosEAs *)pytalloc_get_ptr(obj); PyObject *py_eas; if (object->eas == NULL) { Py_RETURN_NONE; } if (object->eas == NULL) { py_eas = Py_None; Py_INCREF(py_eas); } else { py_eas = PyList_New(object->num_eas); if (py_eas == NULL) { return NULL; } { int eas_cntr_1; for (eas_cntr_1 = 0; eas_cntr_1 < (object->num_eas); eas_cntr_1++) { PyObject *py_eas_1; py_eas_1 = pytalloc_reference_ex(&xattr_EA_Type, object->eas, &object->eas[eas_cntr_1]); PyList_SetItem(py_eas, eas_cntr_1, py_eas_1); } } } return py_eas; } static int py_xattr_DosEAs_set_eas(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DosEAs *object = (struct xattr_DosEAs *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->eas)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->eas"); return -1; } if (value == Py_None) { object->eas = NULL; } else { object->eas = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int eas_cntr_1; object->eas = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->eas, PyList_GET_SIZE(value)); if (!object->eas) { return -1;; } talloc_set_name_const(object->eas, "ARRAY: object->eas"); for (eas_cntr_1 = 0; eas_cntr_1 < PyList_GET_SIZE(value); eas_cntr_1++) { if (PyList_GET_ITEM(value, eas_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->eas[eas_cntr_1]"); return -1; } PY_CHECK_TYPE(&xattr_EA_Type, PyList_GET_ITEM(value, eas_cntr_1), return -1;); if (talloc_reference(object->eas, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, eas_cntr_1))) == NULL) { PyErr_NoMemory(); return -1; } object->eas[eas_cntr_1] = *(struct xattr_EA *)pytalloc_get_ptr(PyList_GET_ITEM(value, eas_cntr_1)); } } } return 0; } static PyGetSetDef py_xattr_DosEAs_getsetters[] = { { .name = discard_const_p(char, "num_eas"), .get = py_xattr_DosEAs_get_num_eas, .set = py_xattr_DosEAs_set_num_eas, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "eas"), .get = py_xattr_DosEAs_get_eas, .set = py_xattr_DosEAs_set_eas, .doc = discard_const_p(char, "PIDL-generated element of base type xattr_EA") }, { .name = NULL } }; static PyObject *py_xattr_DosEAs_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return pytalloc_new(struct xattr_DosEAs, type); } static PyObject *py_xattr_DosEAs_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { struct xattr_DosEAs *object = (struct xattr_DosEAs *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; DATA_BLOB blob; enum ndr_err_code err; TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj)); if (tmp_ctx == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_xattr_DosEAs); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(tmp_ctx); PyErr_SetNdrError(err); return NULL; } ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length); TALLOC_FREE(tmp_ctx); return ret; } static PyObject *py_xattr_DosEAs_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs) { struct xattr_DosEAs *object = (struct xattr_DosEAs *)pytalloc_get_ptr(py_obj); DATA_BLOB blob = {.data = NULL, .length = 0}; Py_ssize_t blob_length = 0; enum ndr_err_code err; const char * const kwnames[] = { "data_blob", "allow_remaining", NULL }; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } if (allow_remaining) { err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_xattr_DosEAs); } else { err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_xattr_DosEAs); } if (!NDR_ERR_CODE_IS_SUCCESS(err)) { PyErr_SetNdrError(err); return NULL; } Py_RETURN_NONE; } static PyObject *py_xattr_DosEAs_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { struct xattr_DosEAs *object = (struct xattr_DosEAs *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_xattr_DosEAs, "xattr_DosEAs", object); ret = PyUnicode_FromString(retstr); talloc_free(retstr); return ret; } static PyMethodDef py_xattr_DosEAs_methods[] = { { "__ndr_pack__", (PyCFunction)py_xattr_DosEAs_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" }, { "__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" }, { "__ndr_print__", (PyCFunction)py_xattr_DosEAs_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" }, { NULL, NULL, 0, NULL } }; static PyTypeObject xattr_DosEAs_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "xattr.DosEAs", .tp_getset = py_xattr_DosEAs_getsetters, .tp_methods = py_xattr_DosEAs_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_xattr_DosEAs_new, }; static PyObject *py_tdb_xattrs_get_num_eas(PyObject *obj, void *closure) { struct tdb_xattrs *object = (struct tdb_xattrs *)pytalloc_get_ptr(obj); PyObject *py_num_eas; py_num_eas = PyLong_FromUnsignedLongLong((uint32_t)object->num_eas); return py_num_eas; } static int py_tdb_xattrs_set_num_eas(PyObject *py_obj, PyObject *value, void *closure) { struct tdb_xattrs *object = (struct tdb_xattrs *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->num_eas"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->num_eas)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->num_eas = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_tdb_xattrs_get_eas(PyObject *obj, void *closure) { struct tdb_xattrs *object = (struct tdb_xattrs *)pytalloc_get_ptr(obj); PyObject *py_eas; py_eas = PyList_New(object->num_eas); if (py_eas == NULL) { return NULL; } { int eas_cntr_0; for (eas_cntr_0 = 0; eas_cntr_0 < (object->num_eas); eas_cntr_0++) { PyObject *py_eas_0; py_eas_0 = pytalloc_reference_ex(&xattr_EA_Type, object->eas, &object->eas[eas_cntr_0]); PyList_SetItem(py_eas, eas_cntr_0, py_eas_0); } } return py_eas; } static int py_tdb_xattrs_set_eas(PyObject *py_obj, PyObject *value, void *closure) { struct tdb_xattrs *object = (struct tdb_xattrs *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->eas"); return -1; } PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int eas_cntr_0; object->eas = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->eas, PyList_GET_SIZE(value)); if (!object->eas) { return -1;; } talloc_set_name_const(object->eas, "ARRAY: object->eas"); for (eas_cntr_0 = 0; eas_cntr_0 < PyList_GET_SIZE(value); eas_cntr_0++) { if (PyList_GET_ITEM(value, eas_cntr_0) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->eas[eas_cntr_0]"); return -1; } PY_CHECK_TYPE(&xattr_EA_Type, PyList_GET_ITEM(value, eas_cntr_0), return -1;); if (talloc_reference(object->eas, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, eas_cntr_0))) == NULL) { PyErr_NoMemory(); return -1; } object->eas[eas_cntr_0] = *(struct xattr_EA *)pytalloc_get_ptr(PyList_GET_ITEM(value, eas_cntr_0)); } } return 0; } static PyGetSetDef py_tdb_xattrs_getsetters[] = { { .name = discard_const_p(char, "num_eas"), .get = py_tdb_xattrs_get_num_eas, .set = py_tdb_xattrs_set_num_eas, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "eas"), .get = py_tdb_xattrs_get_eas, .set = py_tdb_xattrs_set_eas, .doc = discard_const_p(char, "PIDL-generated element of base type xattr_EA") }, { .name = NULL } }; static PyObject *py_tdb_xattrs_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return pytalloc_new(struct tdb_xattrs, type); } static PyObject *py_tdb_xattrs_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { struct tdb_xattrs *object = (struct tdb_xattrs *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; DATA_BLOB blob; enum ndr_err_code err; TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj)); if (tmp_ctx == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_tdb_xattrs); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(tmp_ctx); PyErr_SetNdrError(err); return NULL; } ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length); TALLOC_FREE(tmp_ctx); return ret; } static PyObject *py_tdb_xattrs_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs) { struct tdb_xattrs *object = (struct tdb_xattrs *)pytalloc_get_ptr(py_obj); DATA_BLOB blob = {.data = NULL, .length = 0}; Py_ssize_t blob_length = 0; enum ndr_err_code err; const char * const kwnames[] = { "data_blob", "allow_remaining", NULL }; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } if (allow_remaining) { err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_tdb_xattrs); } else { err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_tdb_xattrs); } if (!NDR_ERR_CODE_IS_SUCCESS(err)) { PyErr_SetNdrError(err); return NULL; } Py_RETURN_NONE; } static PyObject *py_tdb_xattrs_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { struct tdb_xattrs *object = (struct tdb_xattrs *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_tdb_xattrs, "tdb_xattrs", object); ret = PyUnicode_FromString(retstr); talloc_free(retstr); return ret; } static PyMethodDef py_tdb_xattrs_methods[] = { { "__ndr_pack__", (PyCFunction)py_tdb_xattrs_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" }, { "__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" }, { "__ndr_print__", (PyCFunction)py_tdb_xattrs_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" }, { NULL, NULL, 0, NULL } }; static PyTypeObject tdb_xattrs_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "xattr.tdb_xattrs", .tp_getset = py_tdb_xattrs_getsetters, .tp_methods = py_tdb_xattrs_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_tdb_xattrs_new, }; static PyObject *py_xattr_DosStream_get_flags(PyObject *obj, void *closure) { struct xattr_DosStream *object = (struct xattr_DosStream *)pytalloc_get_ptr(obj); PyObject *py_flags; py_flags = PyLong_FromUnsignedLongLong((uint32_t)object->flags); return py_flags; } static int py_xattr_DosStream_set_flags(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DosStream *object = (struct xattr_DosStream *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->flags"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->flags)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->flags = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_xattr_DosStream_get_size(PyObject *obj, void *closure) { struct xattr_DosStream *object = (struct xattr_DosStream *)pytalloc_get_ptr(obj); PyObject *py_size; py_size = PyLong_FromUnsignedLongLong(object->size); return py_size; } static int py_xattr_DosStream_set_size(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DosStream *object = (struct xattr_DosStream *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->size"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->size)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->size = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_xattr_DosStream_get_alloc_size(PyObject *obj, void *closure) { struct xattr_DosStream *object = (struct xattr_DosStream *)pytalloc_get_ptr(obj); PyObject *py_alloc_size; py_alloc_size = PyLong_FromUnsignedLongLong(object->alloc_size); return py_alloc_size; } static int py_xattr_DosStream_set_alloc_size(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DosStream *object = (struct xattr_DosStream *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->alloc_size"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->alloc_size)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->alloc_size = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_xattr_DosStream_get_name(PyObject *obj, void *closure) { struct xattr_DosStream *object = (struct xattr_DosStream *)pytalloc_get_ptr(obj); PyObject *py_name; py_name = PyString_FromStringOrNULL(object->name); return py_name; } static int py_xattr_DosStream_set_name(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DosStream *object = (struct xattr_DosStream *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->name"); return -1; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(value)) { unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return -1; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(value)) { test_str = PyBytes_AS_STRING(value); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name); return -1; } talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str); if (unicode != NULL) { Py_DECREF(unicode); } if (talloc_str == NULL) { PyErr_NoMemory(); return -1; } object->name = talloc_str; } return 0; } static PyGetSetDef py_xattr_DosStream_getsetters[] = { { .name = discard_const_p(char, "flags"), .get = py_xattr_DosStream_get_flags, .set = py_xattr_DosStream_set_flags, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "size"), .get = py_xattr_DosStream_get_size, .set = py_xattr_DosStream_set_size, .doc = discard_const_p(char, "PIDL-generated element of base type udlong") }, { .name = discard_const_p(char, "alloc_size"), .get = py_xattr_DosStream_get_alloc_size, .set = py_xattr_DosStream_set_alloc_size, .doc = discard_const_p(char, "PIDL-generated element of base type udlong") }, { .name = discard_const_p(char, "name"), .get = py_xattr_DosStream_get_name, .set = py_xattr_DosStream_set_name, .doc = discard_const_p(char, "PIDL-generated element of base type string") }, { .name = NULL } }; static PyObject *py_xattr_DosStream_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return pytalloc_new(struct xattr_DosStream, type); } static PyTypeObject xattr_DosStream_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "xattr.DosStream", .tp_getset = py_xattr_DosStream_getsetters, .tp_methods = NULL, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_xattr_DosStream_new, }; static PyObject *py_xattr_DosStreams_get_num_streams(PyObject *obj, void *closure) { struct xattr_DosStreams *object = (struct xattr_DosStreams *)pytalloc_get_ptr(obj); PyObject *py_num_streams; py_num_streams = PyLong_FromUnsignedLongLong((uint32_t)object->num_streams); return py_num_streams; } static int py_xattr_DosStreams_set_num_streams(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DosStreams *object = (struct xattr_DosStreams *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->num_streams"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->num_streams)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->num_streams = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_xattr_DosStreams_get_streams(PyObject *obj, void *closure) { struct xattr_DosStreams *object = (struct xattr_DosStreams *)pytalloc_get_ptr(obj); PyObject *py_streams; if (object->streams == NULL) { Py_RETURN_NONE; } if (object->streams == NULL) { py_streams = Py_None; Py_INCREF(py_streams); } else { py_streams = PyList_New(object->num_streams); if (py_streams == NULL) { return NULL; } { int streams_cntr_1; for (streams_cntr_1 = 0; streams_cntr_1 < (object->num_streams); streams_cntr_1++) { PyObject *py_streams_1; py_streams_1 = pytalloc_reference_ex(&xattr_DosStream_Type, object->streams, &object->streams[streams_cntr_1]); PyList_SetItem(py_streams, streams_cntr_1, py_streams_1); } } } return py_streams; } static int py_xattr_DosStreams_set_streams(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_DosStreams *object = (struct xattr_DosStreams *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->streams)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->streams"); return -1; } if (value == Py_None) { object->streams = NULL; } else { object->streams = NULL; PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int streams_cntr_1; object->streams = talloc_array_ptrtype(pytalloc_get_mem_ctx(py_obj), object->streams, PyList_GET_SIZE(value)); if (!object->streams) { return -1;; } talloc_set_name_const(object->streams, "ARRAY: object->streams"); for (streams_cntr_1 = 0; streams_cntr_1 < PyList_GET_SIZE(value); streams_cntr_1++) { if (PyList_GET_ITEM(value, streams_cntr_1) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->streams[streams_cntr_1]"); return -1; } PY_CHECK_TYPE(&xattr_DosStream_Type, PyList_GET_ITEM(value, streams_cntr_1), return -1;); if (talloc_reference(object->streams, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, streams_cntr_1))) == NULL) { PyErr_NoMemory(); return -1; } object->streams[streams_cntr_1] = *(struct xattr_DosStream *)pytalloc_get_ptr(PyList_GET_ITEM(value, streams_cntr_1)); } } } return 0; } static PyGetSetDef py_xattr_DosStreams_getsetters[] = { { .name = discard_const_p(char, "num_streams"), .get = py_xattr_DosStreams_get_num_streams, .set = py_xattr_DosStreams_set_num_streams, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = discard_const_p(char, "streams"), .get = py_xattr_DosStreams_get_streams, .set = py_xattr_DosStreams_set_streams, .doc = discard_const_p(char, "PIDL-generated element of base type xattr_DosStream") }, { .name = NULL } }; static PyObject *py_xattr_DosStreams_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return pytalloc_new(struct xattr_DosStreams, type); } static PyObject *py_xattr_DosStreams_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { struct xattr_DosStreams *object = (struct xattr_DosStreams *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; DATA_BLOB blob; enum ndr_err_code err; TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj)); if (tmp_ctx == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_xattr_DosStreams); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(tmp_ctx); PyErr_SetNdrError(err); return NULL; } ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length); TALLOC_FREE(tmp_ctx); return ret; } static PyObject *py_xattr_DosStreams_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs) { struct xattr_DosStreams *object = (struct xattr_DosStreams *)pytalloc_get_ptr(py_obj); DATA_BLOB blob = {.data = NULL, .length = 0}; Py_ssize_t blob_length = 0; enum ndr_err_code err; const char * const kwnames[] = { "data_blob", "allow_remaining", NULL }; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } if (allow_remaining) { err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_xattr_DosStreams); } else { err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_xattr_DosStreams); } if (!NDR_ERR_CODE_IS_SUCCESS(err)) { PyErr_SetNdrError(err); return NULL; } Py_RETURN_NONE; } static PyObject *py_xattr_DosStreams_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { struct xattr_DosStreams *object = (struct xattr_DosStreams *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_xattr_DosStreams, "xattr_DosStreams", object); ret = PyUnicode_FromString(retstr); talloc_free(retstr); return ret; } static PyMethodDef py_xattr_DosStreams_methods[] = { { "__ndr_pack__", (PyCFunction)py_xattr_DosStreams_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" }, { "__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" }, { "__ndr_print__", (PyCFunction)py_xattr_DosStreams_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" }, { NULL, NULL, 0, NULL } }; static PyTypeObject xattr_DosStreams_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "xattr.DosStreams", .tp_getset = py_xattr_DosStreams_getsetters, .tp_methods = py_xattr_DosStreams_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_xattr_DosStreams_new, }; static PyObject *py_security_descriptor_hash_v2_get_sd(PyObject *obj, void *closure) { struct security_descriptor_hash_v2 *object = (struct security_descriptor_hash_v2 *)pytalloc_get_ptr(obj); PyObject *py_sd; if (object->sd == NULL) { Py_RETURN_NONE; } if (object->sd == NULL) { py_sd = Py_None; Py_INCREF(py_sd); } else { py_sd = pytalloc_reference_ex(security_descriptor_Type, object->sd, object->sd); } return py_sd; } static int py_security_descriptor_hash_v2_set_sd(PyObject *py_obj, PyObject *value, void *closure) { struct security_descriptor_hash_v2 *object = (struct security_descriptor_hash_v2 *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->sd)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->sd"); return -1; } if (value == Py_None) { object->sd = NULL; } else { object->sd = NULL; PY_CHECK_TYPE(security_descriptor_Type, value, return -1;); if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) { PyErr_NoMemory(); return -1; } object->sd = (struct security_descriptor *)pytalloc_get_ptr(value); } return 0; } static PyObject *py_security_descriptor_hash_v2_get_hash(PyObject *obj, void *closure) { struct security_descriptor_hash_v2 *object = (struct security_descriptor_hash_v2 *)pytalloc_get_ptr(obj); PyObject *py_hash; py_hash = PyList_New(16); if (py_hash == NULL) { return NULL; } { int hash_cntr_0; for (hash_cntr_0 = 0; hash_cntr_0 < (16); hash_cntr_0++) { PyObject *py_hash_0; py_hash_0 = PyLong_FromLong((uint16_t)object->hash[hash_cntr_0]); PyList_SetItem(py_hash, hash_cntr_0, py_hash_0); } } return py_hash; } static int py_security_descriptor_hash_v2_set_hash(PyObject *py_obj, PyObject *value, void *closure) { struct security_descriptor_hash_v2 *object = (struct security_descriptor_hash_v2 *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->hash"); return -1; } PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int hash_cntr_0; if (ARRAY_SIZE(object->hash) != PyList_GET_SIZE(value)) { 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)); return -1; } for (hash_cntr_0 = 0; hash_cntr_0 < PyList_GET_SIZE(value); hash_cntr_0++) { if (PyList_GET_ITEM(value, hash_cntr_0) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->hash[hash_cntr_0]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->hash[hash_cntr_0])); if (PyLong_Check(PyList_GET_ITEM(value, hash_cntr_0))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, hash_cntr_0)); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->hash[hash_cntr_0] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } return 0; } static PyGetSetDef py_security_descriptor_hash_v2_getsetters[] = { { .name = discard_const_p(char, "sd"), .get = py_security_descriptor_hash_v2_get_sd, .set = py_security_descriptor_hash_v2_set_sd, .doc = discard_const_p(char, "PIDL-generated element of base type security_descriptor") }, { .name = discard_const_p(char, "hash"), .get = py_security_descriptor_hash_v2_get_hash, .set = py_security_descriptor_hash_v2_set_hash, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = NULL } }; static PyObject *py_security_descriptor_hash_v2_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return pytalloc_new(struct security_descriptor_hash_v2, type); } static PyObject *py_security_descriptor_hash_v2_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { struct security_descriptor_hash_v2 *object = (struct security_descriptor_hash_v2 *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; DATA_BLOB blob; enum ndr_err_code err; TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj)); if (tmp_ctx == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_security_descriptor_hash_v2); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(tmp_ctx); PyErr_SetNdrError(err); return NULL; } ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length); TALLOC_FREE(tmp_ctx); return ret; } static PyObject *py_security_descriptor_hash_v2_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs) { struct security_descriptor_hash_v2 *object = (struct security_descriptor_hash_v2 *)pytalloc_get_ptr(py_obj); DATA_BLOB blob = {.data = NULL, .length = 0}; Py_ssize_t blob_length = 0; enum ndr_err_code err; const char * const kwnames[] = { "data_blob", "allow_remaining", NULL }; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } if (allow_remaining) { err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_security_descriptor_hash_v2); } else { 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); } if (!NDR_ERR_CODE_IS_SUCCESS(err)) { PyErr_SetNdrError(err); return NULL; } Py_RETURN_NONE; } static PyObject *py_security_descriptor_hash_v2_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { struct security_descriptor_hash_v2 *object = (struct security_descriptor_hash_v2 *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; 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); ret = PyUnicode_FromString(retstr); talloc_free(retstr); return ret; } static PyMethodDef py_security_descriptor_hash_v2_methods[] = { { "__ndr_pack__", (PyCFunction)py_security_descriptor_hash_v2_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" }, { "__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" }, { "__ndr_print__", (PyCFunction)py_security_descriptor_hash_v2_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" }, { NULL, NULL, 0, NULL } }; static PyTypeObject security_descriptor_hash_v2_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "xattr.security_descriptor_hash_v2", .tp_getset = py_security_descriptor_hash_v2_getsetters, .tp_methods = py_security_descriptor_hash_v2_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_security_descriptor_hash_v2_new, }; static PyObject *py_security_descriptor_hash_v3_get_sd(PyObject *obj, void *closure) { struct security_descriptor_hash_v3 *object = (struct security_descriptor_hash_v3 *)pytalloc_get_ptr(obj); PyObject *py_sd; if (object->sd == NULL) { Py_RETURN_NONE; } if (object->sd == NULL) { py_sd = Py_None; Py_INCREF(py_sd); } else { py_sd = pytalloc_reference_ex(security_descriptor_Type, object->sd, object->sd); } return py_sd; } static int py_security_descriptor_hash_v3_set_sd(PyObject *py_obj, PyObject *value, void *closure) { struct security_descriptor_hash_v3 *object = (struct security_descriptor_hash_v3 *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->sd)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->sd"); return -1; } if (value == Py_None) { object->sd = NULL; } else { object->sd = NULL; PY_CHECK_TYPE(security_descriptor_Type, value, return -1;); if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) { PyErr_NoMemory(); return -1; } object->sd = (struct security_descriptor *)pytalloc_get_ptr(value); } return 0; } static PyObject *py_security_descriptor_hash_v3_get_hash_type(PyObject *obj, void *closure) { struct security_descriptor_hash_v3 *object = (struct security_descriptor_hash_v3 *)pytalloc_get_ptr(obj); PyObject *py_hash_type; py_hash_type = PyLong_FromLong((uint16_t)object->hash_type); return py_hash_type; } static int py_security_descriptor_hash_v3_set_hash_type(PyObject *py_obj, PyObject *value, void *closure) { struct security_descriptor_hash_v3 *object = (struct security_descriptor_hash_v3 *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->hash_type"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->hash_type)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->hash_type = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_security_descriptor_hash_v3_get_hash(PyObject *obj, void *closure) { struct security_descriptor_hash_v3 *object = (struct security_descriptor_hash_v3 *)pytalloc_get_ptr(obj); PyObject *py_hash; py_hash = PyList_New(64); if (py_hash == NULL) { return NULL; } { int hash_cntr_0; for (hash_cntr_0 = 0; hash_cntr_0 < (64); hash_cntr_0++) { PyObject *py_hash_0; py_hash_0 = PyLong_FromLong((uint16_t)object->hash[hash_cntr_0]); PyList_SetItem(py_hash, hash_cntr_0, py_hash_0); } } return py_hash; } static int py_security_descriptor_hash_v3_set_hash(PyObject *py_obj, PyObject *value, void *closure) { struct security_descriptor_hash_v3 *object = (struct security_descriptor_hash_v3 *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->hash"); return -1; } PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int hash_cntr_0; if (ARRAY_SIZE(object->hash) != PyList_GET_SIZE(value)) { 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)); return -1; } for (hash_cntr_0 = 0; hash_cntr_0 < PyList_GET_SIZE(value); hash_cntr_0++) { if (PyList_GET_ITEM(value, hash_cntr_0) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->hash[hash_cntr_0]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->hash[hash_cntr_0])); if (PyLong_Check(PyList_GET_ITEM(value, hash_cntr_0))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, hash_cntr_0)); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->hash[hash_cntr_0] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } return 0; } static PyGetSetDef py_security_descriptor_hash_v3_getsetters[] = { { .name = discard_const_p(char, "sd"), .get = py_security_descriptor_hash_v3_get_sd, .set = py_security_descriptor_hash_v3_set_sd, .doc = discard_const_p(char, "PIDL-generated element of base type security_descriptor") }, { .name = discard_const_p(char, "hash_type"), .get = py_security_descriptor_hash_v3_get_hash_type, .set = py_security_descriptor_hash_v3_set_hash_type, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "hash"), .get = py_security_descriptor_hash_v3_get_hash, .set = py_security_descriptor_hash_v3_set_hash, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = NULL } }; static PyObject *py_security_descriptor_hash_v3_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return pytalloc_new(struct security_descriptor_hash_v3, type); } static PyObject *py_security_descriptor_hash_v3_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { struct security_descriptor_hash_v3 *object = (struct security_descriptor_hash_v3 *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; DATA_BLOB blob; enum ndr_err_code err; TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj)); if (tmp_ctx == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_security_descriptor_hash_v3); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(tmp_ctx); PyErr_SetNdrError(err); return NULL; } ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length); TALLOC_FREE(tmp_ctx); return ret; } static PyObject *py_security_descriptor_hash_v3_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs) { struct security_descriptor_hash_v3 *object = (struct security_descriptor_hash_v3 *)pytalloc_get_ptr(py_obj); DATA_BLOB blob = {.data = NULL, .length = 0}; Py_ssize_t blob_length = 0; enum ndr_err_code err; const char * const kwnames[] = { "data_blob", "allow_remaining", NULL }; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } if (allow_remaining) { err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_security_descriptor_hash_v3); } else { 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); } if (!NDR_ERR_CODE_IS_SUCCESS(err)) { PyErr_SetNdrError(err); return NULL; } Py_RETURN_NONE; } static PyObject *py_security_descriptor_hash_v3_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { struct security_descriptor_hash_v3 *object = (struct security_descriptor_hash_v3 *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; 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); ret = PyUnicode_FromString(retstr); talloc_free(retstr); return ret; } static PyMethodDef py_security_descriptor_hash_v3_methods[] = { { "__ndr_pack__", (PyCFunction)py_security_descriptor_hash_v3_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" }, { "__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" }, { "__ndr_print__", (PyCFunction)py_security_descriptor_hash_v3_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" }, { NULL, NULL, 0, NULL } }; static PyTypeObject security_descriptor_hash_v3_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "xattr.security_descriptor_hash_v3", .tp_getset = py_security_descriptor_hash_v3_getsetters, .tp_methods = py_security_descriptor_hash_v3_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_security_descriptor_hash_v3_new, }; static PyObject *py_security_descriptor_hash_v4_get_sd(PyObject *obj, void *closure) { struct security_descriptor_hash_v4 *object = (struct security_descriptor_hash_v4 *)pytalloc_get_ptr(obj); PyObject *py_sd; if (object->sd == NULL) { Py_RETURN_NONE; } if (object->sd == NULL) { py_sd = Py_None; Py_INCREF(py_sd); } else { py_sd = pytalloc_reference_ex(security_descriptor_Type, object->sd, object->sd); } return py_sd; } static int py_security_descriptor_hash_v4_set_sd(PyObject *py_obj, PyObject *value, void *closure) { struct security_descriptor_hash_v4 *object = (struct security_descriptor_hash_v4 *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->sd)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->sd"); return -1; } if (value == Py_None) { object->sd = NULL; } else { object->sd = NULL; PY_CHECK_TYPE(security_descriptor_Type, value, return -1;); if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) { PyErr_NoMemory(); return -1; } object->sd = (struct security_descriptor *)pytalloc_get_ptr(value); } return 0; } static PyObject *py_security_descriptor_hash_v4_get_hash_type(PyObject *obj, void *closure) { struct security_descriptor_hash_v4 *object = (struct security_descriptor_hash_v4 *)pytalloc_get_ptr(obj); PyObject *py_hash_type; py_hash_type = PyLong_FromLong((uint16_t)object->hash_type); return py_hash_type; } static int py_security_descriptor_hash_v4_set_hash_type(PyObject *py_obj, PyObject *value, void *closure) { struct security_descriptor_hash_v4 *object = (struct security_descriptor_hash_v4 *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->hash_type"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->hash_type)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->hash_type = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_security_descriptor_hash_v4_get_hash(PyObject *obj, void *closure) { struct security_descriptor_hash_v4 *object = (struct security_descriptor_hash_v4 *)pytalloc_get_ptr(obj); PyObject *py_hash; py_hash = PyList_New(64); if (py_hash == NULL) { return NULL; } { int hash_cntr_0; for (hash_cntr_0 = 0; hash_cntr_0 < (64); hash_cntr_0++) { PyObject *py_hash_0; py_hash_0 = PyLong_FromLong((uint16_t)object->hash[hash_cntr_0]); PyList_SetItem(py_hash, hash_cntr_0, py_hash_0); } } return py_hash; } static int py_security_descriptor_hash_v4_set_hash(PyObject *py_obj, PyObject *value, void *closure) { struct security_descriptor_hash_v4 *object = (struct security_descriptor_hash_v4 *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->hash"); return -1; } PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int hash_cntr_0; if (ARRAY_SIZE(object->hash) != PyList_GET_SIZE(value)) { 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)); return -1; } for (hash_cntr_0 = 0; hash_cntr_0 < PyList_GET_SIZE(value); hash_cntr_0++) { if (PyList_GET_ITEM(value, hash_cntr_0) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->hash[hash_cntr_0]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->hash[hash_cntr_0])); if (PyLong_Check(PyList_GET_ITEM(value, hash_cntr_0))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, hash_cntr_0)); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->hash[hash_cntr_0] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } return 0; } static PyObject *py_security_descriptor_hash_v4_get_description(PyObject *obj, void *closure) { struct security_descriptor_hash_v4 *object = (struct security_descriptor_hash_v4 *)pytalloc_get_ptr(obj); PyObject *py_description; py_description = PyString_FromStringOrNULL(object->description); return py_description; } static int py_security_descriptor_hash_v4_set_description(PyObject *py_obj, PyObject *value, void *closure) { struct security_descriptor_hash_v4 *object = (struct security_descriptor_hash_v4 *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->description"); return -1; } { const char *test_str; const char *talloc_str; PyObject *unicode = NULL; if (PyUnicode_Check(value)) { unicode = PyUnicode_AsEncodedString(value, "utf-8", "ignore"); if (unicode == NULL) { PyErr_NoMemory(); return -1; } test_str = PyBytes_AS_STRING(unicode); } else if (PyBytes_Check(value)) { test_str = PyBytes_AS_STRING(value); } else { PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(value)->tp_name); return -1; } talloc_str = talloc_strdup(pytalloc_get_mem_ctx(py_obj), test_str); if (unicode != NULL) { Py_DECREF(unicode); } if (talloc_str == NULL) { PyErr_NoMemory(); return -1; } object->description = talloc_str; } return 0; } static PyObject *py_security_descriptor_hash_v4_get_time(PyObject *obj, void *closure) { struct security_descriptor_hash_v4 *object = (struct security_descriptor_hash_v4 *)pytalloc_get_ptr(obj); PyObject *py_time; py_time = PyLong_FromUnsignedLongLong(object->time); return py_time; } static int py_security_descriptor_hash_v4_set_time(PyObject *py_obj, PyObject *value, void *closure) { struct security_descriptor_hash_v4 *object = (struct security_descriptor_hash_v4 *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->time"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->time)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->time = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_security_descriptor_hash_v4_get_sys_acl_hash(PyObject *obj, void *closure) { struct security_descriptor_hash_v4 *object = (struct security_descriptor_hash_v4 *)pytalloc_get_ptr(obj); PyObject *py_sys_acl_hash; py_sys_acl_hash = PyList_New(64); if (py_sys_acl_hash == NULL) { return NULL; } { int sys_acl_hash_cntr_0; for (sys_acl_hash_cntr_0 = 0; sys_acl_hash_cntr_0 < (64); sys_acl_hash_cntr_0++) { PyObject *py_sys_acl_hash_0; py_sys_acl_hash_0 = PyLong_FromLong((uint16_t)object->sys_acl_hash[sys_acl_hash_cntr_0]); PyList_SetItem(py_sys_acl_hash, sys_acl_hash_cntr_0, py_sys_acl_hash_0); } } return py_sys_acl_hash; } static int py_security_descriptor_hash_v4_set_sys_acl_hash(PyObject *py_obj, PyObject *value, void *closure) { struct security_descriptor_hash_v4 *object = (struct security_descriptor_hash_v4 *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->sys_acl_hash"); return -1; } PY_CHECK_TYPE(&PyList_Type, value, return -1;); { int sys_acl_hash_cntr_0; if (ARRAY_SIZE(object->sys_acl_hash) != PyList_GET_SIZE(value)) { 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)); return -1; } for (sys_acl_hash_cntr_0 = 0; sys_acl_hash_cntr_0 < PyList_GET_SIZE(value); sys_acl_hash_cntr_0++) { if (PyList_GET_ITEM(value, sys_acl_hash_cntr_0) == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->sys_acl_hash[sys_acl_hash_cntr_0]"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->sys_acl_hash[sys_acl_hash_cntr_0])); if (PyLong_Check(PyList_GET_ITEM(value, sys_acl_hash_cntr_0))) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(PyList_GET_ITEM(value, sys_acl_hash_cntr_0)); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->sys_acl_hash[sys_acl_hash_cntr_0] = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } } } return 0; } static PyGetSetDef py_security_descriptor_hash_v4_getsetters[] = { { .name = discard_const_p(char, "sd"), .get = py_security_descriptor_hash_v4_get_sd, .set = py_security_descriptor_hash_v4_set_sd, .doc = discard_const_p(char, "PIDL-generated element of base type security_descriptor") }, { .name = discard_const_p(char, "hash_type"), .get = py_security_descriptor_hash_v4_get_hash_type, .set = py_security_descriptor_hash_v4_set_hash_type, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "hash"), .get = py_security_descriptor_hash_v4_get_hash, .set = py_security_descriptor_hash_v4_set_hash, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = discard_const_p(char, "description"), .get = py_security_descriptor_hash_v4_get_description, .set = py_security_descriptor_hash_v4_set_description, .doc = discard_const_p(char, "PIDL-generated element of base type string") }, { .name = discard_const_p(char, "time"), .get = py_security_descriptor_hash_v4_get_time, .set = py_security_descriptor_hash_v4_set_time, .doc = discard_const_p(char, "PIDL-generated element of base type NTTIME") }, { .name = discard_const_p(char, "sys_acl_hash"), .get = py_security_descriptor_hash_v4_get_sys_acl_hash, .set = py_security_descriptor_hash_v4_set_sys_acl_hash, .doc = discard_const_p(char, "PIDL-generated element of base type uint8") }, { .name = NULL } }; static PyObject *py_security_descriptor_hash_v4_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return pytalloc_new(struct security_descriptor_hash_v4, type); } static PyObject *py_security_descriptor_hash_v4_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { struct security_descriptor_hash_v4 *object = (struct security_descriptor_hash_v4 *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; DATA_BLOB blob; enum ndr_err_code err; TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj)); if (tmp_ctx == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_security_descriptor_hash_v4); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(tmp_ctx); PyErr_SetNdrError(err); return NULL; } ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length); TALLOC_FREE(tmp_ctx); return ret; } static PyObject *py_security_descriptor_hash_v4_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs) { struct security_descriptor_hash_v4 *object = (struct security_descriptor_hash_v4 *)pytalloc_get_ptr(py_obj); DATA_BLOB blob = {.data = NULL, .length = 0}; Py_ssize_t blob_length = 0; enum ndr_err_code err; const char * const kwnames[] = { "data_blob", "allow_remaining", NULL }; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } if (allow_remaining) { err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_security_descriptor_hash_v4); } else { 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); } if (!NDR_ERR_CODE_IS_SUCCESS(err)) { PyErr_SetNdrError(err); return NULL; } Py_RETURN_NONE; } static PyObject *py_security_descriptor_hash_v4_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { struct security_descriptor_hash_v4 *object = (struct security_descriptor_hash_v4 *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; 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); ret = PyUnicode_FromString(retstr); talloc_free(retstr); return ret; } static PyMethodDef py_security_descriptor_hash_v4_methods[] = { { "__ndr_pack__", (PyCFunction)py_security_descriptor_hash_v4_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" }, { "__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" }, { "__ndr_print__", (PyCFunction)py_security_descriptor_hash_v4_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" }, { NULL, NULL, 0, NULL } }; static PyTypeObject security_descriptor_hash_v4_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "xattr.security_descriptor_hash_v4", .tp_getset = py_security_descriptor_hash_v4_getsetters, .tp_methods = py_security_descriptor_hash_v4_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_security_descriptor_hash_v4_new, }; static PyObject *py_import_xattr_NTACL_Info(TALLOC_CTX *mem_ctx, int level, union xattr_NTACL_Info *in) { PyObject *ret; switch (level) { case 1: if (in->sd == NULL) { ret = Py_None; Py_INCREF(ret); } else { ret = pytalloc_reference_ex(security_descriptor_Type, in->sd, in->sd); } return ret; case 2: if (in->sd_hs2 == NULL) { ret = Py_None; Py_INCREF(ret); } else { ret = pytalloc_reference_ex(&security_descriptor_hash_v2_Type, in->sd_hs2, in->sd_hs2); } return ret; case 3: if (in->sd_hs3 == NULL) { ret = Py_None; Py_INCREF(ret); } else { ret = pytalloc_reference_ex(&security_descriptor_hash_v3_Type, in->sd_hs3, in->sd_hs3); } return ret; case 4: if (in->sd_hs4 == NULL) { ret = Py_None; Py_INCREF(ret); } else { ret = pytalloc_reference_ex(&security_descriptor_hash_v4_Type, in->sd_hs4, in->sd_hs4); } return ret; } PyErr_SetString(PyExc_TypeError, "unknown union level"); return NULL; } static union xattr_NTACL_Info *py_export_xattr_NTACL_Info(TALLOC_CTX *mem_ctx, int level, PyObject *in) { union xattr_NTACL_Info *ret = talloc_zero(mem_ctx, union xattr_NTACL_Info); switch (level) { case 1: if (in == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->sd"); talloc_free(ret); return NULL; } if (in == Py_None) { ret->sd = NULL; } else { ret->sd = NULL; PY_CHECK_TYPE(security_descriptor_Type, in, talloc_free(ret); return NULL;); if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) { PyErr_NoMemory(); talloc_free(ret); return NULL; } ret->sd = (struct security_descriptor *)pytalloc_get_ptr(in); } break; case 2: if (in == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->sd_hs2"); talloc_free(ret); return NULL; } if (in == Py_None) { ret->sd_hs2 = NULL; } else { ret->sd_hs2 = NULL; PY_CHECK_TYPE(&security_descriptor_hash_v2_Type, in, talloc_free(ret); return NULL;); if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) { PyErr_NoMemory(); talloc_free(ret); return NULL; } ret->sd_hs2 = (struct security_descriptor_hash_v2 *)pytalloc_get_ptr(in); } break; case 3: if (in == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->sd_hs3"); talloc_free(ret); return NULL; } if (in == Py_None) { ret->sd_hs3 = NULL; } else { ret->sd_hs3 = NULL; PY_CHECK_TYPE(&security_descriptor_hash_v3_Type, in, talloc_free(ret); return NULL;); if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) { PyErr_NoMemory(); talloc_free(ret); return NULL; } ret->sd_hs3 = (struct security_descriptor_hash_v3 *)pytalloc_get_ptr(in); } break; case 4: if (in == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->sd_hs4"); talloc_free(ret); return NULL; } if (in == Py_None) { ret->sd_hs4 = NULL; } else { ret->sd_hs4 = NULL; PY_CHECK_TYPE(&security_descriptor_hash_v4_Type, in, talloc_free(ret); return NULL;); if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) { PyErr_NoMemory(); talloc_free(ret); return NULL; } ret->sd_hs4 = (struct security_descriptor_hash_v4 *)pytalloc_get_ptr(in); } break; default: PyErr_SetString(PyExc_TypeError, "invalid union level value"); talloc_free(ret); ret = NULL; } return ret; } static PyObject *py_xattr_NTACL_Info_import(PyTypeObject *type, PyObject *args, PyObject *kwargs) { const char * const kwnames[] = { "mem_ctx", "level", "in", NULL }; PyObject *mem_ctx_obj = NULL; TALLOC_CTX *mem_ctx = NULL; int level = 0; PyObject *in_obj = NULL; union xattr_NTACL_Info *in = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:import", discard_const_p(char *, kwnames), &mem_ctx_obj, &level, &in_obj)) { return NULL; } mem_ctx = pytalloc_get_ptr(mem_ctx_obj); if (mem_ctx == NULL) { PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!"); return NULL; } in = (union xattr_NTACL_Info *)pytalloc_get_ptr(in_obj); if (in == NULL) { PyErr_Format(PyExc_TypeError, "in needs to be a pointer to union xattr_NTACL_Info!"); return NULL; } return py_import_xattr_NTACL_Info(mem_ctx, level, in); } static PyObject *py_xattr_NTACL_Info_export(PyTypeObject *type, PyObject *args, PyObject *kwargs) { const char * const kwnames[] = { "mem_ctx", "level", "in", NULL }; PyObject *mem_ctx_obj = NULL; TALLOC_CTX *mem_ctx = NULL; int level = 0; PyObject *in = NULL; union xattr_NTACL_Info *out = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO:export", discard_const_p(char *, kwnames), &mem_ctx_obj, &level, &in)) { return NULL; } mem_ctx = pytalloc_get_ptr(mem_ctx_obj); if (mem_ctx == NULL) { PyErr_SetString(PyExc_TypeError, "mem_ctx is NULL)!"); return NULL; } out = py_export_xattr_NTACL_Info(mem_ctx, level, in); if (out == NULL) { return NULL; } return pytalloc_GenericObject_reference(out); } static PyMethodDef py_xattr_NTACL_Info_methods[] = { { "__import__", PY_DISCARD_FUNC_SIG(PyCFunction,py_xattr_NTACL_Info_import), METH_VARARGS|METH_KEYWORDS|METH_CLASS, "T.__import__(mem_ctx, level, in) => ret." }, { "__export__", PY_DISCARD_FUNC_SIG(PyCFunction,py_xattr_NTACL_Info_export), METH_VARARGS|METH_KEYWORDS|METH_CLASS, "T.__export__(mem_ctx, level, in) => ret." }, { NULL, NULL, 0, NULL } }; static PyObject *py_xattr_NTACL_Info_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyErr_Format(PyExc_TypeError, "New %s Objects are not supported", type->tp_name); return NULL; } static PyTypeObject xattr_NTACL_Info_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "xattr.NTACL_Info", .tp_getset = NULL, .tp_methods = py_xattr_NTACL_Info_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_xattr_NTACL_Info_new, }; static PyObject *py_xattr_NTACL_get_version(PyObject *obj, void *closure) { struct xattr_NTACL *object = (struct xattr_NTACL *)pytalloc_get_ptr(obj); PyObject *py_version; py_version = PyLong_FromLong((uint16_t)object->version); return py_version; } static int py_xattr_NTACL_set_version(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_NTACL *object = (struct xattr_NTACL *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->version"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->version)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->version = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_xattr_NTACL_get_info(PyObject *obj, void *closure) { struct xattr_NTACL *object = (struct xattr_NTACL *)pytalloc_get_ptr(obj); PyObject *py_info; py_info = pyrpc_import_union(&xattr_NTACL_Info_Type, pytalloc_get_mem_ctx(obj), object->version, &object->info, "union xattr_NTACL_Info"); if (py_info == NULL) { return NULL; } return py_info; } static int py_xattr_NTACL_set_info(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_NTACL *object = (struct xattr_NTACL *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->info"); return -1; } { union xattr_NTACL_Info *info_switch_0; 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"); if (info_switch_0 == NULL) { return -1; } object->info = *info_switch_0; } return 0; } static PyGetSetDef py_xattr_NTACL_getsetters[] = { { .name = discard_const_p(char, "version"), .get = py_xattr_NTACL_get_version, .set = py_xattr_NTACL_set_version, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "info"), .get = py_xattr_NTACL_get_info, .set = py_xattr_NTACL_set_info, .doc = discard_const_p(char, "PIDL-generated element of base type xattr_NTACL_Info") }, { .name = NULL } }; static PyObject *py_xattr_NTACL_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return pytalloc_new(struct xattr_NTACL, type); } static PyObject *py_xattr_NTACL_ndr_pack(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { struct xattr_NTACL *object = (struct xattr_NTACL *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; DATA_BLOB blob; enum ndr_err_code err; TALLOC_CTX *tmp_ctx = talloc_new(pytalloc_get_mem_ctx(py_obj)); if (tmp_ctx == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } err = ndr_push_struct_blob(&blob, tmp_ctx, object, (ndr_push_flags_fn_t)ndr_push_xattr_NTACL); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(tmp_ctx); PyErr_SetNdrError(err); return NULL; } ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length); TALLOC_FREE(tmp_ctx); return ret; } static PyObject *py_xattr_NTACL_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs) { struct xattr_NTACL *object = (struct xattr_NTACL *)pytalloc_get_ptr(py_obj); DATA_BLOB blob = {.data = NULL, .length = 0}; Py_ssize_t blob_length = 0; enum ndr_err_code err; const char * const kwnames[] = { "data_blob", "allow_remaining", NULL }; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|O:__ndr_unpack__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } if (allow_remaining) { err = ndr_pull_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_xattr_NTACL); } else { err = ndr_pull_struct_blob_all(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_pull_flags_fn_t)ndr_pull_xattr_NTACL); } if (!NDR_ERR_CODE_IS_SUCCESS(err)) { PyErr_SetNdrError(err); return NULL; } Py_RETURN_NONE; } static PyObject *py_xattr_NTACL_ndr_print(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { struct xattr_NTACL *object = (struct xattr_NTACL *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; retstr = ndr_print_struct_string(pytalloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_xattr_NTACL, "xattr_NTACL", object); ret = PyUnicode_FromString(retstr); talloc_free(retstr); return ret; } static PyMethodDef py_xattr_NTACL_methods[] = { { "__ndr_pack__", (PyCFunction)py_xattr_NTACL_ndr_pack, METH_NOARGS, "S.ndr_pack(object) -> blob\nNDR pack" }, { "__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" }, { "__ndr_print__", (PyCFunction)py_xattr_NTACL_ndr_print, METH_NOARGS, "S.ndr_print(object) -> None\nNDR print" }, { NULL, NULL, 0, NULL } }; static PyTypeObject xattr_NTACL_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "xattr.NTACL", .tp_getset = py_xattr_NTACL_getsetters, .tp_methods = py_xattr_NTACL_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_xattr_NTACL_new, }; static PyObject *py_xattr_sys_acl_hash_wrapper_get_acl_as_blob(PyObject *obj, void *closure) { struct xattr_sys_acl_hash_wrapper *object = (struct xattr_sys_acl_hash_wrapper *)pytalloc_get_ptr(obj); PyObject *py_acl_as_blob; py_acl_as_blob = PyBytes_FromStringAndSize((char *)(object->acl_as_blob).data, (object->acl_as_blob).length); return py_acl_as_blob; } static int py_xattr_sys_acl_hash_wrapper_set_acl_as_blob(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_sys_acl_hash_wrapper *object = (struct xattr_sys_acl_hash_wrapper *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->acl_as_blob"); return -1; } object->acl_as_blob = data_blob_talloc(pytalloc_get_mem_ctx(py_obj), PyBytes_AS_STRING(value), PyBytes_GET_SIZE(value)); return 0; } static PyObject *py_xattr_sys_acl_hash_wrapper_get_owner(PyObject *obj, void *closure) { struct xattr_sys_acl_hash_wrapper *object = (struct xattr_sys_acl_hash_wrapper *)pytalloc_get_ptr(obj); PyObject *py_owner; py_owner = PyLong_FromUnsignedLongLong(object->owner); return py_owner; } static int py_xattr_sys_acl_hash_wrapper_set_owner(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_sys_acl_hash_wrapper *object = (struct xattr_sys_acl_hash_wrapper *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->owner"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->owner)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->owner = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_xattr_sys_acl_hash_wrapper_get_group(PyObject *obj, void *closure) { struct xattr_sys_acl_hash_wrapper *object = (struct xattr_sys_acl_hash_wrapper *)pytalloc_get_ptr(obj); PyObject *py_group; py_group = PyLong_FromUnsignedLongLong(object->group); return py_group; } static int py_xattr_sys_acl_hash_wrapper_set_group(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_sys_acl_hash_wrapper *object = (struct xattr_sys_acl_hash_wrapper *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->group"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->group)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->group = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_xattr_sys_acl_hash_wrapper_get_mode(PyObject *obj, void *closure) { struct xattr_sys_acl_hash_wrapper *object = (struct xattr_sys_acl_hash_wrapper *)pytalloc_get_ptr(obj); PyObject *py_mode; py_mode = PyLong_FromUnsignedLongLong((uint32_t)object->mode); return py_mode; } static int py_xattr_sys_acl_hash_wrapper_set_mode(PyObject *py_obj, PyObject *value, void *closure) { struct xattr_sys_acl_hash_wrapper *object = (struct xattr_sys_acl_hash_wrapper *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->mode"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->mode)); if (PyLong_Check(value)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(value); if (PyErr_Occurred() != NULL) { return -1; } if (test_var > uint_max) { PyErr_Format(PyExc_OverflowError, "Expected type %s within range 0 - %llu, got %llu",\ PyLong_Type.tp_name, uint_max, test_var); return -1; } object->mode = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyGetSetDef py_xattr_sys_acl_hash_wrapper_getsetters[] = { { .name = discard_const_p(char, "acl_as_blob"), .get = py_xattr_sys_acl_hash_wrapper_get_acl_as_blob, .set = py_xattr_sys_acl_hash_wrapper_set_acl_as_blob, .doc = discard_const_p(char, "PIDL-generated element of base type DATA_BLOB") }, { .name = discard_const_p(char, "owner"), .get = py_xattr_sys_acl_hash_wrapper_get_owner, .set = py_xattr_sys_acl_hash_wrapper_set_owner, .doc = discard_const_p(char, "PIDL-generated element of base type uid_t") }, { .name = discard_const_p(char, "group"), .get = py_xattr_sys_acl_hash_wrapper_get_group, .set = py_xattr_sys_acl_hash_wrapper_set_group, .doc = discard_const_p(char, "PIDL-generated element of base type gid_t") }, { .name = discard_const_p(char, "mode"), .get = py_xattr_sys_acl_hash_wrapper_get_mode, .set = py_xattr_sys_acl_hash_wrapper_set_mode, .doc = discard_const_p(char, "PIDL-generated element of base type uint32") }, { .name = NULL } }; static PyObject *py_xattr_sys_acl_hash_wrapper_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return pytalloc_new(struct xattr_sys_acl_hash_wrapper, type); } static PyTypeObject xattr_sys_acl_hash_wrapper_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "xattr.sys_acl_hash_wrapper", .tp_getset = py_xattr_sys_acl_hash_wrapper_getsetters, .tp_methods = NULL, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_xattr_sys_acl_hash_wrapper_new, }; static PyMethodDef xattr_methods[] = { { NULL, NULL, 0, NULL } }; static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, .m_name = "xattr", .m_doc = "xattr DCE/RPC", .m_size = -1, .m_methods = xattr_methods, }; MODULE_INIT_FUNC(xattr) { PyObject *m = NULL; PyObject *dep_samba_dcerpc_security = NULL; PyObject *dep_talloc = NULL; dep_samba_dcerpc_security = PyImport_ImportModule("samba.dcerpc.security"); if (dep_samba_dcerpc_security == NULL) goto out; dep_talloc = PyImport_ImportModule("talloc"); if (dep_talloc == NULL) goto out; BaseObject_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "BaseObject"); if (BaseObject_Type == NULL) goto out; security_descriptor_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_security, "descriptor"); if (security_descriptor_Type == NULL) goto out; xattr_DosInfoFFFFCompat_Type.tp_base = BaseObject_Type; xattr_DosInfoFFFFCompat_Type.tp_basicsize = pytalloc_BaseObject_size(); xattr_DosInfo1_Type.tp_base = BaseObject_Type; xattr_DosInfo1_Type.tp_basicsize = pytalloc_BaseObject_size(); xattr_DosInfo2Old_Type.tp_base = BaseObject_Type; xattr_DosInfo2Old_Type.tp_basicsize = pytalloc_BaseObject_size(); xattr_DosInfo3_Type.tp_base = BaseObject_Type; xattr_DosInfo3_Type.tp_basicsize = pytalloc_BaseObject_size(); xattr_DosInfo4_Type.tp_base = BaseObject_Type; xattr_DosInfo4_Type.tp_basicsize = pytalloc_BaseObject_size(); xattr_DosInfo_Type.tp_base = BaseObject_Type; xattr_DosInfo_Type.tp_basicsize = pytalloc_BaseObject_size(); xattr_DosAttrib_Type.tp_base = BaseObject_Type; xattr_DosAttrib_Type.tp_basicsize = pytalloc_BaseObject_size(); xattr_DOSATTRIB_Type.tp_base = BaseObject_Type; xattr_DOSATTRIB_Type.tp_basicsize = pytalloc_BaseObject_size(); xattr_EA_Type.tp_base = BaseObject_Type; xattr_EA_Type.tp_basicsize = pytalloc_BaseObject_size(); xattr_DosEAs_Type.tp_base = BaseObject_Type; xattr_DosEAs_Type.tp_basicsize = pytalloc_BaseObject_size(); tdb_xattrs_Type.tp_base = BaseObject_Type; tdb_xattrs_Type.tp_basicsize = pytalloc_BaseObject_size(); xattr_DosStream_Type.tp_base = BaseObject_Type; xattr_DosStream_Type.tp_basicsize = pytalloc_BaseObject_size(); xattr_DosStreams_Type.tp_base = BaseObject_Type; xattr_DosStreams_Type.tp_basicsize = pytalloc_BaseObject_size(); security_descriptor_hash_v2_Type.tp_base = BaseObject_Type; security_descriptor_hash_v2_Type.tp_basicsize = pytalloc_BaseObject_size(); security_descriptor_hash_v3_Type.tp_base = BaseObject_Type; security_descriptor_hash_v3_Type.tp_basicsize = pytalloc_BaseObject_size(); security_descriptor_hash_v4_Type.tp_base = BaseObject_Type; security_descriptor_hash_v4_Type.tp_basicsize = pytalloc_BaseObject_size(); xattr_NTACL_Info_Type.tp_base = BaseObject_Type; xattr_NTACL_Info_Type.tp_basicsize = pytalloc_BaseObject_size(); xattr_NTACL_Type.tp_base = BaseObject_Type; xattr_NTACL_Type.tp_basicsize = pytalloc_BaseObject_size(); xattr_sys_acl_hash_wrapper_Type.tp_base = BaseObject_Type; xattr_sys_acl_hash_wrapper_Type.tp_basicsize = pytalloc_BaseObject_size(); if (PyType_Ready(&xattr_DosInfoFFFFCompat_Type) < 0) goto out; if (PyType_Ready(&xattr_DosInfo1_Type) < 0) goto out; if (PyType_Ready(&xattr_DosInfo2Old_Type) < 0) goto out; if (PyType_Ready(&xattr_DosInfo3_Type) < 0) goto out; if (PyType_Ready(&xattr_DosInfo4_Type) < 0) goto out; if (PyType_Ready(&xattr_DosInfo_Type) < 0) goto out; if (PyType_Ready(&xattr_DosAttrib_Type) < 0) goto out; if (PyType_Ready(&xattr_DOSATTRIB_Type) < 0) goto out; if (PyType_Ready(&xattr_EA_Type) < 0) goto out; if (PyType_Ready(&xattr_DosEAs_Type) < 0) goto out; if (PyType_Ready(&tdb_xattrs_Type) < 0) goto out; if (PyType_Ready(&xattr_DosStream_Type) < 0) goto out; if (PyType_Ready(&xattr_DosStreams_Type) < 0) goto out; if (PyType_Ready(&security_descriptor_hash_v2_Type) < 0) goto out; if (PyType_Ready(&security_descriptor_hash_v3_Type) < 0) goto out; if (PyType_Ready(&security_descriptor_hash_v4_Type) < 0) goto out; if (PyType_Ready(&xattr_NTACL_Info_Type) < 0) goto out; if (PyType_Ready(&xattr_NTACL_Type) < 0) goto out; if (PyType_Ready(&xattr_sys_acl_hash_wrapper_Type) < 0) goto out; #ifdef PY_DOSINFOFFFFCOMPAT_PATCH PY_DOSINFOFFFFCOMPAT_PATCH(&xattr_DosInfoFFFFCompat_Type); #endif #ifdef PY_DOSINFO1_PATCH PY_DOSINFO1_PATCH(&xattr_DosInfo1_Type); #endif #ifdef PY_DOSINFO2OLD_PATCH PY_DOSINFO2OLD_PATCH(&xattr_DosInfo2Old_Type); #endif #ifdef PY_DOSINFO3_PATCH PY_DOSINFO3_PATCH(&xattr_DosInfo3_Type); #endif #ifdef PY_DOSINFO4_PATCH PY_DOSINFO4_PATCH(&xattr_DosInfo4_Type); #endif #ifdef PY_DOSINFO_PATCH PY_DOSINFO_PATCH(&xattr_DosInfo_Type); #endif #ifdef PY_DOSATTRIB_PATCH PY_DOSATTRIB_PATCH(&xattr_DosAttrib_Type); #endif #ifdef PY_DOSATTRIB_PATCH PY_DOSATTRIB_PATCH(&xattr_DOSATTRIB_Type); #endif #ifdef PY_EA_PATCH PY_EA_PATCH(&xattr_EA_Type); #endif #ifdef PY_DOSEAS_PATCH PY_DOSEAS_PATCH(&xattr_DosEAs_Type); #endif #ifdef PY_TDB_XATTRS_PATCH PY_TDB_XATTRS_PATCH(&tdb_xattrs_Type); #endif #ifdef PY_DOSSTREAM_PATCH PY_DOSSTREAM_PATCH(&xattr_DosStream_Type); #endif #ifdef PY_DOSSTREAMS_PATCH PY_DOSSTREAMS_PATCH(&xattr_DosStreams_Type); #endif #ifdef PY_SECURITY_DESCRIPTOR_HASH_V2_PATCH PY_SECURITY_DESCRIPTOR_HASH_V2_PATCH(&security_descriptor_hash_v2_Type); #endif #ifdef PY_SECURITY_DESCRIPTOR_HASH_V3_PATCH PY_SECURITY_DESCRIPTOR_HASH_V3_PATCH(&security_descriptor_hash_v3_Type); #endif #ifdef PY_SECURITY_DESCRIPTOR_HASH_V4_PATCH PY_SECURITY_DESCRIPTOR_HASH_V4_PATCH(&security_descriptor_hash_v4_Type); #endif #ifdef PY_NTACL_INFO_PATCH PY_NTACL_INFO_PATCH(&xattr_NTACL_Info_Type); #endif #ifdef PY_NTACL_PATCH PY_NTACL_PATCH(&xattr_NTACL_Type); #endif #ifdef PY_SYS_ACL_HASH_WRAPPER_PATCH PY_SYS_ACL_HASH_WRAPPER_PATCH(&xattr_sys_acl_hash_wrapper_Type); #endif m = PyModule_Create(&moduledef); if (m == NULL) goto out; PyModule_AddObject(m, "XATTR_DOSATTRIB_NAME", PyUnicode_FromString("user.DosAttrib")); PyModule_AddObject(m, "XATTR_DOSATTRIB_NAME_S3", PyUnicode_FromString("user.DOSATTRIB")); PyModule_AddObject(m, "XATTR_DOSATTRIB_ESTIMATED_SIZE", PyLong_FromUnsignedLongLong(64)); PyModule_AddObject(m, "XATTR_DOSEAS_NAME", PyUnicode_FromString("user.DosEAs")); PyModule_AddObject(m, "XATTR_DOSSTREAMS_NAME", PyUnicode_FromString("user.DosStreams")); PyModule_AddObject(m, "XATTR_STREAM_FLAG_INTERNAL", PyLong_FromUnsignedLongLong(0x00000001)); PyModule_AddObject(m, "XATTR_DOSSTREAM_PREFIX", PyUnicode_FromString("user.DosStream.")); PyModule_AddObject(m, "XATTR_MAX_STREAM_SIZE", PyLong_FromUnsignedLongLong(0x4000)); PyModule_AddObject(m, "XATTR_MAX_STREAM_SIZE_TDB", PyLong_FromUnsignedLongLong(0x100000)); PyModule_AddObject(m, "XATTR_NTACL_NAME", PyUnicode_FromString("security.NTACL")); PyModule_AddObject(m, "XATTR_SD_HASH_SIZE", PyLong_FromUnsignedLongLong(64)); PyModule_AddObject(m, "XATTR_SD_HASH_TYPE_NONE", PyLong_FromUnsignedLongLong(0x0)); PyModule_AddObject(m, "XATTR_SD_HASH_TYPE_SHA256", PyLong_FromUnsignedLongLong(0x1)); PyModule_AddObject(m, "XATTR_DOSINFO_ATTRIB", PyLong_FromUnsignedLongLong((uint32_t)XATTR_DOSINFO_ATTRIB)); PyModule_AddObject(m, "XATTR_DOSINFO_EA_SIZE", PyLong_FromUnsignedLongLong((uint32_t)XATTR_DOSINFO_EA_SIZE)); PyModule_AddObject(m, "XATTR_DOSINFO_SIZE", PyLong_FromUnsignedLongLong((uint32_t)XATTR_DOSINFO_SIZE)); PyModule_AddObject(m, "XATTR_DOSINFO_ALLOC_SIZE", PyLong_FromUnsignedLongLong((uint32_t)XATTR_DOSINFO_ALLOC_SIZE)); PyModule_AddObject(m, "XATTR_DOSINFO_CREATE_TIME", PyLong_FromUnsignedLongLong((uint32_t)XATTR_DOSINFO_CREATE_TIME)); PyModule_AddObject(m, "XATTR_DOSINFO_CHANGE_TIME", PyLong_FromUnsignedLongLong((uint32_t)XATTR_DOSINFO_CHANGE_TIME)); PyModule_AddObject(m, "XATTR_DOSINFO_ITIME", PyLong_FromUnsignedLongLong((uint32_t)XATTR_DOSINFO_ITIME)); Py_INCREF((PyObject *)(void *)&xattr_DosInfoFFFFCompat_Type); PyModule_AddObject(m, "DosInfoFFFFCompat", (PyObject *)(void *)&xattr_DosInfoFFFFCompat_Type); Py_INCREF((PyObject *)(void *)&xattr_DosInfo1_Type); PyModule_AddObject(m, "DosInfo1", (PyObject *)(void *)&xattr_DosInfo1_Type); Py_INCREF((PyObject *)(void *)&xattr_DosInfo2Old_Type); PyModule_AddObject(m, "DosInfo2Old", (PyObject *)(void *)&xattr_DosInfo2Old_Type); Py_INCREF((PyObject *)(void *)&xattr_DosInfo3_Type); PyModule_AddObject(m, "DosInfo3", (PyObject *)(void *)&xattr_DosInfo3_Type); Py_INCREF((PyObject *)(void *)&xattr_DosInfo4_Type); PyModule_AddObject(m, "DosInfo4", (PyObject *)(void *)&xattr_DosInfo4_Type); Py_INCREF((PyObject *)(void *)&xattr_DosInfo_Type); PyModule_AddObject(m, "DosInfo", (PyObject *)(void *)&xattr_DosInfo_Type); Py_INCREF((PyObject *)(void *)&xattr_DosAttrib_Type); PyModule_AddObject(m, "DosAttrib", (PyObject *)(void *)&xattr_DosAttrib_Type); Py_INCREF((PyObject *)(void *)&xattr_DOSATTRIB_Type); PyModule_AddObject(m, "DOSATTRIB", (PyObject *)(void *)&xattr_DOSATTRIB_Type); Py_INCREF((PyObject *)(void *)&xattr_EA_Type); PyModule_AddObject(m, "EA", (PyObject *)(void *)&xattr_EA_Type); Py_INCREF((PyObject *)(void *)&xattr_DosEAs_Type); PyModule_AddObject(m, "DosEAs", (PyObject *)(void *)&xattr_DosEAs_Type); Py_INCREF((PyObject *)(void *)&tdb_xattrs_Type); PyModule_AddObject(m, "tdb_xattrs", (PyObject *)(void *)&tdb_xattrs_Type); Py_INCREF((PyObject *)(void *)&xattr_DosStream_Type); PyModule_AddObject(m, "DosStream", (PyObject *)(void *)&xattr_DosStream_Type); Py_INCREF((PyObject *)(void *)&xattr_DosStreams_Type); PyModule_AddObject(m, "DosStreams", (PyObject *)(void *)&xattr_DosStreams_Type); Py_INCREF((PyObject *)(void *)&security_descriptor_hash_v2_Type); PyModule_AddObject(m, "security_descriptor_hash_v2", (PyObject *)(void *)&security_descriptor_hash_v2_Type); Py_INCREF((PyObject *)(void *)&security_descriptor_hash_v3_Type); PyModule_AddObject(m, "security_descriptor_hash_v3", (PyObject *)(void *)&security_descriptor_hash_v3_Type); Py_INCREF((PyObject *)(void *)&security_descriptor_hash_v4_Type); PyModule_AddObject(m, "security_descriptor_hash_v4", (PyObject *)(void *)&security_descriptor_hash_v4_Type); Py_INCREF((PyObject *)(void *)&xattr_NTACL_Info_Type); PyModule_AddObject(m, "NTACL_Info", (PyObject *)(void *)&xattr_NTACL_Info_Type); Py_INCREF((PyObject *)(void *)&xattr_NTACL_Type); PyModule_AddObject(m, "NTACL", (PyObject *)(void *)&xattr_NTACL_Type); Py_INCREF((PyObject *)(void *)&xattr_sys_acl_hash_wrapper_Type); PyModule_AddObject(m, "sys_acl_hash_wrapper", (PyObject *)(void *)&xattr_sys_acl_hash_wrapper_Type); #ifdef PY_MOD_XATTR_PATCH PY_MOD_XATTR_PATCH(m); #endif out: Py_XDECREF(dep_samba_dcerpc_security); Py_XDECREF(dep_talloc); return m; }