[PATCH] avoid calling casefold_internal if the dn is already casefolded

Andrew Bartlett abartlet at samba.org
Wed Dec 12 04:26:13 MST 2012

On Tue, 2012-12-11 at 22:23 -0800, Matthieu Patou wrote:
> Hello,
> Can someone review this patch ?
> It comes from analysis of indexed ldb_search with scope = one or subtree.
> For each entries in the index we will compare the dn in the index to dn 
> specified as base for the search. And we keep casefolding the later one 
> which is useless and costly.
> With a hundreds of entries in the index the cost of cost folding is 
> starting to be one of the most important one. With this patch we can 
> avoid useless calls.

Did this really help?  I can't see how this is any different to the
dn->valid_case check we already do in ldb_dn_casefold_internal().

Additionally, the reason that dn->valid_case needs to be checked is that
if the DN is changed, the casefolded version may not be valid, and may
need to be regenerated.  (ie, there is a correctness issue here as


Andrew Bartlett

Andrew Bartlett                                http://samba.org/~abartlet/
Authentication Developer, Samba Team           http://samba.org

More information about the samba-technical mailing list