/* Python wrapper functions auto-generated by pidl */
+#define PY_SSIZE_T_CLEAN 1 /* We use Py_ssize_t for PyArg_ParseTupleAndKeywords */
#include <Python.h>
#include "includes.h"
#include <pytalloc.h>
#include "bin/default/librpc/gen_ndr/ndr_orpc_c.h"
/*
- * These functions are here to ensure they can be optomised out by
+ * These functions are here to ensure they can be optimized out by
* the compiler based on the constant input values
*/
static PyTypeObject OBJREF_Type;
static PyTypeObject MInterfacePointer_Type;
-void initorpc(void);static PyTypeObject *Object_Type;
+void initorpc(void);static PyTypeObject *BaseObject_Type;
static PyTypeObject *GUID_Type;
static PyObject *py_COMVERSION_get_MajorVersion(PyObject *obj, void *closure)
static int py_COMVERSION_set_MajorVersion(PyObject *py_obj, PyObject *value, void *closure)
{
struct COMVERSION *object = (struct COMVERSION *)pytalloc_get_ptr(py_obj);
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->MajorVersion");
+ return -1;
+ }
{
const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->MajorVersion));
if (PyLong_Check(value)) {
static int py_COMVERSION_set_MinorVersion(PyObject *py_obj, PyObject *value, void *closure)
{
struct COMVERSION *object = (struct COMVERSION *)pytalloc_get_ptr(py_obj);
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->MinorVersion");
+ return -1;
+ }
{
const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->MinorVersion));
if (PyLong_Check(value)) {
}
static PyGetSetDef py_COMVERSION_getsetters[] = {
- { discard_const_p(char, "MajorVersion"), py_COMVERSION_get_MajorVersion, py_COMVERSION_set_MajorVersion },
- { discard_const_p(char, "MinorVersion"), py_COMVERSION_get_MinorVersion, py_COMVERSION_set_MinorVersion },
- { NULL }
+ {
+ .name = discard_const_p(char, "MajorVersion"),
+ .get = py_COMVERSION_get_MajorVersion,
+ .set = py_COMVERSION_set_MajorVersion,
+ .doc = discard_const_p(char, "PIDL-generated element MajorVersion")
+ },
+ {
+ .name = discard_const_p(char, "MinorVersion"),
+ .get = py_COMVERSION_get_MinorVersion,
+ .set = py_COMVERSION_set_MinorVersion,
+ .doc = discard_const_p(char, "PIDL-generated element MinorVersion")
+ },
+ { .name = NULL }
};
static PyObject *py_COMVERSION_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
static PyObject *py_COMVERSION_ndr_pack(PyObject *py_obj)
{
struct COMVERSION *object = (struct COMVERSION *)pytalloc_get_ptr(py_obj);
+ PyObject *ret = NULL;
DATA_BLOB blob;
enum ndr_err_code err;
- err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_COMVERSION);
+ 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_COMVERSION);
if (err != NDR_ERR_SUCCESS) {
+ TALLOC_FREE(tmp_ctx);
PyErr_SetNdrError(err);
return NULL;
}
- return PyString_FromStringAndSize((char *)blob.data, blob.length);
+ ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
+ TALLOC_FREE(tmp_ctx);
+ return ret;
}
static PyObject *py_COMVERSION_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
{
struct COMVERSION *object = (struct COMVERSION *)pytalloc_get_ptr(py_obj);
DATA_BLOB blob;
- int blob_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;
.tp_getset = py_COMVERSION_getsetters,
.tp_methods = py_COMVERSION_methods,
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- .tp_basicsize = sizeof(pytalloc_Object),
.tp_new = py_COMVERSION_new,
};
static int py_ORPC_EXTENT_set_id(PyObject *py_obj, PyObject *value, void *closure)
{
struct ORPC_EXTENT *object = (struct ORPC_EXTENT *)pytalloc_get_ptr(py_obj);
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->id");
+ 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();
static int py_ORPC_EXTENT_set_size(PyObject *py_obj, PyObject *value, void *closure)
{
struct ORPC_EXTENT *object = (struct ORPC_EXTENT *)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)) {
static int py_ORPC_EXTENT_set_data(PyObject *py_obj, PyObject *value, void *closure)
{
struct ORPC_EXTENT *object = (struct ORPC_EXTENT *)pytalloc_get_ptr(py_obj);
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->data");
+ return -1;
+ }
PY_CHECK_TYPE(&PyList_Type, value, return -1;);
{
int data_cntr_0;
if (!object->data) { return -1;; }
talloc_set_name_const(object->data, "ARRAY: object->data");
for (data_cntr_0 = 0; data_cntr_0 < PyList_GET_SIZE(value); data_cntr_0++) {
+ if (PyList_GET_ITEM(value, data_cntr_0) == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->data[data_cntr_0]");
+ return -1;
+ }
{
const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->data[data_cntr_0]));
if (PyLong_Check(PyList_GET_ITEM(value, data_cntr_0))) {
}
static PyGetSetDef py_ORPC_EXTENT_getsetters[] = {
- { discard_const_p(char, "id"), py_ORPC_EXTENT_get_id, py_ORPC_EXTENT_set_id },
- { discard_const_p(char, "size"), py_ORPC_EXTENT_get_size, py_ORPC_EXTENT_set_size },
- { discard_const_p(char, "data"), py_ORPC_EXTENT_get_data, py_ORPC_EXTENT_set_data },
- { NULL }
+ {
+ .name = discard_const_p(char, "id"),
+ .get = py_ORPC_EXTENT_get_id,
+ .set = py_ORPC_EXTENT_set_id,
+ .doc = discard_const_p(char, "PIDL-generated element id")
+ },
+ {
+ .name = discard_const_p(char, "size"),
+ .get = py_ORPC_EXTENT_get_size,
+ .set = py_ORPC_EXTENT_set_size,
+ .doc = discard_const_p(char, "PIDL-generated element size")
+ },
+ {
+ .name = discard_const_p(char, "data"),
+ .get = py_ORPC_EXTENT_get_data,
+ .set = py_ORPC_EXTENT_set_data,
+ .doc = discard_const_p(char, "PIDL-generated element data")
+ },
+ { .name = NULL }
};
static PyObject *py_ORPC_EXTENT_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
static PyObject *py_ORPC_EXTENT_ndr_pack(PyObject *py_obj)
{
struct ORPC_EXTENT *object = (struct ORPC_EXTENT *)pytalloc_get_ptr(py_obj);
+ PyObject *ret = NULL;
DATA_BLOB blob;
enum ndr_err_code err;
- err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_ORPC_EXTENT);
+ 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_ORPC_EXTENT);
if (err != NDR_ERR_SUCCESS) {
+ TALLOC_FREE(tmp_ctx);
PyErr_SetNdrError(err);
return NULL;
}
- return PyString_FromStringAndSize((char *)blob.data, blob.length);
+ ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
+ TALLOC_FREE(tmp_ctx);
+ return ret;
}
static PyObject *py_ORPC_EXTENT_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
{
struct ORPC_EXTENT *object = (struct ORPC_EXTENT *)pytalloc_get_ptr(py_obj);
DATA_BLOB blob;
- int blob_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;
.tp_getset = py_ORPC_EXTENT_getsetters,
.tp_methods = py_ORPC_EXTENT_methods,
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- .tp_basicsize = sizeof(pytalloc_Object),
.tp_new = py_ORPC_EXTENT_new,
};
static int py_ORPC_EXTENT_ARRAY_set_size(PyObject *py_obj, PyObject *value, void *closure)
{
struct ORPC_EXTENT_ARRAY *object = (struct ORPC_EXTENT_ARRAY *)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)) {
static int py_ORPC_EXTENT_ARRAY_set_reserved(PyObject *py_obj, PyObject *value, void *closure)
{
struct ORPC_EXTENT_ARRAY *object = (struct ORPC_EXTENT_ARRAY *)pytalloc_get_ptr(py_obj);
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->reserved");
+ return -1;
+ }
{
const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->reserved));
if (PyLong_Check(value)) {
{
struct ORPC_EXTENT_ARRAY *object = (struct ORPC_EXTENT_ARRAY *)pytalloc_get_ptr(py_obj);
talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->extent));
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->extent");
+ return -1;
+ }
if (value == Py_None) {
object->extent = NULL;
} else {
object->extent = NULL;
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct *object->extent");
+ return -1;
+ }
PY_CHECK_TYPE(&PyList_Type, value, return -1;);
{
int extent_cntr_1;
if (!object->extent) { return -1;; }
talloc_set_name_const(object->extent, "ARRAY: object->extent");
for (extent_cntr_1 = 0; extent_cntr_1 < PyList_GET_SIZE(value); extent_cntr_1++) {
+ if (PyList_GET_ITEM(value, extent_cntr_1) == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->extent[extent_cntr_1]");
+ return -1;
+ }
if (PyList_GET_ITEM(value, extent_cntr_1) == Py_None) {
object->extent[extent_cntr_1] = NULL;
} else {
object->extent[extent_cntr_1] = NULL;
+ if (PyList_GET_ITEM(value, extent_cntr_1) == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct *object->extent[extent_cntr_1]");
+ return -1;
+ }
PY_CHECK_TYPE(&ORPC_EXTENT_Type, PyList_GET_ITEM(value, extent_cntr_1), return -1;);
if (talloc_reference(object->extent, pytalloc_get_mem_ctx(PyList_GET_ITEM(value, extent_cntr_1))) == NULL) {
PyErr_NoMemory();
}
static PyGetSetDef py_ORPC_EXTENT_ARRAY_getsetters[] = {
- { discard_const_p(char, "size"), py_ORPC_EXTENT_ARRAY_get_size, py_ORPC_EXTENT_ARRAY_set_size },
- { discard_const_p(char, "reserved"), py_ORPC_EXTENT_ARRAY_get_reserved, py_ORPC_EXTENT_ARRAY_set_reserved },
- { discard_const_p(char, "extent"), py_ORPC_EXTENT_ARRAY_get_extent, py_ORPC_EXTENT_ARRAY_set_extent },
- { NULL }
+ {
+ .name = discard_const_p(char, "size"),
+ .get = py_ORPC_EXTENT_ARRAY_get_size,
+ .set = py_ORPC_EXTENT_ARRAY_set_size,
+ .doc = discard_const_p(char, "PIDL-generated element size")
+ },
+ {
+ .name = discard_const_p(char, "reserved"),
+ .get = py_ORPC_EXTENT_ARRAY_get_reserved,
+ .set = py_ORPC_EXTENT_ARRAY_set_reserved,
+ .doc = discard_const_p(char, "PIDL-generated element reserved")
+ },
+ {
+ .name = discard_const_p(char, "extent"),
+ .get = py_ORPC_EXTENT_ARRAY_get_extent,
+ .set = py_ORPC_EXTENT_ARRAY_set_extent,
+ .doc = discard_const_p(char, "PIDL-generated element extent")
+ },
+ { .name = NULL }
};
static PyObject *py_ORPC_EXTENT_ARRAY_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
.tp_getset = py_ORPC_EXTENT_ARRAY_getsetters,
.tp_methods = NULL,
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- .tp_basicsize = sizeof(pytalloc_Object),
.tp_new = py_ORPC_EXTENT_ARRAY_new,
};
static int py_ORPCTHIS_set_version(PyObject *py_obj, PyObject *value, void *closure)
{
struct ORPCTHIS *object = (struct ORPCTHIS *)pytalloc_get_ptr(py_obj);
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->version");
+ return -1;
+ }
PY_CHECK_TYPE(&COMVERSION_Type, value, return -1;);
if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
PyErr_NoMemory();
static int py_ORPCTHIS_set_flags(PyObject *py_obj, PyObject *value, void *closure)
{
struct ORPCTHIS *object = (struct ORPCTHIS *)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)) {
static int py_ORPCTHIS_set_reserved1(PyObject *py_obj, PyObject *value, void *closure)
{
struct ORPCTHIS *object = (struct ORPCTHIS *)pytalloc_get_ptr(py_obj);
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->reserved1");
+ return -1;
+ }
{
const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->reserved1));
if (PyLong_Check(value)) {
static int py_ORPCTHIS_set_cid(PyObject *py_obj, PyObject *value, void *closure)
{
struct ORPCTHIS *object = (struct ORPCTHIS *)pytalloc_get_ptr(py_obj);
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->cid");
+ 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();
{
struct ORPCTHIS *object = (struct ORPCTHIS *)pytalloc_get_ptr(py_obj);
talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->extensions));
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->extensions");
+ return -1;
+ }
if (value == Py_None) {
object->extensions = NULL;
} else {
object->extensions = NULL;
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct *object->extensions");
+ return -1;
+ }
PY_CHECK_TYPE(&ORPC_EXTENT_ARRAY_Type, value, return -1;);
if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
PyErr_NoMemory();
}
static PyGetSetDef py_ORPCTHIS_getsetters[] = {
- { discard_const_p(char, "version"), py_ORPCTHIS_get_version, py_ORPCTHIS_set_version },
- { discard_const_p(char, "flags"), py_ORPCTHIS_get_flags, py_ORPCTHIS_set_flags },
- { discard_const_p(char, "reserved1"), py_ORPCTHIS_get_reserved1, py_ORPCTHIS_set_reserved1 },
- { discard_const_p(char, "cid"), py_ORPCTHIS_get_cid, py_ORPCTHIS_set_cid },
- { discard_const_p(char, "extensions"), py_ORPCTHIS_get_extensions, py_ORPCTHIS_set_extensions },
- { NULL }
+ {
+ .name = discard_const_p(char, "version"),
+ .get = py_ORPCTHIS_get_version,
+ .set = py_ORPCTHIS_set_version,
+ .doc = discard_const_p(char, "PIDL-generated element version")
+ },
+ {
+ .name = discard_const_p(char, "flags"),
+ .get = py_ORPCTHIS_get_flags,
+ .set = py_ORPCTHIS_set_flags,
+ .doc = discard_const_p(char, "PIDL-generated element flags")
+ },
+ {
+ .name = discard_const_p(char, "reserved1"),
+ .get = py_ORPCTHIS_get_reserved1,
+ .set = py_ORPCTHIS_set_reserved1,
+ .doc = discard_const_p(char, "PIDL-generated element reserved1")
+ },
+ {
+ .name = discard_const_p(char, "cid"),
+ .get = py_ORPCTHIS_get_cid,
+ .set = py_ORPCTHIS_set_cid,
+ .doc = discard_const_p(char, "PIDL-generated element cid")
+ },
+ {
+ .name = discard_const_p(char, "extensions"),
+ .get = py_ORPCTHIS_get_extensions,
+ .set = py_ORPCTHIS_set_extensions,
+ .doc = discard_const_p(char, "PIDL-generated element extensions")
+ },
+ { .name = NULL }
};
static PyObject *py_ORPCTHIS_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
static PyObject *py_ORPCTHIS_ndr_pack(PyObject *py_obj)
{
struct ORPCTHIS *object = (struct ORPCTHIS *)pytalloc_get_ptr(py_obj);
+ PyObject *ret = NULL;
DATA_BLOB blob;
enum ndr_err_code err;
- err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_ORPCTHIS);
+ 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_ORPCTHIS);
if (err != NDR_ERR_SUCCESS) {
+ TALLOC_FREE(tmp_ctx);
PyErr_SetNdrError(err);
return NULL;
}
- return PyString_FromStringAndSize((char *)blob.data, blob.length);
+ ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
+ TALLOC_FREE(tmp_ctx);
+ return ret;
}
static PyObject *py_ORPCTHIS_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
{
struct ORPCTHIS *object = (struct ORPCTHIS *)pytalloc_get_ptr(py_obj);
DATA_BLOB blob;
- int blob_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;
.tp_getset = py_ORPCTHIS_getsetters,
.tp_methods = py_ORPCTHIS_methods,
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- .tp_basicsize = sizeof(pytalloc_Object),
.tp_new = py_ORPCTHIS_new,
};
static int py_ORPCTHAT_set_flags(PyObject *py_obj, PyObject *value, void *closure)
{
struct ORPCTHAT *object = (struct ORPCTHAT *)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)) {
{
struct ORPCTHAT *object = (struct ORPCTHAT *)pytalloc_get_ptr(py_obj);
talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->extensions));
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->extensions");
+ return -1;
+ }
if (value == Py_None) {
object->extensions = NULL;
} else {
object->extensions = NULL;
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct *object->extensions");
+ return -1;
+ }
PY_CHECK_TYPE(&ORPC_EXTENT_ARRAY_Type, value, return -1;);
if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
PyErr_NoMemory();
}
static PyGetSetDef py_ORPCTHAT_getsetters[] = {
- { discard_const_p(char, "flags"), py_ORPCTHAT_get_flags, py_ORPCTHAT_set_flags },
- { discard_const_p(char, "extensions"), py_ORPCTHAT_get_extensions, py_ORPCTHAT_set_extensions },
- { NULL }
+ {
+ .name = discard_const_p(char, "flags"),
+ .get = py_ORPCTHAT_get_flags,
+ .set = py_ORPCTHAT_set_flags,
+ .doc = discard_const_p(char, "PIDL-generated element flags")
+ },
+ {
+ .name = discard_const_p(char, "extensions"),
+ .get = py_ORPCTHAT_get_extensions,
+ .set = py_ORPCTHAT_set_extensions,
+ .doc = discard_const_p(char, "PIDL-generated element extensions")
+ },
+ { .name = NULL }
};
static PyObject *py_ORPCTHAT_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
static PyObject *py_ORPCTHAT_ndr_pack(PyObject *py_obj)
{
struct ORPCTHAT *object = (struct ORPCTHAT *)pytalloc_get_ptr(py_obj);
+ PyObject *ret = NULL;
DATA_BLOB blob;
enum ndr_err_code err;
- err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_ORPCTHAT);
+ 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_ORPCTHAT);
if (err != NDR_ERR_SUCCESS) {
+ TALLOC_FREE(tmp_ctx);
PyErr_SetNdrError(err);
return NULL;
}
- return PyString_FromStringAndSize((char *)blob.data, blob.length);
+ ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
+ TALLOC_FREE(tmp_ctx);
+ return ret;
}
static PyObject *py_ORPCTHAT_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
{
struct ORPCTHAT *object = (struct ORPCTHAT *)pytalloc_get_ptr(py_obj);
DATA_BLOB blob;
- int blob_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;
.tp_getset = py_ORPCTHAT_getsetters,
.tp_methods = py_ORPCTHAT_methods,
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- .tp_basicsize = sizeof(pytalloc_Object),
.tp_new = py_ORPCTHAT_new,
};
static int py_STRINGBINDING_set_wTowerId(PyObject *py_obj, PyObject *value, void *closure)
{
struct STRINGBINDING *object = (struct STRINGBINDING *)pytalloc_get_ptr(py_obj);
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->wTowerId");
+ return -1;
+ }
{
const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->wTowerId));
if (PyLong_Check(value)) {
static int py_STRINGBINDING_set_NetworkAddr(PyObject *py_obj, PyObject *value, void *closure)
{
struct STRINGBINDING *object = (struct STRINGBINDING *)pytalloc_get_ptr(py_obj);
- object->NetworkAddr = talloc_strdup(pytalloc_get_mem_ctx(py_obj), PyString_AS_STRING(value));
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->NetworkAddr");
+ 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 = PyString_AS_STRING(unicode);
+ } else if (PyString_Check(value)) {
+ test_str = PyString_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->NetworkAddr = talloc_str;
+ }
return 0;
}
static PyGetSetDef py_STRINGBINDING_getsetters[] = {
- { discard_const_p(char, "wTowerId"), py_STRINGBINDING_get_wTowerId, py_STRINGBINDING_set_wTowerId },
- { discard_const_p(char, "NetworkAddr"), py_STRINGBINDING_get_NetworkAddr, py_STRINGBINDING_set_NetworkAddr },
- { NULL }
+ {
+ .name = discard_const_p(char, "wTowerId"),
+ .get = py_STRINGBINDING_get_wTowerId,
+ .set = py_STRINGBINDING_set_wTowerId,
+ .doc = discard_const_p(char, "PIDL-generated element wTowerId")
+ },
+ {
+ .name = discard_const_p(char, "NetworkAddr"),
+ .get = py_STRINGBINDING_get_NetworkAddr,
+ .set = py_STRINGBINDING_set_NetworkAddr,
+ .doc = discard_const_p(char, "PIDL-generated element NetworkAddr")
+ },
+ { .name = NULL }
};
static PyObject *py_STRINGBINDING_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
static PyObject *py_STRINGBINDING_ndr_pack(PyObject *py_obj)
{
struct STRINGBINDING *object = (struct STRINGBINDING *)pytalloc_get_ptr(py_obj);
+ PyObject *ret = NULL;
DATA_BLOB blob;
enum ndr_err_code err;
- err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_STRINGBINDING);
+ 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_STRINGBINDING);
if (err != NDR_ERR_SUCCESS) {
+ TALLOC_FREE(tmp_ctx);
PyErr_SetNdrError(err);
return NULL;
}
- return PyString_FromStringAndSize((char *)blob.data, blob.length);
+ ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
+ TALLOC_FREE(tmp_ctx);
+ return ret;
}
static PyObject *py_STRINGBINDING_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
{
struct STRINGBINDING *object = (struct STRINGBINDING *)pytalloc_get_ptr(py_obj);
DATA_BLOB blob;
- int blob_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;
.tp_getset = py_STRINGBINDING_getsetters,
.tp_methods = py_STRINGBINDING_methods,
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- .tp_basicsize = sizeof(pytalloc_Object),
.tp_new = py_STRINGBINDING_new,
};
{
struct STRINGARRAY *object = (struct STRINGARRAY *)pytalloc_get_ptr(py_obj);
talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->stringbindings));
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->stringbindings");
+ return -1;
+ }
if (value == Py_None) {
object->stringbindings = NULL;
} else {
object->stringbindings = NULL;
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct *object->stringbindings");
+ return -1;
+ }
if (value == Py_None) {
*object->stringbindings = NULL;
} else {
*object->stringbindings = NULL;
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct **object->stringbindings");
+ return -1;
+ }
PY_CHECK_TYPE(&STRINGBINDING_Type, value, return -1;);
if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
PyErr_NoMemory();
}
static PyGetSetDef py_STRINGARRAY_getsetters[] = {
- { discard_const_p(char, "stringbindings"), py_STRINGARRAY_get_stringbindings, py_STRINGARRAY_set_stringbindings },
- { NULL }
+ {
+ .name = discard_const_p(char, "stringbindings"),
+ .get = py_STRINGARRAY_get_stringbindings,
+ .set = py_STRINGARRAY_set_stringbindings,
+ .doc = discard_const_p(char, "PIDL-generated element stringbindings")
+ },
+ { .name = NULL }
};
static PyObject *py_STRINGARRAY_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
static PyObject *py_STRINGARRAY_ndr_pack(PyObject *py_obj)
{
struct STRINGARRAY *object = (struct STRINGARRAY *)pytalloc_get_ptr(py_obj);
+ PyObject *ret = NULL;
DATA_BLOB blob;
enum ndr_err_code err;
- err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_STRINGARRAY);
+ 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_STRINGARRAY);
if (err != NDR_ERR_SUCCESS) {
+ TALLOC_FREE(tmp_ctx);
PyErr_SetNdrError(err);
return NULL;
}
- return PyString_FromStringAndSize((char *)blob.data, blob.length);
+ ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
+ TALLOC_FREE(tmp_ctx);
+ return ret;
}
static PyObject *py_STRINGARRAY_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
{
struct STRINGARRAY *object = (struct STRINGARRAY *)pytalloc_get_ptr(py_obj);
DATA_BLOB blob;
- int blob_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;
.tp_getset = py_STRINGARRAY_getsetters,
.tp_methods = py_STRINGARRAY_methods,
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- .tp_basicsize = sizeof(pytalloc_Object),
.tp_new = py_STRINGARRAY_new,
};
{
struct DUALSTRINGARRAY *object = (struct DUALSTRINGARRAY *)pytalloc_get_ptr(py_obj);
talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->stringbindings));
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->stringbindings");
+ return -1;
+ }
if (value == Py_None) {
object->stringbindings = NULL;
} else {
object->stringbindings = NULL;
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct *object->stringbindings");
+ return -1;
+ }
if (value == Py_None) {
*object->stringbindings = NULL;
} else {
*object->stringbindings = NULL;
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct **object->stringbindings");
+ return -1;
+ }
PY_CHECK_TYPE(&STRINGBINDING_Type, value, return -1;);
if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
PyErr_NoMemory();
{
struct DUALSTRINGARRAY *object = (struct DUALSTRINGARRAY *)pytalloc_get_ptr(py_obj);
talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const(object->securitybindings));
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->securitybindings");
+ return -1;
+ }
if (value == Py_None) {
object->securitybindings = NULL;
} else {
object->securitybindings = NULL;
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct *object->securitybindings");
+ return -1;
+ }
if (value == Py_None) {
*object->securitybindings = NULL;
} else {
*object->securitybindings = NULL;
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct **object->securitybindings");
+ return -1;
+ }
PY_CHECK_TYPE(&SECURITYBINDING_Type, value, return -1;);
if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
PyErr_NoMemory();
}
static PyGetSetDef py_DUALSTRINGARRAY_getsetters[] = {
- { discard_const_p(char, "stringbindings"), py_DUALSTRINGARRAY_get_stringbindings, py_DUALSTRINGARRAY_set_stringbindings },
- { discard_const_p(char, "securitybindings"), py_DUALSTRINGARRAY_get_securitybindings, py_DUALSTRINGARRAY_set_securitybindings },
- { NULL }
+ {
+ .name = discard_const_p(char, "stringbindings"),
+ .get = py_DUALSTRINGARRAY_get_stringbindings,
+ .set = py_DUALSTRINGARRAY_set_stringbindings,
+ .doc = discard_const_p(char, "PIDL-generated element stringbindings")
+ },
+ {
+ .name = discard_const_p(char, "securitybindings"),
+ .get = py_DUALSTRINGARRAY_get_securitybindings,
+ .set = py_DUALSTRINGARRAY_set_securitybindings,
+ .doc = discard_const_p(char, "PIDL-generated element securitybindings")
+ },
+ { .name = NULL }
};
static PyObject *py_DUALSTRINGARRAY_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
static PyObject *py_DUALSTRINGARRAY_ndr_pack(PyObject *py_obj)
{
struct DUALSTRINGARRAY *object = (struct DUALSTRINGARRAY *)pytalloc_get_ptr(py_obj);
+ PyObject *ret = NULL;
DATA_BLOB blob;
enum ndr_err_code err;
- err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_DUALSTRINGARRAY);
+ 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_DUALSTRINGARRAY);
if (err != NDR_ERR_SUCCESS) {
+ TALLOC_FREE(tmp_ctx);
PyErr_SetNdrError(err);
return NULL;
}
- return PyString_FromStringAndSize((char *)blob.data, blob.length);
+ ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
+ TALLOC_FREE(tmp_ctx);
+ return ret;
}
static PyObject *py_DUALSTRINGARRAY_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
{
struct DUALSTRINGARRAY *object = (struct DUALSTRINGARRAY *)pytalloc_get_ptr(py_obj);
DATA_BLOB blob;
- int blob_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;
.tp_getset = py_DUALSTRINGARRAY_getsetters,
.tp_methods = py_DUALSTRINGARRAY_methods,
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- .tp_basicsize = sizeof(pytalloc_Object),
.tp_new = py_DUALSTRINGARRAY_new,
};
static int py_SECURITYBINDING_set_wAuthnSvc(PyObject *py_obj, PyObject *value, void *closure)
{
struct SECURITYBINDING *object = (struct SECURITYBINDING *)pytalloc_get_ptr(py_obj);
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->wAuthnSvc");
+ return -1;
+ }
{
const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->wAuthnSvc));
if (PyLong_Check(value)) {
static int py_SECURITYBINDING_set_wAuthzSvc(PyObject *py_obj, PyObject *value, void *closure)
{
struct SECURITYBINDING *object = (struct SECURITYBINDING *)pytalloc_get_ptr(py_obj);
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->wAuthzSvc");
+ return -1;
+ }
{
const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->wAuthzSvc));
if (PyLong_Check(value)) {
static int py_SECURITYBINDING_set_PrincName(PyObject *py_obj, PyObject *value, void *closure)
{
struct SECURITYBINDING *object = (struct SECURITYBINDING *)pytalloc_get_ptr(py_obj);
- object->PrincName = talloc_strdup(pytalloc_get_mem_ctx(py_obj), PyString_AS_STRING(value));
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->PrincName");
+ 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 = PyString_AS_STRING(unicode);
+ } else if (PyString_Check(value)) {
+ test_str = PyString_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->PrincName = talloc_str;
+ }
return 0;
}
static PyGetSetDef py_SECURITYBINDING_getsetters[] = {
- { discard_const_p(char, "wAuthnSvc"), py_SECURITYBINDING_get_wAuthnSvc, py_SECURITYBINDING_set_wAuthnSvc },
- { discard_const_p(char, "wAuthzSvc"), py_SECURITYBINDING_get_wAuthzSvc, py_SECURITYBINDING_set_wAuthzSvc },
- { discard_const_p(char, "PrincName"), py_SECURITYBINDING_get_PrincName, py_SECURITYBINDING_set_PrincName },
- { NULL }
+ {
+ .name = discard_const_p(char, "wAuthnSvc"),
+ .get = py_SECURITYBINDING_get_wAuthnSvc,
+ .set = py_SECURITYBINDING_set_wAuthnSvc,
+ .doc = discard_const_p(char, "PIDL-generated element wAuthnSvc")
+ },
+ {
+ .name = discard_const_p(char, "wAuthzSvc"),
+ .get = py_SECURITYBINDING_get_wAuthzSvc,
+ .set = py_SECURITYBINDING_set_wAuthzSvc,
+ .doc = discard_const_p(char, "PIDL-generated element wAuthzSvc")
+ },
+ {
+ .name = discard_const_p(char, "PrincName"),
+ .get = py_SECURITYBINDING_get_PrincName,
+ .set = py_SECURITYBINDING_set_PrincName,
+ .doc = discard_const_p(char, "PIDL-generated element PrincName")
+ },
+ { .name = NULL }
};
static PyObject *py_SECURITYBINDING_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
static PyObject *py_SECURITYBINDING_ndr_pack(PyObject *py_obj)
{
struct SECURITYBINDING *object = (struct SECURITYBINDING *)pytalloc_get_ptr(py_obj);
+ PyObject *ret = NULL;
DATA_BLOB blob;
enum ndr_err_code err;
- err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_SECURITYBINDING);
+ 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_SECURITYBINDING);
if (err != NDR_ERR_SUCCESS) {
+ TALLOC_FREE(tmp_ctx);
PyErr_SetNdrError(err);
return NULL;
}
- return PyString_FromStringAndSize((char *)blob.data, blob.length);
+ ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
+ TALLOC_FREE(tmp_ctx);
+ return ret;
}
static PyObject *py_SECURITYBINDING_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
{
struct SECURITYBINDING *object = (struct SECURITYBINDING *)pytalloc_get_ptr(py_obj);
DATA_BLOB blob;
- int blob_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;
.tp_getset = py_SECURITYBINDING_getsetters,
.tp_methods = py_SECURITYBINDING_methods,
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- .tp_basicsize = sizeof(pytalloc_Object),
.tp_new = py_SECURITYBINDING_new,
};
static int py_STDOBJREF_set_flags(PyObject *py_obj, PyObject *value, void *closure)
{
struct STDOBJREF *object = (struct STDOBJREF *)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)) {
static int py_STDOBJREF_set_cPublicRefs(PyObject *py_obj, PyObject *value, void *closure)
{
struct STDOBJREF *object = (struct STDOBJREF *)pytalloc_get_ptr(py_obj);
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->cPublicRefs");
+ return -1;
+ }
{
const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->cPublicRefs));
if (PyLong_Check(value)) {
static int py_STDOBJREF_set_oxid(PyObject *py_obj, PyObject *value, void *closure)
{
struct STDOBJREF *object = (struct STDOBJREF *)pytalloc_get_ptr(py_obj);
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->oxid");
+ return -1;
+ }
{
const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->oxid));
if (PyLong_Check(value)) {
static int py_STDOBJREF_set_oid(PyObject *py_obj, PyObject *value, void *closure)
{
struct STDOBJREF *object = (struct STDOBJREF *)pytalloc_get_ptr(py_obj);
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->oid");
+ return -1;
+ }
{
const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->oid));
if (PyLong_Check(value)) {
static int py_STDOBJREF_set_ipid(PyObject *py_obj, PyObject *value, void *closure)
{
struct STDOBJREF *object = (struct STDOBJREF *)pytalloc_get_ptr(py_obj);
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->ipid");
+ 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();
}
static PyGetSetDef py_STDOBJREF_getsetters[] = {
- { discard_const_p(char, "flags"), py_STDOBJREF_get_flags, py_STDOBJREF_set_flags },
- { discard_const_p(char, "cPublicRefs"), py_STDOBJREF_get_cPublicRefs, py_STDOBJREF_set_cPublicRefs },
- { discard_const_p(char, "oxid"), py_STDOBJREF_get_oxid, py_STDOBJREF_set_oxid },
- { discard_const_p(char, "oid"), py_STDOBJREF_get_oid, py_STDOBJREF_set_oid },
- { discard_const_p(char, "ipid"), py_STDOBJREF_get_ipid, py_STDOBJREF_set_ipid },
- { NULL }
+ {
+ .name = discard_const_p(char, "flags"),
+ .get = py_STDOBJREF_get_flags,
+ .set = py_STDOBJREF_set_flags,
+ .doc = discard_const_p(char, "PIDL-generated element flags")
+ },
+ {
+ .name = discard_const_p(char, "cPublicRefs"),
+ .get = py_STDOBJREF_get_cPublicRefs,
+ .set = py_STDOBJREF_set_cPublicRefs,
+ .doc = discard_const_p(char, "PIDL-generated element cPublicRefs")
+ },
+ {
+ .name = discard_const_p(char, "oxid"),
+ .get = py_STDOBJREF_get_oxid,
+ .set = py_STDOBJREF_set_oxid,
+ .doc = discard_const_p(char, "PIDL-generated element oxid")
+ },
+ {
+ .name = discard_const_p(char, "oid"),
+ .get = py_STDOBJREF_get_oid,
+ .set = py_STDOBJREF_set_oid,
+ .doc = discard_const_p(char, "PIDL-generated element oid")
+ },
+ {
+ .name = discard_const_p(char, "ipid"),
+ .get = py_STDOBJREF_get_ipid,
+ .set = py_STDOBJREF_set_ipid,
+ .doc = discard_const_p(char, "PIDL-generated element ipid")
+ },
+ { .name = NULL }
};
static PyObject *py_STDOBJREF_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
static PyObject *py_STDOBJREF_ndr_pack(PyObject *py_obj)
{
struct STDOBJREF *object = (struct STDOBJREF *)pytalloc_get_ptr(py_obj);
+ PyObject *ret = NULL;
DATA_BLOB blob;
enum ndr_err_code err;
- err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_STDOBJREF);
+ 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_STDOBJREF);
if (err != NDR_ERR_SUCCESS) {
+ TALLOC_FREE(tmp_ctx);
PyErr_SetNdrError(err);
return NULL;
}
- return PyString_FromStringAndSize((char *)blob.data, blob.length);
+ ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
+ TALLOC_FREE(tmp_ctx);
+ return ret;
}
static PyObject *py_STDOBJREF_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
{
struct STDOBJREF *object = (struct STDOBJREF *)pytalloc_get_ptr(py_obj);
DATA_BLOB blob;
- int blob_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;
.tp_getset = py_STDOBJREF_getsetters,
.tp_methods = py_STDOBJREF_methods,
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- .tp_basicsize = sizeof(pytalloc_Object),
.tp_new = py_STDOBJREF_new,
};
static int py_u_standard_set_std(PyObject *py_obj, PyObject *value, void *closure)
{
struct u_standard *object = (struct u_standard *)pytalloc_get_ptr(py_obj);
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->std");
+ return -1;
+ }
PY_CHECK_TYPE(&STDOBJREF_Type, value, return -1;);
if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
PyErr_NoMemory();
static int py_u_standard_set_saResAddr(PyObject *py_obj, PyObject *value, void *closure)
{
struct u_standard *object = (struct u_standard *)pytalloc_get_ptr(py_obj);
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->saResAddr");
+ return -1;
+ }
PY_CHECK_TYPE(&STRINGARRAY_Type, value, return -1;);
if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
PyErr_NoMemory();
}
static PyGetSetDef py_u_standard_getsetters[] = {
- { discard_const_p(char, "std"), py_u_standard_get_std, py_u_standard_set_std },
- { discard_const_p(char, "saResAddr"), py_u_standard_get_saResAddr, py_u_standard_set_saResAddr },
- { NULL }
+ {
+ .name = discard_const_p(char, "std"),
+ .get = py_u_standard_get_std,
+ .set = py_u_standard_set_std,
+ .doc = discard_const_p(char, "PIDL-generated element std")
+ },
+ {
+ .name = discard_const_p(char, "saResAddr"),
+ .get = py_u_standard_get_saResAddr,
+ .set = py_u_standard_set_saResAddr,
+ .doc = discard_const_p(char, "PIDL-generated element saResAddr")
+ },
+ { .name = NULL }
};
static PyObject *py_u_standard_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
.tp_getset = py_u_standard_getsetters,
.tp_methods = NULL,
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- .tp_basicsize = sizeof(pytalloc_Object),
.tp_new = py_u_standard_new,
};
static int py_u_handler_set_std(PyObject *py_obj, PyObject *value, void *closure)
{
struct u_handler *object = (struct u_handler *)pytalloc_get_ptr(py_obj);
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->std");
+ return -1;
+ }
PY_CHECK_TYPE(&STDOBJREF_Type, value, return -1;);
if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
PyErr_NoMemory();
static int py_u_handler_set_clsid(PyObject *py_obj, PyObject *value, void *closure)
{
struct u_handler *object = (struct u_handler *)pytalloc_get_ptr(py_obj);
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->clsid");
+ 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();
static int py_u_handler_set_saResAddr(PyObject *py_obj, PyObject *value, void *closure)
{
struct u_handler *object = (struct u_handler *)pytalloc_get_ptr(py_obj);
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->saResAddr");
+ return -1;
+ }
PY_CHECK_TYPE(&STRINGARRAY_Type, value, return -1;);
if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
PyErr_NoMemory();
}
static PyGetSetDef py_u_handler_getsetters[] = {
- { discard_const_p(char, "std"), py_u_handler_get_std, py_u_handler_set_std },
- { discard_const_p(char, "clsid"), py_u_handler_get_clsid, py_u_handler_set_clsid },
- { discard_const_p(char, "saResAddr"), py_u_handler_get_saResAddr, py_u_handler_set_saResAddr },
- { NULL }
+ {
+ .name = discard_const_p(char, "std"),
+ .get = py_u_handler_get_std,
+ .set = py_u_handler_set_std,
+ .doc = discard_const_p(char, "PIDL-generated element std")
+ },
+ {
+ .name = discard_const_p(char, "clsid"),
+ .get = py_u_handler_get_clsid,
+ .set = py_u_handler_set_clsid,
+ .doc = discard_const_p(char, "PIDL-generated element clsid")
+ },
+ {
+ .name = discard_const_p(char, "saResAddr"),
+ .get = py_u_handler_get_saResAddr,
+ .set = py_u_handler_set_saResAddr,
+ .doc = discard_const_p(char, "PIDL-generated element saResAddr")
+ },
+ { .name = NULL }
};
static PyObject *py_u_handler_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
.tp_getset = py_u_handler_getsetters,
.tp_methods = NULL,
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- .tp_basicsize = sizeof(pytalloc_Object),
.tp_new = py_u_handler_new,
};
static int py_u_custom_set_clsid(PyObject *py_obj, PyObject *value, void *closure)
{
struct u_custom *object = (struct u_custom *)pytalloc_get_ptr(py_obj);
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->clsid");
+ 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();
static int py_u_custom_set_cbExtension(PyObject *py_obj, PyObject *value, void *closure)
{
struct u_custom *object = (struct u_custom *)pytalloc_get_ptr(py_obj);
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->cbExtension");
+ return -1;
+ }
{
const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->cbExtension));
if (PyLong_Check(value)) {
static int py_u_custom_set_size(PyObject *py_obj, PyObject *value, void *closure)
{
struct u_custom *object = (struct u_custom *)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)) {
static int py_u_custom_set_pData(PyObject *py_obj, PyObject *value, void *closure)
{
struct u_custom *object = (struct u_custom *)pytalloc_get_ptr(py_obj);
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->pData");
+ return -1;
+ }
PY_CHECK_TYPE(&PyList_Type, value, return -1;);
{
int pData_cntr_0;
if (!object->pData) { return -1;; }
talloc_set_name_const(object->pData, "ARRAY: object->pData");
for (pData_cntr_0 = 0; pData_cntr_0 < PyList_GET_SIZE(value); pData_cntr_0++) {
+ if (PyList_GET_ITEM(value, pData_cntr_0) == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->pData[pData_cntr_0]");
+ return -1;
+ }
{
const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->pData[pData_cntr_0]));
if (PyLong_Check(PyList_GET_ITEM(value, pData_cntr_0))) {
}
static PyGetSetDef py_u_custom_getsetters[] = {
- { discard_const_p(char, "clsid"), py_u_custom_get_clsid, py_u_custom_set_clsid },
- { discard_const_p(char, "cbExtension"), py_u_custom_get_cbExtension, py_u_custom_set_cbExtension },
- { discard_const_p(char, "size"), py_u_custom_get_size, py_u_custom_set_size },
- { discard_const_p(char, "pData"), py_u_custom_get_pData, py_u_custom_set_pData },
- { NULL }
+ {
+ .name = discard_const_p(char, "clsid"),
+ .get = py_u_custom_get_clsid,
+ .set = py_u_custom_set_clsid,
+ .doc = discard_const_p(char, "PIDL-generated element clsid")
+ },
+ {
+ .name = discard_const_p(char, "cbExtension"),
+ .get = py_u_custom_get_cbExtension,
+ .set = py_u_custom_set_cbExtension,
+ .doc = discard_const_p(char, "PIDL-generated element cbExtension")
+ },
+ {
+ .name = discard_const_p(char, "size"),
+ .get = py_u_custom_get_size,
+ .set = py_u_custom_set_size,
+ .doc = discard_const_p(char, "PIDL-generated element size")
+ },
+ {
+ .name = discard_const_p(char, "pData"),
+ .get = py_u_custom_get_pData,
+ .set = py_u_custom_set_pData,
+ .doc = discard_const_p(char, "PIDL-generated element pData")
+ },
+ { .name = NULL }
};
static PyObject *py_u_custom_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
.tp_getset = py_u_custom_getsetters,
.tp_methods = NULL,
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- .tp_basicsize = sizeof(pytalloc_Object),
.tp_new = py_u_custom_new,
};
.tp_getset = NULL,
.tp_methods = NULL,
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- .tp_basicsize = sizeof(pytalloc_Object),
.tp_new = py_u_null_new,
};
union OBJREF_Types *ret = talloc_zero(mem_ctx, union OBJREF_Types);
switch (level) {
case OBJREF_NULL:
+ if (in == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->u_null");
+ talloc_free(ret); return NULL;
+ }
PY_CHECK_TYPE(&u_null_Type, in, talloc_free(ret); return NULL;);
if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
PyErr_NoMemory();
break;
case OBJREF_STANDARD:
+ if (in == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->u_standard");
+ talloc_free(ret); return NULL;
+ }
PY_CHECK_TYPE(&u_standard_Type, in, talloc_free(ret); return NULL;);
if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
PyErr_NoMemory();
break;
case OBJREF_HANDLER:
+ if (in == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->u_handler");
+ talloc_free(ret); return NULL;
+ }
PY_CHECK_TYPE(&u_handler_Type, in, talloc_free(ret); return NULL;);
if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
PyErr_NoMemory();
break;
case OBJREF_CUSTOM:
+ if (in == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct ret->u_custom");
+ talloc_free(ret); return NULL;
+ }
PY_CHECK_TYPE(&u_custom_Type, in, talloc_free(ret); return NULL;);
if (talloc_reference(mem_ctx, pytalloc_get_mem_ctx(in)) == NULL) {
PyErr_NoMemory();
static int py_OBJREF_set_signature(PyObject *py_obj, PyObject *value, void *closure)
{
struct OBJREF *object = (struct OBJREF *)pytalloc_get_ptr(py_obj);
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->signature");
+ return -1;
+ }
{
const unsigned long long uint_max = ndr_sizeof2uintmax(sizeof(object->signature));
if (PyLong_Check(value)) {
static int py_OBJREF_set_flags(PyObject *py_obj, PyObject *value, void *closure)
{
struct OBJREF *object = (struct OBJREF *)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)) {
static int py_OBJREF_set_iid(PyObject *py_obj, PyObject *value, void *closure)
{
struct OBJREF *object = (struct OBJREF *)pytalloc_get_ptr(py_obj);
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->iid");
+ 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();
static int py_OBJREF_set_u_objref(PyObject *py_obj, PyObject *value, void *closure)
{
struct OBJREF *object = (struct OBJREF *)pytalloc_get_ptr(py_obj);
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->u_objref");
+ return -1;
+ }
{
union OBJREF_Types *u_objref_switch_0;
u_objref_switch_0 = py_export_OBJREF_Types(pytalloc_get_mem_ctx(py_obj), object->flags, value);
}
static PyGetSetDef py_OBJREF_getsetters[] = {
- { discard_const_p(char, "signature"), py_OBJREF_get_signature, py_OBJREF_set_signature },
- { discard_const_p(char, "flags"), py_OBJREF_get_flags, py_OBJREF_set_flags },
- { discard_const_p(char, "iid"), py_OBJREF_get_iid, py_OBJREF_set_iid },
- { discard_const_p(char, "u_objref"), py_OBJREF_get_u_objref, py_OBJREF_set_u_objref },
- { NULL }
+ {
+ .name = discard_const_p(char, "signature"),
+ .get = py_OBJREF_get_signature,
+ .set = py_OBJREF_set_signature,
+ .doc = discard_const_p(char, "PIDL-generated element signature")
+ },
+ {
+ .name = discard_const_p(char, "flags"),
+ .get = py_OBJREF_get_flags,
+ .set = py_OBJREF_set_flags,
+ .doc = discard_const_p(char, "PIDL-generated element flags")
+ },
+ {
+ .name = discard_const_p(char, "iid"),
+ .get = py_OBJREF_get_iid,
+ .set = py_OBJREF_set_iid,
+ .doc = discard_const_p(char, "PIDL-generated element iid")
+ },
+ {
+ .name = discard_const_p(char, "u_objref"),
+ .get = py_OBJREF_get_u_objref,
+ .set = py_OBJREF_set_u_objref,
+ .doc = discard_const_p(char, "PIDL-generated element u_objref")
+ },
+ { .name = NULL }
};
static PyObject *py_OBJREF_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
static PyObject *py_OBJREF_ndr_pack(PyObject *py_obj)
{
struct OBJREF *object = (struct OBJREF *)pytalloc_get_ptr(py_obj);
+ PyObject *ret = NULL;
DATA_BLOB blob;
enum ndr_err_code err;
- err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_OBJREF);
+ 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_OBJREF);
if (err != NDR_ERR_SUCCESS) {
+ TALLOC_FREE(tmp_ctx);
PyErr_SetNdrError(err);
return NULL;
}
- return PyString_FromStringAndSize((char *)blob.data, blob.length);
+ ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
+ TALLOC_FREE(tmp_ctx);
+ return ret;
}
static PyObject *py_OBJREF_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
{
struct OBJREF *object = (struct OBJREF *)pytalloc_get_ptr(py_obj);
DATA_BLOB blob;
- int blob_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;
.tp_getset = py_OBJREF_getsetters,
.tp_methods = py_OBJREF_methods,
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- .tp_basicsize = sizeof(pytalloc_Object),
.tp_new = py_OBJREF_new,
};
static int py_MInterfacePointer_set_size(PyObject *py_obj, PyObject *value, void *closure)
{
struct MInterfacePointer *object = (struct MInterfacePointer *)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)) {
static int py_MInterfacePointer_set_obj(PyObject *py_obj, PyObject *value, void *closure)
{
struct MInterfacePointer *object = (struct MInterfacePointer *)pytalloc_get_ptr(py_obj);
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->obj");
+ return -1;
+ }
+ if (value == NULL) {
+ PyErr_Format(PyExc_AttributeError, "Cannot delete NDR object: struct object->obj");
+ return -1;
+ }
PY_CHECK_TYPE(&OBJREF_Type, value, return -1;);
if (talloc_reference(pytalloc_get_mem_ctx(py_obj), pytalloc_get_mem_ctx(value)) == NULL) {
PyErr_NoMemory();
}
static PyGetSetDef py_MInterfacePointer_getsetters[] = {
- { discard_const_p(char, "size"), py_MInterfacePointer_get_size, py_MInterfacePointer_set_size },
- { discard_const_p(char, "obj"), py_MInterfacePointer_get_obj, py_MInterfacePointer_set_obj },
- { NULL }
+ {
+ .name = discard_const_p(char, "size"),
+ .get = py_MInterfacePointer_get_size,
+ .set = py_MInterfacePointer_set_size,
+ .doc = discard_const_p(char, "PIDL-generated element size")
+ },
+ {
+ .name = discard_const_p(char, "obj"),
+ .get = py_MInterfacePointer_get_obj,
+ .set = py_MInterfacePointer_set_obj,
+ .doc = discard_const_p(char, "PIDL-generated element obj")
+ },
+ { .name = NULL }
};
static PyObject *py_MInterfacePointer_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
static PyObject *py_MInterfacePointer_ndr_pack(PyObject *py_obj)
{
struct MInterfacePointer *object = (struct MInterfacePointer *)pytalloc_get_ptr(py_obj);
+ PyObject *ret = NULL;
DATA_BLOB blob;
enum ndr_err_code err;
- err = ndr_push_struct_blob(&blob, pytalloc_get_mem_ctx(py_obj), object, (ndr_push_flags_fn_t)ndr_push_MInterfacePointer);
+ 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_MInterfacePointer);
if (err != NDR_ERR_SUCCESS) {
+ TALLOC_FREE(tmp_ctx);
PyErr_SetNdrError(err);
return NULL;
}
- return PyString_FromStringAndSize((char *)blob.data, blob.length);
+ ret = PyString_FromStringAndSize((char *)blob.data, blob.length);
+ TALLOC_FREE(tmp_ctx);
+ return ret;
}
static PyObject *py_MInterfacePointer_ndr_unpack(PyObject *py_obj, PyObject *args, PyObject *kwargs)
{
struct MInterfacePointer *object = (struct MInterfacePointer *)pytalloc_get_ptr(py_obj);
DATA_BLOB blob;
- int blob_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;
.tp_getset = py_MInterfacePointer_getsetters,
.tp_methods = py_MInterfacePointer_methods,
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- .tp_basicsize = sizeof(pytalloc_Object),
.tp_new = py_MInterfacePointer_new,
};
if (dep_talloc == NULL)
return;
- Object_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "Object");
- if (Object_Type == NULL)
+ BaseObject_Type = (PyTypeObject *)PyObject_GetAttrString(dep_talloc, "BaseObject");
+ if (BaseObject_Type == NULL)
return;
GUID_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_misc, "GUID");
if (GUID_Type == NULL)
return;
- COMVERSION_Type.tp_base = Object_Type;
+ COMVERSION_Type.tp_base = BaseObject_Type;
+ COMVERSION_Type.tp_basicsize = pytalloc_BaseObject_size();
- ORPC_EXTENT_Type.tp_base = Object_Type;
+ ORPC_EXTENT_Type.tp_base = BaseObject_Type;
+ ORPC_EXTENT_Type.tp_basicsize = pytalloc_BaseObject_size();
- ORPC_EXTENT_ARRAY_Type.tp_base = Object_Type;
+ ORPC_EXTENT_ARRAY_Type.tp_base = BaseObject_Type;
+ ORPC_EXTENT_ARRAY_Type.tp_basicsize = pytalloc_BaseObject_size();
- ORPCTHIS_Type.tp_base = Object_Type;
+ ORPCTHIS_Type.tp_base = BaseObject_Type;
+ ORPCTHIS_Type.tp_basicsize = pytalloc_BaseObject_size();
- ORPCTHAT_Type.tp_base = Object_Type;
+ ORPCTHAT_Type.tp_base = BaseObject_Type;
+ ORPCTHAT_Type.tp_basicsize = pytalloc_BaseObject_size();
- STRINGBINDING_Type.tp_base = Object_Type;
+ STRINGBINDING_Type.tp_base = BaseObject_Type;
+ STRINGBINDING_Type.tp_basicsize = pytalloc_BaseObject_size();
- STRINGARRAY_Type.tp_base = Object_Type;
+ STRINGARRAY_Type.tp_base = BaseObject_Type;
+ STRINGARRAY_Type.tp_basicsize = pytalloc_BaseObject_size();
- DUALSTRINGARRAY_Type.tp_base = Object_Type;
+ DUALSTRINGARRAY_Type.tp_base = BaseObject_Type;
+ DUALSTRINGARRAY_Type.tp_basicsize = pytalloc_BaseObject_size();
- SECURITYBINDING_Type.tp_base = Object_Type;
+ SECURITYBINDING_Type.tp_base = BaseObject_Type;
+ SECURITYBINDING_Type.tp_basicsize = pytalloc_BaseObject_size();
- STDOBJREF_Type.tp_base = Object_Type;
+ STDOBJREF_Type.tp_base = BaseObject_Type;
+ STDOBJREF_Type.tp_basicsize = pytalloc_BaseObject_size();
- u_standard_Type.tp_base = Object_Type;
+ u_standard_Type.tp_base = BaseObject_Type;
+ u_standard_Type.tp_basicsize = pytalloc_BaseObject_size();
- u_handler_Type.tp_base = Object_Type;
+ u_handler_Type.tp_base = BaseObject_Type;
+ u_handler_Type.tp_basicsize = pytalloc_BaseObject_size();
- u_custom_Type.tp_base = Object_Type;
+ u_custom_Type.tp_base = BaseObject_Type;
+ u_custom_Type.tp_basicsize = pytalloc_BaseObject_size();
- u_null_Type.tp_base = Object_Type;
+ u_null_Type.tp_base = BaseObject_Type;
+ u_null_Type.tp_basicsize = pytalloc_BaseObject_size();
- OBJREF_Type.tp_base = Object_Type;
+ OBJREF_Type.tp_base = BaseObject_Type;
+ OBJREF_Type.tp_basicsize = pytalloc_BaseObject_size();
- MInterfacePointer_Type.tp_base = Object_Type;
+ MInterfacePointer_Type.tp_base = BaseObject_Type;
+ MInterfacePointer_Type.tp_basicsize = pytalloc_BaseObject_size();
if (PyType_Ready(&COMVERSION_Type) < 0)
return;