From c9c3a684966c933f3d283cd4feb7f764c4e22fa1 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Sun, 10 Mar 2002 17:41:14 +0000 Subject: [PATCH] Deprecate filter_print in favor of filter2bv. --- servers/slapd/aclparse.c | 7 +-- servers/slapd/filter.c | 105 +------------------------------------ servers/slapd/proto-slap.h | 1 - 3 files changed, 5 insertions(+), 108 deletions(-) diff --git a/servers/slapd/aclparse.c b/servers/slapd/aclparse.c index a58e13eff6..c920d7b696 100644 --- a/servers/slapd/aclparse.c +++ b/servers/slapd/aclparse.c @@ -1485,10 +1485,11 @@ print_acl( Backend *be, AccessControl *a ) } if ( a->acl_filter != NULL ) { + struct berval bv = { 0, NULL }; to++; - fprintf( stderr, " filter=" ); - filter_print( a->acl_filter ); - fprintf( stderr, "\n" ); + filter2bv( a->acl_filter, &bv ); + fprintf( stderr, " filter=%s\n", bv.bv_val ); + ch_free( bv.bv_val ); } if ( a->acl_attrs != NULL ) { diff --git a/servers/slapd/filter.c b/servers/slapd/filter.c index 11ce1afdef..701a614093 100644 --- a/servers/slapd/filter.c +++ b/servers/slapd/filter.c @@ -240,7 +240,6 @@ get_filter( } assert( f->f_mra != NULL ); - break; default: @@ -269,6 +268,7 @@ get_filter( } else { free(f); } + } else { *filt = f; } @@ -577,109 +577,6 @@ filter_free( Filter *f ) free( f ); } -#ifdef LDAP_DEBUG -void -filter_print( Filter *f ) -{ - int i; - Filter *p; - struct berval escaped; - - if ( f == NULL ) { - fprintf( stderr, "No filter!" ); - } - - switch ( f->f_choice ) { - case LDAP_FILTER_EQUALITY: - filter_escape_value( &f->f_av_value, &escaped ); - fprintf( stderr, "(%s=%s)", - f->f_av_desc->ad_cname.bv_val, - escaped.bv_val ); - ber_memfree( escaped.bv_val ); - break; - - case LDAP_FILTER_GE: - filter_escape_value( &f->f_av_value, &escaped ); - fprintf( stderr, "(%s>=%s)", - f->f_av_desc->ad_cname.bv_val, - escaped.bv_val ); - ber_memfree( escaped.bv_val ); - break; - - case LDAP_FILTER_LE: - filter_escape_value( &f->f_av_value, &escaped ); - fprintf( stderr, "(%s<=%s)", - f->f_ava->aa_desc->ad_cname.bv_val, - escaped.bv_val ); - ber_memfree( escaped.bv_val ); - break; - - case LDAP_FILTER_APPROX: - filter_escape_value( &f->f_av_value, &escaped ); - fprintf( stderr, "(%s~=%s)", - f->f_ava->aa_desc->ad_cname.bv_val, - escaped.bv_val ); - ber_memfree( escaped.bv_val ); - break; - - case LDAP_FILTER_SUBSTRINGS: - fprintf( stderr, "(%s=" /*)*/, - f->f_sub_desc->ad_cname.bv_val ); - if ( f->f_sub_initial.bv_val != NULL ) { - filter_escape_value( &f->f_sub_initial, &escaped ); - fprintf( stderr, "%s", - escaped.bv_val ); - ber_memfree( escaped.bv_val ); - } - if ( f->f_sub_any != NULL ) { - for ( i = 0; f->f_sub_any[i].bv_val != NULL; i++ ) { - filter_escape_value( &f->f_sub_any[i], &escaped ); - fprintf( stderr, "*%s", - escaped.bv_val ); - ber_memfree( escaped.bv_val ); - } - } - if ( f->f_sub_final.bv_val != NULL ) { - filter_escape_value( &f->f_sub_final, &escaped ); - fprintf( stderr, - "*%s", escaped.bv_val ); - ber_memfree( escaped.bv_val ); - } - fprintf( stderr, /*(*/ ")" ); - break; - - case LDAP_FILTER_PRESENT: - fprintf( stderr, "(%s=*)", - f->f_desc->ad_cname.bv_val ); - break; - - case LDAP_FILTER_AND: - case LDAP_FILTER_OR: - case LDAP_FILTER_NOT: - 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 ); - } - fprintf( stderr, /*(*/ ")" ); - break; - - case SLAPD_FILTER_COMPUTED: - fprintf( stderr, "(?=%s)", - f->f_result == LDAP_COMPARE_FALSE ? "false" : - f->f_result == LDAP_COMPARE_TRUE ? "true" : - f->f_result == SLAPD_COMPARE_UNDEFINED ? "undefined" : - "error" ); - break; - - default: - fprintf( stderr, "(unknown-filter=%lu)", f->f_choice ); - break; - } -} -#endif /* ldap_debug */ - void filter2bv( Filter *f, struct berval *fstr ) { diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index b890a83164..4a846cfa41 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -461,7 +461,6 @@ LDAP_SLAPD_F (int) get_filter LDAP_P(( const char **text )); LDAP_SLAPD_F (void) filter_free LDAP_P(( Filter *f )); -LDAP_SLAPD_F (void) filter_print LDAP_P(( Filter *f )); LDAP_SLAPD_F (void) filter2bv LDAP_P(( Filter *f, struct berval *bv )); /* -- 2.39.5