]> git.sur5r.net Git - openldap/commitdiff
Changed be_[n]suffix, be_[n]suffixAlias to BerVarray. No more bvec's anywhere.
authorHoward Chu <hyc@openldap.org>
Wed, 1 May 2002 18:50:14 +0000 (18:50 +0000)
committerHoward Chu <hyc@openldap.org>
Wed, 1 May 2002 18:50:14 +0000 (18:50 +0000)
17 files changed:
servers/slapd/back-bdb/dn2id.c
servers/slapd/back-bdb/init.c
servers/slapd/back-monitor/database.c
servers/slapd/back-monitor/init.c
servers/slapd/back-passwd/search.c
servers/slapd/back-shell/result.c
servers/slapd/back-tcl/tcl_back.h
servers/slapd/back-tcl/tcl_util.c
servers/slapd/backend.c
servers/slapd/backglue.c
servers/slapd/config.c
servers/slapd/mods.c
servers/slapd/repl.c
servers/slapd/root_dse.c
servers/slapd/slap.h
servers/slapd/suffixalias.c
servers/slapd/tools/slapadd.c

index 91a989095c9ab8a05b68691b023a0d8af23efc48..d9792904fb64bcb48a55dc55f4e4876d842644e7 100644 (file)
@@ -744,7 +744,7 @@ int bdb_build_tree(
         * Note that this code always uses be_suffix[0], so defining
         * multiple suffixes for a single backend won't work!
         */
-       rdns = ldap_explode_dn(be->be_nsuffix[0]->bv_val, 0);
+       rdns = ldap_explode_dn(be->be_nsuffix[0].bv_val, 0);
        for (i=0; rdns[i]; i++);
        bdb->bi_nrdns = i;
        charray_free(rdns);
@@ -783,8 +783,8 @@ int bdb_fix_dn(
        
        ldap_pvt_thread_rdwr_rlock(&bdb->bi_tree_rdwr);
        o = bdb_find_id_node(id, bdb->bi_tree);
-       rlen = be->be_suffix[0]->bv_len + 1;
-       nrlen = be->be_nsuffix[0]->bv_len + 1;
+       rlen = be->be_suffix[0].bv_len + 1;
+       nrlen = be->be_nsuffix[0].bv_len + 1;
        for (n = o; n && n->i_parent; n=n->i_parent) {
                rlen += n->i_rdn->rdn.bv_len + 1;
                nrlen += n->i_rdn->nrdn.bv_len + 1;
@@ -803,8 +803,8 @@ int bdb_fix_dn(
        }
        ldap_pvt_thread_rdwr_runlock(&bdb->bi_tree_rdwr);
 
-       strcpy(ptr, be->be_suffix[0]->bv_val);
-       strcpy(nptr, be->be_nsuffix[0]->bv_val);
+       strcpy(ptr, be->be_suffix[0].bv_val);
+       strcpy(nptr, be->be_nsuffix[0].bv_val);
 
        return 0;
 }
index 0283e3170bbb1debb74491ca8df931ab5e6ec59b..a1bb111a7b662d120206415eed9dce1553328cb6 100644 (file)
@@ -171,11 +171,11 @@ bdb_db_open( BackendDB *be )
        u_int32_t flags;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG(( "init", LDAP_LEVEL_ARGS, "bdb_db_open: %s\n", be->be_suffix[0]->bv_val ));
+       LDAP_LOG(( "init", LDAP_LEVEL_ARGS, "bdb_db_open: %s\n", be->be_suffix[0].bv_val ));
 #else
        Debug( LDAP_DEBUG_ARGS,
                "bdb_db_open: %s\n",
-               be->be_suffix[0]->bv_val, 0, 0 );
+               be->be_suffix[0].bv_val, 0, 0 );
 #endif
 
        /* we should check existance of dbenv_home and db_directory */
@@ -195,7 +195,7 @@ bdb_db_open( BackendDB *be )
        flags = DB_INIT_MPOOL | DB_THREAD | DB_CREATE
                | DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_TXN | DB_RECOVER;
 
-       bdb->bi_dbenv->set_errpfx( bdb->bi_dbenv, be->be_suffix[0]->bv_val );
+       bdb->bi_dbenv->set_errpfx( bdb->bi_dbenv, be->be_suffix[0].bv_val );
        bdb->bi_dbenv->set_errcall( bdb->bi_dbenv, bdb_errcall );
 #ifndef NO_THREADS
        bdb->bi_dbenv->set_lk_detect( bdb->bi_dbenv, bdb->bi_lock_detect );
index 13ce9d58389c114d99b0e67bd0a23d19d063670d..bfc1eded080642cadbc51ee4d9ab644608585e7a 100644 (file)
@@ -114,15 +114,8 @@ monitor_subsys_database_init(
                        return( -1 );
                }
                
-               for ( j = 0; be->be_suffix[j]; j++ ) {
-                       struct berval           bv[ 2 ];
-
-                       bv[ 0 ] = *be->be_suffix[ j ];
-                       bv[ 1 ].bv_val = NULL;
-
-                       attr_merge( e, ad_nc, bv );
-                       attr_merge( e_database, ad_nc, bv );
-               }
+               attr_merge( e, ad_nc, be->be_suffix );
+               attr_merge( e_database, ad_nc, be->be_suffix );
 
                for ( j = nBackendInfo; j--; ) {
                        if ( &backendInfo[ j ] == be->bd_info ) {
index 692efd2d71961f01668f379154f99367fe7d9fc3..44d81d0529b5c0c5dc4cb3f27c38cdac2ca358cf 100644 (file)
@@ -226,7 +226,7 @@ monitor_back_db_init(
        struct monitorentrypriv *mp;
        int                     i, rc;
        char                    buf[1024], *end_of_line;
-       struct berval           dn, *ndn;
+       struct berval           dn, ndn;
        const char              *text;
        struct berval           bv[2];
 
@@ -249,11 +249,10 @@ monitor_back_db_init(
        /* indicate system schema supported */
        be->be_flags |= SLAP_BFLAG_MONITOR;
 
-       ndn = NULL;
        dn.bv_val = SLAPD_MONITOR_DN;
        dn.bv_len = sizeof( SLAPD_MONITOR_DN ) - 1;
 
-       rc = dnNormalize( NULL, &dn, &ndn );
+       rc = dnNormalize2( NULL, &dn, &ndn );
        if( rc != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
                LDAP_LOG(( "operation", LDAP_LEVEL_CRIT,
@@ -266,8 +265,9 @@ monitor_back_db_init(
                return -1;
        }
 
-       ber_bvecadd( &be->be_suffix, ber_dupbv( NULL, &dn ) );
-       ber_bvecadd( &be->be_nsuffix, ndn );
+       ber_dupbv( &bv[0], &dn );
+       ber_bvarray_add( &be->be_suffix, &bv[0] );
+       ber_bvarray_add( &be->be_nsuffix, &ndn );
 
        mi = ( struct monitorinfo * )ch_calloc( sizeof( struct monitorinfo ), 1 );
        ldap_pvt_thread_mutex_init( &mi->mi_cache_mutex );
index 83db8ae5fea8d83d801f597dda78ab2e0aa9b024..4847bfff617bc739f815f6d549727aa35fc31c3f 100644 (file)
@@ -180,9 +180,9 @@ passwd_back_search(
                 */
                if( !be_issuffix( be, &parent ) ) {
                        int i;
-                       for( i=0; be->be_nsuffix[i] != NULL; i++ ) {
-                               if( dnIsSuffix( nbase, be->be_nsuffix[i] ) ) {
-                                       matched = be->be_suffix[i]->bv_val;
+                       for( i=0; be->be_nsuffix[i].bv_val != NULL; i++ ) {
+                               if( dnIsSuffix( nbase, &be->be_nsuffix[i] ) ) {
+                                       matched = be->be_suffix[i].bv_val;
                                        break;
                                }
                        }
@@ -262,12 +262,12 @@ pw2entry( Backend *be, struct passwd *pw, const char **text )
         */
 
        pwlen = strlen( pw->pw_name );
-       vals[0].bv_len = (sizeof("uid=,")-1) + ( pwlen + be->be_suffix[0]->bv_len );
+       vals[0].bv_len = (sizeof("uid=,")-1) + ( pwlen + be->be_suffix[0].bv_len );
        vals[0].bv_val = ch_malloc( vals[0].bv_len + 1 );
 
        /* rdn attribute type should be a configuratable item */
        sprintf( vals[0].bv_val, "uid=%s,%s",
-               pw->pw_name, be->be_suffix[0]->bv_val );
+               pw->pw_name, be->be_suffix[0].bv_val );
 
        rc = dnNormalize2( NULL, vals, &bv );
        if( rc != LDAP_SUCCESS ) {
index aaadf6bec7f403bec52a787232cd419669d8c5f4..ded78f03c489bca4238d1ea26f69a002c601051f 100644 (file)
@@ -110,7 +110,7 @@ print_suffixes(
 {
        int     i;
 
-       for ( i = 0; be->be_suffix[i] != NULL; i++ ) {
-               fprintf( fp, "suffix: %s\n", be->be_suffix[i]->bv_val );
+       for ( i = 0; be->be_suffix[i].bv_val != NULL; i++ ) {
+               fprintf( fp, "suffix: %s\n", be->be_suffix[i].bv_val );
        }
 }
index 63da57236e38502a3386ead337e915a89fe50995..aa56a2611f97370e45e008a9503c352f28e49b54 100644 (file)
@@ -44,7 +44,7 @@ struct tclinfo {
 
 void readtclscript (char *script, Tcl_Interp * my_tcl);
 char *tcl_clean_entry (Entry * e);
-struct berval *tcl_merge_bvlist (struct berval **bvlist, struct berval *out);
+struct berval *tcl_merge_bvlist (BerVarray bvlist, struct berval *out);
 
 int tcl_ldap_debug (
        ClientData clientData,
index 5d197f36bc2ab6e3010e58953bcb3fd040e0c036..e23b86d1156b131f6d0b116512b8bafdb6f61b22 100644 (file)
@@ -192,7 +192,7 @@ readtclscript (
 
 struct berval *
 tcl_merge_bvlist(
-       struct berval **bvlist, struct berval *out)
+       BerVarray bvlist, struct berval *out)
 {
        struct berval *ret = NULL;
        int i;
@@ -212,7 +212,7 @@ tcl_merge_bvlist(
        ret->bv_len = 0;
        ret->bv_val = NULL;
 
-       for (i = 0; bvlist[i] != NULL; i++);
+       for (i = 0; bvlist[i].bv_val != NULL; i++);
 
        if (i) {
                char **strlist = ch_malloc ((i + 1) * sizeof(char *));
@@ -221,8 +221,8 @@ tcl_merge_bvlist(
                                ch_free (ret);
                        return NULL;
                }
-               for (i = 0; bvlist[i] != NULL; i++) {
-                       strlist[i] = bvlist[i]->bv_val;
+               for (i = 0; bvlist[i].bv_val != NULL; i++) {
+                       strlist[i] = bvlist[i].bv_val;
                }
                strlist[i] = NULL;
                ret->bv_val = Tcl_Merge(i, strlist);
index 655c2fdc469e2dadd1d932245d13394d5f60b4a5..7d7414aaa831a3a9d1eaaf7e2c41aa7e73039d3c 100644 (file)
@@ -248,11 +248,11 @@ int backend_startup(Backend *be)
 #ifdef NEW_LOGGING
                LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
                           "backend_startup:  starting \"%s\"\n",
-                          be->be_suffix[0]->bv_val ));
+                          be->be_suffix[0].bv_val ));
 #else
                Debug( LDAP_DEBUG_TRACE,
                        "backend_startup: starting \"%s\"\n",
-                       be->be_suffix[0]->bv_val, 0, 0 );
+                       be->be_suffix[0].bv_val, 0, 0 );
 #endif
 
                if ( be->bd_info->bi_open ) {
@@ -425,8 +425,8 @@ int backend_destroy(void)
                if ( bd->bd_info->bi_db_destroy ) {
                        bd->bd_info->bi_db_destroy( bd );
                }
-               ber_bvecfree( bd->be_suffix );
-               ber_bvecfree( bd->be_nsuffix );
+               ber_bvarray_free( bd->be_suffix );
+               ber_bvarray_free( bd->be_nsuffix );
                if ( bd->be_rootdn.bv_val ) free( bd->be_rootdn.bv_val );
                if ( bd->be_rootndn.bv_val ) free( bd->be_rootndn.bv_val );
                if ( bd->be_rootpw.bv_val ) free( bd->be_rootpw.bv_val );
@@ -540,7 +540,7 @@ select_backend(
 
        for ( i = 0; i < nbackends; i++ ) {
                for ( j = 0; backends[i].be_nsuffix != NULL &&
-                   backends[i].be_nsuffix[j] != NULL; j++ )
+                   backends[i].be_nsuffix[j].bv_val != NULL; j++ )
                {
                        if (( backends[i].be_flags & SLAP_BFLAG_GLUE_SUBORDINATE )
                                && noSubs )
@@ -548,7 +548,7 @@ select_backend(
                                continue;
                        }
 
-                       len = backends[i].be_nsuffix[j]->bv_len;
+                       len = backends[i].be_nsuffix[j].bv_len;
 
                        if ( len > dnlen ) {
                                /* suffix is longer than DN */
@@ -565,7 +565,7 @@ select_backend(
                                continue;
                        }
 
-                       if ( strcmp( backends[i].be_nsuffix[j]->bv_val,
+                       if ( strcmp( backends[i].be_nsuffix[j].bv_val,
                                &dn->bv_val[dnlen-len] ) == 0 )
                        {
                                if( be == NULL ) {
@@ -593,8 +593,8 @@ be_issuffix(
 {
        int     i;
 
-       for ( i = 0; be->be_nsuffix != NULL && be->be_nsuffix[i] != NULL; i++ ) {
-               if ( ber_bvcmp( be->be_nsuffix[i], bvsuffix ) == 0 ) {
+       for ( i = 0; be->be_nsuffix != NULL && be->be_nsuffix[i].bv_val != NULL; i++ ) {
+               if ( ber_bvcmp( &be->be_nsuffix[i], bvsuffix ) == 0 ) {
                        return( 1 );
                }
        }
index 0eccc8b8ac9cf75071e081c456cd9a20f37be7ec..e2afd091567ab08fa75260252ca744500652333b 100644 (file)
@@ -63,7 +63,7 @@ glue_back_select (
        bv.bv_val = (char *) dn;
 
        for (i = 0; i<gi->nodes; i++) {
-               if (dnIsSuffix(&bv, gi->n[i].be->be_nsuffix[0])) {
+               if (dnIsSuffix(&bv, &gi->n[i].be->be_nsuffix[0])) {
                        return gi->n[i].be;
                }
        }
@@ -360,20 +360,20 @@ glue_back_search (
                        if (scope == LDAP_SCOPE_ONELEVEL && 
                                dn_match(&gi->n[i].pdn, ndn)) {
                                rc = be->be_search (be, conn, op,
-                                       be->be_suffix[0], be->be_nsuffix[0],
+                                       &be->be_suffix[0], &be->be_nsuffix[0],
                                        LDAP_SCOPE_BASE, deref,
                                        s2limit, t2limit, filter, filterstr,
                                        attrs, attrsonly);
 
                        } else if (scope == LDAP_SCOPE_SUBTREE &&
-                               dnIsSuffix(be->be_nsuffix[0], ndn)) {
+                               dnIsSuffix(&be->be_nsuffix[0], ndn)) {
                                rc = be->be_search (be, conn, op,
-                                       be->be_suffix[0], be->be_nsuffix[0],
+                                       &be->be_suffix[0], &be->be_nsuffix[0],
                                        scope, deref,
                                        s2limit, t2limit, filter, filterstr,
                                        attrs, attrsonly);
 
-                       } else if (dnIsSuffix(&bv, be->be_nsuffix[0])) {
+                       } else if (dnIsSuffix(&bv, &be->be_nsuffix[0])) {
                                rc = be->be_search (be, conn, op, dn, ndn,
                                        scope, deref,
                                        s2limit, t2limit, filter, filterstr,
@@ -833,7 +833,7 @@ glue_sub_init( )
                        if (be->be_flags & SLAP_BFLAG_GLUE_LINKED) {
                                continue;
                        }
-                       if (!dnIsSuffix(be->be_nsuffix[0], b1->be_nsuffix[0])) {
+                       if (!dnIsSuffix(&be->be_nsuffix[0], &b1->be_nsuffix[0])) {
                                continue;
                        }
                        cont--;
@@ -890,7 +890,7 @@ glue_sub_init( )
                                        gi->nodes * sizeof(gluenode));
                        }
                        gi->n[gi->nodes].be = be;
-                       dnParent( be->be_nsuffix[0], &gi->n[gi->nodes].pdn ); 
+                       dnParent( &be->be_nsuffix[0], &gi->n[gi->nodes].pdn ); 
                        gi->nodes++;
                }
                if (gi) {
@@ -898,7 +898,7 @@ glue_sub_init( )
                        gi = (glueinfo *)ch_realloc(gi,
                                sizeof(glueinfo) + gi->nodes * sizeof(gluenode));
                        gi->n[gi->nodes].be = gi->be;
-                       dnParent( b1->be_nsuffix[0], &gi->n[gi->nodes].pdn );
+                       dnParent( &b1->be_nsuffix[0], &gi->n[gi->nodes].pdn );
                        gi->nodes++;
                        b1->be_private = gi;
                        b1->bd_info = bi;
index e79dcc6252dab72695e8fb5f7b1e53e50a989070..b4197a0807ea0eec899d9b4ef9f0e95eb1b4bc10 100644 (file)
@@ -858,9 +858,7 @@ read_config( const char *fname )
                /* set database suffix */
                } else if ( strcasecmp( cargv[0], "suffix" ) == 0 ) {
                        Backend *tmp_be;
-                       struct berval dn;
-                       struct berval *pdn = NULL;
-                       struct berval *ndn = NULL;
+                       struct berval dn, pdn, ndn;
 
                        if ( cargc < 2 ) {
 #ifdef NEW_LOGGING
@@ -919,10 +917,8 @@ read_config( const char *fname )
 
                        dn.bv_val = cargv[1];
                        dn.bv_len = strlen( cargv[1] );
-                       pdn = ch_malloc( sizeof( struct berval ));
-                       ndn = ch_malloc( sizeof( struct berval ));
 
-                       rc = dnPrettyNormal( NULL, &dn, pdn, ndn );
+                       rc = dnPrettyNormal( NULL, &dn, &pdn, &ndn );
                        if( rc != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
                                LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
@@ -936,7 +932,7 @@ read_config( const char *fname )
                                return( 1 );
                        }
 
-                       tmp_be = select_backend( ndn, 0, 0 );
+                       tmp_be = select_backend( &ndn, 0, 0 );
                        if ( tmp_be == be ) {
 #ifdef NEW_LOGGING
                                LDAP_LOG(( "config", LDAP_LEVEL_INFO,
@@ -947,25 +943,25 @@ read_config( const char *fname )
                                        "already served by this backend (ignored)\n",
                                    fname, lineno, 0 );
 #endif
-                               ber_bvfree( pdn );
-                               ber_bvfree( ndn );
+                               free( pdn.bv_val );
+                               free( ndn.bv_val );
 
                        } else if ( tmp_be  != NULL ) {
 #ifdef NEW_LOGGING
                                LDAP_LOG(( "config", LDAP_LEVEL_INFO,
                                        "%s: line %d: suffix already served by a preceding "
                                        "backend \"%s\"\n", fname, lineno,
-                                       tmp_be->be_suffix[0]->bv_val ));
+                                       tmp_be->be_suffix[0].bv_val ));
 #else
                                Debug( LDAP_DEBUG_ANY, "%s: line %d: suffix "
                                        "already served by a preceeding backend \"%s\"\n",
-                                   fname, lineno, tmp_be->be_suffix[0]->bv_val );
+                                   fname, lineno, tmp_be->be_suffix[0].bv_val );
 #endif
-                               ber_bvfree( pdn );
-                               ber_bvfree( ndn );
+                               free( pdn.bv_val );
+                               free( ndn.bv_val );
                                return( 1 );
 
-                       } else if( pdn->bv_len == 0 && default_search_nbase.bv_len ) {
+                       } else if( pdn.bv_len == 0 && default_search_nbase.bv_len ) {
 #ifdef NEW_LOGGING
                                        LDAP_LOG(( "config", LDAP_LEVEL_INFO,
                                                "%s: line %d: suffix DN empty and default search "
@@ -979,14 +975,14 @@ read_config( const char *fname )
 #endif
                        }
 
-                       ber_bvecadd( &be->be_suffix, pdn );
-                       ber_bvecadd( &be->be_nsuffix, ndn );
+                       ber_bvarray_add( &be->be_suffix, &pdn );
+                       ber_bvarray_add( &be->be_nsuffix, &ndn );
 
                /* set database suffixAlias */
                } else if ( strcasecmp( cargv[0], "suffixAlias" ) == 0 ) {
                        Backend *tmp_be;
-                       struct berval alias, *palias, nalias;
-                       struct berval aliased, *paliased, naliased;
+                       struct berval alias, palias, nalias;
+                       struct berval aliased, paliased, naliased;
 
                        if ( cargc < 2 ) {
 #ifdef NEW_LOGGING
@@ -1046,9 +1042,8 @@ read_config( const char *fname )
                        
                        alias.bv_val = cargv[1];
                        alias.bv_len = strlen( cargv[1] );
-                       palias = ch_malloc(sizeof(struct berval));
 
-                       rc = dnPrettyNormal( NULL, &alias, palias, &nalias );
+                       rc = dnPrettyNormal( NULL, &alias, &palias, &nalias );
                        if( rc != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
                                LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
@@ -1069,22 +1064,21 @@ read_config( const char *fname )
                                LDAP_LOG(( "config", LDAP_LEVEL_INFO,
                                        "%s: line %d: suffixAlias served by a preceeding "
                                        "backend \"%s\"\n",
-                                       fname, lineno, tmp_be->be_suffix[0]->bv_val ));
+                                       fname, lineno, tmp_be->be_suffix[0].bv_val ));
 #else
                                Debug( LDAP_DEBUG_ANY,
                                        "%s: line %d: suffixAlias served by"
                                        "  a preceeding backend \"%s\"\n",
-                                       fname, lineno, tmp_be->be_suffix[0]->bv_val );
+                                       fname, lineno, tmp_be->be_suffix[0].bv_val );
 #endif
-                               ber_bvfree( palias );
+                               free( palias.bv_val );
                                return -1;
                        }
 
                        aliased.bv_val = cargv[2];
                        aliased.bv_len = strlen( cargv[2] );
-                       paliased = ch_malloc(sizeof(struct berval));
 
-                       rc = dnPrettyNormal( NULL, &aliased, paliased, &naliased );
+                       rc = dnPrettyNormal( NULL, &aliased, &paliased, &naliased );
                        if( rc != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
                                LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
@@ -1095,7 +1089,7 @@ read_config( const char *fname )
                                        "%s: line %d: aliased DN is invalid\n",
                                   fname, lineno, 0 );
 #endif
-                               ber_bvfree( palias );
+                               free( palias.bv_val );
                                return( 1 );
                        }
 
@@ -1106,20 +1100,20 @@ read_config( const char *fname )
                                LDAP_LOG(( "config", LDAP_LEVEL_INFO,
                                        "%s: line %d: suffixAlias derefs to a different backend "
                                        "a preceeding backend \"%s\"\n",
-                                       fname, lineno, tmp_be->be_suffix[0]->bv_val ));
+                                       fname, lineno, tmp_be->be_suffix[0].bv_val ));
 #else
                                Debug( LDAP_DEBUG_ANY,
                                        "%s: line %d: suffixAlias derefs to differnet backend"
                                        "  a preceeding backend \"%s\"\n",
-                                       fname, lineno, tmp_be->be_suffix[0]->bv_val );
+                                       fname, lineno, tmp_be->be_suffix[0].bv_val );
 #endif
-                               ber_bvfree( palias );
-                               ber_bvfree( paliased );
+                               free( palias.bv_val );
+                               free( paliased.bv_val );
                                return -1;
                        }
 
-                       ber_bvecadd( &be->be_suffixAlias, palias ); 
-                       ber_bvecadd( &be->be_suffixAlias, paliased );
+                       ber_bvarray_add( &be->be_suffixAlias, &palias ); 
+                       ber_bvarray_add( &be->be_suffixAlias, &paliased );
 
                /* set max deref depth */
                } else if ( strcasecmp( cargv[0], "maxDerefDepth" ) == 0 ) {
index 529b4e74b2314e8f4a496c57d0c5d45a4aac9823..f57cf41dab6deb5c6c49b767a8a651b8353f55a9 100644 (file)
@@ -303,22 +303,3 @@ slap_mods_free(
        }
 }
 
-void
-slap_modlist_free(
-    LDAPModList        *ml
-)
-{
-       LDAPModList *next;
-
-       for ( ; ml != NULL; ml = next ) {
-               next = ml->ml_next;
-
-               if (ml->ml_type)
-                       free( ml->ml_type );
-
-               if ( ml->ml_bvalues != NULL )
-                       ber_bvecfree( ml->ml_bvalues );
-
-               free( ml );
-       }
-}
index 6f2b3ac262dd11923036fa8fa83aca188e0adc29..4f0105b3e96c0672436a22046f1a502a4d47722d 100644 (file)
@@ -55,23 +55,23 @@ add_replica_suffix(
     const char  *suffix
 )
 {
-       struct berval dn, *ndn = NULL;
+       struct berval dn, ndn;
        int rc;
 
        dn.bv_val = (char *) suffix;
        dn.bv_len = strlen( dn.bv_val );
 
-       rc = dnNormalize( NULL, &dn, &ndn );
+       rc = dnNormalize2( NULL, &dn, &ndn );
        if( rc != LDAP_SUCCESS ) {
                return 2;
        }
 
-       if ( select_backend( ndn, 0, 0 ) != be ) {
-               ber_bvfree( ndn );
+       if ( select_backend( &ndn, 0, 0 ) != be ) {
+               free( ndn.bv_val );
                return 1;
        }
 
-       ber_bvecadd( &be->be_replica[nr]->ri_nsuffix, ndn );
+       ber_bvarray_add( &be->be_replica[nr]->ri_nsuffix, &ndn );
        return 0;
 }
 
@@ -139,13 +139,13 @@ replog(
                if ( be->be_replica[i]->ri_nsuffix != NULL ) {
                        int j;
 
-                       for ( j = 0; be->be_replica[i]->ri_nsuffix[j]; j++ ) {
-                               if ( dnIsSuffix( ndn, be->be_replica[i]->ri_nsuffix[j] ) ) {
+                       for ( j = 0; be->be_replica[i]->ri_nsuffix[j].bv_val; j++ ) {
+                               if ( dnIsSuffix( ndn, &be->be_replica[i]->ri_nsuffix[j] ) ) {
                                        break;
                                }
                        }
 
-                       if ( !be->be_replica[i]->ri_nsuffix[j] ) {
+                       if ( !be->be_replica[i]->ri_nsuffix[j].bv_val ) {
                                /* do not add "replica:" line */
                                continue;
                        }
@@ -195,13 +195,13 @@ replog(
                        if ( be->be_replica[i]->ri_nsuffix != NULL ) {
                                int j;
 
-                               for ( j = 0; be->be_replica[i]->ri_nsuffix[j]; j++ ) {
-                                       if ( dnIsSuffix( ndn, be->be_replica[i]->ri_nsuffix[j] ) ) {
+                               for ( j = 0; be->be_replica[i]->ri_nsuffix[j].bv_val; j++ ) {
+                                       if ( dnIsSuffix( ndn, &be->be_replica[i]->ri_nsuffix[j] ) ) {
                                                break;
                                        }
                                }
 
-                               if ( !be->be_replica[i]->ri_nsuffix[j] ) {
+                               if ( !be->be_replica[i]->ri_nsuffix[j].bv_val ) {
                                        /* do not add "replica:" line */
                                        continue;
                                }
index b52e3558b499e1dcf6904203d5aeaec1bcfaabce..5db42c0f70c67647bb06734250e21c0709fa8e30 100644 (file)
@@ -93,8 +93,8 @@ root_dse_info(
                if ( backends[i].be_flags & SLAP_BFLAG_GLUE_SUBORDINATE ) {
                        continue;
                }
-               for ( j = 0; backends[i].be_suffix[j] != NULL; j++ ) {
-                       vals[0] = *backends[i].be_suffix[j];
+               for ( j = 0; backends[i].be_suffix[j].bv_val != NULL; j++ ) {
+                       vals[0] = backends[i].be_suffix[j];
                        attr_merge( e, ad_namingContexts, vals );
                }
        }
index 945c8407e6626eeadc3987797b136678abf52847..ddd7c9b0485c49e34b03b60860c182bc280c8bfa 100644 (file)
@@ -1008,7 +1008,7 @@ LDAP_SLAPD_V (int) slapMode;
 
 struct slap_replica_info {
        char *ri_host;                          /* supersedes be_replica */
-       struct berval **ri_nsuffix;     /* array of suffixes this replica accepts */
+       BerVarray ri_nsuffix;   /* array of suffixes this replica accepts */
        AttributeName *ri_attrs;        /* attrs to replicate, NULL=all */
        int ri_exclude;                 /* 1 => exclude ri_attrs */
 };
@@ -1150,9 +1150,9 @@ struct slap_backend_db {
        slap_ssf_set_t be_ssf_set;
 
        /* these should be renamed from be_ to bd_ */
-       struct berval **be_suffix;      /* the DN suffixes of data in this backend */
-       struct berval **be_nsuffix;     /* the normalized DN suffixes in this backend */
-       struct berval **be_suffixAlias; /* pairs of DN suffix aliases and deref values */
+       BerVarray       be_suffix;      /* the DN suffixes of data in this backend */
+       BerVarray       be_nsuffix;     /* the normalized DN suffixes in this backend */
+       BerVarray       be_suffixAlias; /* pairs of DN suffix aliases and deref values */
        struct berval be_rootdn;        /* the magic "root" name (DN) for this db */
        struct berval be_rootndn;       /* the magic "root" normalized name (DN) for this db */
        struct berval be_rootpw;        /* the magic "root" password for this db        */
index bae4e4e078fce22445cbcc5a996d200312768978..faf68b95b4ce3ffecc4a170bbfcf4d8802cf491e 100644 (file)
@@ -40,10 +40,10 @@ void suffix_alias(
        dnLength = dn->bv_len;
 
        for ( i = 0;
-               be->be_suffixAlias != NULL && be->be_suffixAlias[i] != NULL;
+               be->be_suffixAlias != NULL && be->be_suffixAlias[i].bv_val != NULL;
                i += 2 )
        {
-               int aliasLength = be->be_suffixAlias[i]->bv_len;
+               int aliasLength = be->be_suffixAlias[i].bv_len;
                int diff = dnLength - aliasLength;
 
                if ( diff < 0 ) {
@@ -58,12 +58,12 @@ void suffix_alias(
                        /* XXX or an escaped separator... oh well */
                }
 
-               if (!strcmp(be->be_suffixAlias[i]->bv_val, &dn->bv_val[diff])) {
+               if (!strcmp(be->be_suffixAlias[i].bv_val, &dn->bv_val[diff])) {
                        char *oldDN = dn->bv_val;
-                       dn->bv_len = diff + be->be_suffixAlias[i+1]->bv_len;
+                       dn->bv_len = diff + be->be_suffixAlias[i+1].bv_len;
                        dn->bv_val = ch_malloc( dn->bv_len + 1 );
                        strncpy( dn->bv_val, oldDN, diff );
-                       strcpy( &dn->bv_val[diff], be->be_suffixAlias[i+1]->bv_val );
+                       strcpy( &dn->bv_val[diff], be->be_suffixAlias[i+1].bv_val );
 #ifdef NEW_LOGGING
                        LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
                                   "suffix_alias: converted \"%s\" to \"%s\"\n",
index ad18fe9c6b18e658d02cc6997e9c3f4c685d190d..d14114c50c0e18a60a6b5164a9b4505a28032342 100644 (file)
@@ -83,12 +83,12 @@ main( int argc, char **argv )
                        fprintf( stderr, "%s: line %d: "
                                "database (%s) not configured to hold \"%s\"\n",
                                progname, lineno,
-                               be ? be->be_suffix[0]->bv_val : "<none>",
+                               be ? be->be_suffix[0].bv_val : "<none>",
                                e->e_dn );
                        fprintf( stderr, "%s: line %d: "
                                "database (%s) not configured to hold \"%s\"\n",
                                progname, lineno,
-                               be ? be->be_nsuffix[0]->bv_val : "<none>",
+                               be ? be->be_nsuffix[0].bv_val : "<none>",
                                e->e_ndn );
                        rc = EXIT_FAILURE;
                        entry_free( e );