ldb: One-level search was incorrectly falling back to full DB scan
commitb8df3cd999c2dd56f77d90fcdc264decc233834e
authorAndrew Bartlett <abartlet@samba.org>
Mon, 28 May 2018 22:04:29 +0000 (29 10:04 +1200)
committerKarolin Seeger <kseeger@samba.org>
Tue, 26 Jun 2018 07:19:16 +0000 (26 09:19 +0200)
tree089dcb9f02ecec4aa9ef9bc6caaed353825d9205
parent703ca1a427a468f763538f1371c388d25745b2dd
ldb: One-level search was incorrectly falling back to full DB scan

When no search filter is specified, the code falls back to using
'(|(objectClass=*)(distinguishedName=*)'. ltdb_index_dn() then failed
because matching against '*' is not indexed. The error return then
caused the code to fallback to a full-scan of the DB, which could have a
considerable performance hit.

Instead, we want to continue on and do the ltdb_index_filter() over the
indexed results that were returned.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13448

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
(cherry picked from commit 88ae60ed186c9c479722ad62d65a07d0c2e71469)
lib/ldb/ldb_tdb/ldb_index.c