]> git.sur5r.net Git - openldap/commitdiff
remove dnPretty
authorKurt Zeilenga <kurt@openldap.org>
Tue, 29 Apr 2003 18:13:10 +0000 (18:13 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Tue, 29 Apr 2003 18:13:10 +0000 (18:13 +0000)
rename dnPretty2 to dnPretty

servers/slapd/back-ldap/suffixmassage.c
servers/slapd/back-meta/cache-remove.c
servers/slapd/back-monitor/init.c
servers/slapd/dn.c
servers/slapd/filter.c
servers/slapd/proto-slap.h
servers/slapd/referral.c
servers/slapd/schema_init.c
servers/slapd/slapi/slapi_utils.c

index be739828e84815d0d738fba170f7617e2eb5c394..b6a02e6777be5cc9a70ae4b12f962578cf4899e9 100644 (file)
@@ -122,7 +122,7 @@ ldap_back_dn_massage(
                /* DN from remote server may be in arbitrary form.
                 * Pretty it so we can parse reliably.
                 */
-               dnPretty2( NULL, dn, &pretty, NULL );
+               dnPretty( NULL, dn, &pretty, NULL );
                if (pretty.bv_val) dn = &pretty;
        }
 
index 25c97dc563c0c4aed39f0d9173ea5f6aa8bc16ce..06d448166a4534ad7f9adcf9a5ac20782ececf99 100644 (file)
@@ -134,7 +134,7 @@ remove_func (
        }
        if (count == 1) {
 #if 0  /* ??? pdn is not used anywhere */
-               dnPretty2(NULL, &entry->e_nname, &pdn);         
+               dnPretty(NULL, &entry->e_nname, &pdn);  
 #endif
                info->freed += size; 
 #ifdef NEW_LOGGING
index 8e9b3933e3f70a67e7d23b64a943614b9b990fe8..cd4d7811fe2f5f6ce872b69fbc408f40fcabe5b8 100644 (file)
@@ -603,7 +603,7 @@ monitor_back_db_open(
                dn.bv_val = ch_calloc( sizeof( char ), dn.bv_len + 1 );
                strcpy( dn.bv_val, "cn=" );
                strcat( dn.bv_val, monitor_subsys[ i ].mss_name );
-               rc = dnPretty2( NULL, &dn, &monitor_subsys[ i ].mss_rdn, NULL );
+               rc = dnPretty( NULL, &dn, &monitor_subsys[ i ].mss_rdn, NULL );
                free( dn.bv_val );
                if ( rc != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
index b02680096c0d29389241160486b15be2ea8daff3..3930ea666b18abed239692fbf81ea66b8e231a22 100644 (file)
@@ -398,33 +398,8 @@ dnNormalize(
        return LDAP_SUCCESS;
 }
 
-#if 0
-/*
- * dn "pretty"ing routine
- */
 int
 dnPretty(
-       Syntax *syntax,
-       struct berval *val,
-       struct berval **pretty)
-{
-       struct berval *out;
-       int rc;
-
-       assert( pretty && *pretty == NULL );
-
-       out = ch_malloc( sizeof( struct berval ) );
-       rc = dnPretty2( syntax, val, out );
-       if ( rc != LDAP_SUCCESS )
-               free( out );
-       else
-               *pretty = out;
-       return rc;
-}
-#endif
-
-int
-dnPretty2(
        Syntax *syntax,
        struct berval *val,
        struct berval *out,
index 38f99a7f610931d401b6663eae6f126e62ee2b51..af5051c28335a6f261cc5a374918cb78dba8db8a 100644 (file)
@@ -252,20 +252,22 @@ get_filter(
 
                assert( f.f_not != NULL );
                if ( f.f_not->f_choice == SLAPD_FILTER_COMPUTED ) {
-                       if ( f.f_not->f_result == LDAP_COMPARE_TRUE ) {
-                               op->o_tmpfree( f.f_not, op->o_tmpmemctx );
-                               f.f_not = NULL;
-                               f.f_choice = SLAPD_FILTER_COMPUTED;
+                       f.f_choice = SLAPD_FILTER_COMPUTED;
+                       f.f_result = f.f_not->f_result;
+                       op->o_tmpfree( f.f_not, op->o_tmpmemctx );
+                       f.f_not = NULL;
+
+                       switch( f.f_result ) {
+                       case LDAP_COMPARE_TRUE:
                                f.f_result = LDAP_COMPARE_FALSE;
-                       } else if ( f.f_not->f_result == LDAP_COMPARE_FALSE ) {
-                               op->o_tmpfree( f.f_not, op->o_tmpmemctx );
-                               f.f_not = NULL;
-                               f.f_choice = SLAPD_FILTER_COMPUTED;
+                               break;
+                       case LDAP_COMPARE_FALSE:
                                f.f_result = LDAP_COMPARE_TRUE;
+                               break;
+                       default:
+                               /* (!Undefined) is Undefined */
                        }
-                       /* Leave UNDEFINED alone */
                }
-                               
                break;
 
        case LDAP_FILTER_EXT:
@@ -836,7 +838,8 @@ filter2bv_x( Operation *op, Filter *f, struct berval *fstr )
                break;
 
        default:
-               ber_str2bv_x( "(?=unknown)", sizeof("(?=unknown)")-1, 1, fstr, op->o_tmpmemctx );
+               ber_str2bv_x( "(?=unknown)", sizeof("(?=unknown)")-1,
+                       1, fstr, op->o_tmpmemctx );
                break;
        }
 }
@@ -1207,7 +1210,8 @@ vrFilter2bv( Operation *op, ValuesReturnFilter *vrf, struct berval *fstr )
        ber_len_t len;
 
        if ( vrf == NULL ) {
-               ber_str2bv_x( "No filter!", sizeof("No filter!")-1, 1, fstr, op->o_tmpmemctx );
+               ber_str2bv_x( "No filter!", sizeof("No filter!")-1,
+                       1, fstr, op->o_tmpmemctx );
                return;
        }
 
@@ -1404,198 +1408,8 @@ simple_vrFilter2bv( Operation *op, ValuesReturnFilter *vrf, struct berval *fstr
                break;
 
        default:
-               ber_str2bv_x( "(?=unknown)", sizeof("(?=unknown)")-1, 1, fstr, op->o_tmpmemctx );
+               ber_str2bv_x( "(?=unknown)", sizeof("(?=unknown)")-1,
+                       1, fstr, op->o_tmpmemctx );
                break;
        }
 }
-
-#if 0 /* unused */
-static int
-get_substring_vrFilter(
-       Operation *op,
-       BerElement      *ber,
-       ValuesReturnFilter      *vrf,
-       const char      **text )
-{
-       ber_tag_t       tag;
-       ber_len_t       len;
-       ber_tag_t       rc;
-       struct berval value;
-       char            *last;
-       struct berval bv;
-       *text = "error decoding filter";
-
-#ifdef NEW_LOGGING
-       LDAP_LOG( FILTER, ENTRY, 
-               "get_substring_filter: conn %d  begin\n", op->o_connid, 0, 0 );
-#else
-       Debug( LDAP_DEBUG_FILTER, "begin get_substring_filter\n", 0, 0, 0 );
-#endif
-       if ( ber_scanf( ber, "{m" /*}*/, &bv ) == LBER_ERROR ) {
-               return SLAPD_DISCONNECT;
-       }
-
-       vrf->vrf_sub = ch_calloc( 1, sizeof(SubstringsAssertion) );
-       vrf->vrf_sub_desc = NULL;
-       rc = slap_bv2ad( &bv, &vrf->vrf_sub_desc, text );
-
-       if( rc != LDAP_SUCCESS ) {
-               text = NULL;
-               ch_free( vrf->vrf_sub );
-               vrf->vrf_choice = SLAPD_FILTER_COMPUTED;
-               vrf->vrf_result = SLAPD_COMPARE_UNDEFINED;
-               return LDAP_SUCCESS;
-       }
-
-       vrf->vrf_sub_initial.bv_val = NULL;
-       vrf->vrf_sub_any = NULL;
-       vrf->vrf_sub_final.bv_val = NULL;
-
-       for ( tag = ber_first_element( ber, &len, &last ); tag != LBER_DEFAULT;
-               tag = ber_next_element( ber, &len, last ) )
-       {
-               unsigned usage;
-
-               rc = ber_scanf( ber, "m", &value );
-               if ( rc == LBER_ERROR ) {
-                       rc = SLAPD_DISCONNECT;
-                       goto return_error;
-               }
-
-               if ( value.bv_val == NULL || value.bv_len == 0 ) {
-                       rc = LDAP_INVALID_SYNTAX;
-                       goto return_error;
-               } 
-
-               switch ( tag ) {
-               case LDAP_SUBSTRING_INITIAL:
-                       usage = SLAP_MR_SUBSTR_INITIAL;
-                       break;
-
-               case LDAP_SUBSTRING_ANY:
-                       usage = SLAP_MR_SUBSTR_ANY;
-                       break;
-
-               case LDAP_SUBSTRING_FINAL:
-                       usage = SLAP_MR_SUBSTR_FINAL;
-                       break;
-
-               default:
-                       rc = LDAP_PROTOCOL_ERROR;
-
-#ifdef NEW_LOGGING
-                       LDAP_LOG( FILTER, ERR, 
-                               "get_filter_substring: conn %d  unknown substring choice=%ld\n",
-                               op->o_connid, (long)tag, 0 );
-#else
-                       Debug( LDAP_DEBUG_FILTER,
-                               "  unknown substring choice=%ld\n",
-                               (long) tag, 0, 0 );
-#endif
-                       goto return_error;
-               }
-
-               /* validate/normalize using equality matching rule validator! */
-               rc = asserted_value_validate_normalize(
-                       vrf->vrf_sub_desc, vrf->vrf_sub_desc->ad_type->sat_equality,
-                       usage, &value, &bv, text );
-               if( rc != LDAP_SUCCESS ) {
-                       goto return_error;
-               }
-
-               value = bv;
-
-               rc = LDAP_PROTOCOL_ERROR;
-
-               switch ( tag ) {
-               case LDAP_SUBSTRING_INITIAL:
-#ifdef NEW_LOGGING
-                       LDAP_LOG( FILTER, DETAIL1, 
-                               "get_substring_filter: conn %d  INITIAL\n", 
-                               op->o_connid, 0, 0 );
-#else
-                       Debug( LDAP_DEBUG_FILTER, "  INITIAL\n", 0, 0, 0 );
-#endif
-
-                       if ( vrf->vrf_sub_initial.bv_val != NULL
-                               || vrf->vrf_sub_any != NULL 
-                               || vrf->vrf_sub_final.bv_val != NULL )
-                       {
-                               free( value.bv_val );
-                               goto return_error;
-                       }
-
-                       vrf->vrf_sub_initial = value;
-                       break;
-
-               case LDAP_SUBSTRING_ANY:
-#ifdef NEW_LOGGING
-                       LDAP_LOG( FILTER, DETAIL1, 
-                               "get_substring_filter: conn %d  ANY\n", op->o_connid, 0, 0 );
-#else
-                       Debug( LDAP_DEBUG_FILTER, "  ANY\n", 0, 0, 0 );
-#endif
-
-                       if ( vrf->vrf_sub_final.bv_val != NULL ) {
-                               free( value.bv_val );
-                               goto return_error;
-                       }
-
-                       ber_bvarray_add( &vrf->vrf_sub_any, &value );
-                       break;
-
-               case LDAP_SUBSTRING_FINAL:
-#ifdef NEW_LOGGING
-                       LDAP_LOG( FILTER, DETAIL1, 
-                               "get_substring_filter: conn %d  FINAL\n", op->o_connid, 0, 0 );
-#else
-                       Debug( LDAP_DEBUG_FILTER, "  FINAL\n", 0, 0, 0 );
-#endif
-
-                       if ( vrf->vrf_sub_final.bv_val != NULL ) {
-                               free( value.bv_val );
-                               goto return_error;
-                       }
-
-                       vrf->vrf_sub_final = value;
-                       break;
-
-               default:
-#ifdef NEW_LOGGING
-                       LDAP_LOG( FILTER, INFO, 
-                               "get_substring_filter: conn %d  unknown substring type %ld\n",
-                               op->o_connid, (long)tag, 0 );
-#else
-                       Debug( LDAP_DEBUG_FILTER,
-                               "  unknown substring type=%ld\n",
-                               (long) tag, 0, 0 );
-#endif
-
-                       free( value.bv_val );
-
-return_error:
-#ifdef NEW_LOGGING
-                       LDAP_LOG( FILTER, INFO, 
-                               "get_substring_filter: conn %d  error %ld\n",
-                               op->o_connid, (long)rc, 0 );
-#else
-                       Debug( LDAP_DEBUG_FILTER, "  error=%ld\n",
-                               (long) rc, 0, 0 );
-#endif
-                       free( vrf->vrf_sub_initial.bv_val );
-                       ber_bvarray_free( vrf->vrf_sub_any );
-                       free( vrf->vrf_sub_final.bv_val );
-                       ch_free( vrf->vrf_sub );
-                       return rc;
-               }
-       }
-
-#ifdef NEW_LOGGING
-       LDAP_LOG( FILTER, ENTRY, 
-               "get_substring_filter: conn %d exit\n", op->o_connid, 0, 0 );
-#else
-       Debug( LDAP_DEBUG_FILTER, "end get_substring_filter\n", 0, 0, 0 );
-#endif
-       return( LDAP_SUCCESS );
-}
-#endif /* unused */
index 621c936ec99211cee51f95e5bb563daaf52d97fd..9aeccbfc39a425bfb4c164b96309b4c94571035f 100644 (file)
@@ -376,12 +376,7 @@ LDAP_SLAPD_F (int) dnValidate LDAP_P((
 LDAP_SLAPD_F (slap_mr_normalize_func) dnNormalize;
 #define dnNormalize2(s,v,n,x)          dnNormalize(0,(s),NULL,(v),(n),(x))
 
-LDAP_SLAPD_F (int) dnPretty LDAP_P(( 
-       Syntax *syntax, 
-       struct berval *val, 
-       struct berval **pretty ));
-
-LDAP_SLAPD_F (slap_syntax_transform_func) dnPretty2;
+LDAP_SLAPD_F (slap_syntax_transform_func) dnPretty;
 
 LDAP_SLAPD_F (int) dnPrettyNormal LDAP_P(( 
        Syntax *syntax, 
index 503e1f4558b9237bc5cbd7c831caafe7f8795240..85fd39b426b92086934dbc6f7915d53b85c6f8df 100644 (file)
@@ -44,7 +44,7 @@ static char * referral_dn_muck(
                bvin.bv_val = (char *)refDN;
                bvin.bv_len = strlen( refDN );
 
-               rc = dnPretty2( NULL, &bvin, &nrefDN, NULL );
+               rc = dnPretty( NULL, &bvin, &nrefDN, NULL );
                if( rc != LDAP_SUCCESS ) {
                        /* Invalid refDN */
                        return NULL;
@@ -59,7 +59,7 @@ static char * referral_dn_muck(
                return nrefDN.bv_len ? nrefDN.bv_val : ch_strdup( baseDN->bv_val );
        }
 
-       rc = dnPretty2( NULL, targetDN, &ntargetDN, NULL );
+       rc = dnPretty( NULL, targetDN, &ntargetDN, NULL );
        if( rc != LDAP_SUCCESS ) {
                /* Invalid targetDN */
                ch_free( nrefDN.bv_val );
@@ -67,7 +67,7 @@ static char * referral_dn_muck(
        }
 
        if( nrefDN.bv_len ) {
-               rc = dnPretty2( NULL, baseDN, &nbaseDN, NULL );
+               rc = dnPretty( NULL, baseDN, &nbaseDN, NULL );
                if( rc != LDAP_SUCCESS ) {
                        /* Invalid baseDN */
                        ch_free( nrefDN.bv_val );
index e77c883f60cb241156916e9c7bfaf85a332ee758..f75c3b6f75ec0590c1d703214e35ebb32fee3f84 100644 (file)
@@ -2601,7 +2601,7 @@ static slap_syntax_defs_rec syntax_defs[] = {
        {"( 1.3.6.1.4.1.1466.115.121.1.11 DESC 'Country String' )",
                0, countryStringValidate, NULL},
        {"( 1.3.6.1.4.1.1466.115.121.1.12 DESC 'Distinguished Name' )",
-               0, dnValidate, dnPretty2},
+               0, dnValidate, dnPretty},
        {"( 1.3.6.1.4.1.1466.115.121.1.13 DESC 'Data Quality' )",
                0, NULL, NULL},
        {"( 1.3.6.1.4.1.1466.115.121.1.14 DESC 'Delivery Method' )",
index aae1b24e8a7231348df9e3c94d872340e50695c8..156e585b611ec8e55fef003f4eea75eee1e723bc 100644 (file)
@@ -857,7 +857,7 @@ slapi_dn_normalize( char *dn )
        bdn.bv_val = dn;
        bdn.bv_len = strlen( dn );
 
-       if ( dnPretty2( NULL, &bdn, &pdn, NULL ) != LDAP_SUCCESS ) {
+       if ( dnPretty( NULL, &bdn, &pdn, NULL ) != LDAP_SUCCESS ) {
                return NULL;
        }