summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2011-09-21 12:35:20 +0200
committerAndrew Tridgell <tridge@samba.org>2011-10-11 08:42:07 +0200
commit8cab94e827df1ecbb03cd91467be41feece8c6e5 (patch)
tree73daec931e59f28c054be084d354be33a5dca532
parentf2a3125dcb081d8771bbcd09607592fa9cbef028 (diff)
downloadsamba-8cab94e827df1ecbb03cd91467be41feece8c6e5.tar.gz
samba-8cab94e827df1ecbb03cd91467be41feece8c6e5.tar.bz2
samba-8cab94e827df1ecbb03cd91467be41feece8c6e5.zip
ldb:ldb.c/"ldb_request" - make "ldb_request" always return an error string
Signed-off-by: Andrew Tridgell <tridge@samba.org>
-rw-r--r--lib/ldb/common/ldb.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/ldb/common/ldb.c b/lib/ldb/common/ldb.c
index 2dd2d1bdde..0c5f40ae4b 100644
--- a/lib/ldb/common/ldb.c
+++ b/lib/ldb/common/ldb.c
@@ -848,11 +848,15 @@ int ldb_request(struct ldb_context *ldb, struct ldb_request *req)
discard_const(&req->op.add.message));
if (ret != LDB_SUCCESS) {
ldb_oom(ldb);
- return LDB_ERR_OPERATIONS_ERROR;
+ return ret;
}
FIRST_OP(ldb, add);
ret = ldb_msg_check_element_flags(ldb, req->op.add.message);
if (ret != LDB_SUCCESS) {
+ /*
+ * "ldb_msg_check_element_flags" generates an error
+ * string
+ */
return ret;
}
ret = module->ops->add(module, req);
@@ -866,6 +870,10 @@ int ldb_request(struct ldb_context *ldb, struct ldb_request *req)
FIRST_OP(ldb, modify);
ret = ldb_msg_check_element_flags(ldb, req->op.mod.message);
if (ret != LDB_SUCCESS) {
+ /*
+ * "ldb_msg_check_element_flags" generates an error
+ * string
+ */
return ret;
}
ret = module->ops->modify(module, req);
@@ -903,6 +911,12 @@ int ldb_request(struct ldb_context *ldb, struct ldb_request *req)
break;
}
+ if ((ret != LDB_SUCCESS) && (ldb->err_string == NULL)) {
+ /* if no error string was setup by the backend */
+ ldb_asprintf_errstring(ldb, "ldb_request: %s (%d)",
+ ldb_strerror(ret), ret);
+ }
+
return ret;
}