]> git.sur5r.net Git - openldap/commitdiff
SLAP_NVALUES tweaks - after input, a_nvals is always populated. If there is
authorHoward Chu <hyc@openldap.org>
Mon, 24 Mar 2003 01:56:56 +0000 (01:56 +0000)
committerHoward Chu <hyc@openldap.org>
Mon, 24 Mar 2003 01:56:56 +0000 (01:56 +0000)
no normalizer, a_nvals = a_vals.

24 files changed:
servers/slapd/acl.c
servers/slapd/add.c
servers/slapd/attr.c
servers/slapd/back-bdb/attribute.c
servers/slapd/back-bdb/compare.c
servers/slapd/back-bdb/group.c
servers/slapd/back-bdb/index.c
servers/slapd/back-bdb/modify.c
servers/slapd/back-bdb/modrdn.c
servers/slapd/back-ldbm/compare.c
servers/slapd/back-ldbm/group.c
servers/slapd/back-ldbm/index.c
servers/slapd/back-ldbm/modify.c
servers/slapd/back-ldbm/modrdn.c
servers/slapd/back-monitor/compare.c
servers/slapd/compare.c
servers/slapd/entry.c
servers/slapd/filterentry.c
servers/slapd/matchedValues.c
servers/slapd/modrdn.c
servers/slapd/mods.c
servers/slapd/operational.c
servers/slapd/root_dse.c
servers/slapd/schema_check.c

index 9d2dae013659e10765cf7d48d262c94105895d3a..a7d3fb47383c69e424252aa5e767becdd85b6ce6 100644 (file)
@@ -907,7 +907,7 @@ dn_match_cleanup:;
 #ifdef SLAP_NVALUES
                                        SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH |
                                                SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
-                                       at->a_nvals ? at->a_nvals : at->a_vals,
+                                       at->a_nvals,
 #else
                                        SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
                                        at->a_vals,
@@ -1125,7 +1125,7 @@ dn_match_cleanup:;
                                if (aci_mask( be, conn, op,
                                        e, desc, val,
 #ifdef SLAP_NVALUES
-                                       at->a_nvals ? &at->a_nvals[i] : &at->a_vals[i],
+                                       &at->a_nvals[i],
 #else
                                        &at->a_vals[i],
 #endif
@@ -1858,7 +1858,7 @@ aci_mask(
 #ifdef SLAP_NVALUES
                                SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH |
                                        SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
-                               at->a_nvals ? at->a_nvals : at->a_vals,
+                               at->a_nvals,
 #else
                                SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
                                at->a_vals,
index 49f7b3440c7e21ebff7d4ff3dd86d4343a3424f2..f5c1df097563e681680a246fbfa31fe9449d8d95 100644 (file)
@@ -431,7 +431,7 @@ slap_mods2entry(
                        mods->sml_values = NULL;
 
 #ifdef SLAP_NVALUES
-                       if( attr->a_nvals ) {
+                       if( mods->sml_nvalues ) {
                                attr->a_nvals = ch_realloc( attr->a_nvals,
                                        sizeof( struct berval ) * (i+j) );
 
@@ -441,6 +441,8 @@ slap_mods2entry(
                                /* trim the mods array */
                                ch_free( mods->sml_nvalues );
                                mods->sml_nvalues = NULL;
+                       } else {
+                               attr->a_nvals = attr->a_vals;
                        }
 #endif
 
@@ -479,10 +481,31 @@ slap_mods2entry(
                                const char      *text = NULL;
                                char            textbuf[ SLAP_TEXT_BUFLEN ]  = { '\0' };
                                
+#ifdef SLAP_NVALUES
+                               int match;
+
+                               for ( i = 0; mods->sml_nvalues[i].bv_val != NULL; i++ ) {
+                                       /* test asserted values against themselves */
+                                       for( j = 0; j < i; j++ ) {
+                                               rc = value_match( &match, mods->sml_desc, mr,
+                                                       SLAP_MR_EQUALITY | SLAP_MR_VALUE_OF_ASSERTION_SYNTAX
+                                                       | SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH
+                                                       | SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH,
+                                                       &mods->sml_nvalues[i], &mods->sml_nvalues[j], &text );
+                                               if ( rc == LDAP_SUCCESS && match == 0 ) {
+                                                       /* value exists already */
+                                                       snprintf( textbuf, textlen,
+                                                               "%s: value #%d provided more than once",
+                                                               mods->sml_desc->ad_cname.bv_val, j );
+                                                       return LDAP_TYPE_OR_VALUE_EXISTS;
+                                               }
+                                       }
+                               }
+#else
                                rc = modify_check_duplicates( mods->sml_desc, mr,
                                                NULL, mods->sml_bvalues, 0,
                                                &text, textbuf, sizeof( textbuf ) );
-
+#endif
                                if ( rc != LDAP_SUCCESS ) {
                                        return rc;
                                }
@@ -501,8 +524,12 @@ slap_mods2entry(
                mods->sml_values = NULL;
 
 #ifdef SLAP_NVALUES
-               attr->a_nvals = mods->sml_nvalues;
-               mods->sml_nvalues = NULL;
+               if ( mods->sml_nvalues ) {
+                       attr->a_nvals = mods->sml_nvalues;
+                       mods->sml_nvalues = NULL;
+               } else {
+                       attr->a_nvals = attr->a_vals;
+               }
 #endif
 
                *tail = attr;
index d98ec3cefed171fe50df5985ac62032d92d8078b..d2a52aee5f81d106a993706e43fccdc59835f140 100644 (file)
@@ -27,7 +27,7 @@ attr_free( Attribute *a )
 {
        ber_bvarray_free( a->a_vals );
 #ifdef SLAP_NVALUES
-       ber_bvarray_free( a->a_nvals );
+       if (a->a_nvals != a->a_vals) ber_bvarray_free( a->a_nvals );
 #endif
        free( a );
 }
@@ -66,7 +66,7 @@ Attribute *attr_dup( Attribute *a )
                tmp->a_vals[i].bv_val = NULL;
 
 #ifdef SLAP_NVALUES
-               if( a->a_nvals != NULL ) {
+               if( a->a_nvals != a->a_vals ) {
                        tmp->a_nvals = ch_malloc((i+1) * sizeof(struct berval));
                        for( i=0; a->a_nvals[i].bv_val != NULL; i++ ) {
                                ber_dupbv( &tmp->a_nvals[i], &a->a_nvals[i] );
@@ -75,7 +75,7 @@ Attribute *attr_dup( Attribute *a )
                        tmp->a_nvals[i].bv_val = NULL;
 
                } else {
-                       tmp->a_nvals = NULL;
+                       tmp->a_nvals = tmp->a_vals;
                }
 #endif
 
@@ -154,6 +154,7 @@ attr_merge(
 
 #ifdef SLAP_NVALUES
        if( !rc && nvals ) rc = value_add( &(*a)->a_nvals, nvals );
+       else (*a)->a_nvals = (*a)->a_vals;
 #endif
 
        return rc;
@@ -192,6 +193,7 @@ attr_merge_one(
 
 #ifdef SLAP_NVALUES
        if( !rc && nval ) rc = value_add_one( &(*a)->a_nvals, nval );
+       else (*a)->a_nvals = (*a)->a_vals;
 #endif
        return rc;
 }
index 921491753f22161714383e32a5973c70c8026a7b..9ab9ec52d7832f18ba7ba85f4957af04d67b2476 100644 (file)
@@ -203,7 +203,7 @@ dn2entry_retry:
                        && op != NULL
                        && access_allowed(be, conn, op, e, entry_at,
 #ifdef SLAP_NVALUES
-                               attr->a_nvals ? &attr->a_nvals[i] : &attr->a_vals[i],
+                               &attr->a_nvals[i],
 #else
                                &attr->a_vals[i],
 #endif
@@ -213,8 +213,7 @@ dn2entry_retry:
                }
 
 #ifdef SLAP_NVALUES
-               ber_dupbv( &v[j],
-                       attr->a_nvals ? &attr->a_nvals[i] : &attr->a_vals[i] );
+               ber_dupbv( &v[j], &attr->a_nvals[i] );
 #else
                ber_dupbv( &v[j], &attr->a_vals[i] );
 #endif
index 919426fa4e137b9397805061122d90ffd00099f9..c52d37a9116cc7f2b9ba122fd31d50dc0234c144 100644 (file)
@@ -129,7 +129,7 @@ dn2entry_retry:
                if ( value_find_ex( ava->aa_desc,
                        SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH |
                                SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
-                       a->a_nvals ? a->a_nvals : a->a_vals, &ava->aa_value ) == 0 )
+                       a->a_nvals, &ava->aa_value ) == 0 )
 #else
                if ( value_find( ava->aa_desc, a->a_vals, &ava->aa_value ) == 0 )
 #endif
index 5f2cff0d813199f47b48765fa422fc0b204b285a..9bd5d9c57ddfec5dda58b92d03320dc2a79e5102 100644 (file)
@@ -219,8 +219,7 @@ dn2entry_retry:
 #ifdef SLAP_NVALUES
        if( value_find_ex( group_at, SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH
                        | SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
-               attr->a_nvals ? attr->a_nvals : attr->a_vals,
-               op_ndn ) != LDAP_SUCCESS )
+               attr->a_nvals, op_ndn ) != LDAP_SUCCESS )
 #else
        if( value_find_ex( group_at, 0, attr->a_vals, op_ndn ) != LDAP_SUCCESS )
 #endif
index 86c777ef169715ae59320889afcb73cce1b9bb82..ac302beff454cf549bcf8a6bdbaf5a8fbfb5daa7 100644 (file)
@@ -358,8 +358,7 @@ bdb_index_entry(
        for ( ; ap != NULL; ap = ap->a_next ) {
 #ifdef SLAP_NVALUES
                rc = bdb_index_values( be, txn, ap->a_desc,
-                       ap->a_nvals ? ap->a_nvals : ap->a_vals,
-                       e->e_id, op );
+                       ap->a_nvals, e->e_id, op );
 #else
                rc = bdb_index_values( be, txn, ap->a_desc,
                        ap->a_vals, e->e_id, op );
index 8cc9a06b632091569ab8b5a9f86e70f5eb705c72..b24d90e90e15483b5db904b270d0f506f2ad0f4f 100644 (file)
@@ -211,7 +211,7 @@ int bdb_modify_internal(
                if ( ap->a_flags & SLAP_ATTR_IXDEL ) {
                        rc = bdb_index_values( be, tid, ap->a_desc,
 #ifdef SLAP_NVALUES
-                               ap->a_nvals ? ap->a_nvals : ap->a_vals,
+                               ap->a_nvals,
 #else
                                ap->a_vals,
 #endif
@@ -239,7 +239,7 @@ int bdb_modify_internal(
                if (ap->a_flags & SLAP_ATTR_IXADD) {
                        rc = bdb_index_values( be, tid, ap->a_desc,
 #ifdef SLAP_NVALUES
-                               ap->a_nvals ? ap->a_nvals : ap->a_vals,
+                               ap->a_nvals,
 #else
                                ap->a_vals,
 #endif
index 7365a2d6551412839a2e3edfec0f26922e9308b1..8bf93888d22b3fd5de9c7d5d0caad59250c8bdea 100644 (file)
@@ -940,6 +940,9 @@ done:
                Modifications *tmp;
                for (; mod; mod=tmp ) {
                        tmp = mod->sml_next;
+#ifdef SLAP_NVALUES
+                       if ( mod->sml_nvalues ) free( mod->sml_nvalues[0].bv_val );
+#endif
                        free( mod );
                }
        }
index dad8445069c63e3f58148938b72f6611579c4865..58148454206cafdf658d7a54f804af47c2278854 100644 (file)
@@ -107,8 +107,7 @@ ldbm_back_compare(
                if ( value_find_ex( ava->aa_desc,
                        SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH |
                                SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
-                       a->a_nvals ? a->a_nvals : a->a_vals,
-                       &ava->aa_value ) == 0 )
+                       a->a_nvals, &ava->aa_value ) == 0 )
 #else
                if ( value_find( ava->aa_desc, a->a_vals, &ava->aa_value ) == 0 )
 #endif
index 73965f9e9cdba4f9e3f7dd53d163f07bce930612..cfd28f73d08b5395c613a92511c7b9dfd6d6deb8 100644 (file)
@@ -182,8 +182,7 @@ ldbm_back_group(
        if( value_find_ex( group_at,
                SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH
                        | SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
-               attr->a_nvals ? attr->a_nvals : attr->a_vals,
-               op_ndn ) != LDAP_SUCCESS )
+               attr->a_nvals, op_ndn ) != LDAP_SUCCESS )
 #else
        if( value_find_ex( group_at, 0, attr->a_vals, op_ndn ) != LDAP_SUCCESS )
 #endif
index 250a83241daee52b9cf1c1b51b5fcc5b13eb95cc..74b4a36f2e262f9dad2ae0ca282fe67b4402cdd7 100644 (file)
@@ -311,7 +311,7 @@ index_entry(
        for ( ; ap != NULL; ap = ap->a_next ) {
                index_values( be, ap->a_desc,
 #ifdef SLAP_NVALUES
-                       ap->a_nvals ? ap->a_nvals : ap->a_vals,
+                       ap->a_nvals,
 #else
                        ap->a_vals,
 #endif
index 11271c760006d70394f9ca21b146b24c9869bc30..7d4bb818a3aa7173b560a27898ea6196d194d120 100644 (file)
@@ -227,7 +227,7 @@ int ldbm_modify_internal(
                if ( ap->a_flags & SLAP_ATTR_IXDEL ) {
                        rc = index_values( be, ap->a_desc,
 #ifdef SLAP_NVALUES
-                               ap->a_nvals ? ap->a_nvals : ap->a_vals,
+                               ap->a_nvals,
 #else
                                ap->a_vals,
 #endif
@@ -253,7 +253,7 @@ int ldbm_modify_internal(
                if ( ap->a_flags & SLAP_ATTR_IXADD ) {
                        rc = index_values( be, ap->a_desc,
 #ifdef SLAP_NVALUES
-                               ap->a_nvals ? ap->a_nvals : ap->a_vals,
+                               ap->a_nvals,
 #else
                                ap->a_vals,
 #endif
index eddeb5a2bd7c25defc177e9da9a3c5dfd8f29c36..3995cc5178420266194b43b79e0d2dfc976ac2e8 100644 (file)
@@ -661,6 +661,9 @@ return_results:
        if ( mod != NULL ) {
                Modifications *tmp;
                for (; mod; mod = tmp ) {
+#ifdef SLAP_NVALUES
+                       if ( mod->sml_nvalues ) free( mod->sml_nvalues[0].bv_val );
+#endif
                        tmp = mod->sml_next;
                        free( mod );
                }
index 32885e0b51a30873ebe00783c04cbe3dd6252335..dd929a5cf77633a13f3e8ec34ccce759596717a2 100644 (file)
@@ -84,8 +84,7 @@ monitor_back_compare(
 #ifdef SLAP_NVALUES
                if ( value_find_ex( ava->aa_desc,
                        SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH,
-                       a->a_nvals ? a->a_nvals : a->a_vals,
-                       &ava->aa_value ) == 0 )
+                       a->a_nvals, &ava->aa_value ) == 0 )
 #else
                if ( value_find( ava->aa_desc, a->a_vals, &ava->aa_value ) == 0 )
 #endif
index 21aeb3e899802e4eb439b4df232a81440ae0dd7d..17a080cc1b6f0ea3cfc1e73be5166257e1d058f3 100644 (file)
@@ -358,7 +358,7 @@ static int compare_entry(
                if ( value_find_ex( ava->aa_desc,
                        SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH |
                                SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
-                       a->a_nvals ? a->a_nvals : a->a_vals,
+                       a->a_nvals,
                        &ava->aa_value ) == 0 )
 #else
                if ( value_find( ava->aa_desc, a->a_vals, &ava->aa_value ) == 0 )
index fe0985de81d555e2e74251de28043c0ea136e799..745e96a2e90da4c15fdc297d4d439985f6725db6 100644 (file)
@@ -545,7 +545,7 @@ int entry_encode(Entry *e, struct berval *bv)
                len += entry_lenlen(i);
                siz += sizeof(struct berval);   /* empty berval at end */
 #ifdef SLAP_NVALUES_ON_DISK
-               if (a->a_nvals) {
+               if (a->a_nvals != a->a_vals) {
                        for (i=0; a->a_nvals[i].bv_val; i++) {
                                siz += sizeof(struct berval);
                                len += a->a_nvals[i].bv_len + 1;
@@ -590,7 +590,7 @@ int entry_encode(Entry *e, struct berval *bv)
                        *ptr++ = '\0';
                    }
 #ifdef SLAP_NVALUES_ON_DISK
-                   if (a->a_nvals) {
+                   if (a->a_nvals != a->a_vals) {
                        entry_putlen(&ptr, i);
                        for (i=0; a->a_nvals[i].bv_val; i++) {
                            entry_putlen(&ptr, a->a_nvals[i].bv_len);
@@ -725,7 +725,7 @@ int entry_decode(struct berval *bv, Entry **e)
                        bptr->bv_len = 0;
                        bptr++;
                } else {
-                       a->a_nvals = NULL;
+                       a->a_nvals = a->a_vals;
                }
 #elif defined(SLAP_NVALUES)
                if( count && ad->ad_type->sat_equality &&
@@ -756,6 +756,8 @@ int entry_decode(struct berval *bv, Entry **e)
                        }
                        a->a_nvals[j].bv_val = NULL;
                        a->a_nvals[j].bv_len = 0;
+               } else {
+                       a->a_nvals = a->a_vals;
                }
 #endif
 
index b523c756fde833a90c565fc2b09167a245fc734b..935358373d375e3e85f31739b27958cc92e1bb82 100644 (file)
@@ -233,11 +233,11 @@ static int test_mra_filter(
                {
                        struct berval *bv;
 #ifdef SLAP_NVALUES
-                       for ( bv = a->a_nvals ? a->a_nvals : a->a_vals;
-                               bv->bv_val != NULL; bv++ )
+                       bv = a->a_nvals;
 #else
-                       for ( bv = a->a_vals; bv->bv_val != NULL; bv++ )
+                       bv = a->a_vals;
 #endif
+                       for ( ; bv->bv_val != NULL; bv++ )
                        {
                                int ret;
                                int rc;
@@ -292,8 +292,7 @@ static int test_mra_filter(
 
                        /* check match */
 #ifdef SLAP_NVALUES
-                       for ( bv = a->a_nvals ? a->a_nvals : a->a_vals;
-                               bv->bv_val != NULL; bv++ )
+                       for ( bv = a->a_nvals; bv->bv_val != NULL; bv++ )
 #else
                        for ( bv = a->a_vals; bv->bv_val != NULL; bv++ )
 #endif
@@ -447,8 +446,7 @@ test_ava_filter(
                }
 
 #ifdef SLAP_NVALUES
-               for ( bv = a->a_nvals ? a->a_nvals : a->a_vals;
-                       bv->bv_val != NULL; bv++ )
+               for ( bv = a->a_nvals; bv->bv_val != NULL; bv++ )
 #else
                for ( bv = a->a_vals; bv->bv_val != NULL; bv++ )
 #endif
@@ -684,8 +682,7 @@ test_substrings_filter(
                }
 
 #ifdef SLAP_NVALUES
-               for ( bv = a->a_nvals ? a->a_nvals : a->a_vals;
-                       bv->bv_val != NULL; bv++ )
+               for ( bv = a->a_nvals; bv->bv_val != NULL; bv++ )
 #else
                for ( bv = a->a_vals; bv->bv_val != NULL; bv++ )
 #endif
index 17fe275a52ee358afdd43bc446aba6c3ab5623d4..4f0dafbdb6f22a3b977da373a4d084e71b791f35 100644 (file)
@@ -388,7 +388,12 @@ test_mra_vrFilter(
                        if( rc != LDAP_SUCCESS ) continue;
                }
 
-               for ( bv = a->a_vals, j = 0; bv->bv_val != NULL; bv++, j++ ) {
+#ifdef SLAP_NVALUES
+               bv = a->a_nvals;
+#else
+               bv = a->a_vals;
+#endif
+               for ( j = 0; bv->bv_val != NULL; bv++, j++ ) {
                        int ret;
                        int rc;
                        const char *text;
index 3834e065b0ac37a41e22835c640112473dcea5b8..0a7cc9ed7ecce241b0f0a7ed251fd3bf62fc2103 100644 (file)
@@ -564,7 +564,7 @@ slap_modrdn2mods(
                        /* Apply modification */
 #ifdef SLAP_NVALUES
                        mod_tmp = ( Modifications * )ch_malloc( sizeof( Modifications )
-                               + 2 * sizeof ( struct berval ) );
+                               + 4 * sizeof ( struct berval ) );
 #else
                        mod_tmp = ( Modifications * )ch_malloc( sizeof( Modifications )
                                + 2 * sizeof ( struct berval ) );
index cedc658c2023eed54db9d92ef30660ca45cda6f3..fe1cd48aa880e4527937b52dda31d2001ca3273f 100644 (file)
@@ -31,7 +31,7 @@ modify_check_duplicates(
        int             i, j, numvals = 0, nummods,
                        rc = LDAP_SUCCESS, matched;
 #ifdef SLAP_NVALUES
-       /* needs major reworking */
+       /* this function is no longer used */
 #else
        BerVarray       nvals = NULL, nmods = NULL;
 
@@ -315,11 +315,6 @@ modify_add_values(
 
        /* check if the values we're adding already exist */
        if( mr == NULL || !mr->smr_match ) {
-#ifdef SLAP_NVALUES
-               /* we should have no normalized values as there is no equality rule */
-               /* assert( mod->sm_nvalues[0].bv_val == NULL); */
-#endif
-
                if ( a != NULL ) {
                        /* do not allow add of additional attribute
                                if no equality rule exists */
@@ -333,11 +328,6 @@ modify_add_values(
                for ( i = 0; mod->sm_bvalues[i].bv_val != NULL; i++ ) {
                        /* test asserted values against existing values */
                        if( a ) {
-#ifdef SLAP_NVALUES
-                               /* we should have no normalized values as there
-                                       is no equality rule */
-                               assert( a->a_nvals == NULL);
-#endif
                                for( matched = 0, j = 0; a->a_vals[j].bv_val != NULL; j++ ) {
                                        if ( bvmatch( &mod->sm_bvalues[i], &a->a_vals[j] ) ) {
                                                if ( permissive ) {
@@ -639,11 +629,13 @@ modify_delete_values(
                                        mr, &a->a_nvals[j],
                                        &mod->sm_nvalues[i] );
                        } else {
+#if 0
                                assert( a->a_nvals == NULL );
+#endif
                                rc = (*mr->smr_match)( &match,
                                        SLAP_MR_VALUE_OF_ATTRIBUTE_SYNTAX,
                                        a->a_desc->ad_type->sat_syntax,
-                                       mr, &a->a_nvals[j],
+                                       mr, &a->a_vals[j],
                                        &mod->sm_values[i] );
                        }
 #else
@@ -675,7 +667,7 @@ modify_delete_values(
 #ifdef SLAP_NVALUES
                        free( a->a_vals[j].bv_val );
                        a->a_vals[j].bv_val = &dummy;
-                       if( a->a_nvals ) {
+                       if( a->a_nvals != a->a_vals ) {
                                free( a->a_nvals[j].bv_val );
                                a->a_nvals[j].bv_val = &dummy;
                        }
@@ -723,7 +715,7 @@ modify_delete_values(
                if ( j != k ) {
                        a->a_vals[ j ] = a->a_vals[ k ];
 #ifdef SLAP_NVALUES
-                       if (a->a_nvals) {
+                       if (a->a_nvals != a->a_vals) {
                                a->a_nvals[ j ] = a->a_nvals[ k ];
                        }
 #endif
@@ -740,7 +732,7 @@ modify_delete_values(
 
        a->a_vals[j].bv_val = NULL;
 #ifdef SLAP_NVALUES
-       if (a->a_nvals) a->a_nvals[j].bv_val = NULL;
+       if (a->a_nvals != a->a_vals) a->a_nvals[j].bv_val = NULL;
 #else
 
        assert( i == k - j );
index 3517fbe86826cc0299443da57c3a918e3ece570e..b40f3d9ef36ce96fb628670ca38aab6e9f30d3c3 100644 (file)
@@ -66,7 +66,7 @@ slap_operational_hasSubordinate( int hs )
        a->a_vals[1].bv_val = NULL;
 
 #ifdef SLAP_NVALUES
-       a->a_nvals = NULL;
+       a->a_nvals = a->a_vals;
 #endif
 
        a->a_next = NULL;
index 90a7193467000c2842476fe11abb1bd7c5aa0f20..e8a3971c402e3bd9612edc380f584b7b9cd1eab4 100644 (file)
@@ -101,7 +101,7 @@ root_dse_info(
        vals[0].bv_val = "top";
        vals[0].bv_len = sizeof("top")-1;
 #ifdef SLAP_NVALUES
-       if( attr_merge( e, ad_objectClass, vals, vals ) )
+       if( attr_merge( e, ad_objectClass, vals, NULL ) )
 #else
        if( attr_merge( e, ad_objectClass, vals ) )
 #endif
@@ -112,13 +112,13 @@ root_dse_info(
        vals[0].bv_val = "OpenLDAProotDSE";
        vals[0].bv_len = sizeof("OpenLDAProotDSE")-1;
 #ifdef SLAP_NVALUES
-       if( attr_merge( e, ad_objectClass, vals, vals ) )
+       if( attr_merge( e, ad_objectClass, vals, NULL ) )
 #else
        if( attr_merge( e, ad_objectClass, vals ) )
 #endif
                return LDAP_OTHER;
 #ifdef SLAP_NVALUES
-       if( attr_merge( e, ad_structuralObjectClass, vals, vals ) )
+       if( attr_merge( e, ad_structuralObjectClass, vals, NULL ) )
 #else
        if( attr_merge( e, ad_structuralObjectClass, vals ) )
 #endif
@@ -128,6 +128,7 @@ root_dse_info(
                if ( backends[i].be_flags & SLAP_BFLAG_MONITOR ) {
                        vals[0] = backends[i].be_suffix[0];
 #ifdef SLAP_NVALUES
+                       nvals[0] = backends[i].be_nsuffix[0];
                        if( attr_merge( e, ad_monitorContext, vals, nvals ) )
 #else
                        if( attr_merge( e, ad_monitorContext, vals ) )
@@ -143,7 +144,8 @@ root_dse_info(
                for ( j = 0; backends[i].be_suffix[j].bv_val != NULL; j++ ) {
                        vals[0] = backends[i].be_suffix[j];
 #ifdef SLAP_NVALUES
-                       if( attr_merge( e, ad_namingContexts, vals, NULL ) )
+                       nvals[0] = backends[i].be_nsuffix[0];
+                       if( attr_merge( e, ad_namingContexts, vals, nvals ) )
 #else
                        if( attr_merge( e, ad_namingContexts, vals ) )
 #endif
@@ -191,7 +193,7 @@ root_dse_info(
        /* supportedFeatures */
 #ifdef SLAP_NVALUES
        if( attr_merge( e, ad_supportedFeatures,
-               supportedFeatures, supportedFeatures ) )
+               supportedFeatures, NULL ) )
 #else
        if( attr_merge( e, ad_supportedFeatures, supportedFeatures ) )
 #endif
@@ -255,7 +257,8 @@ root_dse_info(
                Attribute *a;
                for( a = usr_attr->e_attrs; a != NULL; a = a->a_next ) {
 #ifdef SLAP_NVALUES
-                       if( attr_merge( e, a->a_desc, a->a_vals, a->a_nvals ) )
+                       if( attr_merge( e, a->a_desc, a->a_vals,
+                        (a->a_nvals == a->a_vals) ? NULL : a->a_nvals ) )
 #else
                        if( attr_merge( e, a->a_desc, a->a_vals ) )
 #endif
@@ -332,7 +335,8 @@ int read_root_dse_file( const char *fname )
 
                for(a = e->e_attrs; a != NULL; a = a->a_next) {
 #ifdef SLAP_NVALUES
-                       if( attr_merge( usr_attr, a->a_desc, a->a_vals, a->a_nvals ) )
+                       if( attr_merge( usr_attr, a->a_desc, a->a_vals,
+                       (a->a_nvals == a->a_vals) ? NULL : a->a_nvals ) )
 #else
                        if( attr_merge( usr_attr, a->a_desc, a->a_vals ) )
 #endif
index 357f7f5ae96dfff2dabcb0fcc28d05b445b61422..8a532897463af1426411e51e9bc325cdfdf16c52 100644 (file)
@@ -859,7 +859,7 @@ entry_naming_check(
 #ifdef SLAP_NVALUES
                if ( value_find_ex( desc,
                        SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH,
-                       attr->a_nvals ? attr->a_nvals : attr->a_vals,
+                       attr->a_nvals,
                        &ava->la_value ) != 0 )
 #else
                if ( value_find( desc, attr->a_vals, &ava->la_value ) != 0 )