1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-08 04:58:40 +03:00

r8222: 0 entries are no error, unless it's a base search

metze
(This used to be commit 0297943ff201b06cc7a3c4aba5d81481a4cc5966)
This commit is contained in:
Stefan Metzmacher 2005-07-08 05:04:57 +00:00 committed by Gerald (Jerry) Carter
parent c11204339a
commit a1a3b96731

View File

@ -47,6 +47,7 @@ static NTSTATUS sldb_Search(struct ldapsrv_partition *partition, struct ldapsrv_
struct ldb_context *samdb;
struct ldb_message **res = NULL;
int i, j, y, count = 0;
int success_limit = 1;
enum ldb_scope scope = LDB_SCOPE_DEFAULT;
const char **attrs = NULL;
const char *errstr = NULL;
@ -67,14 +68,17 @@ static NTSTATUS sldb_Search(struct ldapsrv_partition *partition, struct ldapsrv_
case LDAP_SEARCH_SCOPE_BASE:
DEBUG(10,("sldb_Search: scope: [BASE]\n"));
scope = LDB_SCOPE_BASE;
success_limit = 1;
break;
case LDAP_SEARCH_SCOPE_SINGLE:
DEBUG(10,("sldb_Search: scope: [ONE]\n"));
scope = LDB_SCOPE_ONELEVEL;
success_limit = 0;
break;
case LDAP_SEARCH_SCOPE_SUB:
DEBUG(10,("sldb_Search: scope: [SUB]\n"));
scope = LDB_SCOPE_SUBTREE;
success_limit = 0;
break;
}
@ -135,7 +139,7 @@ reply:
NT_STATUS_HAVE_NO_MEMORY(done_r);
if (result == LDAP_SUCCESS) {
if (count > 0) {
if (count >= success_limit) {
DEBUG(10,("sldb_Search: results: [%d]\n",count));
result = LDAP_SUCCESS;
errstr = NULL;