Bug 1044198

Summary: Replication of the schema may overwrite consumer 'attributetypes' even if consumer definition is a superset
Product: Red Hat Enterprise Linux 7 Reporter: Nathan Kinder <nkinder>
Component: 389-ds-baseAssignee: Rich Megginson <rmeggins>
Status: CLOSED ERRATA QA Contact: Viktor Ashirov <vashirov>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 7.0CC: mreynolds, nhosoi, rmeggins, vashirov
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 389-ds-base-1.3.3.1-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-05 09:33:02 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Nathan Kinder 2013-12-17 21:53:23 UTC
This bug is created as a clone of upstream ticket:
https://fedorahosted.org/389/ticket/47541

This ticket is a follow-up of https://fedorahosted.org/389/ticket/47490

A schema is a ldap entry with two attributes of 'objectclasses' and 'attributetypes'. 
A value of 'objectclasses' is a component that defines an objectclass. For example, a value of 'objectclasses' defines the objectclass 'person' with parentOC, MUST and MAY attribute.
Similarly a value of 'attributetypes' defines  the attribute 'givenname' with syntax,single-multi value, use...
 
During a replication session, the supplier may push its schema ( attributes 'objectclasses' and 'attributetypes') to the consumer. 

A value of 'objectclasses' may differs between supplier and consumer. A problem can arise if the value on the consumer is a superset of the value on the supplier. For example if consumer OC1 defines MUST with A1,A2 while the supplier OC1 defines MUST with A1. In that sense the OC1 on the supplier is more restrictive than the one on the consumer and if OC1 is pushed, then some entries on the consumer may violate the OC1. This problem was addressed with tichet https://fedorahosted.org/389/ticket/47490

A similar issue exists with 'attributetypes' where an attributetypes value, may be more restrictive on the supplier than on a consumer. For example with a more restrictive syntax or being single valued. This ticket is to address the 'attributetypes' checking during the schema push

Comment 2 Viktor Ashirov 2015-01-26 23:14:04 UTC
Please, provide verification steps.
Thank you!

Comment 3 Noriko Hosoi 2015-01-26 23:16:57 UTC
It looks the owner of the ticket is Mark...

Comment 4 mreynolds 2015-01-27 14:39:13 UTC
Verification Steps:

[1]  Create two instances using "dc=example,dc=com" - replica A and replica B
[2]  Setup Multi-Master Replication(MMR) between the two servers
[3]  On Replica A create a new attribute "myAttribute" that is single valued (SINGLE-VALUE)

ldapmodify ...
dn: cn=schema
changetype: modify
add: attributeTypes
attributeTypes: ( myAttribute-oid NAME 'myAttribute'  SYNTAX 1.3.6.1.4.1.1466.
 115.121.1.38 SINGLE-VALUE X-ORIGIN 'user defined' )

[4]  On Replica B create a new attribute with the same name "myAttribute", but it should be multi-valued (no SINGLE-VALUE)

ldapmodify ...
dn: cn=schema
changetype: modify
add: attributeTypes
attributeTypes: ( myAttribute-oid NAME 'myAttribute'  SYNTAX 1.3.6.1.4.1.1466.
 115.121.1.38 X-ORIGIN 'user defined' )


[5]  Add a dummy entry on Replica A to trigger replication, and the schema push.
[6]  Check the Replica B 'myAttribute" is still "multi-valued" or unchanged - meaning the attribute value does not contain "SINGLE-VALUE":

attributeTypes: ( myAttribute-oid NAME 'myAttribute'  SYNTAX 1.3.6.1.4.1.1466.
 115.121.1.38 X-ORIGIN 'user defined' )

[7]  On Replica A, the attributeTypes value should be changed to be multi-valued (no SINGLE-VALUE):

attributeTypes: ( myAttribute-oid NAME 'myAttribute'  SYNTAX 1.3.6.1.4.1.1466.
 115.121.1.38 X-ORIGIN 'user defined' )

So both Replica A & B should have the same attributeTypes value for "myAttribute" (no "SINGLE-VALUE")

[8] Done

Comment 5 Viktor Ashirov 2015-01-27 16:57:33 UTC
Mark, thank you for the verification steps!

$ rpm -qa | grep 389
389-ds-base-1.3.3.1-12.el7.x86_64
389-ds-base-debuginfo-1.3.3.1-12.el7.x86_64
389-ds-base-libs-1.3.3.1-12.el7.x86_64

[1]  Create two instances using "dc=example,dc=com" - replica A and replica B
[2]  Setup Multi-Master Replication(MMR) between the two servers
[3]  On Replica A create a new attribute "myAttribute" that is single valued (SINGLE-VALUE)
$ ldapmodify -D "cn=Directory Manager" -w Secret123 -H ldap://localhost:1189 -a << EOF
dn: cn=schema
changetype: modify
add: attributeTypes
attributeTypes: ( myAttribute-oid NAME 'myAttribute'  SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 SINGLE-VALUE X-ORIGIN 'user defined' )
EOF
modifying entry "cn=schema"

[4]  On Replica B create a new attribute with the same name "myAttribute", but it should be multi-valued (no SINGLE-VALUE)
$ ldapmodify -D "cn=Directory Manager" -w Secret123 -H ldap://localhost:1289 -a << EOF
dn: cn=schema
changetype: modify
add: attributeTypes
attributeTypes: ( myAttribute-oid NAME 'myAttribute'  SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 X-ORIGIN 'user defined' )
EOF
modifying entry "cn=schema"

[5]  Add a dummy entry on Replica A to trigger replication, and the schema push.
$ ldapmodify -D "cn=Directory Manager" -w Secret123 -H ldap://localhost:1189 -a << EOF
dn: cn=user1,ou=People,dc=example,dc=com
objectClass: person
objectClass: top
cn: user1
sn: user1
EOF
adding new entry "cn=user1,ou=People,dc=example,dc=com"

[6]  Check the Replica B 'myAttribute" is still "multi-valued" or unchanged - meaning the attribute value does not contain "SINGLE-VALUE":
$ ldapsearch -D "cn=Directory Manager" -w Secret123 -H ldap://localhost:1189  -LLL -o ldif-wrap=no -b "cn=schema" -s base "objectclass=*" nscpEntryWSI | grep myAttribute
nscpEntryWSI: attributeTypes: ( myAttribute-oid NAME 'myAttribute'  SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 X-ORIGIN 'user defined' )

[7]  On Replica A, the attributeTypes value should be changed to be multi-valued (no SINGLE-VALUE):
$ ldapsearch -D "cn=Directory Manager" -w Secret123 -H ldap://localhost:1289  -LLL -o ldif-wrap=no -b "cn=schema" -s base "objectclass=*" nscpEntryWSI | grep myAttribute
nscpEntryWSI: attributeTypes: ( myAttribute-oid NAME 'myAttribute'  SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 X-ORIGIN 'user defined' )

Both Replica A & B have the same attributeTypes value for "myAttribute" (no "SINGLE-VALUE"). Hence marking as VERIFIED.

Comment 7 errata-xmlrpc 2015-03-05 09:33:02 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2015-0416.html