--- servers/slapd/filter.c 1998/10/20 23:24:28 1.3.10.1 +++ servers/slapd/filter.c 1998/11/11 22:37:39 1.6 @@ -3,17 +3,16 @@ #include "portable.h" #include -#include -#include -#include + +#include +#include + #include "slap.h" static int get_filter_list(); static int get_substring_filter(); extern int get_ava(); -extern char *ch_malloc(); -extern char *ch_realloc(); int get_filter( Connection *conn, BerElement *ber, Filter **filt, char **fstr ) @@ -56,7 +55,7 @@ get_filter( Connection *conn, BerElement err = 0; *fstr = NULL; f->f_choice = ber_peek_tag( ber, &len ); -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 if ( conn->c_version == 30 ) { switch ( f->f_choice ) { case LDAP_FILTER_EQUALITY: @@ -194,7 +193,7 @@ get_filter_list( Connection *conn, BerEl Debug( LDAP_DEBUG_FILTER, "begin get_filter_list\n", 0, 0, 0 ); -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 if ( conn->c_version == 30 ) { (void) ber_skip_tag( ber, &len ); } @@ -235,7 +234,7 @@ get_substring_filter( Debug( LDAP_DEBUG_FILTER, "begin get_substring_filter\n", 0, 0, 0 ); -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 if ( conn->c_version == 30 ) { (void) ber_skip_tag( ber, &len ); } @@ -253,7 +252,7 @@ get_substring_filter( sprintf( *fstr, "(%s=", f->f_sub_type ); for ( tag = ber_first_element( ber, &len, &last ); tag != LBER_DEFAULT; tag = ber_next_element( ber, &len, last ) ) { -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 if ( conn->c_version == 30 ) { rc = ber_scanf( ber, "{a}", &val ); } else @@ -271,7 +270,7 @@ get_substring_filter( value_normalize( val, syntax ); switch ( tag ) { -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 case LDAP_SUBSTRING_INITIAL_30: #endif case LDAP_SUBSTRING_INITIAL: @@ -285,7 +284,7 @@ get_substring_filter( strcat( *fstr, val ); break; -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 case LDAP_SUBSTRING_ANY_30: #endif case LDAP_SUBSTRING_ANY: @@ -297,7 +296,7 @@ get_substring_filter( strcat( *fstr, val ); break; -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 case LDAP_SUBSTRING_FINAL_30: #endif case LDAP_SUBSTRING_FINAL: @@ -390,63 +389,63 @@ filter_print( Filter *f ) Filter *p; if ( f == NULL ) { - printf( "NULL" ); + fprintf( stderr, "NULL" ); } switch ( f->f_choice ) { case LDAP_FILTER_EQUALITY: - printf( "(%s=%s)", f->f_ava.ava_type, + fprintf( stderr, "(%s=%s)", f->f_ava.ava_type, f->f_ava.ava_value.bv_val ); break; case LDAP_FILTER_GE: - printf( "(%s>=%s)", f->f_ava.ava_type, + fprintf( stderr, "(%s>=%s)", f->f_ava.ava_type, f->f_ava.ava_value.bv_val ); break; case LDAP_FILTER_LE: - printf( "(%s<=%s)", f->f_ava.ava_type, + fprintf( stderr, "(%s<=%s)", f->f_ava.ava_type, f->f_ava.ava_value.bv_val ); break; case LDAP_FILTER_APPROX: - printf( "(%s~=%s)", f->f_ava.ava_type, + fprintf( stderr, "(%s~=%s)", f->f_ava.ava_type, f->f_ava.ava_value.bv_val ); break; case LDAP_FILTER_SUBSTRINGS: - printf( "(%s=", f->f_sub_type ); + fprintf( stderr, "(%s=", f->f_sub_type ); if ( f->f_sub_initial != NULL ) { - printf( "%s", f->f_sub_initial ); + fprintf( stderr, "%s", f->f_sub_initial ); } if ( f->f_sub_any != NULL ) { for ( i = 0; f->f_sub_any[i] != NULL; i++ ) { - printf( "*%s", f->f_sub_any[i] ); + fprintf( stderr, "*%s", f->f_sub_any[i] ); } } charray_free( f->f_sub_any ); if ( f->f_sub_final != NULL ) { - printf( "*%s", f->f_sub_final ); + fprintf( stderr, "*%s", f->f_sub_final ); } break; case LDAP_FILTER_PRESENT: - printf( "%s=*", f->f_type ); + fprintf( stderr, "%s=*", f->f_type ); break; case LDAP_FILTER_AND: case LDAP_FILTER_OR: case LDAP_FILTER_NOT: - printf( "(%c", f->f_choice == LDAP_FILTER_AND ? '&' : + fprintf( stderr, "(%c", f->f_choice == LDAP_FILTER_AND ? '&' : f->f_choice == LDAP_FILTER_OR ? '|' : '!' ); for ( p = f->f_list; p != NULL; p = p->f_next ) { filter_print( p ); } - printf( ")" ); + fprintf( stderr, ")" ); break; default: - printf( "unknown type %d", f->f_choice ); + fprintf( stderr, "unknown type %d", f->f_choice ); break; } }