From 8cab94e827df1ecbb03cd91467be41feece8c6e5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Matthias=20Dieter=20Walln=C3=B6fer?= Date: Wed, 21 Sep 2011 12:35:20 +0200 Subject: [PATCH] ldb:ldb.c/"ldb_request" - make "ldb_request" always return an error string Signed-off-by: Andrew Tridgell --- lib/ldb/common/ldb.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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; } -- 2.34.1