summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/ldb_tdb/ldb_search.c
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2005-09-18 18:49:06 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:38:16 -0500
commit16aff2a184f7fab64d718b356056070e305e99e9 (patch)
treec1c3dd59cb0e9c54c0ce95bf9165d353206ebd8e /source4/lib/ldb/ldb_tdb/ldb_search.c
parent46a8d809376cab59c579c654b0de5105727a9585 (diff)
downloadsamba-16aff2a184f7fab64d718b356056070e305e99e9.tar.gz
samba-16aff2a184f7fab64d718b356056070e305e99e9.tar.bz2
samba-16aff2a184f7fab64d718b356056070e305e99e9.zip
r10305: start implementing better error handling
changed the prioivate modules API error string are now not spread over all modules but are kept in a single place. This allows a better control of memory and error reporting. (This used to be commit 3fc676ac1d6f59d08bedbbd9377986154cf84ce4)
Diffstat (limited to 'source4/lib/ldb/ldb_tdb/ldb_search.c')
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_search.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_search.c b/source4/lib/ldb/ldb_tdb/ldb_search.c
index ca0ae06354..fc864ac2ea 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_search.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_search.c
@@ -34,6 +34,7 @@
#include "includes.h"
#include "ldb/include/ldb.h"
+#include "ldb/include/ldb_errors.h"
#include "ldb/include/ldb_private.h"
#include "ldb/ldb_tdb/ldb_tdb.h"
@@ -249,7 +250,6 @@ static int ltdb_search_dn(struct ldb_module *module, const struct ldb_dn *dn,
const char * const attrs[], struct ldb_message ***res)
{
struct ldb_context *ldb = module->ldb;
- struct ltdb_private *ltdb = module->private_data;
int ret;
struct ldb_message *msg, *msg2;
@@ -259,8 +259,6 @@ static int ltdb_search_dn(struct ldb_module *module, const struct ldb_dn *dn,
return -1;
}
- ltdb->last_err_string = NULL;
-
if (ltdb_cache_load(module) != 0) {
ltdb_unlock_read(module);
return -1;
@@ -462,7 +460,6 @@ int ltdb_search_bytree(struct ldb_module *module, const struct ldb_dn *base,
enum ldb_scope scope, struct ldb_parse_tree *tree,
const char * const attrs[], struct ldb_message ***res)
{
- struct ltdb_private *ltdb = module->private_data;
int ret;
if ((base == NULL || base->comp_num == 0) &&
@@ -476,7 +473,7 @@ int ltdb_search_bytree(struct ldb_module *module, const struct ldb_dn *base,
struct ldb_dn *dn;
dn = ldb_dn_explode(module->ldb, tree->u.equality.value.data);
if (dn == NULL) {
- return -1;
+ return LDB_ERR_INVALID_DN_SYNTAX;
}
ret = ltdb_search_dn(module, dn, attrs, res);
talloc_free(dn);
@@ -487,8 +484,6 @@ int ltdb_search_bytree(struct ldb_module *module, const struct ldb_dn *base,
return -1;
}
- ltdb->last_err_string = NULL;
-
if (ltdb_cache_load(module) != 0) {
ltdb_unlock_read(module);
return -1;
@@ -530,7 +525,8 @@ int ltdb_search(struct ldb_module *module, const struct ldb_dn *base,
tree = ldb_parse_tree(ltdb, expression);
if (tree == NULL) {
- ltdb->last_err_string = "expression parse failed";
+ char *err_string = talloc_strdup(module, "expression parse failed");
+ if (err_string) ldb_set_errstring(module, err_string);
return -1;
}