Debug( LDAP_DEBUG_FILTER, "str2filter \"%s\"\n", str, 0, 0 );
#endif
-
if ( str == NULL || *str == '\0' ) {
return( NULL );
}
0, 0, 0 );
#endif
-
str++;
f = str2list( str, LDAP_FILTER_AND );
break;
0, 0, 0 );
#endif
-
str++;
f = str2list( str, LDAP_FILTER_OR );
break;
0, 0, 0 );
#endif
-
str++;
f = str2list( str, LDAP_FILTER_NOT );
break;
0, 0, 0 );
#endif
-
f = str2simple( str );
break;
}
0 );
#endif
-
f = str2simple( str );
break;
}
Debug( LDAP_DEBUG_FILTER, "str2list \"%s\"\n", str, 0, 0 );
#endif
-
f = (Filter *) ch_calloc( 1, sizeof(Filter) );
f->f_choice = ftype;
fp = &f->f_list;
Debug( LDAP_DEBUG_FILTER, "str2simple \"%s\"\n", str, 0, 0 );
#endif
-
if ( (s = strchr( str, '=' )) == NULL ) {
- return( NULL );
+ return NULL;
}
value = &s[1];
if ( str2subvals( value, f ) != 0 ) {
filter_free( f );
*(value-1) = '=';
- return( NULL );
+ return NULL;
}
*(value-1) = '=';
- return( f );
+ return f;
}
} break;
}
return NULL;
}
} else {
+ ber_slen_t len;
char *tmp;
f->f_ava = ch_calloc( 1, sizeof( AttributeAssertion ) );
}
tmp = ch_strdup( value );
- ldap_pvt_filter_value_unescape( tmp );
+ len = ldap_pvt_filter_value_unescape( tmp );
+ if( len < 0 ) {
+ filter_free( f );
+ *(value-1) = '=';
+ free( tmp );
+ return -1;
+ }
ber_str2bv( tmp, 0, 0, &f->f_av_value );
}
*s = savechar;
*(value-1) = '=';
- return( f );
+ return f;
}
static int
str2subvals( const char *in, Filter *f )
{
+ ber_slen_t len;
char *nextstar, *val, *freeme;
int gotstar;
int final;
*nextstar = '\0';
}
- ldap_pvt_filter_value_unescape( val );
+ len = ldap_pvt_filter_value_unescape( val );
+ if( len < 0 ) {
+ free( freeme );
+ return -1;
+ }
if ( final ) {
ber_str2bv( val, 0, 1, &f->f_sub_final );
ber_str2bv( val, 0, 1, &f->f_sub_initial );
} else {
- charray_add( (char ***) &f->f_sub_any, (char *) ber_bvstrdup( val ) );
+ charray_add( (char ***) &f->f_sub_any,
+ (char *) ber_bvstrdup( val ) );
}
val = nextstar+1;
}
free( freeme );
- return( 0 );
+ return 0;
}
/*