Details
Description
In some rare circumstances, object class top is is missing from the search result, although the object classes are requested.
Here is an example.
Import an entry like this:
dn: cn=Heather Nova,dc=example,dc=com
objectclass: top
objectclass: person
cn: Heather Nova
sn: Nova
description: a singer-songwriter and poet based in Bermuda
i.e.
$ ldapmodify -h localhost -p 389 -D "uid=admin,ou=system" -w ***** -a -f heather.ldif
adding new entry cn=Heather Nova,dc=example,dc=com
$
Then perform a search request with the following parameters
$ ldapsearch -h localhost -p 389 -D "uid=admin,ou=system" -w ***** -b "cn=Heather Nova,dc=example,dc=com" -s base "(objectclass=*)" objectclass
version: 1
dn: cn=Heather Nova,dc=example,dc=com
objectclass: person
$
Object class "top" is missing from the search result! This is not the case, if abjectClass is not requested by parameter:
$ ldapsearch -h localhost -p 389 -D "uid=admin,ou=system" -w ***** -b "cn=Heather Nova,dc=example,dc=com" -s base "(objectclass=*)"
version: 1
dn: cn=Heather Nova,dc=example,dc=com
description: a singer-songwriter and poet based in Bermuda
objectclass: person
objectclass: top
sn: Nova
cn: Heather Nova
$
Note: Afterwards (after the last search call), the object class "top" is returned with the first request, as well (cache?):
$ ldapsearch -h localhost -p 389 -D "uid=admin,ou=system" -w ***** -b "cn=Heather Nova,dc=example,dc=com" -s base "(objectclass=*)" objectclass
version: 1
dn: cn=Heather Nova,dc=example,dc=com
objectclass: person
objectclass: top
$
I have created a JUnit test with JNDI, which demonstrates the defect. I'll attach it to this issue soon.