[LDB] Store index DNs as canonical case

Andrew Bartlett abartlet at samba.org
Tue Sep 8 20:53:22 MDT 2009

On Tue, 2009-09-01 at 08:31 -0400, simo wrote:
> On Tue, 2009-09-01 at 21:59 +1000, Andrew Bartlett wrote:
> > --- a/source4/lib/ldb/ldb_tdb/ldb_tdb.h
> > +++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.h
> > @@ -29,6 +29,8 @@ struct ltdb_private {
> >         bool check_base;
> >         struct ltdb_idxptr *idxptr;
> >         bool prepared_commit;
> > +
> > +       int casefold_index;
> >  };
> Why casefold_index ?
> I'd rather call it index version, and have an index_v00_to_v01 upgrade
> function. If later on we need to change something else we will be able
> to bump up index_version to 02 and chain a index_v01_to_v02 upgrade
> function.

I've reworked the code again, and I wonder if you might like to look it
over.  We now use a index version, as requested.

The only issue I can see is that if someone was to upgrade to index
version 1, then edit using older LDB tools, that will work fine.  But if
they then use the new tools again (which detect the new index version in
the header) they won't have correct indexes (as the old tools wont
casefold or sort). 

Is this failure mode (which only shows up on upgrade/downgrade/upgrade)

One 'way out' is to never up the index version on old databases, and pay
a runtime penalty (until a manual change is made).  But new databases
would still work with the old code, and so the same problem could arise.

(Sadly existing LDB versions don't seem to have a way to reject
databases based on index versions.  I could add this from this point
forward however). 

See git://git.samba.org/abartlet/samba.git ldb-index-rewrite

Andrew Bartlett

Andrew Bartlett                                http://samba.org/~abartlet/
Authentication Developer, Samba Team           http://samba.org
Samba Developer, Cisco Inc.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20090909/fd1c8a8f/attachment.pgp>

More information about the samba-technical mailing list