summaryrefslogtreecommitdiff
path: root/lib/ldb
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2012-06-10 20:30:27 +1000
committerAndrew Bartlett <abartlet@samba.org>2012-06-11 11:44:07 +0200
commit657af5a27480ac7fbcaa4fa4b67bbf496da32a35 (patch)
treef814c42e2837ad2828e655352eebf30ee65b7f88 /lib/ldb
parent6aee8021a14a2878f2bb7f393e2b93721925f92a (diff)
downloadsamba-657af5a27480ac7fbcaa4fa4b67bbf496da32a35.tar.gz
samba-657af5a27480ac7fbcaa4fa4b67bbf496da32a35.tar.bz2
samba-657af5a27480ac7fbcaa4fa4b67bbf496da32a35.zip
pyldb: Ensure that the ldb argument is really an ldb before we dereference
Diffstat (limited to 'lib/ldb')
-rw-r--r--lib/ldb/pyldb.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c
index ea7b695d6d..4554886e8d 100644
--- a/lib/ldb/pyldb.c
+++ b/lib/ldb/pyldb.c
@@ -653,6 +653,11 @@ static PyObject *py_ldb_dn_new(PyTypeObject *type, PyObject *args, PyObject *kwa
&py_ldb, &str))
return NULL;
+ if (!PyLdb_Check(py_ldb)) {
+ PyErr_SetString(PyExc_TypeError, "Expected Ldb");
+ return NULL;
+ }
+
ldb_ctx = pyldb_Ldb_AsLdbContext(py_ldb);
mem_ctx = talloc_new(NULL);
@@ -2482,6 +2487,11 @@ static PyObject *py_ldb_msg_from_dict(PyTypeObject *type, PyObject *args)
return NULL;
}
+ if (!PyLdb_Check(py_ldb)) {
+ PyErr_SetString(PyExc_TypeError, "Expected Ldb");
+ return NULL;
+ }
+
/* mask only flags we are going to use */
mod_flags = LDB_FLAG_MOD_TYPE(mod_flags);
if (!mod_flags) {