diff options
author | Andrew Bartlett <abartlet@samba.org> | 2013-09-06 15:39:50 +1200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2013-09-16 19:36:36 +0200 |
commit | cccc0dee04e2e3aecd82ed4cf887f9e36dd4962d (patch) | |
tree | 732d5541d1e3bd7eb80b25904dfcc0c56c5044e8 /source4 | |
parent | 3af4f0377e1ff8b23d415bc4b241bf8cb83c130c (diff) | |
download | samba-cccc0dee04e2e3aecd82ed4cf887f9e36dd4962d.tar.gz samba-cccc0dee04e2e3aecd82ed4cf887f9e36dd4962d.tar.bz2 samba-cccc0dee04e2e3aecd82ed4cf887f9e36dd4962d.zip |
dsdb: Add DSDB_SEARCH_ONE_ONLY support to dsdb_module_search*()
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source4')
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/util.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/util.c b/source4/dsdb/samdb/ldb_modules/util.c index f7803e56cb..8d587a4cb3 100644 --- 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); |