From 347b2c65a4b8c219cfdae3306fdc3d793980cbed Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 6 Sep 2013 15:37:30 +1200 Subject: ldb: Show the type of failing operation in default error message Signed-off-by: Andrew Bartlett Reviewed-by: Stefan Metzmacher --- lib/ldb/common/ldb_modules.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'lib/ldb') diff --git a/lib/ldb/common/ldb_modules.c b/lib/ldb/common/ldb_modules.c index 440365688b..a39b12df92 100644 --- a/lib/ldb/common/ldb_modules.c +++ b/lib/ldb/common/ldb_modules.c @@ -554,8 +554,33 @@ int ldb_next_request(struct ldb_module *module, struct ldb_request *request) return ret; } if (!ldb_errstring(module->ldb)) { + const char *op; + switch (request->operation) { + case LDB_SEARCH: + op = "LDB_SEARCH"; + break; + case LDB_ADD: + op = "LDB_ADD"; + break; + case LDB_MODIFY: + op = "LDB_MODIFY"; + break; + case LDB_DELETE: + op = "LDB_DELETE"; + break; + case LDB_RENAME: + op = "LDB_RENAME"; + break; + case LDB_EXTENDED: + op = "LDB_EXTENDED"; + break; + default: + op = "request"; + break; + } + /* Set a default error string, to place the blame somewhere */ - ldb_asprintf_errstring(module->ldb, "error in module %s: %s (%d)", module->ops->name, ldb_strerror(ret), ret); + ldb_asprintf_errstring(module->ldb, "error in module %s: %s during %s (%d)", module->ops->name, ldb_strerror(ret), op, ret); } if (!(request->handle->flags & LDB_HANDLE_FLAG_DONE_CALLED)) { -- cgit