[s4] LDB TDB indexes

tridge at samba.org tridge at samba.org
Wed Nov 18 04:10:20 MST 2009


Hi Matthias,

I think I've tracked down the main cause of this bug. The problem
wasn't actually in ldb_index.c, it was in ldb_tdb.c. When we do a
modify or a rename, we need to be careful to pass the real object DN
to the indexing code, not the DN that the user supplied. The
difference between the two can be crucial if they differ by case.

The way the indexing code is supposed to work at the moment is that
the DN lists are always 'correct' DNs (ie. the real DN of the object,
which is the DN you would get back from a search). This is supposed to
avoid the need to call the casefolding functions a lot in the indexing
code, which could get really expensive.

The rename and modify methods incorrectly used a user supplied DN
instead of the 'real' DN, and that led to the bug you saw.

I'm still looking at this (and testing), but if you could take a look
at my ldb-wip branch then you'll see the main fix here:

  http://git.samba.org/?p=tridge/samba.git;a=commitdiff;h=8fcfccbd5f0895bdf09f44fbd8543dfd4d051882

I'll also have a look at your cleanup changes before I push, and I'll
add a test case for this problem.

One bad thing about the current design is that it is fragile. Normally
DNs should be compared using their case-folded form, but the indexing
code doesn't do that (as an optimisation). We should be on the lookout
for any more cases like this as it is very easy to get wrong.

Cheers, Tridge


More information about the samba-technical mailing list