ldb: One-level search was incorrectly falling back to full DB scan
authorAndrew Bartlett <abartlet@samba.org>
Mon, 28 May 2018 22:04:29 +0000 (10:04 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 30 May 2018 02:23:27 +0000 (04:23 +0200)
commit88ae60ed186c9c479722ad62d65a07d0c2e71469
tree4f2c0db156ffa39262d9d62df64f1af22fc35d99
parent9e143ee9b9f7be53c193cee3153f64c4dedc07e9
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>
lib/ldb/ldb_tdb/ldb_index.c