- value = s + 1;
- *s-- = '\0';
- savechar = *s;
-
- f = (Filter *) ch_calloc( 1, sizeof(Filter) );
-
- switch ( *s ) {
- case '<':
- f->f_choice = LDAP_FILTER_LE;
- *s = '\0';
- break;
- case '>':
- f->f_choice = LDAP_FILTER_GE;
- *s = '\0';
- break;
- case '~':
- f->f_choice = LDAP_FILTER_APPROX;
- *s = '\0';
- break;
- default:
- if ( ldap_pvt_find_wildcard( value ) == NULL ) {
- f->f_choice = LDAP_FILTER_EQUALITY;
- } else if ( strcmp( value, "*" ) == 0 ) {
- f->f_choice = LDAP_FILTER_PRESENT;
- } else {
- f->f_choice = LDAP_FILTER_SUBSTRINGS;
- f->f_sub_type = ch_strdup( str );
- if ( str2subvals( value, f ) != 0 ) {
- filter_free( f );
- *(value-1) = '=';
- return( NULL );
- }
- *(value-1) = '=';
- return( f );
- }
- break;
- }
-
- if ( f->f_choice == LDAP_FILTER_PRESENT ) {
- f->f_type = ch_strdup( str );
- } else {
- f->f_avtype = ch_strdup( str );
- f->f_avvalue.bv_val = ch_strdup( value );
- ldap_pvt_filter_value_unescape( f->f_avvalue.bv_val );
- f->f_avvalue.bv_len = strlen( value );
- }
-
- *s = savechar;
- *(value-1) = '=';
- return( f );
-}
-
-static int
-str2subvals( char *val, Filter *f )
-{
- char *nextstar, *freeme;
- int gotstar;
-
- Debug( LDAP_DEBUG_FILTER, "str2subvals \"%s\"\n", val, 0, 0 );