git.samba.org
/
samba.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bdd363a
)
dsdb: Add DSDB_SEARCH_ONE_ONLY support to dsdb_module_search*()
author
Andrew Bartlett
<abartlet@samba.org>
Fri, 6 Sep 2013 03:39:50 +0000
(15:39 +1200)
committer
Karolin Seeger
<kseeger@samba.org>
Tue, 15 Jul 2014 10:46:16 +0000
(12:46 +0200)
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit
cccc0dee04e2e3aecd82ed4cf887f9e36dd4962d
)
source4/dsdb/samdb/ldb_modules/util.c
patch
|
blob
|
history
diff --git
a/source4/dsdb/samdb/ldb_modules/util.c
b/source4/dsdb/samdb/ldb_modules/util.c
index f7803e56cb153fbf5055615404c1a81471394154..8d587a4cb3862714607441c45bd47a0f84db9022 100644
(file)
--- a/
source4/dsdb/samdb/ldb_modules/util.c
+++ b/
source4/dsdb/samdb/ldb_modules/util.c
@@
-174,6
+174,19
@@
int dsdb_module_search_tree(struct ldb_module *module,
ret = ldb_wait(req->handle, LDB_WAIT_ALL);
}
+ 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;
+ }
+ if (res->count != 1) {
+ talloc_free(tmp_ctx);
+ ldb_reset_err_string(ldb_module_get_ctx(module));
+ return LDB_ERR_CONSTRAINT_VIOLATION;
+ }
+ }
+
talloc_free(req);
if (ret == LDB_SUCCESS) {
*_res = talloc_steal(mem_ctx, res);