Raise a python exception when the ldb search fails
authorAndrew Bartlett <abartlet@samba.org>
Wed, 7 Jan 2009 05:29:23 +0000 (16:29 +1100)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 7 Jan 2009 06:09:26 +0000 (17:09 +1100)
This fixes a regression found by ldap.py in the new hand-written
python bindings.

Andrew Bartlett

source4/lib/ldb/pyldb.c

index 0bc644716d12b6dff894bf60b774582851b9699d..521fa498aa568ea2e4cedb345583fd60baae24c6 100644 (file)
@@ -848,6 +848,12 @@ static PyObject *py_ldb_search(PyLdbObject *self, PyObject *args, PyObject *kwar
 
        talloc_free(req);
 
+       if (ret != LDB_SUCCESS) {
+               talloc_free(res);
+               PyErr_LDB_ERROR_IS_ERR_RAISE(ret, ldb_ctx);
+               return NULL;
+       }
+
        return PyLdbResult_FromResult(res);
 }