[Date Prev][Date Next] [Chronological] [Thread] [Top]

Bug in servers/slapd/filterentry.c



The test_ava_filter() routine in servers/slapd/filterentry.c contains a bug
which results in invalid results being returned when using the ">=" and "<="
search filter operators. In both cases, the code ignores entries which
compare equal to the filter object. 

The obvious solution to this problem is adding the equality operator to the
test of the return value of the value_cmp() call. The following patch
(against openldap-devel) implements this logic: 

*** ldap/servers/slapd/filterentry.c    Thu Aug 20 23:33:42 1998
--- dev/oldap/servers/slapd/filterentry.c       Fri Sep 25 14:43:25 1998
***************
*** 136,148 ****
                        break;

                case LDAP_FILTER_GE:
!                       if ( rc > 0 ) {
                                return( 0 );
                        }
                        break;

                case LDAP_FILTER_LE:
!                       if ( rc < 0 ) {
                                return( 0 );
                        }
                        break;
--- 136,148 ----
                        break;

                case LDAP_FILTER_GE:
!                       if ( rc >= 0 ) {
                                return( 0 );
                        }
                        break;

                case LDAP_FILTER_LE:
!                       if ( rc <= 0 ) {
                                return( 0 );
                        }
                        break;

Comments? Suggestions? Alternative solutions?

Ken McGarrahan
Southwestern Bell Telephone
*	Phone: (314) 235-3160
*	E-Mail: km4155@sbc.com