Issue Details (XML | Word | Printable)

Key: DIRSERVER-335
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Alex Karasulu
Reporter: Stefan Zoerner
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Directory ApacheDS

Adding new object classes to an entry removes the old ones

Created: 09/Aug/05 03:59 AM   Updated: 10/Feb/06 12:34 PM
Return to search
Component/s: None
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments:
  Size
Java Source File Licensed for inclusion in ASF works AddObjectClassesToEntryTest.java 2005-08-10 11:00 PM Stefan Zoerner 4 kB
Java Archive File ldap.jar 2005-08-10 06:36 PM 547 kB
Java Source File LDAPModifyAddTest.java 2005-08-10 06:36 PM 3 kB
Text File Licensed for inclusion in ASF works patch_testCase_AddOpbjectClasses.txt 2005-08-10 07:29 PM Stefan Zoerner 3 kB
Environment:
Server: ApacheDS 0.9.1 on Windows XP
java version "1.5.0_03"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_03-b07)

Client: Windows XP
Command line tool ldapadd (from IBM Tivoli Directory Server)
or Softerra LDAP Administrator 3.2

Resolution Date: 11/Aug/05 02:53 AM


 Description  « Hide
If additional objectclasses are added to an existing entry by a client, the old ones are lost.
 e.g. applying the following LDIF to ApacheDS

--8<--

# create an entry for a person
#
dn: cn=Tori Amos,ou=system
changetype: add
objectclass: top
objectclass: person
cn: Tori Amos
sn: Amos
description: an American singer-songwriter

# add objectclasses and uid
#
dn: cn=Tori Amos,ou=system
changetype: modify
add: objectclass
objectclass: organizationalPerson
objectclass: inetOrgPerson
-
add: uid
uid: tamos
-

-->8--

leaves an entry behind with only two (instead of all for objectclasses):

$ ldapadd -p 10389 -D uid=admin,ou=system -w *** -f addAndModifyObjectClasses.ldif
adding new entry cn=Tori Amos,ou=system

modifying entry cn=Tori Amos,ou=system

$ ldapsearch -p 10389 -b "ou=system" "(cn=Tori Amos)"
cn=Tori Amos,ou=system
sn=Amos
objectclass=inetOrgPerson
objectclass=organizationalPerson
cn=Tori Amos
uid=tamos
description=an American singer-songwriter

---

Expected result would be:

cn=Tori Amos,ou=system
sn=Amos
objectclass=top
objectclass=person
objectclass=inetOrgPerson
objectclass=organizationalPerson
cn=Tori Amos
uid=tamos
description=an American singer-songwriter


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Alex Karasulu made changes - 09/Aug/05 06:17 AM
Field Original Value New Value
Fix Version/s 0.9.2 [ 12310192 ]
Alex Karasulu added a comment - 10/Aug/05 04:21 PM
Committed on revision 231186 here:

http://svn.apache.org/viewcvs.cgi?rev=231186&view=rev

Problem is gone now in 0.9.2-SNAPSHOT.

Alex Karasulu made changes - 10/Aug/05 04:21 PM
Status Open [ 1 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
Repository Revision Date User Message
ASF #231284 Wed Aug 10 17:32:30 UTC 2005 akarasulu More corrections to the usage of LockableAttributesImpl.put(). These changes
should fix the specific problems in DIREVE-216.
Files Changed
MODIFY /directory/shared/ldap/trunk/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/add/AddAttributeValueRule.java
MODIFY /directory/shared/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/decoder/search/SearchResponseEntryTest.java
MODIFY /directory/shared/ldap/trunk/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/decoder/add/AddRequestTest.java

Repository Revision Date User Message
ASF #231287 Wed Aug 10 17:49:15 UTC 2005 akarasulu committing test contributed by stefan from DIREVE-216
Files Changed
ADD /directory/apacheds/trunk/main/src/test/org/apache/ldap/server/AddObjectClassesToEntryTest.java





Stefan Zoerner added a comment - 10/Aug/05 07:29 PM
I added a new method to the test cases (class org.apache.ldap.server.jndi.ModifyContextTest) which checks my problem. With Alex changes it disappeard. But I am not sure how characteristic the methods in ModifyContextTest really are. Do they also check the partition implementation?

The test succeeds now. But as Ugo described above the top object class still vanishes if someone tries (I observed the same problem). Therfore, the test case is not good enough ...

Stefan Zoerner made changes - 10/Aug/05 07:29 PM
Attachment patch_testCase_AddOpbjectClasses.txt [ 12311668 ]

Stefan Zoerner added a comment - 10/Aug/05 11:00 PM
This is getting tricky. In order to resolve the confusion I created a JUnit Testcase which uses JNDI to connect to the Directory Server via LDAP and demonstrates the error situation. This is probably easier to use/integrate than the LDIF and the JLDAP tests above.

With the current version of apacheds-main-0.9.2-SNAPSHOT.jar, two of the three tests fail. Especially the situation, Ugo described above (top missing after modification), is shown.

I checked the test case with another LDAP implementation (Sun) -- all three tests ran as expected.

In order to run the tests, a valid jndi.properties is needed.
My configuration was:
---
java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory
java.naming.provider.url=ldap://localhost:10389/ou=system
java.naming.security.principal=uid=admin,ou=system
java.naming.security.credentials=*****
java.naming.security.authentication=simple
---
I hope this helps.

Stefan Zoerner made changes - 10/Aug/05 11:00 PM
Attachment AddObjectClassesToEntryTest.java [ 12311670 ]
Alex Karasulu added a comment - 11/Aug/05 01:16 AM
Let's reopen this even though the problem has morphed into something else. Personally I think it has exposed other issues. Also note this is all starting to reveal itself do to fixes I made to the semantic behavoir of the LockableAttributesImpl.put(Attribute) method which was incorrectly not replacing the entry. I think we now are seeing places where this was used incorrrectly to make up for the lack of correct operation. We just need to keep fixing things as they arise.

Alex Karasulu made changes - 11/Aug/05 01:16 AM
Resolution Fixed [ 1 ]
Status Resolved [ 5 ] Reopened [ 4 ]
Alex Karasulu made changes - 11/Aug/05 02:49 AM
Status Reopened [ 4 ] In Progress [ 3 ]
Alex Karasulu added a comment - 11/Aug/05 02:53 AM
Ok I think I've nipped this one in the bud once and for all. I committed some changes to the apache ber provider which incorrectly used the LockableAttributesImpl.put methods to add objectClass attrbitute values on add operations. I have committed your test case stefan in revision 231287 here:

http://svn.apache.org/viewcvs.cgi?rev=231287&view=rev

Let me know how this latest fix works out. If the issue morphs into something else we can open a separate JIRA issue. This issue is way too loaded :). Thanks guys for all your help both you Stefan and Ugo for finding and contributing the test cases.

Alex Karasulu made changes - 11/Aug/05 02:53 AM
Resolution Fixed [ 1 ]
Status In Progress [ 3 ] Resolved [ 5 ]
Stefan Zoerner added a comment - 28/Aug/05 04:31 PM
This bug has been fixed two weeks ago. I successfully retested the case in the current version, hence I close the issue.

Stefan Zoerner made changes - 28/Aug/05 04:31 PM
Status Resolved [ 5 ] Closed [ 6 ]
Alex Karasulu made changes - 10/Feb/06 12:34 PM
Project Directory Server [ 10516 ] Directory ApacheDS [ 12310260 ]
Fix Version/s 0.9.2 [ 12310192 ]
Key DIREVE-216 DIRSERVER-335
Affects Version/s 0.9.1 [ 11125 ]