summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2015-03-03 22:29:11 +0100
committerAndrew Bartlett <abartlet@samba.org>2015-03-03 23:20:06 +0100
commitd460bab949ef48ca4e77864d624da5834dabd057 (patch)
treead33a61b4f6640aed77dc0a56d45ba8b18e8588a /lib
parentd599dcb6bcac3b7b1600694be38937db0e8719b7 (diff)
downloadsamba-d460bab949ef48ca4e77864d624da5834dabd057.tar.gz
samba-d460bab949ef48ca4e77864d624da5834dabd057.tar.xz
samba-d460bab949ef48ca4e77864d624da5834dabd057.zip
pyldb: Type-check arguments parsed with PyArg_ParseTuple*
PyObject* arguments need to be type-checked before they're cast to subtypes. Signed-off-by: Petr Viktorin <pviktori@redhat.com> Reviewed-by: Jelmer Vernooij <jelmer@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/ldb/pyldb.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c
index adcde0cac1..30cb836738 100644
--- a/lib/ldb/pyldb.c
+++ b/lib/ldb/pyldb.c
@@ -121,9 +121,9 @@ static PyObject *py_ldb_control_new(PyTypeObject *type, PyObject *args, PyObject
TALLOC_CTX *mem_ctx;
struct ldb_context *ldb_ctx;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Os",
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!s",
discard_const_p(char *, kwnames),
- &py_ldb, &data))
+ &PyLdb, &py_ldb, &data))
return NULL;
mem_ctx = talloc_new(NULL);
@@ -2141,9 +2141,9 @@ static PyObject *py_ldb_module_search(PyLdbModuleObject *self, PyObject *args, P
const char * const*attrs;
/* type "int" rather than "enum" for "scope" is intentional */
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiOO",
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!iOO",
discard_const_p(char *, kwnames),
- &py_base, &scope, &py_tree, &py_attrs))
+ &PyLdbDn, &py_base, &scope, &py_tree, &py_attrs))
return NULL;
mod = self->mod;
@@ -2185,7 +2185,7 @@ static PyObject *py_ldb_module_add(PyLdbModuleObject *self, PyObject *args)
int ret;
struct ldb_module *mod;
- if (!PyArg_ParseTuple(args, "O", &py_message))
+ if (!PyArg_ParseTuple(args, "O!", &PyLdbMessage, &py_message))
return NULL;
req = talloc_zero(NULL, struct ldb_request);
@@ -2207,7 +2207,7 @@ static PyObject *py_ldb_module_modify(PyLdbModuleObject *self, PyObject *args)
PyObject *py_message;
struct ldb_module *mod;
- if (!PyArg_ParseTuple(args, "O", &py_message))
+ if (!PyArg_ParseTuple(args, "O!", &PyLdbMessage, &py_message))
return NULL;
req = talloc_zero(NULL, struct ldb_request);
@@ -2228,7 +2228,7 @@ static PyObject *py_ldb_module_delete(PyLdbModuleObject *self, PyObject *args)
struct ldb_request *req;
PyObject *py_dn;
- if (!PyArg_ParseTuple(args, "O", &py_dn))
+ if (!PyArg_ParseTuple(args, "O!", &PyLdbDn, &py_dn))
return NULL;
req = talloc_zero(NULL, struct ldb_request);
@@ -2248,7 +2248,7 @@ static PyObject *py_ldb_module_rename(PyLdbModuleObject *self, PyObject *args)
struct ldb_request *req;
PyObject *py_dn1, *py_dn2;
- if (!PyArg_ParseTuple(args, "OO", &py_dn1, &py_dn2))
+ if (!PyArg_ParseTuple(args, "O!O!", &PyLdbDn, &py_dn1, &PyLdbDn, &py_dn2))
return NULL;
req = talloc_zero(NULL, struct ldb_request);