[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: how to ensure uniquesness of attribute?



"S.T. Wong" wrote:

> Hi there,
>
> I'd like to know if it's possible to check updates of particular attributes,
> e.g. mailacceptinggeneralid, so that the value of these attributes are unique
> within the database.   Would anyone please help ?

Just a couple ideas.  May not be the best, but
should get ideas flowing :-)

1) Before adding the record to the database,
   search it for that attribute.  Works,
   but there's the possibility of a race condition
   (one searches, then between searching and adding
   another process adds a record with the attribute
   and you get duplicates)

2) Make it part of your DN.  This works well with
   uid, but is not always appropriate, and only really
   works if you use it as your rdn.  Within a level
   of a branch of the tree, it's guaranteed to be
   unique (i.e. if your dn's are
   mailacceptinggeneraluid=xxx, ou=people, o=company
   this will be unique directly under ou=people,
   but you can have
   mailacceptinggeneraluid=xxx, ou=others, o=company,
   so it's only guaranteed unique under a given
   branch, and only within one level.)  'Course, if
   your rdn is uid or something, this is not practical.

3) Write a pluggin to handle this - Netscape does
   this on their directory server for uid.  You can do
   the same for other attributes.  This will work
   best, but problems are many fold:  It's much more
   complicated, it's realy implementation specific
   rather than LDAP standards, I don't know if
   OpenLDAP supports it, etc.

A lot depends on how critical it is - I tend to use
option 1 above, and have never had a problem.

--
 Jeff Clowser
 mailto:jclowser@aerotek.com       Hanover MD  21076 USA
 Phone: (410)-579-4328             7312 Parkway Drive