mirror of
https://github.com/samba-team/samba.git
synced 2025-02-02 09:47:23 +03:00
pydsdb_dns: Use TypeError not LdbError for mismatched types
This avoids the samba-tool command handling code blowing up when trying to parse an LdbError Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
This commit is contained in:
parent
fa3c026983
commit
f5e945c810
@ -32,27 +32,18 @@
|
||||
/* FIXME: These should be in a header file somewhere */
|
||||
#define PyErr_LDB_OR_RAISE(py_ldb, ldb) \
|
||||
if (!py_check_dcerpc_type(py_ldb, "ldb", "Ldb")) { \
|
||||
PyErr_SetString(py_ldb_get_exception(), "Ldb connection object required"); \
|
||||
PyErr_SetString(PyExc_TypeError, "Ldb connection object required"); \
|
||||
return NULL; \
|
||||
} \
|
||||
ldb = pyldb_Ldb_AsLdbContext(py_ldb);
|
||||
|
||||
#define PyErr_LDB_DN_OR_RAISE(py_ldb_dn, dn) \
|
||||
if (!py_check_dcerpc_type(py_ldb_dn, "ldb", "Dn")) { \
|
||||
PyErr_SetString(py_ldb_get_exception(), "ldb Dn object required"); \
|
||||
PyErr_SetString(PyExc_TypeError, "ldb Dn object required"); \
|
||||
return NULL; \
|
||||
} \
|
||||
dn = pyldb_Dn_AsDn(py_ldb_dn);
|
||||
|
||||
static PyObject *py_ldb_get_exception(void)
|
||||
{
|
||||
PyObject *mod = PyImport_ImportModule("ldb");
|
||||
if (mod == NULL)
|
||||
return NULL;
|
||||
|
||||
return PyObject_GetAttrString(mod, "LdbError");
|
||||
}
|
||||
|
||||
static PyObject *py_dnsp_DnssrvRpcRecord_get_list(struct dnsp_DnssrvRpcRecord *records,
|
||||
uint16_t num_records)
|
||||
{
|
||||
@ -168,7 +159,7 @@ static PyObject *py_dsdb_dns_extract(PyObject *self, PyObject *args)
|
||||
}
|
||||
|
||||
if (!py_check_dcerpc_type(py_dns_el, "ldb", "MessageElement")) {
|
||||
PyErr_SetString(py_ldb_get_exception(),
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"ldb MessageElement object required");
|
||||
return NULL;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user