From: Howard Chu Date: Tue, 12 Nov 2013 05:01:33 +0000 (-0800) Subject: ITS#7743 Fix indexed AND filter X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=66bb780b16272edc8b210c8fb2aff63027012c62;p=openldap ITS#7743 Fix indexed AND filter Partially revert 47f6aec61e65afd66bea096887f1cd550b55946e Was using RANGE_FIRST/RANGE_LAST on an IDL known to *not* be a range. --- diff --git a/servers/slapd/back-bdb/idl.c b/servers/slapd/back-bdb/idl.c index 9594a362d1..4ca2eac222 100644 --- a/servers/slapd/back-bdb/idl.c +++ b/servers/slapd/back-bdb/idl.c @@ -1089,8 +1089,8 @@ bdb_idl_intersection( * turn it into a range. */ if ( BDB_IDL_IS_RANGE( b ) - && BDB_IDL_RANGE_FIRST( b ) <= BDB_IDL_RANGE_FIRST( a ) - && BDB_IDL_RANGE_LAST( b ) >= BDB_IDL_RANGE_LAST( a ) ) { + && BDB_IDL_RANGE_FIRST( b ) <= BDB_IDL_FIRST( a ) + && BDB_IDL_RANGE_LAST( b ) >= BDB_IDL_LLAST( a ) ) { if (idmax - idmin + 1 == a[0]) { a[0] = NOID; diff --git a/servers/slapd/back-bdb/idl.h b/servers/slapd/back-bdb/idl.h index a606488337..b3affa2afb 100644 --- a/servers/slapd/back-bdb/idl.h +++ b/servers/slapd/back-bdb/idl.h @@ -62,6 +62,7 @@ #define BDB_IDL_ALL( bdb, ids ) BDB_IDL_RANGE( ids, 1, ((bdb)->bi_lastid) ) #define BDB_IDL_FIRST( ids ) ( (ids)[1] ) +#define BDB_IDL_LLAST( ids ) ( (ids)[(ids)[0]] ) #define BDB_IDL_LAST( ids ) ( BDB_IDL_IS_RANGE(ids) \ ? (ids)[2] : (ids)[(ids)[0]] ) diff --git a/servers/slapd/back-mdb/idl.c b/servers/slapd/back-mdb/idl.c index 9260d2be9a..e435491e45 100644 --- a/servers/slapd/back-mdb/idl.c +++ b/servers/slapd/back-mdb/idl.c @@ -715,8 +715,8 @@ mdb_idl_intersection( * turn it into a range. */ if ( MDB_IDL_IS_RANGE( b ) - && MDB_IDL_RANGE_FIRST( b ) <= MDB_IDL_RANGE_FIRST( a ) - && MDB_IDL_RANGE_LAST( b ) >= MDB_IDL_RANGE_LAST( a ) ) { + && MDB_IDL_RANGE_FIRST( b ) <= MDB_IDL_FIRST( a ) + && MDB_IDL_RANGE_LAST( b ) >= MDB_IDL_LLAST( a ) ) { if (idmax - idmin + 1 == a[0]) { a[0] = NOID; diff --git a/servers/slapd/back-mdb/idl.h b/servers/slapd/back-mdb/idl.h index 8ce742a8c1..bc0dd41d76 100644 --- a/servers/slapd/back-mdb/idl.h +++ b/servers/slapd/back-mdb/idl.h @@ -62,6 +62,7 @@ #define MDB_IDL_ALL( ids ) MDB_IDL_RANGE( ids, 1, NOID ) #define MDB_IDL_FIRST( ids ) ( (ids)[1] ) +#define MDB_IDL_LLAST( ids ) ( (ids)[(ids)[0]] ) #define MDB_IDL_LAST( ids ) ( MDB_IDL_IS_RANGE(ids) \ ? (ids)[2] : (ids)[(ids)[0]] )