SubtreeSpecificationParser and LDAP filter
------------------------------------------

                 Key: DIRSERVER-916
                 URL: https://issues.apache.org/jira/browse/DIRSERVER-916
             Project: Directory ApacheDS
          Issue Type: Bug
            Reporter: Stefan Seelmann
             Fix For: 1.5.1


I got a curious error. While playing with the new LS subtreespecification 
editor and writing a subtreespecification with an LDAP filter the 
SubtreeSpecificationParser *sometimes* gets killed. 

It seems like the parser is stateful. If I first write some 
subtreespecifications w/o an LDAP filter the parser seems to be stable. But 
when adding it just after starting the server the parser dies with an "Read end 
dead".

It was able to reproduce it with the following steps, using the trunk:


1.) Create an entry with the following subtreespecification
-------------------------------------------------------------------
dn: cn=subentry,dc=example,dc=com
objectClass: accessControlSubentry
objectClass: subentry
objectClass: top
cn: subentry
prescriptiveaci: { identificationTag "dummy", precedence 1, authenticationLe
 vel none, itemOrUserFirst userFirst: { userClasses {  }, userPermissions { 
  } } }
subtreespecification: { specificationFilter (cn=test)  }
-------------------------------------------------------------------


2.) Shutdown the server


3.) Startup the server


4.) Overwrite the subtreespecification value with a refinement
-------------------------------------------------------------------
dn: cn=subentry,dc=example,dc=com
changetype: modify
replace: subtreespecification
subtreespecification: { specificationFilter item:top  }
-
-------------------------------------------------------------------


4.) Overwrite the subtreespecification value with a filter
-------------------------------------------------------------------
dn: cn=subentry,dc=example,dc=com
changetype: modify
replace: subtreespecification
subtreespecification: { specificationFilter (cn=test)  }
-
-------------------------------------------------------------------


The client receives the following error message:
-------------------------------------------------------------------
ldap_modify: Invalid syntax (21)
        additional info: failed to modify entry cn=subentry,dc=example,dc=com: 
failed to parse the new subtreeSpecification
-------------------------------------------------------------------


The server throws the following exception:
-------------------------------------------------------------------
[22:46:49] ERROR [org.apache.directory.server.core.subtree.SubentryService] - 
failed to parse the new subtreeSpecification
java.text.ParseException: Parser failure on subtree specification:
        { specificationFilter (cn=test)  }
Antlr exception trace:
filterParser failed. Read end dead
        at 
org.apache.directory.shared.ldap.subtree.SubtreeSpecificationParser.parse(SubtreeSpecificationParser.java:133)
        at 
org.apache.directory.server.core.subtree.SubentryService.modify(SubentryService.java:1045)
        at 
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.modify(InterceptorChain.java:1162)
        at 
org.apache.directory.server.core.schema.SchemaService.modify(SchemaService.java:1517)
        at 
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.modify(InterceptorChain.java:1162)
        at 
org.apache.directory.server.core.operational.OperationalAttributeService.modify(OperationalAttributeService.java:177)
        at 
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.modify(InterceptorChain.java:1162)
        at 
org.apache.directory.server.core.exception.ExceptionService.modify(ExceptionService.java:291)
        at 
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.modify(InterceptorChain.java:1162)
        at 
org.apache.directory.server.core.authz.DefaultAuthorizationService.modify(DefaultAuthorizationService.java:241)
        at 
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.modify(InterceptorChain.java:1162)
        at 
org.apache.directory.server.core.authz.AuthorizationService.modify(AuthorizationService.java:510)
        at 
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.modify(InterceptorChain.java:1162)
        at 
org.apache.directory.server.core.referral.ReferralService.modify(ReferralService.java:746)
        at 
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.modify(InterceptorChain.java:1162)
        at 
org.apache.directory.server.core.authn.AuthenticationService.modify(AuthenticationService.java:351)
        at 
org.apache.directory.server.core.interceptor.InterceptorChain$Entry$1.modify(InterceptorChain.java:1162)
        at 
org.apache.directory.server.core.normalization.NormalizationService.modify(NormalizationService.java:132)
        at 
org.apache.directory.server.core.interceptor.InterceptorChain.modify(InterceptorChain.java:761)
        at 
org.apache.directory.server.core.partition.PartitionNexusProxy.modify(PartitionNexusProxy.java:362)
        at 
org.apache.directory.server.core.partition.PartitionNexusProxy.modify(PartitionNexusProxy.java:349)
        at 
org.apache.directory.server.core.jndi.ServerDirContext.modifyAttributes(ServerDirContext.java:233)
        at 
javax.naming.directory.InitialDirContext.modifyAttributes(InitialDirContext.java:153)
        at 
org.apache.directory.server.ldap.support.ModifyHandler.messageReceived(ModifyHandler.java:80)
        at 
org.apache.mina.handler.demux.DemuxingIoHandler.messageReceived(DemuxingIoHandler.java:144)
        at 
org.apache.directory.server.ldap.LdapProtocolProvider$LdapProtocolHandler.messageReceived(LdapProtocolProvider.java:427)
        at 
org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageReceived(AbstractIoFilterChain.java:703)
        at 
org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:362)
        at 
org.apache.mina.common.support.AbstractIoFilterChain.access$1200(AbstractIoFilterChain.java:54)
        at 
org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:800)
        at 
org.apache.mina.filter.LoggingFilter.messageReceived(LoggingFilter.java:97)
        at 
org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:362)
        at 
org.apache.mina.common.support.AbstractIoFilterChain.access$1200(AbstractIoFilterChain.java:54)
        at 
org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:800)
        at 
org.apache.mina.filter.codec.support.SimpleProtocolDecoderOutput.flush(SimpleProtocolDecoderOutput.java:60)
        at 
org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:190)
        at 
org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:362)
        at 
org.apache.mina.common.support.AbstractIoFilterChain.access$1200(AbstractIoFilterChain.java:54)
        at 
org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:800)
        at 
org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.java:243)
        at 
org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(ExecutorFilter.java:305)
        at 
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
        at 
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
        at java.lang.Thread.run(Thread.java:595)
-------------------------------------------------------------------


Now when trying to modify the subtreespecification again, the client gets the 
follwoing message, but no server logs:
-------------------------------------------------------------------
ldap_modify: Loop detected (54)
        additional info: failed to modify entry cn=subentry,dc=example,dc=com: 
Unexpected exception
-------------------------------------------------------------------


The same error occurs when trying to delete the entry



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to