Deprecate filter_print in favor of filter2bv.

This commit is contained in:
Kurt Zeilenga 2002-03-10 17:41:14 +00:00
parent 902350f991
commit c9c3a68496
3 changed files with 5 additions and 108 deletions

View File

@ -1485,10 +1485,11 @@ print_acl( Backend *be, AccessControl *a )
} }
if ( a->acl_filter != NULL ) { if ( a->acl_filter != NULL ) {
struct berval bv = { 0, NULL };
to++; to++;
fprintf( stderr, " filter=" ); filter2bv( a->acl_filter, &bv );
filter_print( a->acl_filter ); fprintf( stderr, " filter=%s\n", bv.bv_val );
fprintf( stderr, "\n" ); ch_free( bv.bv_val );
} }
if ( a->acl_attrs != NULL ) { if ( a->acl_attrs != NULL ) {

View File

@ -240,7 +240,6 @@ get_filter(
} }
assert( f->f_mra != NULL ); assert( f->f_mra != NULL );
break; break;
default: default:
@ -269,6 +268,7 @@ get_filter(
} else { } else {
free(f); free(f);
} }
} else { } else {
*filt = f; *filt = f;
} }
@ -577,109 +577,6 @@ filter_free( Filter *f )
free( 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 void
filter2bv( Filter *f, struct berval *fstr ) filter2bv( Filter *f, struct berval *fstr )
{ {

View File

@ -461,7 +461,6 @@ LDAP_SLAPD_F (int) get_filter LDAP_P((
const char **text )); const char **text ));
LDAP_SLAPD_F (void) filter_free LDAP_P(( Filter *f )); 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 )); LDAP_SLAPD_F (void) filter2bv LDAP_P(( Filter *f, struct berval *bv ));
/* /*