Fix ITS#2023,2027 ACL filters with substrings.

This commit is contained in:
Howard Chu 2002-08-26 12:36:59 +00:00
parent 1620b1da34
commit 68fd171c11
2 changed files with 31 additions and 15 deletions

View File

@ -654,6 +654,7 @@ filter_print( Filter *f )
fprintf( stderr, "%s",
escaped.bv_val );
ber_memfree( escaped.bv_val );
i = 1;
}
if ( f->f_sub_any != NULL ) {
for ( i = 0; f->f_sub_any[i] != NULL; i++ ) {
@ -668,7 +669,9 @@ filter_print( Filter *f )
fprintf( stderr,
"*%s", escaped.bv_val );
ber_memfree( escaped.bv_val );
i = 0;
}
if ( i ) fprintf( stderr, "*" );
fprintf( stderr, /*(*/ ")" );
break;

View File

@ -238,7 +238,7 @@ static int
str2subvals( const char *in, Filter *f )
{
char *nextstar, *val, *freeme;
int gotstar;
int gotstar, rc = 0;
Debug( LDAP_DEBUG_FILTER, "str2subvals \"%s\"\n", in, 0, 0 );
@ -248,27 +248,40 @@ str2subvals( const char *in, Filter *f )
gotstar = 0;
while ( val && *val ) {
if ( (nextstar = ldap_pvt_find_wildcard( val )) != NULL )
if ( (nextstar = ldap_pvt_find_wildcard( val )) != NULL ) {
gotstar++;
if ( nextstar == val ) {
/* we got two stars in a row with no val! */
if ( gotstar > 1 ) {
rc = -1;
break;
}
val++;
continue;
}
*nextstar++ = '\0';
ldap_pvt_filter_value_unescape( val );
if ( gotstar == 0 ) {
f->f_sub_initial = ber_bvstrdup( val );
} else if ( nextstar == NULL ) {
f->f_sub_final = ber_bvstrdup( val );
} else {
charray_add( (char ***) &f->f_sub_any, (char *) ber_bvstrdup( val ) );
}
gotstar = 1;
if ( ldap_pvt_filter_value_unescape( val ) < 1 ) {
rc = -1;
break;
}
if ( nextstar == NULL ) {
f->f_sub_final = ber_bvstrdup( val );
} else if ( gotstar == 1 ) {
f->f_sub_initial = ber_bvstrdup( val );
} else {
ber_bvecadd( &f->f_sub_any, ber_bvstrdup( val ) );
}
val = nextstar;
}
free( freeme );
return( 0 );
return( rc );
}
/*