summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2010-09-28 12:57:15 +1000
committerAndrew Bartlett <abartlet@samba.org>2010-09-29 04:23:07 +1000
commit88abf441d021e753f149a534a232090634652367 (patch)
tree8567a04c246eda6e0e9d64f7dc2efee514b789c8
parent063b61289db73444d514d2897339cf135fc8dfc9 (diff)
downloadsamba-88abf441d021e753f149a534a232090634652367.tar.gz
samba-88abf441d021e753f149a534a232090634652367.tar.bz2
samba-88abf441d021e753f149a534a232090634652367.zip
s4-dsdb Add ldb_reset_err_string() when we set error codes.
If we don't we could show an old, incrorrect error
-rw-r--r--source4/dsdb/common/util.c3
-rw-r--r--source4/dsdb/samdb/ldb_modules/util.c1
2 files changed, 4 insertions, 0 deletions
diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c
index ceb12a836a..a5d0f60f51 100644
--- a/source4/dsdb/common/util.c
+++ b/source4/dsdb/common/util.c
@@ -3811,6 +3811,7 @@ int dsdb_search(struct ldb_context *ldb,
ret = dsdb_request_add_controls(req, dsdb_flags);
if (ret != LDB_SUCCESS) {
talloc_free(tmp_ctx);
+ ldb_reset_err_string(ldb);
return ret;
}
@@ -3827,10 +3828,12 @@ int dsdb_search(struct ldb_context *ldb,
if (dsdb_flags & DSDB_SEARCH_ONE_ONLY) {
if (res->count == 0) {
talloc_free(tmp_ctx);
+ ldb_reset_err_string(ldb);
return LDB_ERR_NO_SUCH_OBJECT;
}
if (res->count != 1) {
talloc_free(tmp_ctx);
+ ldb_reset_err_string(ldb);
return LDB_ERR_CONSTRAINT_VIOLATION;
}
}
diff --git a/source4/dsdb/samdb/ldb_modules/util.c b/source4/dsdb/samdb/ldb_modules/util.c
index 1dc466efb1..b64b934aeb 100644
--- a/source4/dsdb/samdb/ldb_modules/util.c
+++ b/source4/dsdb/samdb/ldb_modules/util.c
@@ -622,6 +622,7 @@ int dsdb_module_reference_dn(struct ldb_module *module, TALLOC_CTX *mem_ctx, str
*dn = ldb_msg_find_attr_as_dn(ldb_module_get_ctx(module),
mem_ctx, res->msgs[0], attribute);
if (!*dn) {
+ ldb_reset_err_string(ldb_module_get_ctx(module));
talloc_free(res);
return LDB_ERR_NO_SUCH_ATTRIBUTE;
}