Hi Francesco

sorry for the latency...

There is a clear bug in the way we handle a filter like (ObjectClass=top) in the search engine. As 'top' is never present in the index - for obvious reason : *every* single entry has such an attribute value -, the filter returns no candidate, so the encapsulating filter evaluation simply stops :

(&(objectClass=top:[0])(cn=testLDAPGroup))  (note the [0] here).


The code that does that is :

    private long getConjunctionScan( PartitionTxn partitionTxn, BranchNode node ) throws LdapException
    {
        long count = Long.MAX_VALUE;
        List<ExprNode> children = node.getChildren();

        for ( ExprNode child : children )
        {
            if ( ( count == 1 ) && ( child instanceof ScopeNode ) )
            {
                // We can stop here
                break;
            }

            annotate( partitionTxn, child );
            count = Math.min( ( ( Long ) child.get( COUNT_ANNOTATION ) ), count );

            if ( count == 0 )
            {
                // No need to continue   <----- Obviously a bad idea in this very case...
                break;
            }
        }

In your case,  there is a workaround : changing your filter to be "(&(objectClass=*)(cn=testLDAPGroup))"


I'll open a JIRA.


Thanks for the report and the test case !


On 17/03/2020 15:02, Francesco Chicchiriccò wrote:
On 2020/03/15 14:46:27, Francesco Chicchiricc�� <ilgro...@apache.org> wrote:
On 2020/03/15 14:14:56, Emmanuel Lécharny <elecha...@gmail.com> wrote:
Hi Francesco,

On 15/03/2020 14:49, Francesco Chicchiriccò wrote:
Hi there,
I am upgrading Apache DS from 2.0.0.AM25 to 2.0.0 and experiencing some 
troubles.
Hmmm, there is no such 2.0.0.
Ah, sorry, I was meaning 2.0.0.AM26 of course.

For example, this used to work fine (e.g.  to find the group with the given cn) 
previously:

ldapsearch -h localhost -p 1389 -D "uid=admin,ou=system" -x -W -b "ou=groups,o=isp" 
'(&(&(objectClass=top)(objectClass=groupOfUniqueNames))(cn=lastGroup3ae5600a))' cn

Now this does not return any result; when I change the filter to

'(&(objectClass=groupOfUniqueNames)(cn=lastGroup3ae5600a))'

it works again.

Also

'(&(objectClass=top)(cn=lastGroup3ae5600a))'

is working fine; so it seems that top is somehow disturbing.

Any ideas? Thanks!
Do you have an env I can use to test that ?
Hi Emmanuel,
sorry it took so long to get something simpler to reproduce the problem.

I have assembled at

https://github.com/ilgrosso/apacheds

Just clone and run

mvn clean verify

The tests executed are

https://github.com/ilgrosso/apacheds/blob/master/src/test/java/net/tirasa/sample/apacheds/ApacheDSApplicationTests.java#L42

which runs with filter

(&(objectClass=groupOfUniqueNames)(cn=testLDAPGroup))

and finds the group, and

https://github.com/ilgrosso/apacheds/blob/master/src/test/java/net/tirasa/sample/apacheds/ApacheDSApplicationTests.java#L59

which runs with filter

(&(objectClass=top)(cn=testLDAPGroup))

and does not find the group.

The ApacheDS init is in

https://github.com/ilgrosso/apacheds/blob/master/src/main/java/net/tirasa/sample/apacheds/ApacheDSStart.java#L193

Thanks for your support.
Regards.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@directory.apache.org
For additional commands, e-mail: users-h...@directory.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@directory.apache.org
For additional commands, e-mail: users-h...@directory.apache.org

Reply via email to