Issue Details (XML | Word | Printable)

Key: DIRSERVER-316
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

Deletion of RDN and objectClass attribute

Created: 22/Aug/05 08:59 PM   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 ObjectClassesRemovalTest.java 2005-08-22 09:09 PM Stefan Zoerner 2 kB
Issue Links:
Reference
 

Resolution Date: 24/Aug/05 10:23 AM


 Description  « Hide
It is possible to remove the RDN and the objectClass attribute from an entry via a modify operation. Removing the objectClass attribute leads to an entry which can't be deleted.

Attached you find a testcase which demonstrates the deletion of the objectClass on a person entry.
After this operation, it is still possible to lookup the entry with its DN, although it has no attributes and deletion attempts cause an error:
LDAP: error code 54 - failed to delete entry cn=Charly Brown,dc=apache,dc=org

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Stefan Zoerner added a comment - 22/Aug/05 09:09 PM
Here is the test case. Output is

Deletion of attribute objectClass should fail.
cn=Charly Brown,dc=apache,dc=org
No attributes
javax.naming.NamingException: [LDAP: error code 54 - failed to delete entry cn=Charly Brown,dc=apache,dc=org:
org.apache.ldap.server.interceptor.InterceptorException: Unexpected exception. [Root exception is java.lang.NullPointerException]
at org.apache.ldap.server.interceptor.InterceptorChain.throwInterceptorException(InterceptorChain.java:1202)
at org.apache.ldap.server.interceptor.InterceptorChain.access$500(InterceptorChain.java:49)
at org.apache.ldap.server.interceptor.InterceptorChain$2.delete(InterceptorChain.java:932)
...

Stefan Zoerner made changes - 22/Aug/05 09:09 PM
Field Original Value New Value
Attachment ObjectClassesRemovalTest.java [ 12311885 ]
Repository Revision Date User Message
ASF #239501 Wed Aug 24 01:21:51 UTC 2005 akarasulu changes ...

 o added some schema checking for 2251 compliance to the SchemaService which
   is an interceptor responsible for schema checks
 o added satelite class for actually doing the checks called SchemaChecker
   which I suspect can be split into several other classes for the specific
   nature of the schema checks it performs
 o added test case to unit test the operation of functions in the SchemaChecker
 o added log4j configuration for testing only which is not packaged into the
   core jar

todos ...

 o this stuff needs serious refactoring because of crazy amounts of code
   duplication - it was easier (quick and dirty) to get the code working
   as separate functions for now

This commit resolves the following issue, DIREVE-230, filed by Stefan:

http://issues.apache.org/jira/browse/DIREVE-230
Files Changed
MODIFY /directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/schema/SchemaService.java
ADD /directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/schema/SchemaChecker.java
ADD /directory/apacheds/trunk/core/src/test/resources
ADD /directory/apacheds/trunk/core/src/test/org/apache/ldap/server/schema/SchemaCheckerTest.java
ADD /directory/apacheds/trunk/core/src/test/resources/log4j.properties

Alex Karasulu added a comment - 24/Aug/05 02:27 AM
I think this is all a result of not having proper schema checking in place. If the server checked to make sure a modify operation left a valid structural objectClass in place after all mods are applied then we would not have this problem. Likewise we should not allow the deletion of the RDN attributes without an RDN change. Overall schema checking is a mess we really need a central strategy behind it. For now I will add schema checks to make sure these consistency issues do not arrise.

Alex Karasulu made changes - 24/Aug/05 02:28 AM
Status Open [ 1 ] In Progress [ 3 ]
Alex Karasulu added a comment - 24/Aug/05 02:34 AM
From Section 4.6 of RFC 2251:

+--------------------------------------------------------------------------------------------------------
 | The Modify Operation cannot be used to remove from an entry any of
 | its distinguished values, those values which form the entry's
 | relative distinguished name. An attempt to do so will result in the
 | server returning the error notAllowedOnRDN. The Modify DN Operation
 | described in section 4.9 is used to rename an entry.
+--------------------------------------------------------------------------------------------------------

Alex Karasulu added a comment - 24/Aug/05 04:59 AM
Started working on fixes for these problems and we can squeeze this into 0.9.2.

Alex Karasulu made changes - 24/Aug/05 04:59 AM
Fix Version/s 0.9.2 [ 12310192 ]
Stefan Zoerner added a comment - 24/Aug/05 05:58 AM
I refined my test cases according to Alex cite from RFC 2251. After this I found out that some servers provide other return codes, at least if the the removal is tried on a part of the RDN which is a required attribute as well (e.g. cn for person).

Sun JS DS 5.2: 65 - Object Class Violation
OpenLDAP 2.1: 64 - Naming Violation
IBM Tivoli 6.0: 67 - Not Allowed On RDN (at last)
MS ADAM: 67 - Not Allowed On RDN (inventive message text here: "CANT_ON_RDN")

I will therefor accept all three values in my test cases in order to keep the bar green for each solution. The 67 seems to be the better choice than 64, although it may depend on the fact that I used a required attribute as a RDN. The Sun server may check schema violations first, therfore its message is reasonable as well. Anyway, I will also add a test with a non required attribute as RDN.

Alex Karasulu added a comment - 24/Aug/05 10:23 AM
Committed resolving changes in revision 239501 here:

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

Alex Karasulu made changes - 24/Aug/05 10:23 AM
Status In Progress [ 3 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
Alex Karasulu made changes - 24/Aug/05 10:27 AM
Link This issue relates to DIREVE-231 [ DIREVE-231 ]
Stefan Zoerner added a comment - 25/Aug/05 03:34 AM
I have rebuilded my Apache DS and verified, that neither the objectClass defect situation (as described in the test case) nor the RDN error case (as included in test cases of my little testsuite) appear (due to the Schema Service, which now prevents me from deleting those attributes). Error codes were fine, from my retest point of view, the bug is fixed as well. Thanks, Alex!

Stefan Zoerner added a comment - 25/Aug/05 05:41 AM
Retest was successful.

Stefan Zoerner made changes - 25/Aug/05 05:41 AM
Status Resolved [ 5 ] Closed [ 6 ]
Alex Karasulu made changes - 10/Feb/06 12:34 PM
Affects Version/s 0.9.2 [ 12310192 ]
Fix Version/s 0.9.2 [ 12310192 ]
Key DIREVE-230 DIRSERVER-316
Project Directory Server [ 10516 ] Directory ApacheDS [ 12310260 ]