[ 
https://issues.apache.org/jira/browse/DIRSERVER-1961?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13912893#comment-13912893
 ] 

Emmanuel Lecharny commented on DIRSERVER-1961:
----------------------------------------------

There is a double problem. In DefaultSearchEngine, line 205, we do :

                optimizer.annotate( filter );
                evaluator = evaluatorBuilder.build( filter );

                // Special case if the filter selects no candidate
                if ( ( evaluator == null ) || ( evaluator instanceof 
EmptyEvaluator ) ) // <<<----------------- Here
                {
                    ScopeNode node = new ScopeNode( aliasDerefMode, 
effectiveBase, effectiveBaseId, scope );
                    evaluator = new BaseLevelScopeEvaluator<Entry>( db, node );
                }

When we have no candidate, we will get an EmptyEvaluator, and in this case, we 
return a BaseLevelScopeEvaluator, which will return an entry when doing a 
search. Obviously, this is not what we would expect.

So if we change the test to return an EmptyEvaluator (the expected return), we 
have another issue. The IllegalModificationIT.testIllegalModify2() test will 
fail when using the LDAPSdk API (note that the same test works when used with 
the KDAP API). The reason is that the LDAPSdk send this filter : 
(|(objectClass=*)(objectClass=ldapsubentry))

In the NormalizationInterceptor, we do a removeObjectClass( ExprNode ) which 
will remove the (ObjectClass=*) filter, as this will select all the candidates. 
Sadly, when we have a OR filter, we don't evaluate the filter as always 
successful (here, we get (objectClass=ldapsubentry)  as the remaining filter, 
which will only select a few entries, if any, when it should be discarded).

So there is a bug in the removeObjectClass() method which has to be fixed. The 
way to fix that would be to modify the way we manage OR and NOT filters :
- if a NOT filter has an (ObjectClass=*) as one of its element, we should 
replace the whole NotNode to a UndefinedNode.
- if an AND filter has an (ObjectClass=*) as one of its element, we can simply 
remove it
- if an OR filter has an (ObjectClass=*) as one of its element, we should 
replace the OrNode by a ScopeNode

> Searches wth Object level scope and non-existing attribute assertion in 
> filter are not working 
> -----------------------------------------------------------------------------------------------
>
>                 Key: DIRSERVER-1961
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1961
>             Project: Directory ApacheDS
>          Issue Type: Bug
>    Affects Versions: 2.0.0-M15
>            Reporter: Kiran Ayyagari
>            Assignee: Kiran Ayyagari
>            Priority: Blocker
>             Fix For: 2.0.0-M16
>
>
> To reproduce perform the below search
> ldapsearch -H ldap://localhost:10389 -x -D "uid=admin,ou=system" -w secret -b 
> "ou=schema" -s base "(objectClass=person)" "*"
> Expected: should not return any entries.
> Actual: returns ou=schema entry.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to