From 337d3d9ba9e271272046feac0d17911d024eb43f Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Fri, 7 Jan 2011 12:03:04 -0500 Subject: Work around libldb bug Libldb performs non-indexed searches for ONELEVEL requests. We'll use SUBTREE instead to reduce the performance hit substantially --- src/db/sysdb_ops.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c index 19f43c6c0..23264b41b 100644 --- a/src/db/sysdb_ops.c +++ b/src/db/sysdb_ops.c @@ -265,7 +265,11 @@ int sysdb_search_user_by_uid(TALLOC_CTX *mem_ctx, goto done; } - ret = sysdb_search_entry(tmpctx, ctx, basedn, LDB_SCOPE_ONELEVEL, filter, + /* Use SUBTREE scope here, not ONELEVEL + * There is a bug in LDB that makes ONELEVEL searches extremely + * slow (it ignores indexing) + */ + ret = sysdb_search_entry(tmpctx, ctx, basedn, LDB_SCOPE_SUBTREE, filter, attrs?attrs:def_attrs, &msgs_count, &msgs); if (ret) { goto done; @@ -359,7 +363,11 @@ int sysdb_search_group_by_gid(TALLOC_CTX *mem_ctx, goto done; } - ret = sysdb_search_entry(tmpctx, ctx, basedn, LDB_SCOPE_ONELEVEL, filter, + /* Use SUBTREE scope here, not ONELEVEL + * There is a bug in LDB that makes ONELEVEL searches extremely + * slow (it ignores indexing) + */ + ret = sysdb_search_entry(tmpctx, ctx, basedn, LDB_SCOPE_SUBTREE, filter, attrs?attrs:def_attrs, &msgs_count, &msgs); if (ret) { goto done; -- cgit