summaryrefslogtreecommitdiff
path: root/source4/dsdb
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2012-07-06 20:48:34 +1000
committerAndrew Bartlett <abartlet@samba.org>2012-07-06 22:45:34 +1000
commit507e6fdce520999c5b29b3c98de945c4ff96c9a9 (patch)
treedf62f6f51bee86f77bc91b3fe466becabea1596d /source4/dsdb
parent8d99b398d923d924088d4682a97bae38ccda0b0d (diff)
downloadsamba-507e6fdce520999c5b29b3c98de945c4ff96c9a9.tar.gz
samba-507e6fdce520999c5b29b3c98de945c4ff96c9a9.tar.bz2
samba-507e6fdce520999c5b29b3c98de945c4ff96c9a9.zip
s4-pydsdb: Improve PyErr_LDB_{DN,}_OR_RAISE to use py_check_dcerpc_type
This checks the type rather than just dereferencing the pointer. Andrew Bartlett
Diffstat (limited to 'source4/dsdb')
-rw-r--r--source4/dsdb/pydsdb.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/source4/dsdb/pydsdb.c b/source4/dsdb/pydsdb.c
index d3486a41ec..08d87b957c 100644
--- a/source4/dsdb/pydsdb.c
+++ b/source4/dsdb/pydsdb.c
@@ -40,12 +40,19 @@ typedef intargfunc ssizeargfunc;
/* FIXME: These should be in a header file somewhere */
#define PyErr_LDB_OR_RAISE(py_ldb, ldb) \
-/* if (!PyLdb_Check(py_ldb)) { \
+ if (!py_check_dcerpc_type(py_ldb, "ldb", "Ldb")) { \
PyErr_SetString(py_ldb_get_exception(), "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"); \
+ return NULL; \
+ } \
+ dn = pyldb_Dn_AsDn(py_ldb_dn);
+
static PyObject *py_ldb_get_exception(void)
{
PyObject *mod = PyImport_ImportModule("ldb");