s4:dsdb/ldb_modules: make it possible to find a reason for LDB_ERR_NO_SUCH_OBJECT...
authorStefan Metzmacher <metze@samba.org>
Thu, 14 Jan 2016 10:50:56 +0000 (11:50 +0100)
committerVolker Lendecke <vl@samba.org>
Mon, 1 Feb 2016 08:53:10 +0000 (09:53 +0100)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source4/dsdb/samdb/ldb_modules/util.c

index 1455760061cecc9ea1836cc5e2a6b3be68d8bcc1..5f995defd19d7190df197c174d1c54406069db34 100644 (file)
@@ -177,8 +177,7 @@ int dsdb_module_search_tree(struct ldb_module *module,
        if (dsdb_flags & DSDB_SEARCH_ONE_ONLY) {
                if (res->count == 0) {
                        talloc_free(tmp_ctx);
-                       ldb_reset_err_string(ldb_module_get_ctx(module));
-                       return LDB_ERR_NO_SUCH_OBJECT;
+                       return ldb_error(ldb_module_get_ctx(module), LDB_ERR_NO_SUCH_OBJECT, __func__);
                }
                if (res->count != 1) {
                        talloc_free(tmp_ctx);
@@ -279,7 +278,7 @@ int dsdb_module_dn_by_guid(struct ldb_module *module, TALLOC_CTX *mem_ctx,
        }
        if (res->count == 0) {
                talloc_free(tmp_ctx);
-               return LDB_ERR_NO_SUCH_OBJECT;
+               return ldb_error(ldb_module_get_ctx(module), LDB_ERR_NO_SUCH_OBJECT, __func__);
        }
        if (res->count != 1) {
                ldb_asprintf_errstring(ldb_module_get_ctx(module), "More than one object found matching objectGUID %s\n",