]> git.sur5r.net Git - openldap/commitdiff
Deprecate filter_print in favor of filter2bv.
authorKurt Zeilenga <kurt@openldap.org>
Sun, 10 Mar 2002 17:41:14 +0000 (17:41 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Sun, 10 Mar 2002 17:41:14 +0000 (17:41 +0000)
servers/slapd/aclparse.c
servers/slapd/filter.c
servers/slapd/proto-slap.h

index a58e13eff67ae9980497a47483bc5f42d9f6e6de..c920d7b696d744259a1e11a171dff4c17e6ca0dc 100644 (file)
@@ -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 ) {
index 11ce1afdef71c08853976f7d047f32b6b592a6cb..701a6140930cb048da929ef6a57adeb1eade1f60 100644 (file)
@@ -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 )
 {
index b890a83164ef2ddc75b98e93744f6ecb8815aa6e..4a846cfa41249854709157a8c972552793fd9bd5 100644 (file)
@@ -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 ));
 
 /*