[Fedora-directory-devel] Please review: [Bug 464854] ldapsearch with size limit (-z) doesn't work with OR filter and range search

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[Bug 464854] ldapsearch with size limit (-z) doesn't work with OR filter and range search

https://bugzilla.redhat.com/show_bug.cgi?id=464854


[Description of Problem]
If sizelimit is specified (e.g., -z 5) in ldapsearch, the filter including a range search does not return expected entries even if entries matches the filter.

How to reproduce the problem:
Create a test ldif file with dbgen.pl
$ dbgen.pl -o /path/to/example10k.ldif -n 10000
Import it
$ ldif2db -n userRoot -i /path/to/example10k.ldif
Start the server
$ start-slapd

Run the following command
$ ldapsearch -D 'cn=Directory Manager' -w <pw> -b "dc=example,dc=com"
"(&(l=Boston)(|(ou=Payroll)(ou=Accounting))(roomNumber>=9700))" dn roomNumber l ou
It returns 7 entries.

$ ldapsearch -D 'cn=Directory Manager' -w <pw> -b "dc=example,dc=com" -z 5
"(&(l=Boston)(|(ou=Payroll)(ou=Accounting))(roomNumber>=9700))" dn roomNumber l ou
It returns no entries.  This entry count could be random from 0 to 5.
Expected result: returns 5 entries

Problem description:
SIZELIMIT is checked in index_range_read to eliminate the unnecessary data
retrieval.  But when the filter contains a range search which is connected by
AND, then we should not do sizelimit.  There was a bug in the function which
sets is_and.  The flag should have been cleared only when the function set it
to 1.  Instead, it was cleared each time the function is called.  It let
index_range_read stop reading when it reaches sizelimit even though it should
not have.

[Proposed Fix]
Created an attachment (id=328581)
--> (https://bugzilla.redhat.com/attachment.cgi?id=328581)
cvs diff ldapserver/ldap/servers/slapd/back-ldbm/filterindex.c

Fix Description: list_candidates sets SLAPI_SEARCH_IS_AND to 1 in pblock when
the filter starts with AND.  This function is recursively called and the IS_AND
info should be passed to the descendent candidates functions.  The IS_AND flag
is cleared only by the function which sets it to 1.

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

--
Fedora-directory-devel mailing list
Fedora-directory-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-directory-devel

[Index of Archives]     [Fedora Directory Announce]     [Fedora Users]     [Older Fedora Users Mail]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Review]     [Fedora Art]     [Fedora Music]     [Fedora Packaging]     [CentOS]     [Fedora SELinux]     [Big List of Linux Books]     [KDE Users]     [Fedora Art]     [Fedora Docs]

  Powered by Linux