From a1a3b967315eee71da4d5d09d4fa9dd948502772 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 8 Jul 2005 05:04:57 +0000 Subject: r8222: 0 entries are no error, unless it's a base search metze (This used to be commit 0297943ff201b06cc7a3c4aba5d81481a4cc5966) --- source4/ldap_server/ldap_simple_ldb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source4/ldap_server') diff --git a/source4/ldap_server/ldap_simple_ldb.c b/source4/ldap_server/ldap_simple_ldb.c index e8c66e80a2..4403ec8ea2 100644 --- a/source4/ldap_server/ldap_simple_ldb.c +++ b/source4/ldap_server/ldap_simple_ldb.c @@ -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; -- cgit