1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

pyldb: Ensure that the ldb argument is really an ldb before we dereference

This commit is contained in:
Andrew Bartlett 2012-06-10 20:30:27 +10:00
parent 6aee8021a1
commit 657af5a274

View File

@ -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) {