[LDB] Store index DNs as canonical case

Andrew Bartlett abartlet at samba.org
Tue Sep 1 05:59:03 MDT 2009


On Tue, 2009-09-01 at 08:22 +1000, Andrew Bartlett wrote:
> On Mon, 2009-08-31 at 13:10 -0400, simo wrote:
> > On Mon, 2009-08-31 at 23:27 +1000, Andrew Bartlett wrote:
> > > The attached patch reworks our index code to always store the canonical
> > > casefolded form of the DN in an index.  It does not work yet, and needs
> > > to add a 'index version' to the ldb to trigger a reindex.  The
> > > casefolded index entries should be backward compatible, because the
> > > previous code accepted any case variation, so we are simply being more
> > > strict in what we now write.  
> > > 
> > > This was inspired by a bug where we would not delete index entries
> > > because the DN was not in a canonical from, and the existing
> > > strcasecmp() didn't match.  
> > > 
> > > (strcasecmp isn't the right option any more anyway)
> > > 
> > > This stems from the fact that LDB DNs were just case-insensitive strings
> > > originally, but have become far more complex since then. 
> > > 
> > > Any comments would be most welcome while I chase down the remaining
> > > issues. 
> > 
> > Comment:
> > this means that the index string format depends on the case sensitivity
> > of an attribute, this is a change in behavior, although I see you
> > recognize the need of a re-index the db on upgrade.
> 
> Given that the on-disk TDB_KEY DN=<casefold_dn> already varies like
> this, we simply get closer to what I think should have done in the first
> place, and stored the TDB key in the index)!

Attached is my current work.  The only issue I've got is that @INDEX DNs
are showing up in base searches, when they contain a DN as the index
value. 

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: 0006-s4-ldb-Fix-incorrect-swap-of-ldb_context-and-TALLOC_.patch
Type: text/x-patch
Size: 2468 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20090901/3a44a96e/attachment-0010.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0007-s4-ldb-Add-support-for-upgrading-existing-ldbs-to-ca.patch
Type: text/x-patch
Size: 5679 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20090901/3a44a96e/attachment-0011.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-s4-ldb-Rework-ldb-index-code-to-use-the-casefolded-D.patch
Type: text/x-patch
Size: 37718 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20090901/3a44a96e/attachment-0012.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0008-s4-ldb-Remove-LTDB_PACKING_FORMAT_NODN.patch
Type: text/x-patch
Size: 1959 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20090901/3a44a96e/attachment-0013.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0009-s4-ldif_handlers-Fix-memory-leak-in-objectCategory-L.patch
Type: text/x-patch
Size: 866 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20090901/3a44a96e/attachment-0014.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-s4-ldb-samba-Use-temp-talloc-contexts-and-talloc_ste.patch
Type: text/x-patch
Size: 5042 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20090901/3a44a96e/attachment-0015.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-s4-ldb-Fix-ldb_list_find-folowing-the-change-from.patch
Type: text/x-patch
Size: 2099 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20090901/3a44a96e/attachment-0016.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-s4-ldb-Rework-ldb_tdb-to-use-global-memory-contexts.patch
Type: text/x-patch
Size: 28160 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20090901/3a44a96e/attachment-0017.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0010-s4-ldb-mark-as-casefold-index-only-after-another-r.patch
Type: text/x-patch
Size: 2864 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20090901/3a44a96e/attachment-0018.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-s4-ldb-always-talloc_free-the-ldb_ldif_write-conte.patch
Type: text/x-patch
Size: 739 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20090901/3a44a96e/attachment-0019.bin>
-------------- 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/20090901/3a44a96e/attachment-0001.pgp>


More information about the samba-technical mailing list