ldap_server: Remove success_limit
authorAndrew Bartlett <abartlet@samba.org>
Wed, 3 Apr 2019 03:48:33 +0000 (16:48 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 20 May 2019 04:01:11 +0000 (04:01 +0000)
This was always set to 0 so was poinless.  Any LDAP scope can return 0 entries,
even a SCOPE_BASE if the filter does not match.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
source4/ldap_server/ldap_backend.c

index 9f72734f973f1b1397830cabe147382fe6f471f9..2b8a86b623ac828ce5e2f564f57aec0dec32acb4 100644 (file)
@@ -521,7 +521,6 @@ static NTSTATUS ldapsrv_SearchRequest(struct ldapsrv_call *call)
        enum ldb_scope scope = LDB_SCOPE_DEFAULT;
        const char **attrs = NULL;
        const char *scope_str, *errstr = NULL;
-       int success_limit = 1;
        int result = -1;
        int ldb_ret = -1;
        unsigned int i, j;
@@ -544,17 +543,14 @@ static NTSTATUS ldapsrv_SearchRequest(struct ldapsrv_call *call)
                case LDAP_SEARCH_SCOPE_BASE:
                        scope_str = "BASE";
                        scope = LDB_SCOPE_BASE;
-                       success_limit = 0;
                        break;
                case LDAP_SEARCH_SCOPE_SINGLE:
                        scope_str = "ONE";
                        scope = LDB_SCOPE_ONELEVEL;
-                       success_limit = 0;
                        break;
                case LDAP_SEARCH_SCOPE_SUB:
                        scope_str = "SUB";
                        scope = LDB_SCOPE_SUBTREE;
-                       success_limit = 0;
                        break;
                default:
                        result = LDAP_PROTOCOL_ERROR;
@@ -749,15 +745,11 @@ reply:
 
        if (result != -1) {
        } else if (ldb_ret == LDB_SUCCESS) {
-               if (res->count >= success_limit) {
-                       DEBUG(10,("SearchRequest: results: [%d]\n", res->count));
-                       result = LDAP_SUCCESS;
-                       errstr = NULL;
-               }
                if (res->controls) {
                        done_r->msg->controls = res->controls;
                        talloc_steal(done_r, res->controls);
                }
+               result = LDB_SUCCESS;
        } else {
                DEBUG(10,("SearchRequest: error\n"));
                result = map_ldb_error(local_ctx, ldb_ret, ldb_errstring(samdb),