ldb:pyldb.c - py_ldb_* modification calls - error string shouldn't be set here
authorMatthias Dieter Wallnöfer <mdw@samba.org>
Tue, 20 Sep 2011 15:41:10 +0000 (17:41 +0200)
committerAndrew Tridgell <tridge@samba.org>
Tue, 11 Oct 2011 06:42:07 +0000 (08:42 +0200)
As discussed with Jelmer, we shouldn't be setting a generic LDB error string
only for the Python bindings alone. This should be done in "ldb_request"
and "ldb_wait" - the common place for all possible LDB access mechanisms.

Signed-off-by: Andrew Tridgell <tridge@samba.org>
lib/ldb/pyldb.c

index dbdfe777e027c2a8ba91bc1f483cd42d451235da..673cee268d49647311ca362185d747982e9d6360 100644 (file)
@@ -995,17 +995,13 @@ static PyObject *py_ldb_modify(PyLdbObject *self, PyObject *args, PyObject *kwar
 
        ret = ldb_request(ldb_ctx, req);
        if (ret == LDB_SUCCESS) {
-                       ret = ldb_wait(req->handle, LDB_WAIT_ALL);
+               ret = ldb_wait(req->handle, LDB_WAIT_ALL);
        }
 
        if (ret == LDB_SUCCESS) {
                ret = ldb_transaction_commit(ldb_ctx);
        } else {
                ldb_transaction_cancel(ldb_ctx);
-               if (ldb_ctx->err_string == NULL) {
-                       /* no error string was setup by the backend */
-                       ldb_asprintf_errstring(ldb_ctx, "%s (%d)", ldb_strerror(ret), ret);
-               }
        }
 
        talloc_free(mem_ctx);
@@ -1152,10 +1148,6 @@ static PyObject *py_ldb_add(PyLdbObject *self, PyObject *args, PyObject *kwargs)
                ret = ldb_transaction_commit(ldb_ctx);
        } else {
                ldb_transaction_cancel(ldb_ctx);
-               if (ldb_ctx->err_string == NULL) {
-                       /* no error string was setup by the backend */
-                       ldb_asprintf_errstring(ldb_ctx, "%s (%d)", ldb_strerror(ret), ret);
-               }
        }
 
        talloc_free(mem_ctx);
@@ -1227,10 +1219,6 @@ static PyObject *py_ldb_delete(PyLdbObject *self, PyObject *args, PyObject *kwar
                ret = ldb_transaction_commit(ldb_ctx);
        } else {
                ldb_transaction_cancel(ldb_ctx);
-               if (ldb_ctx->err_string == NULL) {
-                       /* no error string was setup by the backend */
-                       ldb_asprintf_errstring(ldb_ctx, "%s (%d)", ldb_strerror(ret), ret);
-               }
        }
 
        talloc_free(mem_ctx);
@@ -1310,10 +1298,6 @@ static PyObject *py_ldb_rename(PyLdbObject *self, PyObject *args, PyObject *kwar
                ret = ldb_transaction_commit(ldb_ctx);
        } else {
                ldb_transaction_cancel(ldb_ctx);
-               if (ldb_ctx->err_string == NULL) {
-                       /* no error string was setup by the backend */
-                       ldb_asprintf_errstring(ldb_ctx, "%s (%d)", ldb_strerror(ret), ret);
-               }
        }
 
        talloc_free(mem_ctx);