/* 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_dssetup.h" #include "bin/default/librpc/gen_ndr/ndr_dssetup_c.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/misc.h" static PyTypeObject dssetup_DsRolePrimaryDomInfoBasic_Type; static PyTypeObject dssetup_DsRoleUpgradeStatus_Type; static PyTypeObject dssetup_DsRoleOpStatus_Type; static PyTypeObject dssetup_DsRoleInfo_Type; static PyTypeObject dssetup_InterfaceType; static PyTypeObject dssetup_DsRoleGetPrimaryDomainInformation_Type; static PyTypeObject *GUID_Type; static PyTypeObject *BaseObject_Type; static PyTypeObject *ClientConnection_Type; static PyTypeObject *ndr_syntax_id_Type; static PyObject *py_dssetup_DsRolePrimaryDomInfoBasic_get_role(PyObject *obj, void *closure) { struct dssetup_DsRolePrimaryDomInfoBasic *object = (struct dssetup_DsRolePrimaryDomInfoBasic *)pytalloc_get_ptr(obj); PyObject *py_role; py_role = PyLong_FromLong((uint16_t)object->role); return py_role; } static int py_dssetup_DsRolePrimaryDomInfoBasic_set_role(PyObject *py_obj, PyObject *value, void *closure) { struct dssetup_DsRolePrimaryDomInfoBasic *object = (struct dssetup_DsRolePrimaryDomInfoBasic *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->role"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->role)); 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->role = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_dssetup_DsRolePrimaryDomInfoBasic_get_flags(PyObject *obj, void *closure) { struct dssetup_DsRolePrimaryDomInfoBasic *object = (struct dssetup_DsRolePrimaryDomInfoBasic *)pytalloc_get_ptr(obj); PyObject *py_flags; py_flags = PyLong_FromUnsignedLongLong((uint32_t)object->flags); return py_flags; } static int py_dssetup_DsRolePrimaryDomInfoBasic_set_flags(PyObject *py_obj, PyObject *value, void *closure) { struct dssetup_DsRolePrimaryDomInfoBasic *object = (struct dssetup_DsRolePrimaryDomInfoBasic *)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_dssetup_DsRolePrimaryDomInfoBasic_get_domain(PyObject *obj, void *closure) { struct dssetup_DsRolePrimaryDomInfoBasic *object = (struct dssetup_DsRolePrimaryDomInfoBasic *)pytalloc_get_ptr(obj); PyObject *py_domain; if (object->domain == NULL) { Py_RETURN_NONE; } if (object->domain == NULL) { py_domain = Py_None; Py_INCREF(py_domain); } else { if (object->domain == NULL) { py_domain = Py_None; Py_INCREF(py_domain); } else { py_domain = PyUnicode_Decode(object->domain, strlen(object->domain), "utf-8", "ignore"); } } return py_domain; } static int py_dssetup_DsRolePrimaryDomInfoBasic_set_domain(PyObject *py_obj, PyObject *value, void *closure) { struct dssetup_DsRolePrimaryDomInfoBasic *object = (struct dssetup_DsRolePrimaryDomInfoBasic *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->domain"); return -1; } if (value == Py_None) { object->domain = NULL; } else { object->domain = NULL; { 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->domain = talloc_str; } } return 0; } static PyObject *py_dssetup_DsRolePrimaryDomInfoBasic_get_dns_domain(PyObject *obj, void *closure) { struct dssetup_DsRolePrimaryDomInfoBasic *object = (struct dssetup_DsRolePrimaryDomInfoBasic *)pytalloc_get_ptr(obj); PyObject *py_dns_domain; if (object->dns_domain == NULL) { Py_RETURN_NONE; } if (object->dns_domain == NULL) { py_dns_domain = Py_None; Py_INCREF(py_dns_domain); } else { if (object->dns_domain == NULL) { py_dns_domain = Py_None; Py_INCREF(py_dns_domain); } else { py_dns_domain = PyUnicode_Decode(object->dns_domain, strlen(object->dns_domain), "utf-8", "ignore"); } } return py_dns_domain; } static int py_dssetup_DsRolePrimaryDomInfoBasic_set_dns_domain(PyObject *py_obj, PyObject *value, void *closure) { struct dssetup_DsRolePrimaryDomInfoBasic *object = (struct dssetup_DsRolePrimaryDomInfoBasic *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->dns_domain"); return -1; } if (value == Py_None) { object->dns_domain = NULL; } else { object->dns_domain = NULL; { 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->dns_domain = talloc_str; } } return 0; } static PyObject *py_dssetup_DsRolePrimaryDomInfoBasic_get_forest(PyObject *obj, void *closure) { struct dssetup_DsRolePrimaryDomInfoBasic *object = (struct dssetup_DsRolePrimaryDomInfoBasic *)pytalloc_get_ptr(obj); PyObject *py_forest; if (object->forest == NULL) { Py_RETURN_NONE; } if (object->forest == NULL) { py_forest = Py_None; Py_INCREF(py_forest); } else { if (object->forest == NULL) { py_forest = Py_None; Py_INCREF(py_forest); } else { py_forest = PyUnicode_Decode(object->forest, strlen(object->forest), "utf-8", "ignore"); } } return py_forest; } static int py_dssetup_DsRolePrimaryDomInfoBasic_set_forest(PyObject *py_obj, PyObject *value, void *closure) { struct dssetup_DsRolePrimaryDomInfoBasic *object = (struct dssetup_DsRolePrimaryDomInfoBasic *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->forest"); return -1; } if (value == Py_None) { object->forest = NULL; } else { object->forest = NULL; { 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->forest = talloc_str; } } return 0; } static PyObject *py_dssetup_DsRolePrimaryDomInfoBasic_get_domain_guid(PyObject *obj, void *closure) { struct dssetup_DsRolePrimaryDomInfoBasic *object = (struct dssetup_DsRolePrimaryDomInfoBasic *)pytalloc_get_ptr(obj); PyObject *py_domain_guid; py_domain_guid = pytalloc_reference_ex(GUID_Type, pytalloc_get_mem_ctx(obj), &object->domain_guid); return py_domain_guid; } static int py_dssetup_DsRolePrimaryDomInfoBasic_set_domain_guid(PyObject *py_obj, PyObject *value, void *closure) { struct dssetup_DsRolePrimaryDomInfoBasic *object = (struct dssetup_DsRolePrimaryDomInfoBasic *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->domain_guid"); return -1; } PY_CHECK_TYPE(GUID_Type, value, return -1;); if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) { PyErr_NoMemory(); return -1; } object->domain_guid = *(struct GUID *)pytalloc_get_ptr(value); return 0; } static PyGetSetDef py_dssetup_DsRolePrimaryDomInfoBasic_getsetters[] = { { .name = discard_const_p(char, "role"), .get = py_dssetup_DsRolePrimaryDomInfoBasic_get_role, .set = py_dssetup_DsRolePrimaryDomInfoBasic_set_role, .doc = discard_const_p(char, "PIDL-generated element of base type dssetup_DsRole") }, { .name = discard_const_p(char, "flags"), .get = py_dssetup_DsRolePrimaryDomInfoBasic_get_flags, .set = py_dssetup_DsRolePrimaryDomInfoBasic_set_flags, .doc = discard_const_p(char, "PIDL-generated element of base type dssetup_DsRoleFlags") }, { .name = discard_const_p(char, "domain"), .get = py_dssetup_DsRolePrimaryDomInfoBasic_get_domain, .set = py_dssetup_DsRolePrimaryDomInfoBasic_set_domain, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "dns_domain"), .get = py_dssetup_DsRolePrimaryDomInfoBasic_get_dns_domain, .set = py_dssetup_DsRolePrimaryDomInfoBasic_set_dns_domain, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "forest"), .get = py_dssetup_DsRolePrimaryDomInfoBasic_get_forest, .set = py_dssetup_DsRolePrimaryDomInfoBasic_set_forest, .doc = discard_const_p(char, "PIDL-generated element of base type uint16") }, { .name = discard_const_p(char, "domain_guid"), .get = py_dssetup_DsRolePrimaryDomInfoBasic_get_domain_guid, .set = py_dssetup_DsRolePrimaryDomInfoBasic_set_domain_guid, .doc = discard_const_p(char, "PIDL-generated element of base type GUID") }, { .name = NULL } }; static PyObject *py_dssetup_DsRolePrimaryDomInfoBasic_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return pytalloc_new(struct dssetup_DsRolePrimaryDomInfoBasic, type); } static PyTypeObject dssetup_DsRolePrimaryDomInfoBasic_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "dssetup.DsRolePrimaryDomInfoBasic", .tp_getset = py_dssetup_DsRolePrimaryDomInfoBasic_getsetters, .tp_methods = NULL, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_dssetup_DsRolePrimaryDomInfoBasic_new, }; static PyObject *py_dssetup_DsRoleUpgradeStatus_get_upgrading(PyObject *obj, void *closure) { struct dssetup_DsRoleUpgradeStatus *object = (struct dssetup_DsRoleUpgradeStatus *)pytalloc_get_ptr(obj); PyObject *py_upgrading; py_upgrading = PyLong_FromUnsignedLongLong((uint32_t)object->upgrading); return py_upgrading; } static int py_dssetup_DsRoleUpgradeStatus_set_upgrading(PyObject *py_obj, PyObject *value, void *closure) { struct dssetup_DsRoleUpgradeStatus *object = (struct dssetup_DsRoleUpgradeStatus *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->upgrading"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->upgrading)); 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->upgrading = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_dssetup_DsRoleUpgradeStatus_get_previous_role(PyObject *obj, void *closure) { struct dssetup_DsRoleUpgradeStatus *object = (struct dssetup_DsRoleUpgradeStatus *)pytalloc_get_ptr(obj); PyObject *py_previous_role; py_previous_role = PyLong_FromLong((uint16_t)object->previous_role); return py_previous_role; } static int py_dssetup_DsRoleUpgradeStatus_set_previous_role(PyObject *py_obj, PyObject *value, void *closure) { struct dssetup_DsRoleUpgradeStatus *object = (struct dssetup_DsRoleUpgradeStatus *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->previous_role"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->previous_role)); 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->previous_role = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyGetSetDef py_dssetup_DsRoleUpgradeStatus_getsetters[] = { { .name = discard_const_p(char, "upgrading"), .get = py_dssetup_DsRoleUpgradeStatus_get_upgrading, .set = py_dssetup_DsRoleUpgradeStatus_set_upgrading, .doc = discard_const_p(char, "PIDL-generated element of base type dssetup_DsUpgrade") }, { .name = discard_const_p(char, "previous_role"), .get = py_dssetup_DsRoleUpgradeStatus_get_previous_role, .set = py_dssetup_DsRoleUpgradeStatus_set_previous_role, .doc = discard_const_p(char, "PIDL-generated element of base type dssetup_DsPrevious") }, { .name = NULL } }; static PyObject *py_dssetup_DsRoleUpgradeStatus_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return pytalloc_new(struct dssetup_DsRoleUpgradeStatus, type); } static PyTypeObject dssetup_DsRoleUpgradeStatus_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "dssetup.DsRoleUpgradeStatus", .tp_getset = py_dssetup_DsRoleUpgradeStatus_getsetters, .tp_methods = NULL, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_dssetup_DsRoleUpgradeStatus_new, }; static PyObject *py_dssetup_DsRoleOpStatus_get_status(PyObject *obj, void *closure) { struct dssetup_DsRoleOpStatus *object = (struct dssetup_DsRoleOpStatus *)pytalloc_get_ptr(obj); PyObject *py_status; py_status = PyLong_FromLong((uint16_t)object->status); return py_status; } static int py_dssetup_DsRoleOpStatus_set_status(PyObject *py_obj, PyObject *value, void *closure) { struct dssetup_DsRoleOpStatus *object = (struct dssetup_DsRoleOpStatus *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->status"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->status)); 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->status = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyGetSetDef py_dssetup_DsRoleOpStatus_getsetters[] = { { .name = discard_const_p(char, "status"), .get = py_dssetup_DsRoleOpStatus_get_status, .set = py_dssetup_DsRoleOpStatus_set_status, .doc = discard_const_p(char, "PIDL-generated element of base type dssetup_DsRoleOp") }, { .name = NULL } }; static PyObject *py_dssetup_DsRoleOpStatus_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return pytalloc_new(struct dssetup_DsRoleOpStatus, type); } static PyTypeObject dssetup_DsRoleOpStatus_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "dssetup.DsRoleOpStatus", .tp_getset = py_dssetup_DsRoleOpStatus_getsetters, .tp_methods = NULL, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_dssetup_DsRoleOpStatus_new, }; static PyObject *py_import_dssetup_DsRoleInfo(TALLOC_CTX *mem_ctx, int level, union dssetup_DsRoleInfo *in) { PyObject *ret; switch (level) { case DS_ROLE_BASIC_INFORMATION: ret = pytalloc_reference_ex(&dssetup_DsRolePrimaryDomInfoBasic_Type, mem_ctx, &in->basic); return ret; case DS_ROLE_UPGRADE_STATUS: ret = pytalloc_reference_ex(&dssetup_DsRoleUpgradeStatus_Type, mem_ctx, &in->upgrade); return ret; case DS_ROLE_OP_STATUS: ret = pytalloc_reference_ex(&dssetup_DsRoleOpStatus_Type, mem_ctx, &in->opstatus); return ret; } PyErr_SetString(PyExc_TypeError, "unknown union level"); return NULL; } static union dssetup_DsRoleInfo *py_export_dssetup_DsRoleInfo(TALLOC_CTX *mem_ctx, int level, PyObject *in) { union dssetup_DsRoleInfo *ret = talloc_zero(mem_ctx, union dssetup_DsRoleInfo); switch (level) { case DS_ROLE_BASIC_INFORMATION: if (in == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->basic"); talloc_free(ret); return NULL; } PY_CHECK_TYPE(&dssetup_DsRolePrimaryDomInfoBasic_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->basic = *(struct dssetup_DsRolePrimaryDomInfoBasic *)pytalloc_get_ptr(in); break; case DS_ROLE_UPGRADE_STATUS: if (in == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->upgrade"); talloc_free(ret); return NULL; } PY_CHECK_TYPE(&dssetup_DsRoleUpgradeStatus_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->upgrade = *(struct dssetup_DsRoleUpgradeStatus *)pytalloc_get_ptr(in); break; case DS_ROLE_OP_STATUS: if (in == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->opstatus"); talloc_free(ret); return NULL; } PY_CHECK_TYPE(&dssetup_DsRoleOpStatus_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->opstatus = *(struct dssetup_DsRoleOpStatus *)pytalloc_get_ptr(in); break; default: PyErr_SetString(PyExc_TypeError, "invalid union level value"); talloc_free(ret); ret = NULL; } return ret; } static PyObject *py_dssetup_DsRoleInfo_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 dssetup_DsRoleInfo *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 dssetup_DsRoleInfo *)pytalloc_get_ptr(in_obj); if (in == NULL) { PyErr_Format(PyExc_TypeError, "in needs to be a pointer to union dssetup_DsRoleInfo!"); return NULL; } return py_import_dssetup_DsRoleInfo(mem_ctx, level, in); } static PyObject *py_dssetup_DsRoleInfo_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 dssetup_DsRoleInfo *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_dssetup_DsRoleInfo(mem_ctx, level, in); if (out == NULL) { return NULL; } return pytalloc_GenericObject_reference(out); } static PyMethodDef py_dssetup_DsRoleInfo_methods[] = { { "__import__", PY_DISCARD_FUNC_SIG(PyCFunction,py_dssetup_DsRoleInfo_import), METH_VARARGS|METH_KEYWORDS|METH_CLASS, "T.__import__(mem_ctx, level, in) => ret." }, { "__export__", PY_DISCARD_FUNC_SIG(PyCFunction,py_dssetup_DsRoleInfo_export), METH_VARARGS|METH_KEYWORDS|METH_CLASS, "T.__export__(mem_ctx, level, in) => ret." }, { NULL, NULL, 0, NULL } }; static PyObject *py_dssetup_DsRoleInfo_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyErr_Format(PyExc_TypeError, "New %s Objects are not supported", type->tp_name); return NULL; } static PyTypeObject dssetup_DsRoleInfo_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "dssetup.DsRoleInfo", .tp_getset = NULL, .tp_methods = py_dssetup_DsRoleInfo_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_dssetup_DsRoleInfo_new, }; static PyObject *py_dssetup_DsRoleGetPrimaryDomainInformation_in_get_level(PyObject *obj, void *closure) { struct dssetup_DsRoleGetPrimaryDomainInformation *object = (struct dssetup_DsRoleGetPrimaryDomainInformation *)pytalloc_get_ptr(obj); PyObject *py_level; py_level = PyLong_FromLong((uint16_t)object->in.level); return py_level; } static int py_dssetup_DsRoleGetPrimaryDomainInformation_in_set_level(PyObject *py_obj, PyObject *value, void *closure) { struct dssetup_DsRoleGetPrimaryDomainInformation *object = (struct dssetup_DsRoleGetPrimaryDomainInformation *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->in.level"); return -1; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->in.level)); 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->in.level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return -1; } } return 0; } static PyObject *py_dssetup_DsRoleGetPrimaryDomainInformation_out_get_info(PyObject *obj, void *closure) { struct dssetup_DsRoleGetPrimaryDomainInformation *object = (struct dssetup_DsRoleGetPrimaryDomainInformation *)pytalloc_get_ptr(obj); PyObject *py_info; if (object->out.info == NULL) { Py_RETURN_NONE; } if (object->out.info == NULL) { py_info = Py_None; Py_INCREF(py_info); } else { py_info = pyrpc_import_union(&dssetup_DsRoleInfo_Type, object->out.info, object->in.level, object->out.info, "union dssetup_DsRoleInfo"); if (py_info == NULL) { return NULL; } } return py_info; } static int py_dssetup_DsRoleGetPrimaryDomainInformation_out_set_info(PyObject *py_obj, PyObject *value, void *closure) { struct dssetup_DsRoleGetPrimaryDomainInformation *object = (struct dssetup_DsRoleGetPrimaryDomainInformation *)pytalloc_get_ptr(py_obj); talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->out.info)); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.info"); return -1; } if (value == Py_None) { object->out.info = NULL; } else { object->out.info = NULL; { union dssetup_DsRoleInfo *info_switch_1; info_switch_1 = (union dssetup_DsRoleInfo *)pyrpc_export_union(&dssetup_DsRoleInfo_Type, pytalloc_get_mem_ctx(py_obj), object->in.level, value, "union dssetup_DsRoleInfo"); if (info_switch_1 == NULL) { return -1; } object->out.info = info_switch_1; } } return 0; } static PyObject *py_dssetup_DsRoleGetPrimaryDomainInformation_get_result(PyObject *obj, void *closure) { struct dssetup_DsRoleGetPrimaryDomainInformation *object = (struct dssetup_DsRoleGetPrimaryDomainInformation *)pytalloc_get_ptr(obj); PyObject *py_result; py_result = PyErr_FromWERROR(object->out.result); return py_result; } static int py_dssetup_DsRoleGetPrimaryDomainInformation_set_result(PyObject *py_obj, PyObject *value, void *closure) { struct dssetup_DsRoleGetPrimaryDomainInformation *object = (struct dssetup_DsRoleGetPrimaryDomainInformation *)pytalloc_get_ptr(py_obj); if (value == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->out.result"); return -1; } object->out.result = W_ERROR(PyLong_AsLong(value)); return 0; } static PyGetSetDef py_dssetup_DsRoleGetPrimaryDomainInformation_getsetters[] = { { .name = discard_const_p(char, "in_level"), .get = py_dssetup_DsRoleGetPrimaryDomainInformation_in_get_level, .set = py_dssetup_DsRoleGetPrimaryDomainInformation_in_set_level, .doc = discard_const_p(char, "PIDL-generated element of base type dssetup_DsRoleInfoLevel") }, { .name = discard_const_p(char, "out_info"), .get = py_dssetup_DsRoleGetPrimaryDomainInformation_out_get_info, .set = py_dssetup_DsRoleGetPrimaryDomainInformation_out_set_info, .doc = discard_const_p(char, "PIDL-generated element of base type dssetup_DsRoleInfo") }, { .name = discard_const_p(char, "result"), .get = py_dssetup_DsRoleGetPrimaryDomainInformation_get_result, .set = py_dssetup_DsRoleGetPrimaryDomainInformation_set_result, .doc = discard_const_p(char, "PIDL-generated element of type WERROR") }, { .name = NULL } }; static PyObject *py_dssetup_DsRoleGetPrimaryDomainInformation_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { PyObject *self = pytalloc_new(struct dssetup_DsRoleGetPrimaryDomainInformation, type); return self; } static PyObject *py_dssetup_DsRoleGetPrimaryDomainInformation_ndr_opnum(PyTypeObject *type, PyObject *Py_UNUSED(ignored)) { return PyLong_FromLong(0); } static PyObject *py_dssetup_DsRoleGetPrimaryDomainInformation_ndr_pack(PyObject *py_obj, int ndr_inout_flags, uint32_t ndr_push_flags) { const struct ndr_interface_call *call = NULL; struct dssetup_DsRoleGetPrimaryDomainInformation *object = (struct dssetup_DsRoleGetPrimaryDomainInformation *)pytalloc_get_ptr(py_obj); PyObject *ret = NULL; struct ndr_push *push = NULL; DATA_BLOB blob; enum ndr_err_code err; if (ndr_table_dssetup.num_calls < 1) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_dssetup_DsRoleGetPrimaryDomainInformation_ndr_pack"); return NULL; } call = &ndr_table_dssetup.calls[0]; push = ndr_push_init_ctx(pytalloc_get_mem_ctx(py_obj)); if (push == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } push->flags |= ndr_push_flags; err = call->ndr_push(push, ndr_inout_flags, object); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(push); PyErr_SetNdrError(err); return NULL; } blob = ndr_push_blob(push); ret = PyBytes_FromStringAndSize((char *)blob.data, blob.length); TALLOC_FREE(push); return ret; } static PyObject *py_dssetup_DsRoleGetPrimaryDomainInformation_ndr_pack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs) { const char * const kwnames[] = { "bigendian", "ndr64", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_push_flags = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_in__", discard_const_p(char *, kwnames), &bigendian_obj, &ndr64_obj)) { return NULL; } if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_push_flags |= LIBNDR_FLAG_NDR64; } return py_dssetup_DsRoleGetPrimaryDomainInformation_ndr_pack(py_obj, NDR_IN, ndr_push_flags); } static PyObject *py_dssetup_DsRoleGetPrimaryDomainInformation_ndr_pack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs) { const char * const kwnames[] = { "bigendian", "ndr64", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_push_flags = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:__ndr_pack_out__", discard_const_p(char *, kwnames), &bigendian_obj, &ndr64_obj)) { return NULL; } if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_push_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_push_flags |= LIBNDR_FLAG_NDR64; } return py_dssetup_DsRoleGetPrimaryDomainInformation_ndr_pack(py_obj, NDR_OUT, ndr_push_flags); } static PyObject *py_dssetup_DsRoleGetPrimaryDomainInformation_ndr_unpack(PyObject *py_obj, const DATA_BLOB *blob, int ndr_inout_flags, uint32_t ndr_pull_flags, bool allow_remaining) { const struct ndr_interface_call *call = NULL; struct dssetup_DsRoleGetPrimaryDomainInformation *object = (struct dssetup_DsRoleGetPrimaryDomainInformation *)pytalloc_get_ptr(py_obj); struct ndr_pull *pull = NULL; enum ndr_err_code err; if (ndr_table_dssetup.num_calls < 1) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_dssetup_DsRoleGetPrimaryDomainInformation_ndr_unpack"); return NULL; } call = &ndr_table_dssetup.calls[0]; pull = ndr_pull_init_blob(blob, object); if (pull == NULL) { PyErr_SetNdrError(NDR_ERR_ALLOC); return NULL; } pull->flags |= ndr_pull_flags; err = call->ndr_pull(pull, ndr_inout_flags, object); if (!NDR_ERR_CODE_IS_SUCCESS(err)) { TALLOC_FREE(pull); PyErr_SetNdrError(err); return NULL; } if (!allow_remaining) { uint32_t highest_ofs; if (pull->offset > pull->relative_highest_offset) { highest_ofs = pull->offset; } else { highest_ofs = pull->relative_highest_offset; } if (highest_ofs < pull->data_size) { err = ndr_pull_error(pull, NDR_ERR_UNREAD_BYTES, "not all bytes consumed ofs[%u] size[%u]", highest_ofs, pull->data_size); TALLOC_FREE(pull); PyErr_SetNdrError(err); return NULL; } } TALLOC_FREE(pull); Py_RETURN_NONE; } static PyObject *py_dssetup_DsRoleGetPrimaryDomainInformation_ndr_unpack_in(PyObject *py_obj, PyObject *args, PyObject *kwargs) { DATA_BLOB blob; Py_ssize_t blob_length = 0; const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_in__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &bigendian_obj, &ndr64_obj, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_pull_flags |= LIBNDR_FLAG_NDR64; } if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } return py_dssetup_DsRoleGetPrimaryDomainInformation_ndr_unpack(py_obj, &blob, NDR_IN, ndr_pull_flags, allow_remaining); } static PyObject *py_dssetup_DsRoleGetPrimaryDomainInformation_ndr_unpack_out(PyObject *py_obj, PyObject *args, PyObject *kwargs) { DATA_BLOB blob; Py_ssize_t blob_length = 0; const char * const kwnames[] = { "data_blob", "bigendian", "ndr64", "allow_remaining", NULL }; PyObject *bigendian_obj = NULL; PyObject *ndr64_obj = NULL; uint32_t ndr_pull_flags = LIBNDR_FLAG_REF_ALLOC; PyObject *allow_remaining_obj = NULL; bool allow_remaining = false; if (!PyArg_ParseTupleAndKeywords(args, kwargs, PYARG_BYTES_LEN "|OOO:__ndr_unpack_out__", discard_const_p(char *, kwnames), &blob.data, &blob_length, &bigendian_obj, &ndr64_obj, &allow_remaining_obj)) { return NULL; } blob.length = blob_length; if (bigendian_obj && PyObject_IsTrue(bigendian_obj)) { ndr_pull_flags |= LIBNDR_FLAG_BIGENDIAN; } if (ndr64_obj && PyObject_IsTrue(ndr64_obj)) { ndr_pull_flags |= LIBNDR_FLAG_NDR64; } if (allow_remaining_obj && PyObject_IsTrue(allow_remaining_obj)) { allow_remaining = true; } return py_dssetup_DsRoleGetPrimaryDomainInformation_ndr_unpack(py_obj, &blob, NDR_OUT, ndr_pull_flags, allow_remaining); } static PyObject *py_dssetup_DsRoleGetPrimaryDomainInformation_ndr_print(PyObject *py_obj, const char *name, int ndr_inout_flags) { const struct ndr_interface_call *call = NULL; struct dssetup_DsRoleGetPrimaryDomainInformation *object = (struct dssetup_DsRoleGetPrimaryDomainInformation *)pytalloc_get_ptr(py_obj); PyObject *ret; char *retstr; if (ndr_table_dssetup.num_calls < 1) { PyErr_SetString(PyExc_TypeError, "Internal Error, ndr_interface_call missing for py_dssetup_DsRoleGetPrimaryDomainInformation_ndr_print"); return NULL; } call = &ndr_table_dssetup.calls[0]; retstr = ndr_print_function_string(pytalloc_get_mem_ctx(py_obj), call->ndr_print, name, ndr_inout_flags, object); ret = PyUnicode_FromString(retstr); TALLOC_FREE(retstr); return ret; } static PyObject *py_dssetup_DsRoleGetPrimaryDomainInformation_ndr_print_in(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_dssetup_DsRoleGetPrimaryDomainInformation_ndr_print(py_obj, "dssetup_DsRoleGetPrimaryDomainInformation_in", NDR_IN); } static PyObject *py_dssetup_DsRoleGetPrimaryDomainInformation_ndr_print_out(PyObject *py_obj, PyObject *Py_UNUSED(ignored)) { return py_dssetup_DsRoleGetPrimaryDomainInformation_ndr_print(py_obj, "dssetup_DsRoleGetPrimaryDomainInformation_out", NDR_OUT); } static PyMethodDef py_dssetup_DsRoleGetPrimaryDomainInformation_methods[] = { { "opnum", (PyCFunction)py_dssetup_DsRoleGetPrimaryDomainInformation_ndr_opnum, METH_NOARGS|METH_CLASS, "dssetup.DsRoleGetPrimaryDomainInformation.opnum() -> 0 (0x00) " }, { "__ndr_pack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_dssetup_DsRoleGetPrimaryDomainInformation_ndr_pack_in), METH_VARARGS|METH_KEYWORDS, "S.ndr_pack_in(object, bigendian=False, ndr64=False) -> blob\nNDR pack input" }, { "__ndr_pack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_dssetup_DsRoleGetPrimaryDomainInformation_ndr_pack_out), METH_VARARGS|METH_KEYWORDS, "S.ndr_pack_out(object, bigendian=False, ndr64=False) -> blob\nNDR pack output" }, { "__ndr_unpack_in__", PY_DISCARD_FUNC_SIG(PyCFunction,py_dssetup_DsRoleGetPrimaryDomainInformation_ndr_unpack_in), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack_in(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack input" }, { "__ndr_unpack_out__", PY_DISCARD_FUNC_SIG(PyCFunction,py_dssetup_DsRoleGetPrimaryDomainInformation_ndr_unpack_out), METH_VARARGS|METH_KEYWORDS, "S.ndr_unpack_out(class, blob, bigendian=False, ndr64=False, allow_remaining=False) -> None\nNDR unpack output" }, { "__ndr_print_in__", (PyCFunction)py_dssetup_DsRoleGetPrimaryDomainInformation_ndr_print_in, METH_NOARGS, "S.ndr_print_in(object) -> None\nNDR print input" }, { "__ndr_print_out__", (PyCFunction)py_dssetup_DsRoleGetPrimaryDomainInformation_ndr_print_out, METH_NOARGS, "S.ndr_print_out(object) -> None\nNDR print output" }, { NULL, NULL, 0, NULL } }; static PyTypeObject dssetup_DsRoleGetPrimaryDomainInformation_Type = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "dssetup.DsRoleGetPrimaryDomainInformation", .tp_getset = py_dssetup_DsRoleGetPrimaryDomainInformation_getsetters, .tp_methods = py_dssetup_DsRoleGetPrimaryDomainInformation_methods, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = py_dssetup_DsRoleGetPrimaryDomainInformation_new, }; static bool pack_py_dssetup_DsRoleGetPrimaryDomainInformation_args_in(PyObject *args, PyObject *kwargs, struct dssetup_DsRoleGetPrimaryDomainInformation *r) { PyObject *py_level; const char *kwnames[] = { "level", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:dssetup_DsRoleGetPrimaryDomainInformation", discard_const_p(char *, kwnames), &py_level)) { return false; } if (py_level == NULL) { PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct r->in.level"); return false; } { const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(r->in.level)); if (PyLong_Check(py_level)) { unsigned long long test_var; test_var = PyLong_AsUnsignedLongLong(py_level); if (PyErr_Occurred() != NULL) { return false; } 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 false; } r->in.level = test_var; } else { PyErr_Format(PyExc_TypeError, "Expected type %s",\ PyLong_Type.tp_name); return false; } } return true; } static PyObject *unpack_py_dssetup_DsRoleGetPrimaryDomainInformation_args_out(struct dssetup_DsRoleGetPrimaryDomainInformation *r) { PyObject *result; PyObject *py_info; if (r->out.info == NULL) { py_info = Py_None; Py_INCREF(py_info); } else { py_info = pyrpc_import_union(&dssetup_DsRoleInfo_Type, r->out.info, r->in.level, r->out.info, "union dssetup_DsRoleInfo"); if (py_info == NULL) { return NULL; } } result = py_info; if (!W_ERROR_IS_OK(r->out.result)) { PyErr_SetWERROR(r->out.result); return NULL; } return result; } const struct PyNdrRpcMethodDef py_ndr_dssetup_methods[] = { { "DsRoleGetPrimaryDomainInformation", "S.DsRoleGetPrimaryDomainInformation(level) -> info", (py_dcerpc_call_fn)dcerpc_dssetup_DsRoleGetPrimaryDomainInformation_r, (py_data_pack_fn)pack_py_dssetup_DsRoleGetPrimaryDomainInformation_args_in, (py_data_unpack_fn)unpack_py_dssetup_DsRoleGetPrimaryDomainInformation_args_out, 0, &ndr_table_dssetup }, {0} }; static PyObject *interface_dssetup_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return py_dcerpc_interface_init_helper(type, args, kwargs, &ndr_table_dssetup); } #define PY_DOC_DSSETUP "Active Directory Setup" static PyTypeObject dssetup_InterfaceType = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "dssetup.dssetup", .tp_basicsize = sizeof(dcerpc_InterfaceObject), .tp_doc = "dssetup(binding, lp_ctx=None, credentials=None) -> connection\n" "\n" "binding should be a DCE/RPC binding string (for example: ncacn_ip_tcp:127.0.0.1)\n" "lp_ctx should be a path to a smb.conf file or a param.LoadParm object\n" "credentials should be a credentials.Credentials object.\n\n"PY_DOC_DSSETUP, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = interface_dssetup_new, }; static PyObject *syntax_dssetup_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { return py_dcerpc_syntax_init_helper(type, args, kwargs, &ndr_table_dssetup.syntax_id); } #define PY_DOC_DSSETUP_SYNTAX "Active Directory Setup" static PyTypeObject dssetup_SyntaxType = { PyVarObject_HEAD_INIT(NULL, 0) .tp_name = "dssetup.dssetup_abstract_syntax", .tp_doc = "dssetup_abstract_syntax()\n"PY_DOC_DSSETUP_SYNTAX, .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, .tp_new = syntax_dssetup_new, }; static PyMethodDef dssetup_methods[] = { { NULL, NULL, 0, NULL } }; static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, .m_name = "dssetup", .m_doc = "dssetup DCE/RPC", .m_size = -1, .m_methods = dssetup_methods, }; MODULE_INIT_FUNC(dssetup) { PyObject *m = NULL; PyObject *dep_samba_dcerpc_misc = NULL; PyObject *dep_talloc = NULL; PyObject *dep_samba_dcerpc_base = NULL; dep_samba_dcerpc_misc = PyImport_ImportModule("samba.dcerpc.misc"); if (dep_samba_dcerpc_misc == NULL) goto out; dep_talloc = PyImport_ImportModule("talloc"); if (dep_talloc == NULL) goto out; dep_samba_dcerpc_base = PyImport_ImportModule("samba.dcerpc.base"); if (dep_samba_dcerpc_base == NULL) goto out; GUID_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_misc, "GUID"); if (GUID_Type == NULL) goto out; BaseObject_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "BaseObject"); if (BaseObject_Type == NULL) goto out; ClientConnection_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_base, "ClientConnection"); if (ClientConnection_Type == NULL) goto out; ndr_syntax_id_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_misc, "ndr_syntax_id"); if (ndr_syntax_id_Type == NULL) goto out; dssetup_DsRolePrimaryDomInfoBasic_Type.tp_base = BaseObject_Type; dssetup_DsRolePrimaryDomInfoBasic_Type.tp_basicsize = pytalloc_BaseObject_size(); dssetup_DsRoleUpgradeStatus_Type.tp_base = BaseObject_Type; dssetup_DsRoleUpgradeStatus_Type.tp_basicsize = pytalloc_BaseObject_size(); dssetup_DsRoleOpStatus_Type.tp_base = BaseObject_Type; dssetup_DsRoleOpStatus_Type.tp_basicsize = pytalloc_BaseObject_size(); dssetup_DsRoleInfo_Type.tp_base = BaseObject_Type; dssetup_DsRoleInfo_Type.tp_basicsize = pytalloc_BaseObject_size(); dssetup_DsRoleGetPrimaryDomainInformation_Type.tp_base = BaseObject_Type; dssetup_DsRoleGetPrimaryDomainInformation_Type.tp_basicsize = pytalloc_BaseObject_size(); dssetup_InterfaceType.tp_base = ClientConnection_Type; dssetup_SyntaxType.tp_base = ndr_syntax_id_Type; dssetup_SyntaxType.tp_basicsize = pytalloc_BaseObject_size(); if (PyType_Ready(&dssetup_DsRolePrimaryDomInfoBasic_Type) < 0) goto out; if (PyType_Ready(&dssetup_DsRoleUpgradeStatus_Type) < 0) goto out; if (PyType_Ready(&dssetup_DsRoleOpStatus_Type) < 0) goto out; if (PyType_Ready(&dssetup_DsRoleInfo_Type) < 0) goto out; if (PyType_Ready(&dssetup_DsRoleGetPrimaryDomainInformation_Type) < 0) goto out; if (PyType_Ready(&dssetup_InterfaceType) < 0) goto out; if (PyType_Ready(&dssetup_SyntaxType) < 0) goto out; if (!PyInterface_AddNdrRpcMethods(&dssetup_InterfaceType, py_ndr_dssetup_methods)) return NULL; #ifdef PY_DSROLEPRIMARYDOMINFOBASIC_PATCH PY_DSROLEPRIMARYDOMINFOBASIC_PATCH(&dssetup_DsRolePrimaryDomInfoBasic_Type); #endif #ifdef PY_DSROLEUPGRADESTATUS_PATCH PY_DSROLEUPGRADESTATUS_PATCH(&dssetup_DsRoleUpgradeStatus_Type); #endif #ifdef PY_DSROLEOPSTATUS_PATCH PY_DSROLEOPSTATUS_PATCH(&dssetup_DsRoleOpStatus_Type); #endif #ifdef PY_DSROLEINFO_PATCH PY_DSROLEINFO_PATCH(&dssetup_DsRoleInfo_Type); #endif #ifdef PY_DSROLEGETPRIMARYDOMAININFORMATION_PATCH PY_DSROLEGETPRIMARYDOMAININFORMATION_PATCH(&dssetup_DsRoleGetPrimaryDomainInformation_Type); #endif #ifdef PY_DSSETUP_PATCH PY_DSSETUP_PATCH(&dssetup_InterfaceType); #endif #ifdef PY_DSSETUP_ABSTRACT_SYNTAX_PATCH PY_DSSETUP_ABSTRACT_SYNTAX_PATCH(&dssetup_SyntaxType); #endif #ifdef PY_ABSTRACT_SYNTAX_PATCH PY_ABSTRACT_SYNTAX_PATCH(&dssetup_SyntaxType); #endif m = PyModule_Create(&moduledef); if (m == NULL) goto out; PyModule_AddObject(m, "DS_ROLE_STANDALONE_WORKSTATION", PyLong_FromLong((uint16_t)DS_ROLE_STANDALONE_WORKSTATION)); PyModule_AddObject(m, "DS_ROLE_MEMBER_WORKSTATION", PyLong_FromLong((uint16_t)DS_ROLE_MEMBER_WORKSTATION)); PyModule_AddObject(m, "DS_ROLE_STANDALONE_SERVER", PyLong_FromLong((uint16_t)DS_ROLE_STANDALONE_SERVER)); PyModule_AddObject(m, "DS_ROLE_MEMBER_SERVER", PyLong_FromLong((uint16_t)DS_ROLE_MEMBER_SERVER)); PyModule_AddObject(m, "DS_ROLE_BACKUP_DC", PyLong_FromLong((uint16_t)DS_ROLE_BACKUP_DC)); PyModule_AddObject(m, "DS_ROLE_PRIMARY_DC", PyLong_FromLong((uint16_t)DS_ROLE_PRIMARY_DC)); PyModule_AddObject(m, "DS_ROLE_PRIMARY_DS_RUNNING", PyLong_FromUnsignedLongLong((uint32_t)DS_ROLE_PRIMARY_DS_RUNNING)); PyModule_AddObject(m, "DS_ROLE_PRIMARY_DS_MIXED_MODE", PyLong_FromUnsignedLongLong((uint32_t)DS_ROLE_PRIMARY_DS_MIXED_MODE)); PyModule_AddObject(m, "DS_ROLE_UPGRADE_IN_PROGRESS", PyLong_FromUnsignedLongLong((uint32_t)DS_ROLE_UPGRADE_IN_PROGRESS)); PyModule_AddObject(m, "DS_ROLE_PRIMARY_DOMAIN_GUID_PRESENT", PyLong_FromUnsignedLongLong((uint32_t)DS_ROLE_PRIMARY_DOMAIN_GUID_PRESENT)); PyModule_AddObject(m, "DS_ROLE_NOT_UPGRADING", PyLong_FromUnsignedLongLong((uint32_t)DS_ROLE_NOT_UPGRADING)); PyModule_AddObject(m, "DS_ROLE_UPGRADING", PyLong_FromUnsignedLongLong((uint32_t)DS_ROLE_UPGRADING)); PyModule_AddObject(m, "DS_ROLE_PREVIOUS_UNKNOWN", PyLong_FromLong((uint16_t)DS_ROLE_PREVIOUS_UNKNOWN)); PyModule_AddObject(m, "DS_ROLE_PREVIOUS_PRIMARY", PyLong_FromLong((uint16_t)DS_ROLE_PREVIOUS_PRIMARY)); PyModule_AddObject(m, "DS_ROLE_PREVIOUS_BACKUP", PyLong_FromLong((uint16_t)DS_ROLE_PREVIOUS_BACKUP)); PyModule_AddObject(m, "DS_ROLE_OP_IDLE", PyLong_FromLong((uint16_t)DS_ROLE_OP_IDLE)); PyModule_AddObject(m, "DS_ROLE_OP_ACTIVE", PyLong_FromLong((uint16_t)DS_ROLE_OP_ACTIVE)); PyModule_AddObject(m, "DS_ROLE_OP_NEEDS_REBOOT", PyLong_FromLong((uint16_t)DS_ROLE_OP_NEEDS_REBOOT)); PyModule_AddObject(m, "DS_ROLE_BASIC_INFORMATION", PyLong_FromLong((uint16_t)DS_ROLE_BASIC_INFORMATION)); PyModule_AddObject(m, "DS_ROLE_UPGRADE_STATUS", PyLong_FromLong((uint16_t)DS_ROLE_UPGRADE_STATUS)); PyModule_AddObject(m, "DS_ROLE_OP_STATUS", PyLong_FromLong((uint16_t)DS_ROLE_OP_STATUS)); Py_INCREF((PyObject *)(void *)&dssetup_DsRolePrimaryDomInfoBasic_Type); PyModule_AddObject(m, "DsRolePrimaryDomInfoBasic", (PyObject *)(void *)&dssetup_DsRolePrimaryDomInfoBasic_Type); Py_INCREF((PyObject *)(void *)&dssetup_DsRoleUpgradeStatus_Type); PyModule_AddObject(m, "DsRoleUpgradeStatus", (PyObject *)(void *)&dssetup_DsRoleUpgradeStatus_Type); Py_INCREF((PyObject *)(void *)&dssetup_DsRoleOpStatus_Type); PyModule_AddObject(m, "DsRoleOpStatus", (PyObject *)(void *)&dssetup_DsRoleOpStatus_Type); Py_INCREF((PyObject *)(void *)&dssetup_DsRoleInfo_Type); PyModule_AddObject(m, "DsRoleInfo", (PyObject *)(void *)&dssetup_DsRoleInfo_Type); Py_INCREF((PyObject *)(void *)&dssetup_DsRoleGetPrimaryDomainInformation_Type); PyModule_AddObject(m, "DsRoleGetPrimaryDomainInformation", (PyObject *)(void *)&dssetup_DsRoleGetPrimaryDomainInformation_Type); Py_INCREF((PyObject *)(void *)&dssetup_InterfaceType); PyModule_AddObject(m, "dssetup", (PyObject *)(void *)&dssetup_InterfaceType); Py_INCREF((PyObject *)(void *)&dssetup_SyntaxType); PyModule_AddObject(m, "dssetup_abstract_syntax", (PyObject *)(void *)&dssetup_SyntaxType); Py_INCREF((PyObject *)(void *)&dssetup_SyntaxType); PyModule_AddObject(m, "abstract_syntax", (PyObject *)(void *)&dssetup_SyntaxType); #ifdef PY_MOD_DSSETUP_PATCH PY_MOD_DSSETUP_PATCH(m); #endif out: Py_XDECREF(dep_samba_dcerpc_misc); Py_XDECREF(dep_talloc); Py_XDECREF(dep_samba_dcerpc_base); return m; }