[ldb] Unique indexes in ldb?

Andrew Bartlett abartlet at samba.org
Tue Mar 25 03:49:07 GMT 2008

On Mon, 2008-03-24 at 23:17 -0400, simo wrote:
> On Tue, 2008-03-25 at 12:22 +1100, Andrew Bartlett wrote:
> > How hard would it be to add unique indexes to ldb?
> > 
> > In the AD schema, a number of items are marked as being unique, and I
> > presume this maps down to a unique index in their JET database. 
> > 
> > I'm wondering, how hard would it be to add such an index to ldb?  This
> > would remove a lot of the complexity from modules such as samldb (which
> > tries to prevent duplicate SIDs). 
> > 
> > Thoughts?
> Does not sound too hard to do, all we need to do is to mark an attribute
> as unique and check the index value is the only one present or return an
> error.
> The check should be done in one of the calls made by
> ltdb_store()->ltdb_index_add(), probably the most appropriate is
> ltdb_index_add1() but we need to pass down the information about the
> attribute being marked as unique.

Great.  I presume you would prefer I did this after you merged your
branch? :-)

> I guess the biggest problem is what to do if we change an attribute to
> be unique when the database is already populated and we actually have
> duplicate values.

Simply fail to add the index, and make lots of noise.  It really will be
up to the administrator to get this right, and we hope to get the index
into the database early enough. 

Andrew Bartlett

Andrew Bartlett
Authentication Developer, Samba Team           http://samba.org
Samba Developer, Red Hat 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/archive/samba-technical/attachments/20080325/a458311b/attachment.bin

More information about the samba-technical mailing list