Hide Forgot
Description of problem: Attribute uniqueness plugin monitors specified attributes and ensures, that newly added entries have unique values for the monitored attributes. One example is attribute uid - if user tries to add new entry with uid equal to uid of already existing entry, the addition operation is refused by DS. It is possible to configure Attribute Uniqueness plugin and still add entry with duplicate attribute. Below are steps for case when 'sn' attribute is being monitored. Version-Release number of selected component (if applicable): 389-ds-base-1.2.11.15-29.el6.x86_64 (RHEL64) 389-ds-base-1.3.1.6-8.el7.x86_64 (RHEL7) How reproducible: always Steps to Reproduce: 1. Delete sn index: ldapdelete -h $HOST -p $PORT -D "cn=directory manager" -w Secret123 "cn=sn,cn=index,cn=userRoot,cn=ldbm database,cn=plugins,cn=config" 2. Configure attribute uniqueness on sn attribute: ldapmodify -h $HOST -p $PORT -D "cn=directory manager" -w Secret123 -a <<EOF dn: cn=attribute uniqueness,cn=plugins,cn=config changetype: modify replace: nsslapd-pluginEnabled nsslapd-pluginEnabled: on - replace: nsslapd-pluginarg0 nsslapd-pluginarg0: sn - replace: nsslapd-pluginarg1 nsslapd-pluginarg1: dc=example,dc=com EOF 3. Add user: ldapmodify -h $HOST -p $PORT -D "cn=directory manager" -w Secret123 -a <<EOF dn: cn=tuser1,ou=people,dc=example,dc=com objectclass: person objectclass: top sn: tuser1 cn: tuser1 EOF 4. Restart server 5. Add user with value 'sn' equal to value of sn of cn=tuser1: ldapmodify -h $HOST -p $PORT -D "cn=directory manager" -w Secret123 -a <<EOF dn: cn=tuser2,ou=people,dc=example,dc=com objectclass: person objectclass: top sn: tuser1 cn: tuser2 EOF Actual results: ldapsearch -LLL -h $HOST -p $PORT -D "cn=directory manager" -w Secret123 -b "cn=tuser1,ou=people,dc=example,dc=com" sn dn: cn=tuser1,ou=People,dc=example,dc=com sn: tuser1 ldapsearch -LLL -h $HOST -p $PORT -D "cn=directory manager" -w Secret123 -b "cn=tuser2,ou=people,dc=example,dc=com" sn dn: cn=tuser2,ou=People,dc=example,dc=com sn: tuser1 ldapsearch -LLL -h $HOST -p $PORT -D "cn=directory manager" -w Secret123 -b "cn=attribute uniqueness,cn=plugins,cn=config" dn: cn=attribute uniqueness,cn=plugins,cn=config objectClass: top objectClass: nsSlapdPlugin objectClass: extensibleObject cn: attribute uniqueness nsslapd-pluginPath: libattr-unique-plugin nsslapd-pluginInitfunc: NSUniqueAttr_Init nsslapd-pluginType: betxnpreoperation nsslapd-pluginEnabled: on nsslapd-pluginarg0: sn nsslapd-pluginarg1: dc=example,dc=com nsslapd-plugin-depends-on-type: database nsslapd-pluginId: NSUniqueAttr nsslapd-pluginVersion: 1.3.1.6 nsslapd-pluginVendor: 389 Project nsslapd-pluginDescription: Enforce unique attribute values Expected results: Addition of cn=tuser2 should be refused by Attribute Uniqueness plugin. Additional info: When steps 3 and 4 are reversed, i.e. instance is first restarted, then user cn=tuser1 added, then addition of cn=tuser2 is refused with: adding new entry "cn=tuser2,ou=people,dc=example,dc=com" ldap_add: Constraint violation (19) additional info: Another entry with the same attribute value already exists (attribute: "sn")
This request was not resolved in time for the current release. Red Hat invites you to ask your support representative to propose this request, if still desired, for consideration in the next release of Red Hat Enterprise Linux.
Upstream ticket: https://fedorahosted.org/389/ticket/47639
The issue is that the index that is removed (sn) is a default index. So at the next restart that index is automatically recreated by the backend. So when the next add takes place there is an "sn" index to use, but it's empty. The server uses this index to find any matching entries, but none are found because it's empty. This allows the duplicate "sn" valued entry to be added. Removing the default index configuration at the same time the backend index is deleted achieves the desired results. To correctly remove a default user index, it must also be deleted from the default index branch of cn=config: [1] ldapdelete -h $HOST -p $PORT -D "cn=directory manager" -w Secret123 "cn=sn,cn=index,cn=userRoot,cn=ldbm database,cn=plugins,cn=config" [2] ldapdelete -h $HOST -p $PORT -D "cn=directory manager" -w Secret123 "cn=sn,cn=default indexes,cn=config,cn=ldbm database,cn=plugins,cn=config" This will not be fixed in the core server, instead a doc bug has been filed to document the correct way to remove an default user index. https://bugzilla.redhat.com/show_bug.cgi?id=1108356