mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
use /-* for all parents; ignore /-0; check syntax; better parsing
This commit is contained in:
parent
4137870344
commit
a4b1ba0b5f
@ -650,27 +650,33 @@ slap_set_filter( SLAP_SET_GATHER gatherer,
|
|||||||
|
|
||||||
case '-':
|
case '-':
|
||||||
if ( ( SF_TOP() == (void *)'/' )
|
if ( ( SF_TOP() == (void *)'/' )
|
||||||
&& ( *filter >= '0' || *filter <= '9' ) )
|
&& ( *filter == '*' || ASCII_DIGIT( *filter ) ) )
|
||||||
{
|
{
|
||||||
int parent = 0;
|
|
||||||
int count = 1;
|
|
||||||
int i;
|
|
||||||
for ( len = 1;
|
|
||||||
( c = filter[ len ] )
|
|
||||||
&& ( c >= '0' && c <= '9' );
|
|
||||||
len++ )
|
|
||||||
/* count */ ;
|
|
||||||
for ( i = len ; i > 0 ; i-- ) {
|
|
||||||
parent += (int)( filter[ i - 1 ] - '0' ) * count;
|
|
||||||
count *= 10;
|
|
||||||
}
|
|
||||||
SF_POP();
|
SF_POP();
|
||||||
if ( parent == 0 ) {
|
|
||||||
|
if ( *filter == '*' ) {
|
||||||
set = set_parents( cp, SF_POP() );
|
set = set_parents( cp, SF_POP() );
|
||||||
|
filter++;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
set = set_parent( cp, SF_POP(), parent );
|
char *next = NULL;
|
||||||
|
long parent = strtol( filter, &next, 10 );
|
||||||
|
|
||||||
|
if ( next == filter ) {
|
||||||
|
SF_ERROR( syntax );
|
||||||
}
|
}
|
||||||
filter += len;
|
|
||||||
|
set = SF_POP();
|
||||||
|
if ( parent != 0 ) {
|
||||||
|
set = set_parent( cp, set, parent );
|
||||||
|
}
|
||||||
|
filter = next;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( set == NULL ) {
|
||||||
|
SF_ERROR( memory );
|
||||||
|
}
|
||||||
|
|
||||||
SF_PUSH( set );
|
SF_PUSH( set );
|
||||||
set = NULL;
|
set = NULL;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user