mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-04-12 15:10:31 +08:00
ITS#10233 - fix idl intersection
The `mdb_idl_intersection()` and `wt_idl_intersection()` functions derived from back-bdb return wrong results. expect: [1, 3] ∩ [2] = [] actual: [1, 3] ∩ [2] = [2] also - Add scope checking for back-wt - fix compiler warning
This commit is contained in:
parent
836cb913ef
commit
efa9f173d2
@ -727,7 +727,9 @@ mdb_idl_intersection(
|
||||
if ( idmin > idmax ) {
|
||||
a[0] = 0;
|
||||
return 0;
|
||||
} else if ( idmin == idmax ) {
|
||||
} else if ( idmin == idmax &&
|
||||
(( MDB_IDL_FIRST(a) == MDB_IDL_LAST(b)) ||
|
||||
( MDB_IDL_FIRST(b) == MDB_IDL_LAST(a)))) {
|
||||
a[0] = 1;
|
||||
a[1] = idmin;
|
||||
return 0;
|
||||
|
@ -232,7 +232,7 @@ int wt_entry_return(
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Our entries are allocated in two blocks; the data comes from
|
||||
/* Our entries are allocated in two blocks; the data comes from
|
||||
* the db itself and the Entry structure and associated pointers
|
||||
* are allocated in entry_decode. The db data pointer is saved
|
||||
* in e_bv.
|
||||
@ -256,6 +256,7 @@ int wt_entry_return(
|
||||
}
|
||||
|
||||
entry_free( e );
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wt_entry_release(
|
||||
|
@ -53,13 +53,10 @@ void wt_idl_dump( ID *ids )
|
||||
|
||||
} else {
|
||||
ID i;
|
||||
Debug( LDAP_DEBUG_ANY, "IDL: size %ld", (long) ids[0] );
|
||||
Debug( LDAP_DEBUG_ANY, "IDL: size %ld\n", (long) ids[0] );
|
||||
|
||||
for( i=1; i<=ids[0]; i++ ) {
|
||||
if( i % 16 == 1 ) {
|
||||
Debug( LDAP_DEBUG_ANY, "\n" );
|
||||
}
|
||||
Debug( LDAP_DEBUG_ANY, " %02lx", (long) ids[i] );
|
||||
Debug( LDAP_DEBUG_ANY, " %ld\n", (long) ids[i] );
|
||||
}
|
||||
|
||||
Debug( LDAP_DEBUG_ANY, "\n" );
|
||||
@ -282,7 +279,9 @@ wt_idl_intersection(
|
||||
if ( idmin > idmax ) {
|
||||
a[0] = 0;
|
||||
return 0;
|
||||
} else if ( idmin == idmax ) {
|
||||
} else if ( idmin == idmax &&
|
||||
(( WT_IDL_FIRST(a) == WT_IDL_LAST(b)) ||
|
||||
( WT_IDL_FIRST(b) == WT_IDL_LAST(a)))) {
|
||||
a[0] = 1;
|
||||
a[1] = idmin;
|
||||
return 0;
|
||||
|
@ -606,7 +606,7 @@ loop_begin:
|
||||
if ( id == base->e_id ) scopeok = 1;
|
||||
break;
|
||||
case LDAP_SCOPE_ONELEVEL:
|
||||
scopeok = 1;
|
||||
scopeok = dnIsSuffixScope(&e->e_nname, &base->e_nname, LDAP_SCOPE_ONELEVEL);
|
||||
break;
|
||||
case LDAP_SCOPE_CHILDREN:
|
||||
if ( id == base->e_id ) break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user