summaryrefslogtreecommitdiff
path: root/source4/dns_server/pydns.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2017-04-10 16:06:13 +1200
committerAndrew Bartlett <abartlet@samba.org>2017-06-10 21:48:20 +0200
commitf5e945c810b5e453b699d4e796cfb6790c442a17 (patch)
tree3313119c5141f629168c0a7ea5a4d39a121b7a20 /source4/dns_server/pydns.c
parentfa3c026983d597769f600e50b7e2b0e8772f3fd6 (diff)
downloadsamba-f5e945c810b5e453b699d4e796cfb6790c442a17.tar.gz
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>
Diffstat (limited to 'source4/dns_server/pydns.c')
-rw-r--r--source4/dns_server/pydns.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/source4/dns_server/pydns.c b/source4/dns_server/pydns.c
index 3de9739f1f1..7fc8f0c8811 100644
--- a/source4/dns_server/pydns.c
+++ b/source4/dns_server/pydns.c
@@ -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;
}