You can set unique arribute of openldap by “overlay unique”.
http://www.openldap.org/doc/admin24/overlays.html
http://www.openldap.org/software/man.cgi?query=slapo-unique
STEP1 configure –enable-unique
overlay unique is default=off, so you should add “–enable-unique” option to configure.
$ cd openldap-2.4.40
$ ./configure --prefix=/usr/local/openldap --enable-unique
$ make depend ^^^^^^^^^^^^^^^
$ make
$ make test
$ su
# make install
STEP2 vi /usr/local/openldap/etc/openldap/slapd.conf
If you will set displayName & mail to unique attribute , you add setting “overlay unique” , “unique_uri” after rootdn setting.
database bdb
suffix "dc=my-domain,dc=com"
rootdn "cn=Manager,dc=my-domain,dc=com"
:
overlay unique
unique_uri ldap:///ou=People,dc=my-domain,dc=com?displayName?sub
unique_uri ldap:///ou=People,dc=my-domain,dc=com?mail?sub
If you add setting “overlay unique” , “unique_uri” before rootdn setting, openldap shows warning , below.
# /etc/rc.d/init.d/slapd restart
Stopping slapd: [ OK ]
Checking configuration files for slapd: [WARNING]
554464e2 slapo-unique needs a rootdn; backend <> has none, YMMV.
554464e2 slapo-unique needs a rootdn; backend <> has none, YMMV.
config file testing succeeded
Starting slapd: [ OK ]