]> git.sur5r.net Git - openldap/commitdiff
More memory context tweaks
authorHoward Chu <hyc@openldap.org>
Fri, 11 Apr 2003 01:29:28 +0000 (01:29 +0000)
committerHoward Chu <hyc@openldap.org>
Fri, 11 Apr 2003 01:29:28 +0000 (01:29 +0000)
66 files changed:
servers/slapd/acl.c
servers/slapd/aclparse.c
servers/slapd/add.c
servers/slapd/attr.c
servers/slapd/ava.c
servers/slapd/back-bdb/add.c
servers/slapd/back-bdb/compare.c
servers/slapd/back-bdb/delete.c
servers/slapd/back-bdb/filterindex.c
servers/slapd/back-bdb/index.c
servers/slapd/back-bdb/modify.c
servers/slapd/back-bdb/modrdn.c
servers/slapd/back-bdb/passwd.c
servers/slapd/back-bdb/proto-bdb.h
servers/slapd/back-bdb/search.c
servers/slapd/back-bdb/tools.c
servers/slapd/back-ldap/back-ldap.h
servers/slapd/back-ldap/config.c
servers/slapd/back-ldap/search.c
servers/slapd/back-ldap/suffixmassage.c
servers/slapd/back-ldbm/add.c
servers/slapd/back-ldbm/compare.c
servers/slapd/back-ldbm/delete.c
servers/slapd/back-ldbm/filterindex.c
servers/slapd/back-ldbm/index.c
servers/slapd/back-ldbm/modify.c
servers/slapd/back-ldbm/modrdn.c
servers/slapd/back-ldbm/passwd.c
servers/slapd/back-ldbm/proto-back-ldbm.h
servers/slapd/back-ldbm/search.c
servers/slapd/back-ldbm/tools.c
servers/slapd/back-monitor/conn.c
servers/slapd/back-passwd/search.c
servers/slapd/back-sql/modify.c
servers/slapd/backend.c
servers/slapd/bind.c
servers/slapd/compare.c
servers/slapd/config.c
servers/slapd/connection.c
servers/slapd/delete.c
servers/slapd/dn.c
servers/slapd/entry.c
servers/slapd/filter.c
servers/slapd/filterentry.c
servers/slapd/limits.c
servers/slapd/matchedValues.c
servers/slapd/modify.c
servers/slapd/modrdn.c
servers/slapd/mra.c
servers/slapd/proto-slap.h
servers/slapd/referral.c
servers/slapd/repl.c
servers/slapd/sasl.c
servers/slapd/saslauthz.c
servers/slapd/schema_check.c
servers/slapd/schema_init.c
servers/slapd/schema_prep.c
servers/slapd/search.c
servers/slapd/sl_malloc.c
servers/slapd/slap.h
servers/slapd/slapi/slapi_ops.c
servers/slapd/slapi/slapi_utils.c
servers/slapd/tools/Makefile.in
servers/slapd/tools/mimic.c
servers/slapd/tools/slapcommon.c
servers/slapd/value.c

index 143d53d18dcd92648904169901f1766ee5a45f7d..d51e3c7aaf2c1eb58e4d7a4db00959f9448dbc4c 100644 (file)
@@ -670,7 +670,7 @@ acl_mask(
 
                                        string_expand(&bv, &b->a_dn_pat, 
                                                        e->e_ndn, matches);
-                                       if ( dnNormalize2(NULL, &bv, &pat) != LDAP_SUCCESS ) {
+                                       if ( dnNormalize2(NULL, &bv, &pat, op->o_tmpmemctx ) != LDAP_SUCCESS ) {
                                                /* did not expand to a valid dn */
                                                continue;
                                        }
@@ -903,7 +903,7 @@ dn_match_cleanup:;
                                        SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH |
                                                SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
                                        at->a_nvals,
-                                       &bv ) == 0 )
+                                       &bv, op->o_tmpmemctx ) == 0 )
                                {
                                        /* found it */
                                        match = 1;
@@ -975,7 +975,7 @@ dn_match_cleanup:;
                                bv.bv_val = buf; 
 
                                string_expand( &bv, &b->a_group_pat, e->e_ndn, matches );
-                               if ( dnNormalize2( NULL, &bv, &ndn ) != LDAP_SUCCESS ) {
+                               if ( dnNormalize2( NULL, &bv, &ndn, op->o_tmpmemctx ) != LDAP_SUCCESS ) {
                                        /* did not expand to a valid dn */
                                        continue;
                                }
@@ -1435,7 +1435,7 @@ aci_set_gather (void *cookie, struct berval *name, struct berval *attr)
         * also return the syntax or some "comparison cookie".
         */
 
-       if (dnNormalize2(NULL, name, &ndn) == LDAP_SUCCESS) {
+       if (dnNormalize2(NULL, name, &ndn, cp->op->o_tmpmemctx ) == LDAP_SUCCESS) {
                const char *text;
                AttributeDescription *desc = NULL;
                if (slap_bv2ad(attr, &desc, &text) == LDAP_SUCCESS) {
@@ -1483,7 +1483,7 @@ aci_match_set (
                         * NOTE: dnNormalize2 honors the ber_len field
                         * as the length of the dn to be normalized
                         */
-                       if ( dnNormalize2(NULL, &subjdn, &ndn) == LDAP_SUCCESS
+                       if ( dnNormalize2(NULL, &subjdn, &ndn, op->o_tmpmemctx) == LDAP_SUCCESS
                                && slap_bv2ad(&setat, &desc, &text) == LDAP_SUCCESS )
                        {
                                backend_attribute(op, e,
index e22f3263ec5a715c7550dc5f20dc42c43942534c..0032846346699260a925059317b70088e9a86f91 100644 (file)
@@ -239,7 +239,7 @@ parse_acl(
                        {
                                if ( a->acl_dn_style != ACL_STYLE_REGEX ) {
                                        struct berval bv;
-                                       rc = dnNormalize2( NULL, &a->acl_dn_pat, &bv);
+                                       rc = dnNormalize2( NULL, &a->acl_dn_pat, &bv, NULL);
                                        if ( rc != LDAP_SUCCESS ) {
                                                fprintf( stderr,
                                                        "%s: line %d: bad DN \"%s\"\n",
@@ -410,7 +410,7 @@ parse_acl(
                                        }
 
                                        if ( sty != ACL_STYLE_REGEX && expand == 0 ) {
-                                               rc = dnNormalize2(NULL, &bv, &b->a_dn_pat);
+                                               rc = dnNormalize2(NULL, &bv, &b->a_dn_pat, NULL);
                                                if ( rc != LDAP_SUCCESS ) {
                                                        fprintf( stderr,
                                                                "%s: line %d: bad DN \"%s\"\n",
@@ -520,7 +520,7 @@ parse_acl(
                                                b->a_group_pat = bv;
                                        } else {
                                                ber_str2bv( right, 0, 0, &bv );
-                                               rc = dnNormalize2( NULL, &bv, &b->a_group_pat );
+                                               rc = dnNormalize2( NULL, &bv, &b->a_group_pat, NULL );
                                                if ( rc != LDAP_SUCCESS ) {
                                                        fprintf( stderr,
                                                                "%s: line %d: bad DN \"%s\"\n",
index 400f926534880bf1017be8b1abe17e8b6dccbc68..376e931afc5fd5e42e40d8fe5bb808ed96f1a950 100644 (file)
@@ -78,7 +78,7 @@ do_add( Operation *op, SlapReply *rs )
 
        e = (Entry *) ch_calloc( 1, sizeof(Entry) );
 
-       rs->sr_err = dnPrettyNormal( NULL, &dn, &e->e_name, &e->e_nname );
+       rs->sr_err = dnPrettyNormal( NULL, &dn, &e->e_name, &e->e_nname, op->o_tmpmemctx );
 
        if( rs->sr_err != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
@@ -242,7 +242,7 @@ do_add( Operation *op, SlapReply *rs )
                        size_t textlen = sizeof textbuf;
 
                        rs->sr_err = slap_mods_check( modlist, update, &rs->sr_text,
-                               textbuf, textlen );
+                               textbuf, textlen, op->o_tmpmemctx );
 
                        if( rs->sr_err != LDAP_SUCCESS ) {
                                send_ldap_result( op, rs );
index a2a009aeff20bb3cb6d10d3fc536bcd0443b0e6b..d1023d96231ce053d6176a926cfe5cc7219bba0c 100644 (file)
@@ -156,7 +156,8 @@ int
 attr_merge_normalize(
        Entry           *e,
        AttributeDescription *desc,
-       BerVarray       vals
+       BerVarray       vals,
+       void     *memctx
 ) {
        BerVarray       nvals = NULL;
        int             rc;
@@ -172,7 +173,7 @@ attr_merge_normalize(
                                        0,
                                        desc->ad_type->sat_syntax,
                                        desc->ad_type->sat_equality,
-                                       &vals[i], &nvals[i] );
+                                       &vals[i], &nvals[i], memctx );
 
                        if ( rc != LDAP_SUCCESS ) {
                                nvals[i+1].bv_val = NULL;
@@ -225,7 +226,8 @@ int
 attr_merge_normalize_one(
        Entry           *e,
        AttributeDescription *desc,
-       struct berval   *val
+       struct berval   *val,
+       void            *memctx
 ) {
        struct berval   nval;
        int             rc;
@@ -235,7 +237,7 @@ attr_merge_normalize_one(
                                0,
                                desc->ad_type->sat_syntax,
                                desc->ad_type->sat_equality,
-                               val, &nval );
+                               val, &nval, memctx );
 
                if ( rc != LDAP_SUCCESS ) {
                        return rc;
index bf43ec5dea5f57453cabb0f651607750259dcb31..0ec27edcc51db98e816badf8b4304f9015195e3d 100644 (file)
@@ -22,8 +22,7 @@ ava_free(
        int     freeit
 )
 {
-       /* op->o_tmpfree( ava->aa_value.bv_val, op->o_tmpmemctx ); */
-       ch_free( ava->aa_value.bv_val );
+       op->o_tmpfree( ava->aa_value.bv_val, op->o_tmpmemctx );
        if ( freeit ) {
                op->o_tmpfree( (char *) ava, op->o_tmpmemctx );
        }
@@ -68,7 +67,7 @@ get_ava(
 
        rc = asserted_value_validate_normalize(
                aa->aa_desc, ad_mr(aa->aa_desc, usage),
-               usage, &value, &aa->aa_value, text );
+               usage, &value, &aa->aa_value, text, op->o_tmpmemctx );
 
        if( rc != LDAP_SUCCESS ) {
                op->o_tmpfree( aa, op->o_tmpmemctx );
index 2def78482cc7ebcb143ee283c77ffcaf9d40c77a..0d919f10699aaa3e53047da53e7318961424d042 100644 (file)
@@ -415,7 +415,7 @@ retry:      /* transaction retry */
        }
 
        /* attribute indexes */
-       rs->sr_err = bdb_index_entry_add( op->o_bd, ltid, op->oq_add.rs_e );
+       rs->sr_err = bdb_index_entry_add( op, ltid, op->oq_add.rs_e );
        if ( rs->sr_err != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
                LDAP_LOG ( OPERATION, ERR, 
index eb928e3b5c310854a0df63306b1dc087017f95ab..65b9e6de9bb2fa0c9086ba4e013b5421bc972d44 100644 (file)
@@ -119,7 +119,7 @@ dn2entry_retry:
                if ( value_find_ex( op->oq_compare.rs_ava->aa_desc,
                        SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH |
                                SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
-                       a->a_nvals, &op->oq_compare.rs_ava->aa_value ) == 0 )
+                       a->a_nvals, &op->oq_compare.rs_ava->aa_value, op->o_tmpmemctx ) == 0 )
                {
                        rs->sr_err = LDAP_COMPARE_TRUE;
                        break;
index 4d59452d7d60239a384c8e7a6117c5bfd8fe5545..bb7c90def3352a19aba6bb50bf096a61a41ea22f 100644 (file)
@@ -388,7 +388,7 @@ retry:      /* transaction retry */
        }
 
        /* delete indices for old attributes */
-       rs->sr_err = bdb_index_entry_del( op->o_bd, ltid, e );
+       rs->sr_err = bdb_index_entry_del( op, ltid, e );
        if ( rs->sr_err != LDAP_SUCCESS ) {
                switch( rs->sr_err ) {
                case DB_LOCK_DEADLOCK:
index 80354a7b8ba094afb12ea204e8141716ca11893e..3a123b68e225c10d25aefb93973b917e139fa92b 100644 (file)
 #include "idl.h"
 
 static int presence_candidates(
-       Backend *be,
+       Operation *op,
        AttributeDescription *desc,
        ID *ids );
 
 static int equality_candidates(
-       Backend *be,
+       Operation *op,
        AttributeAssertion *ava,
        ID *ids,
        ID *tmp );
 static int approx_candidates(
-       Backend *be,
+       Operation *op,
        AttributeAssertion *ava,
        ID *ids,
        ID *tmp );
 static int substring_candidates(
-       Backend *be,
+       Operation *op,
        SubstringsAssertion *sub,
        ID *ids,
        ID *tmp );
 
 static int list_candidates(
-       Backend *be,
+       Operation *op,
        Filter *flist,
        int ftype,
        ID *ids,
@@ -44,7 +44,7 @@ static int list_candidates(
 
 int
 bdb_filter_candidates(
-       Backend *be,
+       Operation *op,
        Filter  *f,
        ID *ids,
        ID *tmp,
@@ -64,7 +64,7 @@ bdb_filter_candidates(
 #else
                Debug( LDAP_DEBUG_FILTER, "\tDN ONE\n", 0, 0, 0 );
 #endif
-               rc = bdb_dn2idl( be, f->f_dn, DN_ONE_PREFIX, ids );
+               rc = bdb_dn2idl( op->o_bd, f->f_dn, DN_ONE_PREFIX, ids );
                if( rc == DB_NOTFOUND ) {
                        BDB_IDL_ZERO( ids );
                        rc = 0;
@@ -77,7 +77,7 @@ bdb_filter_candidates(
 #else
                Debug( LDAP_DEBUG_FILTER, "\tDN SUBTREE\n", 0, 0, 0 );
 #endif
-               rc = bdb_dn2idl( be, f->f_dn, DN_SUBTREE_PREFIX, ids );
+               rc = bdb_dn2idl( op->o_bd, f->f_dn, DN_SUBTREE_PREFIX, ids );
                break;
 
        case LDAP_FILTER_PRESENT:
@@ -86,7 +86,7 @@ bdb_filter_candidates(
 #else
                Debug( LDAP_DEBUG_FILTER, "\tPRESENT\n", 0, 0, 0 );
 #endif
-               rc = presence_candidates( be, f->f_desc, ids );
+               rc = presence_candidates( op, f->f_desc, ids );
                break;
 
        case LDAP_FILTER_EQUALITY:
@@ -95,7 +95,7 @@ bdb_filter_candidates(
 #else
                Debug( LDAP_DEBUG_FILTER, "\tEQUALITY\n", 0, 0, 0 );
 #endif
-               rc = equality_candidates( be, f->f_ava, ids, tmp );
+               rc = equality_candidates( op, f->f_ava, ids, tmp );
                break;
 
        case LDAP_FILTER_APPROX:
@@ -104,7 +104,7 @@ bdb_filter_candidates(
 #else
                Debug( LDAP_DEBUG_FILTER, "\tAPPROX\n", 0, 0, 0 );
 #endif
-               rc = approx_candidates( be, f->f_ava, ids, tmp );
+               rc = approx_candidates( op, f->f_ava, ids, tmp );
                break;
 
        case LDAP_FILTER_SUBSTRINGS:
@@ -113,7 +113,7 @@ bdb_filter_candidates(
 #else
                Debug( LDAP_DEBUG_FILTER, "\tSUBSTRINGS\n", 0, 0, 0 );
 #endif
-               rc = substring_candidates( be, f->f_sub, ids, tmp );
+               rc = substring_candidates( op, f->f_sub, ids, tmp );
                break;
 
        case LDAP_FILTER_GE:
@@ -123,7 +123,7 @@ bdb_filter_candidates(
 #else
                Debug( LDAP_DEBUG_FILTER, "\tGE\n", 0, 0, 0 );
 #endif
-               rc = presence_candidates( be, f->f_ava->aa_desc, ids );
+               rc = presence_candidates( op, f->f_ava->aa_desc, ids );
                break;
 
        case LDAP_FILTER_LE:
@@ -133,7 +133,7 @@ bdb_filter_candidates(
 #else
                Debug( LDAP_DEBUG_FILTER, "\tLE\n", 0, 0, 0 );
 #endif
-               rc = presence_candidates( be, f->f_ava->aa_desc, ids );
+               rc = presence_candidates( op, f->f_ava->aa_desc, ids );
                break;
 
        case LDAP_FILTER_NOT:
@@ -151,7 +151,7 @@ bdb_filter_candidates(
 #else
                Debug( LDAP_DEBUG_FILTER, "\tAND\n", 0, 0, 0 );
 #endif
-               rc = list_candidates( be
+               rc = list_candidates( op
                        f->f_and, LDAP_FILTER_AND, ids, tmp, stack );
                break;
 
@@ -161,7 +161,7 @@ bdb_filter_candidates(
 #else
                Debug( LDAP_DEBUG_FILTER, "\tOR\n", 0, 0, 0 );
 #endif
-               rc = list_candidates( be
+               rc = list_candidates( op
                        f->f_or, LDAP_FILTER_OR, ids, tmp, stack );
                break;
 
@@ -191,14 +191,14 @@ bdb_filter_candidates(
 
 static int
 list_candidates(
-       Backend *be,
+       Operation *op,
        Filter  *flist,
        int             ftype,
        ID *ids,
        ID *tmp,
        ID *save )
 {
-       struct bdb_info *bdb = (struct bdb_info *) be->be_private;
+       struct bdb_info *bdb = (struct bdb_info *) op->o_bd->be_private;
        int rc = 0;
        Filter  *f;
 
@@ -216,7 +216,7 @@ list_candidates(
        }
 
        for ( f = flist; f != NULL; f = f->f_next ) {
-               rc = bdb_filter_candidates( be, f, save, tmp,
+               rc = bdb_filter_candidates( op, f, save, tmp,
                        save+BDB_IDL_UM_SIZE );
 
                if ( rc != 0 ) {
@@ -266,11 +266,11 @@ list_candidates(
 
 static int
 presence_candidates(
-       Backend *be,
+       Operation *op,
        AttributeDescription *desc,
        ID *ids )
 {
-       struct bdb_info *bdb = (struct bdb_info *) be->be_private;
+       struct bdb_info *bdb = (struct bdb_info *) op->o_bd->be_private;
        DB *db;
        int rc;
        slap_mask_t mask;
@@ -289,7 +289,7 @@ presence_candidates(
                return 0;
        }
 
-       rc = bdb_index_param( be, desc, LDAP_FILTER_PRESENT,
+       rc = bdb_index_param( op->o_bd, desc, LDAP_FILTER_PRESENT,
                &db, &mask, &prefix );
 
        if( rc != LDAP_SUCCESS ) {
@@ -334,7 +334,7 @@ presence_candidates(
                return 0;
        }
 
-       rc = bdb_key_read( be, db, NULL, &prefix, ids );
+       rc = bdb_key_read( op->o_bd, db, NULL, &prefix, ids );
 
        if( rc == DB_NOTFOUND ) {
                BDB_IDL_ZERO( ids );
@@ -372,7 +372,7 @@ done:
 
 static int
 equality_candidates(
-       Backend *be,
+       Operation *op,
        AttributeAssertion *ava,
        ID *ids,
        ID *tmp )
@@ -393,7 +393,7 @@ equality_candidates(
                        ava->aa_desc->ad_cname.bv_val, 0, 0 );
 #endif
 
-       rc = bdb_index_param( be, ava->aa_desc, LDAP_FILTER_EQUALITY,
+       rc = bdb_index_param( op->o_bd, ava->aa_desc, LDAP_FILTER_EQUALITY,
                &db, &mask, &prefix );
 
        if( rc != LDAP_SUCCESS ) {
@@ -440,7 +440,7 @@ equality_candidates(
                mr,
                &prefix,
                &ava->aa_value,
-               &keys );
+               &keys, op->o_tmpmemctx );
 
        if( rc != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
@@ -471,7 +471,7 @@ equality_candidates(
        }
 
        for ( i= 0; keys[i].bv_val != NULL; i++ ) {
-               rc = bdb_key_read( be, db, NULL, &keys[i], tmp );
+               rc = bdb_key_read( op->o_bd, db, NULL, &keys[i], tmp );
 
                if( rc == DB_NOTFOUND ) {
                        BDB_IDL_ZERO( ids );
@@ -511,7 +511,7 @@ equality_candidates(
                        break;
        }
 
-       ber_bvarray_free( keys );
+       ber_bvarray_free_x( keys, op->o_tmpmemctx );
 
 #ifdef NEW_LOGGING
        LDAP_LOG ( INDEX, RESULTS, 
@@ -531,7 +531,7 @@ equality_candidates(
 
 static int
 approx_candidates(
-       Backend *be,
+       Operation *op,
        AttributeAssertion *ava,
        ID *ids,
        ID *tmp )
@@ -552,7 +552,7 @@ approx_candidates(
                        ava->aa_desc->ad_cname.bv_val, 0, 0 );
 #endif
 
-       rc = bdb_index_param( be, ava->aa_desc, LDAP_FILTER_APPROX,
+       rc = bdb_index_param( op->o_bd, ava->aa_desc, LDAP_FILTER_APPROX,
                &db, &mask, &prefix );
 
        if( rc != LDAP_SUCCESS ) {
@@ -604,7 +604,7 @@ approx_candidates(
                mr,
                &prefix,
                &ava->aa_value,
-               &keys );
+               &keys, op->o_tmpmemctx );
 
        if( rc != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
@@ -635,7 +635,7 @@ approx_candidates(
        }
 
        for ( i= 0; keys[i].bv_val != NULL; i++ ) {
-               rc = bdb_key_read( be, db, NULL, &keys[i], tmp );
+               rc = bdb_key_read( op->o_bd, db, NULL, &keys[i], tmp );
 
                if( rc == DB_NOTFOUND ) {
                        BDB_IDL_ZERO( ids );
@@ -676,7 +676,7 @@ approx_candidates(
                        break;
        }
 
-       ber_bvarray_free( keys );
+       ber_bvarray_free_x( keys, op->o_tmpmemctx );
 
 #ifdef NEW_LOGGING
        LDAP_LOG ( INDEX, RESULTS, 
@@ -694,7 +694,7 @@ approx_candidates(
 
 static int
 substring_candidates(
-       Backend *be,
+       Operation *op,
        SubstringsAssertion     *sub,
        ID *ids,
        ID *tmp )
@@ -715,7 +715,7 @@ substring_candidates(
                        sub->sa_desc->ad_cname.bv_val, 0, 0 );
 #endif
 
-       rc = bdb_index_param( be, sub->sa_desc, LDAP_FILTER_SUBSTRINGS,
+       rc = bdb_index_param( op->o_bd, sub->sa_desc, LDAP_FILTER_SUBSTRINGS,
                &db, &mask, &prefix );
 
        if( rc != LDAP_SUCCESS ) {
@@ -763,7 +763,7 @@ substring_candidates(
                mr,
                &prefix,
                sub,
-               &keys );
+               &keys, op->o_tmpmemctx );
 
        if( rc != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
@@ -794,7 +794,7 @@ substring_candidates(
        }
 
        for ( i= 0; keys[i].bv_val != NULL; i++ ) {
-               rc = bdb_key_read( be, db, NULL, &keys[i], tmp );
+               rc = bdb_key_read( op->o_bd, db, NULL, &keys[i], tmp );
 
                if( rc == DB_NOTFOUND ) {
                        BDB_IDL_ZERO( ids );
@@ -835,7 +835,7 @@ substring_candidates(
                        break;
        }
 
-       ber_bvarray_free( keys );
+       ber_bvarray_free_x( keys, op->o_tmpmemctx );
 
 #ifdef NEW_LOGGING
        LDAP_LOG ( INDEX, RESULTS, 
index ec1bd891252f58f5c9aef3879f42a0dc05567327..25f6f0099eca691e8287372804faca5b8b30deb7 100644 (file)
@@ -142,12 +142,12 @@ done:
 }
 
 static int indexer(
-       Backend *be,
+       Operation *op,
        DB_TXN *txn,
        struct berval *atname,
        BerVarray vals,
        ID id,
-       int op,
+       int opid,
        slap_mask_t mask )
 {
        int rc, i;
@@ -155,10 +155,11 @@ static int indexer(
        DB *db;
        AttributeDescription *ad = NULL;
        struct berval *keys;
+       void *mark;
 
        assert( mask );
 
-       rc = bdb_db_cache( be, txn, atname->bv_val, &db );
+       rc = bdb_db_cache( op->o_bd, txn, atname->bv_val, &db );
        
        if ( rc != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
@@ -176,8 +177,10 @@ static int indexer(
        rc = slap_bv2ad( atname, &ad, &text );
        if( rc != LDAP_SUCCESS ) return rc;
 
+       mark = sl_mark(op->o_tmpmemctx);
+
        if( IS_SLAP_INDEX( mask, SLAP_INDEX_PRESENT ) ) {
-               rc = bdb_key_change( be, db, txn, &presence_key, id, op );
+               rc = bdb_key_change( op->o_bd, db, txn, &presence_key, id, opid );
                if( rc ) {
                        goto done;
                }
@@ -189,17 +192,17 @@ static int indexer(
                        mask,
                        ad->ad_type->sat_syntax,
                        ad->ad_type->sat_equality,
-                       atname, vals, &keys );
+                       atname, vals, &keys, op->o_tmpmemctx );
 
                if( rc == LDAP_SUCCESS && keys != NULL ) {
                        for( i=0; keys[i].bv_val != NULL; i++ ) {
-                               rc = bdb_key_change( be, db, txn, &keys[i], id, op );
+                               rc = bdb_key_change( op->o_bd, db, txn, &keys[i], id, opid );
                                if( rc ) {
                                        ber_bvarray_free( keys );
                                        goto done;
                                }
                        }
-                       ber_bvarray_free( keys );
+                       ber_bvarray_free_x( keys, op->o_tmpmemctx );
                }
                rc = LDAP_SUCCESS;
        }
@@ -210,17 +213,17 @@ static int indexer(
                        mask,
                        ad->ad_type->sat_syntax,
                        ad->ad_type->sat_approx,
-                       atname, vals, &keys );
+                       atname, vals, &keys, op->o_tmpmemctx );
 
                if( rc == LDAP_SUCCESS && keys != NULL ) {
                        for( i=0; keys[i].bv_val != NULL; i++ ) {
-                               rc = bdb_key_change( be, db, txn, &keys[i], id, op );
+                               rc = bdb_key_change( op->o_bd, db, txn, &keys[i], id, opid );
                                if( rc ) {
                                        ber_bvarray_free( keys );
                                        goto done;
                                }
                        }
-                       ber_bvarray_free( keys );
+                       ber_bvarray_free_x( keys, op->o_tmpmemctx );
                }
 
                rc = LDAP_SUCCESS;
@@ -232,55 +235,56 @@ static int indexer(
                        mask,
                        ad->ad_type->sat_syntax,
                        ad->ad_type->sat_substr,
-                       atname, vals, &keys );
+                       atname, vals, &keys, op->o_tmpmemctx );
 
                if( rc == LDAP_SUCCESS && keys != NULL ) {
                        for( i=0; keys[i].bv_val != NULL; i++ ) {
-                               bdb_key_change( be, db, txn, &keys[i], id, op );
+                               bdb_key_change( op->o_bd, db, txn, &keys[i], id, opid );
                                if( rc ) {
                                        ber_bvarray_free( keys );
                                        goto done;
                                }
                        }
-                       ber_bvarray_free( keys );
+                       ber_bvarray_free_x( keys, op->o_tmpmemctx );
                }
 
                rc = LDAP_SUCCESS;
        }
 
 done:
+       sl_release( mark, op->o_tmpmemctx );
        return rc;
 }
 
 static int index_at_values(
-       Backend *be,
+       Operation *op,
        DB_TXN *txn,
        AttributeType *type,
        struct berval *tags,
        BerVarray vals,
        ID id,
-       int op )
+       int opid )
 {
        int rc;
        slap_mask_t mask = 0;
 
        if( type->sat_sup ) {
                /* recurse */
-               rc = index_at_values( be, txn,
+               rc = index_at_values( op, txn,
                        type->sat_sup, tags,
-                       vals, id, op );
+                       vals, id, opid );
 
                if( rc ) return rc;
        }
 
        /* If this type has no AD, we've never used it before */
        if( type->sat_ad ) {
-               bdb_attr_mask( be->be_private, type->sat_ad, &mask );
+               bdb_attr_mask( op->o_bd->be_private, type->sat_ad, &mask );
        }
 
        if( mask ) {
-               rc = indexer( be, txn, &type->sat_cname,
-                       vals, id, op,
+               rc = indexer( op, txn, &type->sat_cname,
+                       vals, id, opid,
                        mask );
 
                if( rc ) return rc;
@@ -293,12 +297,12 @@ static int index_at_values(
 
                desc = ad_find_tags( type, tags );
                if( desc ) {
-                       bdb_attr_mask( be->be_private, desc, &mask );
+                       bdb_attr_mask( op->o_bd->be_private, desc, &mask );
                }
 
                if( mask ) {
-                       rc = indexer( be, txn, &desc->ad_cname,
-                               vals, id, op,
+                       rc = indexer( op, txn, &desc->ad_cname,
+                               vals, id, opid,
                                mask );
 
                        if( rc ) {
@@ -311,27 +315,27 @@ static int index_at_values(
 }
 
 int bdb_index_values(
-       Backend *be,
+       Operation *op,
        DB_TXN *txn,
        AttributeDescription *desc,
        BerVarray vals,
        ID id,
-       int op )
+       int opid )
 {
        int rc;
 
-       rc = index_at_values( be, txn,
+       rc = index_at_values( op, txn,
                desc->ad_type, &desc->ad_tags,
-               vals, id, op );
+               vals, id, opid );
 
        return rc;
 }
 
 int
 bdb_index_entry(
-       Backend *be,
+       Operation *op,
        DB_TXN *txn,
-       int op,
+       int opid,
        Entry   *e )
 {
        int rc;
@@ -339,17 +343,17 @@ bdb_index_entry(
 
 #ifdef NEW_LOGGING
        LDAP_LOG( INDEX, ENTRY, "index_entry: %s (%s) %ld\n",
-               op == SLAP_INDEX_ADD_OP ? "add" : "del", e->e_dn, (long) e->e_id );
+               opid == SLAP_INDEX_ADD_OP ? "add" : "del", e->e_dn, (long) e->e_id );
 #else
        Debug( LDAP_DEBUG_TRACE, "=> index_entry_%s( %ld, \"%s\" )\n",
-               op == SLAP_INDEX_ADD_OP ? "add" : "del",
+               opid == SLAP_INDEX_ADD_OP ? "add" : "del",
                (long) e->e_id, e->e_dn );
 #endif
 
        /* add each attribute to the indexes */
        for ( ; ap != NULL; ap = ap->a_next ) {
-               rc = bdb_index_values( be, txn, ap->a_desc,
-                       ap->a_nvals, e->e_id, op );
+               rc = bdb_index_values( op, txn, ap->a_desc,
+                       ap->a_nvals, e->e_id, opid );
 
                if( rc != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
@@ -358,7 +362,7 @@ bdb_index_entry(
 #else
                        Debug( LDAP_DEBUG_TRACE,
                                "<= index_entry_%s( %ld, \"%s\" ) failure\n",
-                               op == SLAP_INDEX_ADD_OP ? "add" : "del",
+                               opid == SLAP_INDEX_ADD_OP ? "add" : "del",
                                (long) e->e_id, e->e_dn );
 #endif
                        return rc;
@@ -369,7 +373,7 @@ bdb_index_entry(
        LDAP_LOG( INDEX, ENTRY, "index_entry: success\n", 0, 0, 0  );
 #else
        Debug( LDAP_DEBUG_TRACE, "<= index_entry_%s( %ld, \"%s\" ) success\n",
-               op == SLAP_INDEX_ADD_OP ? "add" : "del",
+               opid == SLAP_INDEX_ADD_OP ? "add" : "del",
                (long) e->e_id, e->e_dn );
 #endif
 
index d51c091436e6269fb83b3903e246ae21d30561e7..0d188d626eedb8cb987fd6a4704616044d1c6f3f 100644 (file)
@@ -207,7 +207,7 @@ int bdb_modify_internal(
        /* start with deleting the old index entries */
        for ( ap = save_attrs; ap != NULL; ap = ap->a_next ) {
                if ( ap->a_flags & SLAP_ATTR_IXDEL ) {
-                       rc = bdb_index_values( op->o_bd, tid, ap->a_desc,
+                       rc = bdb_index_values( op, tid, ap->a_desc,
                                ap->a_nvals,
                                e->e_id, SLAP_INDEX_DELETE_OP );
                        if ( rc != LDAP_SUCCESS ) {
@@ -231,7 +231,7 @@ int bdb_modify_internal(
        /* add the new index entries */
        for ( ap = e->e_attrs; ap != NULL; ap = ap->a_next ) {
                if (ap->a_flags & SLAP_ATTR_IXADD) {
-                       rc = bdb_index_values( op->o_bd, tid, ap->a_desc,
+                       rc = bdb_index_values( op, tid, ap->a_desc,
                                ap->a_nvals,
                                e->e_id, SLAP_INDEX_ADD_OP );
                        if ( rc != LDAP_SUCCESS ) {
index e723a47321470a8f5470b4a408161a1c4dacf214..01734bb1837aed6ac22761d41662ada23460ff7c 100644 (file)
@@ -26,8 +26,8 @@ bdb_modrdn( Operation *op, SlapReply *rs )
        Entry           *p = NULL;
        Entry           *matched;
        /* LDAP v2 supporting correct attribute handling. */
-       LDAPRDN         *new_rdn = NULL;
-       LDAPRDN         *old_rdn = NULL;
+       LDAPRDN         new_rdn = NULL;
+       LDAPRDN         old_rdn = NULL;
        char textbuf[SLAP_TEXT_BUFLEN];
        size_t textlen = sizeof textbuf;
        DB_TXN *        ltid = NULL;
@@ -647,7 +647,7 @@ retry:      /* transaction retry */
        /* Build target dn and make sure target entry doesn't exist already. */
        if (!new_dn.bv_val) build_new_dn( &new_dn, new_parent_dn, &op->oq_modrdn.rs_newrdn ); 
 
-       if (!new_ndn.bv_val) dnNormalize2( NULL, &new_dn, &new_ndn );
+       if (!new_ndn.bv_val) dnNormalize2( NULL, &new_dn, &new_ndn, op->o_tmpmemctx );
 
 #ifdef NEW_LOGGING
        LDAP_LOG ( OPERATION, RESULTS, 
@@ -676,8 +676,8 @@ retry:      /* transaction retry */
        /* Get attribute type and attribute value of our new rdn, we will
         * need to add that to our new entry
         */
-       if ( !new_rdn && ldap_bv2rdn( &op->oq_modrdn.rs_newrdn, &new_rdn, (char **)&rs->sr_text,
-               LDAP_DN_FORMAT_LDAP ) )
+       if ( !new_rdn && ldap_bv2rdn_x( &op->oq_modrdn.rs_newrdn, &new_rdn, (char **)&rs->sr_text,
+               LDAP_DN_FORMAT_LDAP, op->o_tmpmemctx ) )
        {
 #ifdef NEW_LOGGING
                LDAP_LOG ( OPERATION, ERR, 
@@ -699,19 +699,19 @@ retry:    /* transaction retry */
        LDAP_LOG ( OPERATION, RESULTS, 
                "bdb_modrdn: new_rdn_type=\"%s\", "
                "new_rdn_val=\"%s\"\n",
-               new_rdn[ 0 ][ 0 ]->la_attr.bv_val, 
-               new_rdn[ 0 ][ 0 ]->la_value.bv_val, 0 );
+               new_rdn[ 0 ]->la_attr.bv_val, 
+               new_rdn[ 0 ]->la_value.bv_val, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE,
                "bdb_modrdn: new_rdn_type=\"%s\", "
                "new_rdn_val=\"%s\"\n",
-               new_rdn[ 0 ][ 0 ]->la_attr.bv_val,
-               new_rdn[ 0 ][ 0 ]->la_value.bv_val, 0 );
+               new_rdn[ 0 ]->la_attr.bv_val,
+               new_rdn[ 0 ]->la_value.bv_val, 0 );
 #endif
 
        if ( op->oq_modrdn.rs_deleteoldrdn ) {
-               if ( !old_rdn && ldap_bv2rdn( &op->o_req_dn, &old_rdn, (char **)&rs->sr_text,
-                       LDAP_DN_FORMAT_LDAP ) )
+               if ( !old_rdn && ldap_bv2rdn_x( &op->o_req_dn, &old_rdn, (char **)&rs->sr_text,
+                       LDAP_DN_FORMAT_LDAP, op->o_tmpmemctx ) )
                {
 #ifdef NEW_LOGGING
                        LDAP_LOG ( OPERATION, ERR, 
index 42aa31eb78436032f3f2e640b576e52b2d93d0aa..2e21acf9d647376ad84eefad767ee658ae12f54b 100644 (file)
@@ -92,7 +92,7 @@ bdb_exop_passwd( Operation *op, SlapReply *rs )
                goto done;
        }
 
-       rc = dnNormalize2( NULL, &dn, &ndn );
+       rc = dnNormalize2( NULL, &dn, &ndn, op->o_tmpmemctx );
        if( rc != LDAP_SUCCESS ) {
                rs->sr_text = "Invalid DN";
                goto done;
index 4fd7d8a75f3166baef6ed7bb36918656536b7eb1..74e455bddbb8126e1d2416c1eabfb4bc2a4caba3 100644 (file)
@@ -119,7 +119,7 @@ void bdb_errcall( const char *pfx, char * msg );
  * filterentry.c
  */
 int bdb_filter_candidates(
-       Backend *be,
+       Operation *op,
        Filter  *f,
        ID *ids,
        ID *tmp,
@@ -236,14 +236,14 @@ bdb_index_param LDAP_P((
 
 extern int
 bdb_index_values LDAP_P((
-       Backend *be,
+       Operation *op,
        DB_TXN *txn,
        AttributeDescription *desc,
        BerVarray vals,
        ID id,
-       int op ));
+       int opid ));
 
-int bdb_index_entry LDAP_P(( Backend *be, DB_TXN *t, int r, Entry *e ));
+int bdb_index_entry LDAP_P(( Operation *op, DB_TXN *t, int r, Entry *e ));
 
 #define bdb_index_entry_add(be,t,e) \
        bdb_index_entry((be),(t),SLAP_INDEX_ADD_OP,(e))
index 38b087017eed7ff037218ecc107cc79982c860a0..595a65b0f616ff72ef6a882524265c2ef43ca515 100644 (file)
@@ -157,7 +157,7 @@ static int search_aliases(
 
        /* Find all aliases in database */
        BDB_IDL_ALL( bdb, aliases );
-       rs->sr_err = bdb_filter_candidates( op->o_bd, &af, aliases,
+       rs->sr_err = bdb_filter_candidates( op, &af, aliases,
                curscop, visited );
        if (rs->sr_err != LDAP_SUCCESS) {
                return rs->sr_err;
@@ -179,7 +179,7 @@ static int search_aliases(
                 * to the cumulative list of candidates.
                 */
                BDB_IDL_CPY( curscop, aliases );
-               rs->sr_err = bdb_filter_candidates( op->o_bd, sf, subscop, NULL, NULL );
+               rs->sr_err = bdb_filter_candidates( op, sf, subscop, NULL, NULL );
                if (first) {
                        first = 0;
                } else {
@@ -1525,12 +1525,12 @@ static int search_candidates(
        if( op->ors_deref & LDAP_DEREF_SEARCHING ) {
                rc = search_aliases( op, rs, e, locker, &scopef, ids, stack );
        } else {
-               rc = bdb_filter_candidates( op->o_bd, &scopef, ids,
+               rc = bdb_filter_candidates( op, &scopef, ids,
                        stack, stack+BDB_IDL_UM_SIZE );
        }
 
        if ( rc == LDAP_SUCCESS ) {
-               rc = bdb_filter_candidates( op->o_bd, &f, ids,
+               rc = bdb_filter_candidates( op, &f, ids,
                        stack, stack+BDB_IDL_UM_SIZE );
        }
 
index d95ca4640c85267cd50535676c303f0f00a27a5e..f0da2f86620ac777bdb4b52b99d4b9d2592a272e 100644 (file)
@@ -220,6 +220,7 @@ ID bdb_tool_entry_put(
        struct bdb_info *bdb = (struct bdb_info *) be->be_private;
        DB_TXN *tid = NULL;
        struct berval pdn;
+       Operation op = {0};
 
        assert( be != NULL );
        assert( slapMode & SLAP_TOOL_MODE );
@@ -274,7 +275,10 @@ ID bdb_tool_entry_put(
                goto done;
        }
 
-       rc = bdb_index_entry_add( be, tid, e );
+       op.o_bd = be;
+       op.o_tmpmemctx = NULL;
+       op.o_tmpmfuncs = &ch_mfuncs;
+       rc = bdb_index_entry_add( &op, tid, e );
        if( rc != 0 ) {
                snprintf( text->bv_val, text->bv_len,
                                "index_entry_add failed: %s (%d)",
@@ -335,6 +339,7 @@ int bdb_tool_entry_reindex(
        Entry *e;
        DB_TXN *tid = NULL;
        struct berval pdn;
+       Operation op = {0};
 
 #ifdef NEW_LOGGING
        LDAP_LOG ( TOOLS, ARGS, 
@@ -408,7 +413,10 @@ int bdb_tool_entry_reindex(
                goto done;
        }
 
-       rc = bdb_index_entry_add( be, tid, e );
+       op.o_bd = be;
+       op.o_tmpmemctx = NULL;
+       op.o_tmpmfuncs = &ch_mfuncs;
+       rc = bdb_index_entry_add( &op, tid, e );
 
 done:
        if( rc == 0 ) {
index dc67f7e1586c0a964f097e8cf992bec23afd4723..69dbb8194878d55cc0b108a0b910c35999e318dd 100644 (file)
@@ -40,6 +40,8 @@
 
 #include "external.h"
 
+#undef ENABLE_REWRITE
+
 /* String rewrite library */
 #ifdef ENABLE_REWRITE
 #include "rewrite.h"
index 80fca89905ed8b294a4acccf1c7282269733a17c..3c997e7e79658d95b953d69a90874e21ed6da155 100644 (file)
@@ -162,7 +162,7 @@ ldap_back_db_config(
                }
                
                ber_str2bv( argv[1], 0, 0, &bvnc );
-               if ( dnPrettyNormal( NULL, &bvnc, &pvnc, &nvnc ) != LDAP_SUCCESS ) {
+               if ( dnPrettyNormal( NULL, &bvnc, &pvnc, &nvnc, NULL ) != LDAP_SUCCESS ) {
                        fprintf( stderr, "%s: line %d: suffix DN %s is invalid\n",
                                fname, lineno, bvnc.bv_val );
                        return( 1 );
@@ -180,7 +180,7 @@ ldap_back_db_config(
                }
 
                ber_str2bv( argv[2], 0, 0, &brnc );
-               if ( dnPrettyNormal( NULL, &brnc, &prnc, &nrnc ) != LDAP_SUCCESS ) {
+               if ( dnPrettyNormal( NULL, &brnc, &prnc, &nrnc, NULL ) != LDAP_SUCCESS ) {
                        fprintf( stderr, "%s: line %d: suffix DN %s is invalid\n",
                                fname, lineno, brnc.bv_val );
                        free( nvnc.bv_val );
index c9827ae247e92f5ebe8d36cdebb80dcb1990fd31..001567081639891fb081bf79e65b8ff9cde14508 100644 (file)
@@ -408,7 +408,7 @@ ldap_build_entry(
         * 
         * FIXME: should we log anything, or delegate to dnNormalize2?
         */
-       if ( dnNormalize2( NULL, &ent->e_name, &ent->e_nname ) != LDAP_SUCCESS ) {
+       if ( dnNormalize2( NULL, &ent->e_name, &ent->e_nname, op->o_tmpmemctx ) != LDAP_SUCCESS ) {
                return LDAP_INVALID_DN_SYNTAX;
        }
        
@@ -533,7 +533,8 @@ ldap_build_entry(
                                        SLAP_MR_VALUE_OF_ATTRIBUTE_SYNTAX,
                                        attr->a_desc->ad_type->sat_syntax,
                                        attr->a_desc->ad_type->sat_equality,
-                                       &attr->a_vals[i], &attr->a_nvals[i] );
+                                       &attr->a_vals[i], &attr->a_nvals[i],
+                                       op->o_tmpmemctx );
                        }
                        attr->a_nvals[i].bv_val = NULL;
                        attr->a_nvals[i].bv_len = 0;
index 81b1debc3302f04b3e7530a0cb69c3bb2a098dcd..411a9051f8b08597c651166d7118200dca1f5ee2 100644 (file)
@@ -121,7 +121,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 );
+               dnPretty2( NULL, dn, &pretty, NULL );
                if (pretty.bv_val) dn = &pretty;
        }
 
index a5cbdcb4517e3cd341c0990eb153b1712c72fa15..52aa5a5d3f6c313a2e3cac9947a0893a35cc9730 100644 (file)
@@ -338,7 +338,7 @@ ldbm_back_add(
        rs->sr_err = -1;
 
        /* attribute indexes */
-       if ( index_entry_add( op->o_bd, op->oq_add.rs_e ) != LDAP_SUCCESS ) {
+       if ( index_entry_add( op, op->oq_add.rs_e ) != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
                LDAP_LOG( BACK_LDBM, ERR,
                        "ldbm_back_add: index_entry_add failed.\n", 0, 0, 0 );
index 155a022b4c790af5da56411a98ce1c887de00dfb..0f560e59d1f3cc06bdcd9849a46587ee1a99605b 100644 (file)
@@ -97,7 +97,8 @@ ldbm_back_compare(
                if ( value_find_ex( op->oq_compare.rs_ava->aa_desc,
                        SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH |
                                SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
-                       a->a_nvals, &op->oq_compare.rs_ava->aa_value ) == 0 )
+                       a->a_nvals, &op->oq_compare.rs_ava->aa_value,
+                       op->o_tmpmemctx ) == 0 )
                {
                        rs->sr_err = LDAP_COMPARE_TRUE;
                        break;
index 0ab46b74d79ac197b581120f70ea75c3d022f432..3317f40c3799adae3d799b173a05d8b26f4b01b6 100644 (file)
@@ -252,7 +252,7 @@ ldbm_back_delete(
        }
 
        /* delete attribute indices */
-       (void) index_entry_del( op->o_bd, e );
+       (void) index_entry_del( op, e );
 
        rs->sr_err = LDAP_SUCCESS;
        send_ldap_result( op, rs );
index ff07968cd9b505e6edf0b394ff5851387213f42b..f019e1765218a0b859de5c9d10338e0f93fff637 100644 (file)
 #include "back-ldbm.h"
 
 static ID_BLOCK        *presence_candidates(
-       Backend *be,
+       Operation *op,
        AttributeDescription *desc );
 static ID_BLOCK        *equality_candidates(
-       Backend *be, AttributeAssertion *ava );
+       Operation *op, AttributeAssertion *ava );
 static ID_BLOCK        *approx_candidates(
-       Backend *be, AttributeAssertion *ava );
+       Operation *op, AttributeAssertion *ava );
 static ID_BLOCK        *substring_candidates(
-       Backend *be,
+       Operation *op,
        SubstringsAssertion *sub );
 static ID_BLOCK        *list_candidates(
-       Backend *be,
+       Operation *op,
        Filter *flist,
        int ftype );
 
 ID_BLOCK *
 filter_candidates(
-    Backend    *be,
+    Operation  *op,
     Filter     *f
 )
 {
@@ -56,7 +56,7 @@ filter_candidates(
 #endif
 
                /* an error is treated as an empty list */
-               if ( dn2idl( be, f->f_dn, DN_ONE_PREFIX, &result ) != 0
+               if ( dn2idl( op->o_bd, f->f_dn, DN_ONE_PREFIX, &result ) != 0
                                && result != NULL ) {
                        idl_free( result );
                        result = NULL;
@@ -72,7 +72,7 @@ filter_candidates(
 #endif
 
                /* an error is treated as an empty list */
-               if ( dn2idl( be, f->f_dn, DN_SUBTREE_PREFIX, &result ) != 0
+               if ( dn2idl( op->o_bd, f->f_dn, DN_SUBTREE_PREFIX, &result ) != 0
                                && result != NULL ) {
                        idl_free( result );
                        result = NULL;
@@ -88,7 +88,7 @@ filter_candidates(
                Debug( LDAP_DEBUG_FILTER, "\tPRESENT\n", 0, 0, 0 );
 #endif
 
-               result = presence_candidates( be, f->f_desc );
+               result = presence_candidates( op, f->f_desc );
                break;
 
        case LDAP_FILTER_EQUALITY:
@@ -101,7 +101,7 @@ filter_candidates(
                Debug( LDAP_DEBUG_FILTER, "\tEQUALITY\n", 0, 0, 0 );
 #endif
 
-               result = equality_candidates( be, f->f_ava );
+               result = equality_candidates( op, f->f_ava );
                break;
 
        case LDAP_FILTER_APPROX:
@@ -114,7 +114,7 @@ filter_candidates(
                Debug( LDAP_DEBUG_FILTER, "\tAPPROX\n", 0, 0, 0 );
 #endif
 
-               result = approx_candidates( be, f->f_ava );
+               result = approx_candidates( op, f->f_ava );
                break;
 
        case LDAP_FILTER_SUBSTRINGS:
@@ -125,7 +125,7 @@ filter_candidates(
                Debug( LDAP_DEBUG_FILTER, "\tSUBSTRINGS\n", 0, 0, 0 );
 #endif
 
-               result = substring_candidates( be, f->f_sub );
+               result = substring_candidates( op, f->f_sub );
                break;
 
        case LDAP_FILTER_GE:
@@ -135,7 +135,7 @@ filter_candidates(
                Debug( LDAP_DEBUG_FILTER, "\tGE\n", 0, 0, 0 );
 #endif
 
-               result = presence_candidates( be, f->f_ava->aa_desc );
+               result = presence_candidates( op, f->f_ava->aa_desc );
                break;
 
        case LDAP_FILTER_LE:
@@ -145,7 +145,7 @@ filter_candidates(
                Debug( LDAP_DEBUG_FILTER, "\tLE\n", 0, 0, 0 );
 #endif
 
-               result = presence_candidates( be, f->f_ava->aa_desc );
+               result = presence_candidates( op, f->f_ava->aa_desc );
                break;
 
        case LDAP_FILTER_AND:
@@ -155,7 +155,7 @@ filter_candidates(
                Debug( LDAP_DEBUG_FILTER, "\tAND\n", 0, 0, 0 );
 #endif
 
-               result = list_candidates( be, f->f_and, LDAP_FILTER_AND );
+               result = list_candidates( op, f->f_and, LDAP_FILTER_AND );
                break;
 
        case LDAP_FILTER_OR:
@@ -165,7 +165,7 @@ filter_candidates(
                Debug( LDAP_DEBUG_FILTER, "\tOR\n", 0, 0, 0 );
 #endif
 
-               result = list_candidates( be, f->f_or, LDAP_FILTER_OR );
+               result = list_candidates( op, f->f_or, LDAP_FILTER_OR );
                break;
 
        case LDAP_FILTER_NOT:
@@ -181,7 +181,7 @@ filter_candidates(
                 * list could result in matching entries be excluded from
                 * the returned candidate list.
                 */
-               result = idl_allids( be );
+               result = idl_allids( op->o_bd );
                break;
        default:
 #ifdef NEW_LOGGING
@@ -192,7 +192,7 @@ filter_candidates(
                /* unknown filters must not return NULL, to allow
                 * extended filter processing to be done later.
                 */
-               result = idl_allids( be );
+               result = idl_allids( op->o_bd );
                break;
        }
 
@@ -210,7 +210,7 @@ filter_candidates(
 
 static ID_BLOCK *
 presence_candidates(
-    Backend    *be,
+    Operation *op,
        AttributeDescription *desc
 )
 {
@@ -227,13 +227,13 @@ presence_candidates(
        Debug( LDAP_DEBUG_TRACE, "=> presence_candidates\n", 0, 0, 0 );
 #endif
 
-       idl = idl_allids( be );
+       idl = idl_allids( op->o_bd );
 
        if( desc == slap_schema.si_ad_objectClass ) {
                return idl;
        }
 
-       rc = index_param( be, desc, LDAP_FILTER_PRESENT,
+       rc = index_param( op->o_bd, desc, LDAP_FILTER_PRESENT,
                &dbname, &mask, &prefix );
 
        if( rc != LDAP_SUCCESS ) {
@@ -262,7 +262,7 @@ presence_candidates(
                return idl;
        }
 
-       db = ldbm_cache_open( be, dbname, LDBM_SUFFIX, LDBM_WRCREAT );
+       db = ldbm_cache_open( op->o_bd, dbname, LDBM_SUFFIX, LDBM_WRCREAT );
        
        if ( db == NULL ) {
 #ifdef NEW_LOGGING
@@ -282,7 +282,7 @@ presence_candidates(
                idl_free( idl );
                idl = NULL;
 
-               rc = key_read( be, db, &prefix, &idl );
+               rc = key_read( op->o_bd, db, &prefix, &idl );
 
                if( rc != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
@@ -307,7 +307,7 @@ presence_candidates(
                }
        }
 
-       ldbm_cache_close( be, db );
+       ldbm_cache_close( op->o_bd, db );
 
 #ifdef NEW_LOGGING
        LDAP_LOG( FILTER, ENTRY, 
@@ -323,7 +323,7 @@ presence_candidates(
 
 static ID_BLOCK *
 equality_candidates(
-    Backend    *be,
+    Operation *op,
        AttributeAssertion *ava
 )
 {
@@ -344,9 +344,9 @@ equality_candidates(
 #endif
 
 
-       idl = idl_allids( be );
+       idl = idl_allids( op->o_bd );
 
-       rc = index_param( be, ava->aa_desc, LDAP_FILTER_EQUALITY,
+       rc = index_param( op->o_bd, ava->aa_desc, LDAP_FILTER_EQUALITY,
                &dbname, &mask, &prefix );
 
        if( rc != LDAP_SUCCESS ) {
@@ -391,7 +391,7 @@ equality_candidates(
                mr,
                &prefix,
                &ava->aa_value,
-               &keys );
+               &keys, op->o_tmpmemctx );
 
        if( rc != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
@@ -420,7 +420,7 @@ equality_candidates(
                return idl;
        }
 
-       db = ldbm_cache_open( be, dbname, LDBM_SUFFIX, LDBM_WRCREAT );
+       db = ldbm_cache_open( op->o_bd, dbname, LDBM_SUFFIX, LDBM_WRCREAT );
        
        if ( db == NULL ) {
 #ifdef NEW_LOGGING
@@ -439,7 +439,7 @@ equality_candidates(
                ID_BLOCK *save;
                ID_BLOCK *tmp;
 
-               rc = key_read( be, db, &keys[i], &tmp );
+               rc = key_read( op->o_bd, db, &keys[i], &tmp );
 
                if( rc != LDAP_SUCCESS ) {
                        idl_free( idl );
@@ -471,7 +471,7 @@ equality_candidates(
                }
 
                save = idl;
-               idl = idl_intersection( be, idl, tmp );
+               idl = idl_intersection( op->o_bd, idl, tmp );
                idl_free( save );
                idl_free( tmp );
 
@@ -480,7 +480,7 @@ equality_candidates(
 
        ber_bvarray_free( keys );
 
-       ldbm_cache_close( be, db );
+       ldbm_cache_close( op->o_bd, db );
 
 
 #ifdef NEW_LOGGING
@@ -497,7 +497,7 @@ equality_candidates(
 
 static ID_BLOCK *
 approx_candidates(
-    Backend    *be,
+    Operation *op,
        AttributeAssertion *ava
 )
 {
@@ -518,9 +518,9 @@ approx_candidates(
 #endif
 
 
-       idl = idl_allids( be );
+       idl = idl_allids( op->o_bd );
 
-       rc = index_param( be, ava->aa_desc, LDAP_FILTER_APPROX,
+       rc = index_param( op->o_bd, ava->aa_desc, LDAP_FILTER_APPROX,
                &dbname, &mask, &prefix );
 
        if( rc != LDAP_SUCCESS ) {
@@ -570,7 +570,7 @@ approx_candidates(
                mr,
                &prefix,
                &ava->aa_value,
-               &keys );
+               &keys, op->o_tmpmemctx );
 
        if( rc != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
@@ -600,7 +600,7 @@ approx_candidates(
                return idl;
        }
 
-       db = ldbm_cache_open( be, dbname, LDBM_SUFFIX, LDBM_WRCREAT );
+       db = ldbm_cache_open( op->o_bd, dbname, LDBM_SUFFIX, LDBM_WRCREAT );
        
        if ( db == NULL ) {
 #ifdef NEW_LOGGING
@@ -620,7 +620,7 @@ approx_candidates(
                ID_BLOCK *save;
                ID_BLOCK *tmp;
 
-               rc = key_read( be, db, &keys[i], &tmp );
+               rc = key_read( op->o_bd, db, &keys[i], &tmp );
 
                if( rc != LDAP_SUCCESS ) {
                        idl_free( idl );
@@ -650,7 +650,7 @@ approx_candidates(
                }
 
                save = idl;
-               idl = idl_intersection( be, idl, tmp );
+               idl = idl_intersection( op->o_bd, idl, tmp );
                idl_free( save );
                idl_free( tmp );
 
@@ -659,7 +659,7 @@ approx_candidates(
 
        ber_bvarray_free( keys );
 
-       ldbm_cache_close( be, db );
+       ldbm_cache_close( op->o_bd, db );
 
 #ifdef NEW_LOGGING
        LDAP_LOG( FILTER, ENTRY, 
@@ -675,7 +675,7 @@ approx_candidates(
 
 static ID_BLOCK *
 list_candidates(
-    Backend    *be,
+    Operation *op,
     Filter     *flist,
     int                ftype
 )
@@ -692,7 +692,7 @@ list_candidates(
 
        idl = NULL;
        for ( f = flist; f != NULL; f = f->f_next ) {
-               if ( (tmp = filter_candidates( be, f )) == NULL &&
+               if ( (tmp = filter_candidates( op, f )) == NULL &&
                    ftype == LDAP_FILTER_AND ) {
 #ifdef NEW_LOGGING
                        LDAP_LOG( FILTER, INFO, "list_candidates: NULL\n", 0, 0, 0 );
@@ -709,11 +709,11 @@ list_candidates(
                if ( idl == NULL ) {
                        idl = tmp;
                } else if ( ftype == LDAP_FILTER_AND ) {
-                       idl = idl_intersection( be, idl, tmp );
+                       idl = idl_intersection( op->o_bd, idl, tmp );
                        idl_free( tmp );
                        idl_free( tmp2 );
                } else {
-                       idl = idl_union( be, idl, tmp );
+                       idl = idl_union( op->o_bd, idl, tmp );
                        idl_free( tmp );
                        idl_free( tmp2 );
                }
@@ -732,7 +732,7 @@ list_candidates(
 
 static ID_BLOCK *
 substring_candidates(
-    Backend    *be,
+    Operation *op,
     SubstringsAssertion        *sub
 )
 {
@@ -753,9 +753,9 @@ substring_candidates(
 #endif
 
 
-       idl = idl_allids( be );
+       idl = idl_allids( op->o_bd );
 
-       rc = index_param( be, sub->sa_desc, LDAP_FILTER_SUBSTRINGS,
+       rc = index_param( op->o_bd, sub->sa_desc, LDAP_FILTER_SUBSTRINGS,
                &dbname, &mask, &prefix );
 
        if( rc != LDAP_SUCCESS ) {
@@ -801,7 +801,7 @@ substring_candidates(
                mr,
                &prefix,
                sub,
-               &keys );
+               &keys, op->o_tmpmemctx );
 
        if( rc != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
@@ -831,7 +831,7 @@ substring_candidates(
                return idl;
        }
 
-       db = ldbm_cache_open( be, dbname, LDBM_SUFFIX, LDBM_WRCREAT );
+       db = ldbm_cache_open( op->o_bd, dbname, LDBM_SUFFIX, LDBM_WRCREAT );
        
        if ( db == NULL ) {
 #ifdef NEW_LOGGING
@@ -851,7 +851,7 @@ substring_candidates(
                ID_BLOCK *save;
                ID_BLOCK *tmp;
 
-               rc = key_read( be, db, &keys[i], &tmp );
+               rc = key_read( op->o_bd, db, &keys[i], &tmp );
 
                if( rc != LDAP_SUCCESS ) {
                        idl_free( idl );
@@ -881,7 +881,7 @@ substring_candidates(
                }
 
                save = idl;
-               idl = idl_intersection( be, idl, tmp );
+               idl = idl_intersection( op->o_bd, idl, tmp );
                idl_free( save );
                idl_free( tmp );
 
@@ -890,7 +890,7 @@ substring_candidates(
 
        ber_bvarray_free( keys );
 
-       ldbm_cache_close( be, db );
+       ldbm_cache_close( op->o_bd, db );
 
 #ifdef NEW_LOGGING
        LDAP_LOG( FILTER, ENTRY, 
index 2680fb0abcaa26e2654d6c03f4fb34e76e1e8e14..00e6c6a37523a7389ea95dc47830cca3c403a433 100644 (file)
@@ -136,12 +136,12 @@ done:
 }
 
 static int indexer(
-       Backend *be,
+       Operation *op,
        char *dbname,
        struct berval *atname,
        BerVarray vals,
        ID id,
-       int op,
+       int opid,
        slap_mask_t mask )
 {
        int rc, i;
@@ -149,6 +149,7 @@ static int indexer(
     DBCache    *db;
        AttributeDescription *ad = NULL;
        struct berval *keys;
+       void *mark;
 
        assert( mask );
 
@@ -156,7 +157,7 @@ static int indexer(
 
        if( rc != LDAP_SUCCESS ) return rc;
 
-       db = ldbm_cache_open( be, dbname, LDBM_SUFFIX, LDBM_WRCREAT );
+       db = ldbm_cache_open( op->o_bd, dbname, LDBM_SUFFIX, LDBM_WRCREAT );
        
        if ( db == NULL ) {
 #ifdef NEW_LOGGING
@@ -171,8 +172,10 @@ static int indexer(
                return LDAP_OTHER;
        }
 
+       mark = sl_mark( op->o_tmpmemctx );
+
        if( IS_SLAP_INDEX( mask, SLAP_INDEX_PRESENT ) ) {
-               key_change( be, db, atname, id, op );
+               key_change( op->o_bd, db, atname, id, opid );
        }
 
        if( IS_SLAP_INDEX( mask, SLAP_INDEX_EQUALITY ) ) {
@@ -181,11 +184,11 @@ static int indexer(
                        mask,
                        ad->ad_type->sat_syntax,
                        ad->ad_type->sat_equality,
-                       atname, vals, &keys );
+                       atname, vals, &keys, op->o_tmpmemctx );
 
                if( rc == LDAP_SUCCESS && keys != NULL ) {
                        for( i=0; keys[i].bv_val != NULL; i++ ) {
-                               key_change( be, db, &keys[i], id, op );
+                               key_change( op->o_bd, db, &keys[i], id, opid );
                        }
                        ber_bvarray_free( keys );
                }
@@ -197,11 +200,11 @@ static int indexer(
                        mask,
                        ad->ad_type->sat_syntax,
                        ad->ad_type->sat_approx,
-                       atname, vals, &keys );
+                       atname, vals, &keys, op->o_tmpmemctx );
 
                if( rc == LDAP_SUCCESS && keys != NULL ) {
                        for( i=0; keys[i].bv_val != NULL; i++ ) {
-                               key_change( be, db, &keys[i], id, op );
+                               key_change( op->o_bd, db, &keys[i], id, opid );
                        }
                        ber_bvarray_free( keys );
                }
@@ -213,46 +216,49 @@ static int indexer(
                        mask,
                        ad->ad_type->sat_syntax,
                        ad->ad_type->sat_substr,
-                       atname, vals, &keys );
+                       atname, vals, &keys, op->o_tmpmemctx );
 
                if( rc == LDAP_SUCCESS && keys != NULL ) {
                        for( i=0; keys[i].bv_val != NULL; i++ ) {
-                               key_change( be, db, &keys[i], id, op );
+                               key_change( op->o_bd, db, &keys[i], id, opid );
                        }
                        ber_bvarray_free( keys );
                }
        }
 
-       ldbm_cache_close( be, db );
+       ldbm_cache_close( op->o_bd, db );
+
+       sl_release( mark, op->o_tmpmemctx );
+
        return LDAP_SUCCESS;
 }
 
 static int index_at_values(
-       Backend *be,
+       Operation *op,
        AttributeType *type,
        struct berval *tags,
        BerVarray vals,
        ID id,
-       int op )
+       int opid )
 {
        slap_mask_t mask = 0;
 
        if( type->sat_sup ) {
                /* recurse */
-               (void) index_at_values( be,
+               (void) index_at_values( op,
                        type->sat_sup, tags,
-                       vals, id, op );
+                       vals, id, opid );
        }
 
        /* If this type has no AD, we've never used it before */
        if( type->sat_ad ) {
-               attr_mask( be->be_private, type->sat_ad, &mask );
+               attr_mask( op->o_bd->be_private, type->sat_ad, &mask );
        }
 
        if( mask ) {
-               indexer( be, type->sat_cname.bv_val,
+               indexer( op, type->sat_cname.bv_val,
                        &type->sat_cname,
-                       vals, id, op,
+                       vals, id, opid,
                        mask );
        }
 
@@ -263,12 +269,12 @@ static int index_at_values(
 
                desc = ad_find_tags(type, tags);
                if( desc ) {
-                       attr_mask( be->be_private, desc, &mask );
+                       attr_mask( op->o_bd->be_private, desc, &mask );
                }
 
                if( mask ) {
-                       indexer( be, desc->ad_cname.bv_val, &desc->ad_cname,
-                               vals, id, op,
+                       indexer( op, desc->ad_cname.bv_val, &desc->ad_cname,
+                               vals, id, opid,
                                mask );
                }
        }
@@ -277,48 +283,48 @@ static int index_at_values(
 }
 
 int index_values(
-       Backend *be,
+       Operation *op,
        AttributeDescription *desc,
        BerVarray vals,
        ID id,
-       int op )
+       int opid )
 {
-       (void) index_at_values( be,
+       (void) index_at_values( op,
                desc->ad_type, &desc->ad_tags,
-               vals, id, op );
+               vals, id, opid );
 
        return LDAP_SUCCESS;
 }
 
 int
 index_entry(
-       Backend *be,
-       int op,
+       Operation *op,
+       int opid,
        Entry *e )
 {
        Attribute *ap = e->e_attrs;
 #ifdef NEW_LOGGING
        LDAP_LOG( INDEX, ENTRY, 
-               "index_entry: %s (%s)%ld\n", op == SLAP_INDEX_ADD_OP ? "add" : "del",
+               "index_entry: %s (%s)%ld\n", opid == SLAP_INDEX_ADD_OP ? "add" : "del",
                e->e_dn, e->e_id );
 #else
        Debug( LDAP_DEBUG_TRACE, "=> index_entry_%s( %ld, \"%s\" )\n",
-               op == SLAP_INDEX_ADD_OP ? "add" : "del",
+               opid == SLAP_INDEX_ADD_OP ? "add" : "del",
                e->e_id, e->e_dn );
 #endif
 
        /* add each attribute to the indexes */
        for ( ; ap != NULL; ap = ap->a_next ) {
-               index_values( be, ap->a_desc,
+               index_values( op, ap->a_desc,
                        ap->a_nvals,
-                       e->e_id, op );
+                       e->e_id, opid );
        }
 
 #ifdef NEW_LOGGING
        LDAP_LOG( INDEX, ENTRY, "index_entry: success\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "<= index_entry_%s( %ld, \"%s\" ) success\n",
-           op == SLAP_INDEX_ADD_OP ? "add" : "del",
+           opid == SLAP_INDEX_ADD_OP ? "add" : "del",
                e->e_id, e->e_dn );
 #endif
 
index 46ca1025a9471f132ae9b6db966aba937af53af5..b044b7ffdeb3e44d6c13f1a89629951e35d95744 100644 (file)
@@ -222,7 +222,7 @@ int ldbm_modify_internal(
        /* start with deleting the old index entries */
        for ( ap = save_attrs; ap != NULL; ap = ap->a_next ) {
                if ( ap->a_flags & SLAP_ATTR_IXDEL ) {
-                       rc = index_values( op->o_bd, ap->a_desc,
+                       rc = index_values( op, ap->a_desc,
                                ap->a_nvals,
                                e->e_id, SLAP_INDEX_DELETE_OP );
                        if ( rc != LDAP_SUCCESS ) {
@@ -244,7 +244,7 @@ int ldbm_modify_internal(
        /* add the new index entries */
        for ( ap = e->e_attrs; ap != NULL; ap = ap->a_next ) {
                if ( ap->a_flags & SLAP_ATTR_IXADD ) {
-                       rc = index_values( op->o_bd, ap->a_desc,
+                       rc = index_values( op, ap->a_desc,
                                ap->a_nvals,
                                e->e_id, SLAP_INDEX_ADD_OP );
                        if ( rc != LDAP_SUCCESS ) {
index de0d99b8868636fcc41b9b8f76a508a019f8d84c..41db98229b2807fa65a427a021f69057dd3aeeaa 100644 (file)
@@ -45,8 +45,8 @@ ldbm_back_modrdn(
        Entry           *e, *p = NULL;
        Entry           *matched;
        /* LDAP v2 supporting correct attribute handling. */
-       LDAPRDN         *new_rdn = NULL;
-       LDAPRDN         *old_rdn = NULL;
+       LDAPRDN         new_rdn = NULL;
+       LDAPRDN         old_rdn = NULL;
        int             isroot = -1;
 #define CAN_ROLLBACK   -1
 #define MUST_DESTROY   1
@@ -466,7 +466,7 @@ ldbm_back_modrdn(
        
        /* Build target dn and make sure target entry doesn't exist already. */
        build_new_dn( &new_dn, new_parent_dn, &op->oq_modrdn.rs_newrdn ); 
-       dnNormalize2( NULL, &new_dn, &new_ndn );
+       dnNormalize2( NULL, &new_dn, &new_ndn, op->o_tmpmemctx );
 
 #ifdef NEW_LOGGING
        LDAP_LOG( BACK_LDBM, DETAIL1, "ldbm_back_modrdn: new ndn=%s\n", 
@@ -521,14 +521,14 @@ ldbm_back_modrdn(
        LDAP_LOG ( OPERATION, RESULTS, 
                "ldbm_back_modrdn: new_rdn_type=\"%s\", "
                "new_rdn_val=\"%s\"\n",
-               new_rdn[ 0 ][ 0 ]->la_attr.bv_val, 
-               new_rdn[ 0 ][ 0 ]->la_value.bv_val, 0 );
+               new_rdn[ 0 ]->la_attr.bv_val, 
+               new_rdn[ 0 ]->la_value.bv_val, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE,
                "ldbm_back_modrdn: new_rdn_type=\"%s\", "
                "new_rdn_val=\"%s\"\n",
-               new_rdn[ 0 ][ 0 ]->la_attr.bv_val,
-               new_rdn[ 0 ][ 0 ]->la_value.bv_val, 0 );
+               new_rdn[ 0 ]->la_attr.bv_val,
+               new_rdn[ 0 ]->la_value.bv_val, 0 );
 #endif
 
        if ( op->oq_modrdn.rs_deleteoldrdn ) {
index fa6d34d86979b3b7dc1653547242f505bf68948f..74191f19a94258be6a4351b083f2cb27ad9fffac 100644 (file)
@@ -92,7 +92,7 @@ ldbm_back_exop_passwd(
                goto done;
        }
 
-       rc = dnNormalize2( NULL, &dn, &ndn );
+       rc = dnNormalize2( NULL, &dn, &ndn, op->o_tmpmemctx );
        if( rc != LDAP_SUCCESS ) {
                rs->sr_text = "Invalid DN";
                goto done;
index 105713081037e7e5ec02e3cff29235d17dbe45f6..8cab4337839547ae0f26ef0700bdc23538bc039a 100644 (file)
@@ -100,7 +100,7 @@ BI_entry_get_rw ldbm_back_entry_get;
  * filterindex.c
  */
 
-ID_BLOCK * filter_candidates LDAP_P(( Backend *be, Filter *f ));
+ID_BLOCK * filter_candidates LDAP_P(( Operation *op, Filter *f ));
 
 /*
  * id2children.c
@@ -157,13 +157,13 @@ index_param LDAP_P((
 
 extern int
 index_values LDAP_P((
-       Backend *be,
+       Operation *op,
        AttributeDescription *desc,
        BerVarray vals,
        ID id,
-       int op ));
+       int opid ));
 
-int index_entry LDAP_P(( Backend *be, int r, Entry *e ));
+int index_entry LDAP_P(( Operation *op, int r, Entry *e ));
 #define index_entry_add(be,e) index_entry((be),SLAP_INDEX_ADD_OP,(e))
 #define index_entry_del(be,e) index_entry((be),SLAP_INDEX_DELETE_OP,(e))
 
index dc51c35318b8e9c36631dcb9b8719682d1ca796c..3c84a361dd8f57ceb5398ae0ede67867b5dfb0a9 100644 (file)
@@ -20,7 +20,7 @@ static ID_BLOCK       *base_candidate(
        Backend *be, Entry *e );
 
 static ID_BLOCK        *search_candidates(
-       Backend *be, Entry *e, Filter *filter,
+       Operation *op, Entry *e, Filter *filter,
        int scope, int deref, int manageDSAit );
 
 
@@ -84,7 +84,7 @@ ldbm_back_search(
                }
 #endif /* LDAP_CACHING */
 
-               candidates = search_candidates( op->o_bd, e, op->oq_search.rs_filter,
+               candidates = search_candidates( op, e, op->oq_search.rs_filter,
                                op->oq_search.rs_scope, op->oq_search.rs_deref,
                                manageDSAit || get_domainScope(op) );
 
@@ -194,7 +194,7 @@ ldbm_back_search(
        } else {
                cscope = ( op->oq_search.rs_scope != LDAP_SCOPE_SUBTREE )
                        ? LDAP_SCOPE_BASE : LDAP_SCOPE_SUBTREE;
-               candidates = search_candidates( op->o_bd, e, op->oq_search.rs_filter,
+               candidates = search_candidates( op, e, op->oq_search.rs_filter,
                    op->oq_search.rs_scope, op->oq_search.rs_deref, manageDSAit );
        }
 
@@ -606,7 +606,7 @@ base_candidate(
 
 static ID_BLOCK *
 search_candidates(
-    Backend    *be,
+    Operation  *op,
     Entry      *e,
     Filter     *filter,
     int                scope,
@@ -663,7 +663,7 @@ search_candidates(
        fand.f_dn = &e->e_nname;
        fand.f_next = xf.f_or == filter ? filter : &xf ;
 
-       candidates = filter_candidates( be, &f );
+       candidates = filter_candidates( op, &f );
 
        return( candidates );
 }
index 3b253abee602b378001f29b0799a3874baeacd68..64d930a610b84f15326ce1110180e478829d866a 100644 (file)
@@ -173,6 +173,7 @@ ID ldbm_tool_entry_put(
        Datum key, data;
        int rc, len;
        ID id;
+       Operation op = {0};
 
        assert( slapMode & SLAP_TOOL_MODE );
        assert( id2entry != NULL );
@@ -216,7 +217,11 @@ ID ldbm_tool_entry_put(
                return NOID;
        }
 
-       rc = index_entry_add( be, e );
+       op.o_bd = be;
+       op.o_tmpmemctx = NULL;
+       op.o_tmpmfuncs = &ch_mfuncs;
+
+       rc = index_entry_add( &op, e );
        if( rc != 0 ) {
                strncpy( text->bv_val, "index add failed", text->bv_len );
                return NOID;
@@ -260,6 +265,7 @@ int ldbm_tool_entry_reindex(
 {
        int rc;
        Entry *e;
+       Operation op = {0};
 
 #ifdef NEW_LOGGING
        LDAP_LOG( BACK_LDBM, ENTRY, "ldbm_tool_entry_reindex: ID=%ld\n", 
@@ -302,7 +308,11 @@ int ldbm_tool_entry_reindex(
 #endif
 
        dn2id_add( be, &e->e_nname, e->e_id );
-       rc = index_entry_add( be, e );
+
+       op.o_bd = be;
+       op.o_tmpmemctx = NULL;
+       op.o_tmpmfuncs = &ch_mfuncs;
+       rc = index_entry_add( &op, e );
 
        entry_free( e );
 
index 8b8287f201da552083506f7e032dd3bf65d94976..538396434e264d04e72b6f9b58833cb636387fe8 100644 (file)
@@ -394,7 +394,7 @@ monitor_subsys_conn_create(
                *ep = e;
 
        } else {
-               LDAPRDN         *values = NULL;
+               LDAPRDN         values = NULL;
                const char      *text = NULL;
                unsigned long   connid;
               
@@ -407,9 +407,9 @@ monitor_subsys_conn_create(
                }
                
                assert( values );
-               assert( values[ 0 ][ 0 ] );
+               assert( values[ 0 ] );
 
-               connid = atol( values[ 0 ][ 0 ]->la_value.bv_val
+               connid = atol( values[ 0 ]->la_value.bv_val
                                + sizeof( CONN_CN_PREFIX ) );
 
                ldap_rdnfree( values );
index a6f2c9e49b28d8d857e190cd6a6fe8124f500ace..52d8ae81bf3aeda1326a528e5d8902ddeba2e115 100644 (file)
@@ -33,7 +33,7 @@ passwd_back_search(
        char            *s;
        time_t          stoptime;
 
-       LDAPRDN *rdn = NULL;
+       LDAPRDN rdn = NULL;
        struct berval parent = { 0, NULL };
 
        AttributeDescription *ad_objectClass = slap_schema.si_ad_objectClass;
@@ -74,13 +74,13 @@ passwd_back_search(
                                goto done;
                        }
 
-                       if( slap_bv2ad( &rdn[0][0]->la_attr, &desc, &rs->sr_text )) {
+                       if( slap_bv2ad( &rdn[0]->la_attr, &desc, &rs->sr_text )) {
                                rs->sr_err = LDAP_NO_SUCH_OBJECT;
                                ldap_rdnfree(rdn);
                                goto done;
                        }
 
-                       vals[0] = rdn[0][0]->la_value;
+                       vals[0] = rdn[0]->la_value;
                        attr_mergeit( e, desc, vals );
 
                        ldap_rdnfree(rdn);
@@ -185,7 +185,7 @@ passwd_back_search(
 
                ldap_pvt_thread_mutex_lock( &passwd_mutex );
                pw_start( op->o_bd );
-               if ( (pw = getpwnam( rdn[0][0]->la_value.bv_val )) == NULL ) {
+               if ( (pw = getpwnam( rdn[0]->la_value.bv_val )) == NULL ) {
                        rs->sr_matched = parent.bv_val;
                        rs->sr_err = LDAP_NO_SUCH_OBJECT;
                        ldap_pvt_thread_mutex_unlock( &passwd_mutex );
index 10bcd29f710d06a86c38fca7b0229a77a4813ce8..8b1a376673d9abce2a59132a8c2bb97971626655 100644 (file)
@@ -555,8 +555,8 @@ backsql_modrdn( Operation *op, SlapReply *rs )
        struct berval           p_dn, p_ndn,
                                *new_pdn = NULL, *new_npdn = NULL,
                                new_dn, new_ndn;
-       LDAPRDN                 *new_rdn = NULL;
-       LDAPRDN                 *old_rdn = NULL;
+       LDAPRDN                 new_rdn = NULL;
+       LDAPRDN                 old_rdn = NULL;
        Entry                   e;
        Modifications           *mod;
        struct berval           *newSuperior = op->oq_modrdn.rs_newSup;
@@ -785,14 +785,14 @@ backsql_modrdn( Operation *op, SlapReply *rs )
        LDAP_LOG ( OPERATION, RESULTS, 
                "backsql_modrdn: new_rdn_type=\"%s\", "
                "new_rdn_val=\"%s\"\n",
-               new_rdn[ 0 ][ 0 ]->la_attr.bv_val, 
-               new_rdn[ 0 ][ 0 ]->la_value.bv_val, 0 );
+               new_rdn[ 0 ]->la_attr.bv_val, 
+               new_rdn[ 0 ]->la_value.bv_val, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE,
                "backsql_modrdn: new_rdn_type=\"%s\", "
                "new_rdn_val=\"%s\"\n",
-               new_rdn[ 0 ][ 0 ]->la_attr.bv_val,
-               new_rdn[ 0 ][ 0 ]->la_value.bv_val, 0 );
+               new_rdn[ 0 ]->la_attr.bv_val,
+               new_rdn[ 0 ]->la_value.bv_val, 0 );
 #endif
 
        if ( op->oq_modrdn.rs_deleteoldrdn ) {
index 536941a16b5bf94724c01f95b3750b32a038e270..f1c319d6bb7ed3657c73048b06ce952ece138efd 100644 (file)
@@ -1143,7 +1143,7 @@ backend_group(
                        rc = value_find_ex( group_at,
                                SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH |
                                SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
-                               a->a_nvals, op_ndn );
+                               a->a_nvals, op_ndn, op->o_tmpmemctx );
                } else {
                        rc = LDAP_NO_SUCH_ATTRIBUTE;
                }
index 0eea2b823f4ccf6c725fbec4314797ed49d9ef6f..1c6c29612e5982fe0a955be6983d2460362e8b1d 100644 (file)
@@ -161,7 +161,7 @@ do_bind(
                goto cleanup;
        } 
 
-       rs->sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn );
+       rs->sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn, op->o_tmpmemctx );
        if ( rs->sr_err != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
                LDAP_LOG( OPERATION, INFO, 
@@ -543,7 +543,7 @@ do_bind(
                        if ( rs->sr_err != SLAPI_BIND_ANONYMOUS ) {
                                slapi_pblock_get( pb, SLAPI_CONN_DN, (void *)&op->orb_edn.bv_val );
                        }
-                       rs->sr_err = dnPrettyNormal( NULL, &op->orb_edn, &op->o_req_dn, &op->o_req_ndn );
+                       rs->sr_err = dnPrettyNormal( NULL, &op->orb_edn, &op->o_req_dn, &op->o_req_ndn, op->o_tmpmemctx );
                        ldap_pvt_thread_mutex_lock( &op->o_conn->c_mutex );
                        op->o_conn->c_dn = op->o_req_dn;
                        op->o_conn->c_ndn = op->o_req_ndn;
@@ -588,14 +588,10 @@ do_bind(
                        if(op->orb_edn.bv_len) {
                                op->o_conn->c_dn = op->orb_edn;
                        } else {
-                               op->o_conn->c_dn = op->o_req_dn;
-                               op->o_req_dn.bv_val = NULL;
-                               op->o_req_dn.bv_len = 0;
+                               ber_dupbv(&op->o_conn->c_dn, &op->o_req_dn);
                        }
 
-                       op->o_conn->c_ndn = op->o_req_ndn;
-                       op->o_req_ndn.bv_val = NULL;
-                       op->o_req_ndn.bv_len = 0;
+                       ber_dupbv( &op->o_conn->c_ndn, &op->o_req_ndn );
 
                        if( op->o_conn->c_dn.bv_len != 0 ) {
                                ber_len_t max = sockbuf_max_incoming_auth;
@@ -649,11 +645,11 @@ cleanup:
        op->o_conn->c_sasl_bindop = NULL;
 
        if( op->o_req_dn.bv_val != NULL ) {
-               free( op->o_req_dn.bv_val );
+               sl_free( op->o_req_dn.bv_val, op->o_tmpmemctx );
                op->o_req_dn.bv_val = NULL;
        }
        if( op->o_req_ndn.bv_val != NULL ) {
-               free( op->o_req_ndn.bv_val );
+               sl_free( op->o_req_ndn.bv_val, op->o_tmpmemctx );
                op->o_req_ndn.bv_val = NULL;
        }
 
index 415592186c42330f483eb443a7a24a9e9a161cab..92d0a45350efa7414485d5bf83771387a9cd65cb 100644 (file)
@@ -110,7 +110,7 @@ do_compare(
                goto cleanup;
        } 
 
-       rs->sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn );
+       rs->sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn, op->o_tmpmemctx );
        if( rs->sr_err != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
                LDAP_LOG( OPERATION, INFO, 
@@ -133,7 +133,7 @@ do_compare(
        rs->sr_err = asserted_value_validate_normalize( ava.aa_desc,
                ava.aa_desc->ad_type->sat_equality,
                SLAP_MR_EQUALITY|SLAP_MR_VALUE_OF_ASSERTION_SYNTAX,
-               &value, &ava.aa_value, &rs->sr_text );
+               &value, &ava.aa_value, &rs->sr_text, op->o_tmpmemctx );
        if( rs->sr_err != LDAP_SUCCESS ) {
                send_ldap_result( op, rs );
                goto cleanup;
@@ -330,7 +330,7 @@ static int compare_entry(
                        SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH |
                                SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
                        a->a_nvals,
-                       &ava->aa_value ) == 0 )
+                       &ava->aa_value, op->o_tmpmemctx ) == 0 )
                {
                        rc = LDAP_COMPARE_TRUE;
                        break;
index 8951f40664229f103fa8e1c54acede67ce3d63bc..5adaada4c4eb0b24e5e9c61c327599d7dffb6aae 100644 (file)
@@ -481,7 +481,7 @@ read_config( const char *fname, int depth )
 
                                rc = dnPrettyNormal( NULL, &dn,
                                        &default_search_base,
-                                       &default_search_nbase );
+                                       &default_search_nbase, NULL );
 
                                if( rc != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
@@ -659,10 +659,10 @@ read_config( const char *fname, int depth )
                        ber_str2bv( cargv[1], 0, 0, &dn );
                        if ( be ) {
                                rc = dnPrettyNormal( NULL, &dn, &be->be_schemadn,
-                                       &be->be_schemandn );
+                                       &be->be_schemandn, NULL );
                        } else {
                                rc = dnPrettyNormal( NULL, &dn, &global_schemadn,
-                                       &global_schemandn );
+                                       &global_schemandn, NULL );
                        }
                        if ( rc != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
@@ -973,7 +973,7 @@ read_config( const char *fname, int depth )
                        dn.bv_val = cargv[1];
                        dn.bv_len = strlen( cargv[1] );
 
-                       rc = dnPrettyNormal( NULL, &dn, &pdn, &ndn );
+                       rc = dnPrettyNormal( NULL, &dn, &pdn, &ndn, NULL );
                        if( rc != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
                                LDAP_LOG( CONFIG, CRIT, 
@@ -1117,7 +1117,7 @@ read_config( const char *fname, int depth )
 
                                rc = dnPrettyNormal( NULL, &dn,
                                        &be->be_rootdn,
-                                       &be->be_rootndn );
+                                       &be->be_rootndn, NULL );
 
                                if( rc != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
@@ -1879,7 +1879,7 @@ read_config( const char *fname, int depth )
                                dn.bv_val = cargv[1];
                                dn.bv_len = strlen( cargv[1] );
 
-                               rc = dnNormalize2( NULL, &dn, &be->be_update_ndn );
+                               rc = dnNormalize2( NULL, &dn, &be->be_update_ndn, NULL );
                                if( rc != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
                                        LDAP_LOG( CONFIG, CRIT, 
@@ -2416,7 +2416,7 @@ read_config( const char *fname, int depth )
        if ( !global_schemadn.bv_val ) {
                ber_str2bv( SLAPD_SCHEMA_DN, sizeof(SLAPD_SCHEMA_DN)-1, 1,
                        &global_schemadn );
-               dnNormalize2( NULL, &global_schemadn, &global_schemandn );
+               dnNormalize2( NULL, &global_schemadn, &global_schemandn, NULL );
        }
 
        if ( load_ucdata( NULL ) < 0 ) return 1;
index 09410a3f2737fb9f21f361735c7ba5a425ef0082..67ec8daea8e3521055e793d2c3b6fb7803b524b3 100644 (file)
@@ -919,7 +919,7 @@ connection_operation( void *ctx, void *arg_v )
        memsiz = ber_len( op->o_ber ) * 32;
        if ( SLAB_SIZE > memsiz ) memsiz = SLAB_SIZE;
 
-       if ( tag == LDAP_REQ_SEARCH ) {
+       if ( tag != LDAP_REQ_ADD ) {
                memctx = sl_mem_create( memsiz, ctx );
                ber_set_option( op->o_ber, LBER_OPT_BER_MEMCTX, memctx );
                op->o_tmpmemctx = memctx;
index daade821c01217927de76e0857b3846d150fa7e7..64b32f8dbe9c6e2ee84b4fac2cfb477fc07a7bb3 100644 (file)
@@ -76,7 +76,7 @@ do_delete(
                goto cleanup;
        } 
 
-       rs->sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn );
+       rs->sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn, op->o_tmpmemctx );
        if( rs->sr_err != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
                LDAP_LOG( OPERATION, INFO, 
index 0df75dfadb5d1c22a4b25e4f14e4cd342631e095..b02680096c0d29389241160486b15be2ea8daff3 100644 (file)
  * structural representation of a distinguished name.
  */
 static int
-LDAPDN_validate( LDAPDN *dn )
+LDAPDN_validate( LDAPDN dn )
 {
        int             iRDN;
        int             rc;
 
        assert( dn );
 
-       for ( iRDN = 0; dn[ 0 ][ iRDN ]; iRDN++ ) {
-               LDAPRDN         *rdn = dn[ 0 ][ iRDN ];
+       for ( iRDN = 0; dn[ iRDN ]; iRDN++ ) {
+               LDAPRDN         rdn = dn[ iRDN ];
                int             iAVA;
 
                assert( rdn );
 
-               for ( iAVA = 0; rdn[ 0 ][ iAVA ]; iAVA++ ) {
-                       LDAPAVA                 *ava = rdn[ 0 ][ iAVA ];
+               for ( iAVA = 0; rdn[ iAVA ]; iAVA++ ) {
+                       LDAPAVA                 *ava = rdn[ iAVA ];
                        AttributeDescription    *ad;
                        slap_syntax_validate_func *validate = NULL;
 
@@ -106,7 +106,7 @@ dnValidate(
        struct berval *in )
 {
        int             rc;
-       LDAPDN          *dn = NULL;
+       LDAPDN          dn = NULL;
 
        assert( in );
 
@@ -152,16 +152,16 @@ dnValidate(
  * a RDN should be limited.
  */
 static void
-AVA_Sort( LDAPRDN *rdn, int iAVA )
+AVA_Sort( LDAPRDN rdn, int iAVA )
 {
        int             i;
-       LDAPAVA         *ava_in = rdn[ 0 ][ iAVA ];
+       LDAPAVA         *ava_in = rdn[ iAVA ];
 
        assert( rdn );
        assert( ava_in );
        
        for ( i = 0; i < iAVA; i++ ) {
-               LDAPAVA         *ava = rdn[ 0 ][ i ];
+               LDAPAVA         *ava = rdn[ i ];
                int             a, j;
 
                assert( ava );
@@ -200,7 +200,7 @@ AVA_Sort( LDAPRDN *rdn, int iAVA )
                                return;
                        }
 
-                       ava = rdn[ 0 ][ i ];
+                       ava = rdn[ i ];
                        a = strcmp( ava_in->la_attr.bv_val, 
                                        ava->la_attr.bv_val );
                }
@@ -209,9 +209,9 @@ AVA_Sort( LDAPRDN *rdn, int iAVA )
                 * move ahead
                 */
                for ( j = iAVA; j > i; j-- ) {
-                       rdn[ 0 ][ j ] = rdn[ 0 ][ j - 1 ];
+                       rdn[ j ] = rdn[ j - 1 ];
                }
-               rdn[ 0 ][ i ] = ava_in;
+               rdn[ i ] = ava_in;
 
                return;
        }
@@ -222,21 +222,21 @@ AVA_Sort( LDAPRDN *rdn, int iAVA )
  * structural representation of a distinguished name.
  */
 static int
-LDAPDN_rewrite( LDAPDN *dn, unsigned flags )
+LDAPDN_rewrite( LDAPDN dn, unsigned flags, void *ctx )
 {
        int             iRDN;
        int             rc;
 
        assert( dn );
 
-       for ( iRDN = 0; dn[ 0 ][ iRDN ]; iRDN++ ) {
-               LDAPRDN         *rdn = dn[ 0 ][ iRDN ];
+       for ( iRDN = 0; dn[ iRDN ]; iRDN++ ) {
+               LDAPRDN         rdn = dn[ iRDN ];
                int             iAVA;
 
                assert( rdn );
 
-               for ( iAVA = 0; rdn[ 0 ][ iAVA ]; iAVA++ ) {
-                       LDAPAVA                 *ava = rdn[ 0 ][ iAVA ];
+               for ( iAVA = 0; rdn[ iAVA ]; iAVA++ ) {
+                       LDAPAVA                 *ava = rdn[ iAVA ];
                        AttributeDescription    *ad;
                        slap_syntax_validate_func *validf = NULL;
                        slap_mr_normalize_func *normf = NULL;
@@ -303,7 +303,7 @@ LDAPDN_rewrite( LDAPDN *dn, unsigned flags )
                                        ava->la_value.bv_len
                                                ? &ava->la_value
                                                : (struct berval *) &slap_empty_bv,
-                                       &bv );
+                                       &bv, ctx );
                        
                                if ( rc != LDAP_SUCCESS ) {
                                        return LDAP_INVALID_SYNTAX;
@@ -322,7 +322,7 @@ LDAPDN_rewrite( LDAPDN *dn, unsigned flags )
                                        ava->la_value.bv_len
                                                ? &ava->la_value
                                                : (struct berval *) &slap_empty_bv,
-                                       &bv );
+                                       &bv, ctx );
                        
                                if ( rc != LDAP_SUCCESS ) {
                                        return LDAP_INVALID_SYNTAX;
@@ -331,7 +331,7 @@ LDAPDN_rewrite( LDAPDN *dn, unsigned flags )
 
 
                        if( bv.bv_val ) {
-                               free( ava->la_value.bv_val );
+                               ber_memfree_x( ava->la_value.bv_val, ctx );
                                ava->la_value = bv;
                        }
 
@@ -348,7 +348,8 @@ dnNormalize(
     Syntax *syntax,
     MatchingRule *mr,
     struct berval *val,
-    struct berval *out )
+    struct berval *out,
+    void *ctx)
 {
        assert( val );
        assert( out );
@@ -356,13 +357,13 @@ dnNormalize(
        Debug( LDAP_DEBUG_TRACE, ">>> dnNormalize: <%s>\n", val->bv_val, 0, 0 );
 
        if ( val->bv_len != 0 ) {
-               LDAPDN          *dn = NULL;
+               LDAPDN          dn = NULL;
                int             rc;
 
                /*
                 * Go to structural representation
                 */
-               rc = ldap_bv2dn( val, &dn, LDAP_DN_FORMAT_LDAP );
+               rc = ldap_bv2dn_x( val, &dn, LDAP_DN_FORMAT_LDAP, ctx );
                if ( rc != LDAP_SUCCESS ) {
                        return LDAP_INVALID_SYNTAX;
                }
@@ -372,7 +373,7 @@ dnNormalize(
                /*
                 * Schema-aware rewrite
                 */
-               if ( LDAPDN_rewrite( dn, 0 ) != LDAP_SUCCESS ) {
+               if ( LDAPDN_rewrite( dn, 0, ctx ) != LDAP_SUCCESS ) {
                        ldap_dnfree( dn );
                        return LDAP_INVALID_SYNTAX;
                }
@@ -380,16 +381,16 @@ dnNormalize(
                /*
                 * Back to string representation
                 */
-               rc = ldap_dn2bv( dn, out,
-                       LDAP_DN_FORMAT_LDAPV3 | LDAP_DN_PRETTY );
+               rc = ldap_dn2bv_x( dn, out,
+                       LDAP_DN_FORMAT_LDAPV3 | LDAP_DN_PRETTY, ctx );
 
-               ldap_dnfree( dn );
+               ldap_dnfree_x( dn, ctx );
 
                if ( rc != LDAP_SUCCESS ) {
                        return LDAP_INVALID_SYNTAX;
                }
        } else {
-               ber_dupbv( out, val );
+               ber_dupbv_x( out, val, ctx );
        }
 
        Debug( LDAP_DEBUG_TRACE, "<<< dnNormalize: <%s>\n", out->bv_val, 0, 0 );
@@ -426,7 +427,8 @@ int
 dnPretty2(
        Syntax *syntax,
        struct berval *val,
-       struct berval *out)
+       struct berval *out,
+       void *ctx)
 {
        assert( val );
        assert( out );
@@ -438,17 +440,17 @@ dnPretty2(
 #endif
 
        if ( val->bv_len == 0 ) {
-               ber_dupbv( out, val );
+               ber_dupbv_x( out, val, ctx );
 
        } else if ( val->bv_len > SLAP_LDAPDN_MAXLEN ) {
                return LDAP_INVALID_SYNTAX;
 
        } else {
-               LDAPDN          *dn = NULL;
+               LDAPDN          dn = NULL;
                int             rc;
 
                /* FIXME: should be liberal in what we accept */
-               rc = ldap_bv2dn( val, &dn, LDAP_DN_FORMAT_LDAP );
+               rc = ldap_bv2dn_x( val, &dn, LDAP_DN_FORMAT_LDAP, ctx );
                if ( rc != LDAP_SUCCESS ) {
                        return LDAP_INVALID_SYNTAX;
                }
@@ -458,8 +460,8 @@ dnPretty2(
                /*
                 * Schema-aware rewrite
                 */
-               if ( LDAPDN_rewrite( dn, SLAP_LDAPDN_PRETTY ) != LDAP_SUCCESS ) {
-                       ldap_dnfree( dn );
+               if ( LDAPDN_rewrite( dn, SLAP_LDAPDN_PRETTY, ctx ) != LDAP_SUCCESS ) {
+                       ldap_dnfree_x( dn, ctx );
                        return LDAP_INVALID_SYNTAX;
                }
 
@@ -467,10 +469,10 @@ dnPretty2(
                /* RE: the default is the form that is used as
                 * an internal representation; the pretty form
                 * is a variant */
-               rc = ldap_dn2bv( dn, out,
-                       LDAP_DN_FORMAT_LDAPV3 | LDAP_DN_PRETTY );
+               rc = ldap_dn2bv_x( dn, out,
+                       LDAP_DN_FORMAT_LDAPV3 | LDAP_DN_PRETTY, ctx );
 
-               ldap_dnfree( dn );
+               ldap_dnfree_x( dn, ctx );
 
                if ( rc != LDAP_SUCCESS ) {
                        return LDAP_INVALID_SYNTAX;
@@ -486,8 +488,9 @@ int
 dnPrettyNormalDN(
        Syntax *syntax,
        struct berval *val,
-       LDAPDN **dn,
-       int flags )
+       LDAPDN *dn,
+       int flags,
+       void *ctx )
 {
        assert( val );
        assert( dn );
@@ -512,7 +515,7 @@ dnPrettyNormalDN(
                int             rc;
 
                /* FIXME: should be liberal in what we accept */
-               rc = ldap_bv2dn( val, dn, LDAP_DN_FORMAT_LDAP );
+               rc = ldap_bv2dn_x( val, dn, LDAP_DN_FORMAT_LDAP, ctx );
                if ( rc != LDAP_SUCCESS ) {
                        return LDAP_INVALID_SYNTAX;
                }
@@ -522,8 +525,8 @@ dnPrettyNormalDN(
                /*
                 * Schema-aware rewrite
                 */
-               if ( LDAPDN_rewrite( *dn, flags ) != LDAP_SUCCESS ) {
-                       ldap_dnfree( *dn );
+               if ( LDAPDN_rewrite( *dn, flags, ctx ) != LDAP_SUCCESS ) {
+                       ldap_dnfree_x( *dn, ctx );
                        *dn = NULL;
                        return LDAP_INVALID_SYNTAX;
                }
@@ -544,7 +547,8 @@ dnPrettyNormal(
        Syntax *syntax,
        struct berval *val,
        struct berval *pretty,
-       struct berval *normal)
+       struct berval *normal,
+       void *ctx)
 {
 #ifdef NEW_LOGGING
        LDAP_LOG ( OPERATION, ENTRY, ">>> dnPrettyNormal: <%s>\n", val->bv_val, 0, 0 );
@@ -557,15 +561,15 @@ dnPrettyNormal(
        assert( normal );
 
        if ( val->bv_len == 0 ) {
-               ber_dupbv( pretty, val );
-               ber_dupbv( normal, val );
+               ber_dupbv_x( pretty, val, ctx );
+               ber_dupbv_x( normal, val, ctx );
 
        } else if ( val->bv_len > SLAP_LDAPDN_MAXLEN ) {
                /* too big */
                return LDAP_INVALID_SYNTAX;
 
        } else {
-               LDAPDN          *dn = NULL;
+               LDAPDN          dn = NULL;
                int             rc;
 
                pretty->bv_val = NULL;
@@ -574,7 +578,7 @@ dnPrettyNormal(
                normal->bv_len = 0;
 
                /* FIXME: should be liberal in what we accept */
-               rc = ldap_bv2dn( val, &dn, LDAP_DN_FORMAT_LDAP );
+               rc = ldap_bv2dn_x( val, &dn, LDAP_DN_FORMAT_LDAP, ctx );
                if ( rc != LDAP_SUCCESS ) {
                        return LDAP_INVALID_SYNTAX;
                }
@@ -584,33 +588,33 @@ dnPrettyNormal(
                /*
                 * Schema-aware rewrite
                 */
-               if ( LDAPDN_rewrite( dn, SLAP_LDAPDN_PRETTY ) != LDAP_SUCCESS ) {
-                       ldap_dnfree( dn );
+               if ( LDAPDN_rewrite( dn, SLAP_LDAPDN_PRETTY, ctx ) != LDAP_SUCCESS ) {
+                       ldap_dnfree_x( dn, ctx );
                        return LDAP_INVALID_SYNTAX;
                }
 
-               rc = ldap_dn2bv( dn, pretty,
-                       LDAP_DN_FORMAT_LDAPV3 | LDAP_DN_PRETTY );
+               rc = ldap_dn2bv_x( dn, pretty,
+                       LDAP_DN_FORMAT_LDAPV3 | LDAP_DN_PRETTY, ctx );
 
                if ( rc != LDAP_SUCCESS ) {
-                       ldap_dnfree( dn );
+                       ldap_dnfree_x( dn, ctx );
                        return LDAP_INVALID_SYNTAX;
                }
 
-               if ( LDAPDN_rewrite( dn, 0 ) != LDAP_SUCCESS ) {
-                       ldap_dnfree( dn );
-                       free( pretty->bv_val );
+               if ( LDAPDN_rewrite( dn, 0, ctx ) != LDAP_SUCCESS ) {
+                       ldap_dnfree_x( dn, ctx );
+                       ber_memfree_x( pretty->bv_val, ctx );
                        pretty->bv_val = NULL;
                        pretty->bv_len = 0;
                        return LDAP_INVALID_SYNTAX;
                }
 
-               rc = ldap_dn2bv( dn, normal,
-                       LDAP_DN_FORMAT_LDAPV3 | LDAP_DN_PRETTY );
+               rc = ldap_dn2bv_x( dn, normal,
+                       LDAP_DN_FORMAT_LDAPV3 | LDAP_DN_PRETTY, ctx );
 
-               ldap_dnfree( dn );
+               ldap_dnfree_x( dn, ctx );
                if ( rc != LDAP_SUCCESS ) {
-                       free( pretty->bv_val );
+                       ber_memfree_x( pretty->bv_val, ctx );
                        pretty->bv_val = NULL;
                        pretty->bv_len = 0;
                        return LDAP_INVALID_SYNTAX;
@@ -701,9 +705,10 @@ dnParent(
 int
 dnExtractRdn( 
        struct berval   *dn, 
-       struct berval   *rdn )
+       struct berval   *rdn,
+       void *ctx )
 {
-       LDAPRDN         *tmpRDN;
+       LDAPRDN         tmpRDN;
        const char      *p;
        int             rc;
 
@@ -714,14 +719,14 @@ dnExtractRdn(
                return LDAP_OTHER;
        }
 
-       rc = ldap_bv2rdn( dn, &tmpRDN, (char **)&p, LDAP_DN_FORMAT_LDAP );
+       rc = ldap_bv2rdn_x( dn, &tmpRDN, (char **)&p, LDAP_DN_FORMAT_LDAP, ctx );
        if ( rc != LDAP_SUCCESS ) {
                return rc;
        }
 
-       rc = ldap_rdn2bv( tmpRDN, rdn, LDAP_DN_FORMAT_LDAPV3 | LDAP_DN_PRETTY );
+       rc = ldap_rdn2bv_x( tmpRDN, rdn, LDAP_DN_FORMAT_LDAPV3 | LDAP_DN_PRETTY, ctx );
 
-       ldap_rdnfree( tmpRDN );
+       ldap_rdnfree_x( tmpRDN, ctx );
        if ( rc != LDAP_SUCCESS ) {
                return rc;
        }
index d01e5259280640c97d63b5634203fab0af9f22be..61749ad06b95b25d481d44b41ef3c7de69eb0090 100644 (file)
@@ -127,7 +127,7 @@ str2entry( char *s )
                                return NULL;
                        }
 
-                       rc = dnPrettyNormal( NULL, &vals[0], &e->e_name, &e->e_nname );
+                       rc = dnPrettyNormal( NULL, &vals[0], &e->e_name, &e->e_nname, NULL );
                        if( rc != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
                                LDAP_LOG( OPERATION, DETAIL1, 
@@ -191,7 +191,7 @@ str2entry( char *s )
 
                        if( pretty ) {
                                rc = pretty( ad->ad_type->sat_syntax,
-                                       &vals[0], &pval );
+                                       &vals[0], &pval, NULL );
 
                        } else if( validate ) {
                                /*
@@ -247,7 +247,7 @@ str2entry( char *s )
                                SLAP_MR_VALUE_OF_ATTRIBUTE_SYNTAX,
                                ad->ad_type->sat_syntax,
                                ad->ad_type->sat_equality,
-                               &vals[0], &nvals[0] );
+                               &vals[0], &nvals[0], NULL );
 
                        if( rc ) {
 #ifdef NEW_LOGGING
@@ -442,6 +442,9 @@ entry_id_cmp( const void *v_e1, const void *v_e2 )
        return( e1->e_id < e2->e_id ? -1 : (e1->e_id > e2->e_id ? 1 : 0) );
 }
 
+#define entry_lenlen(l)        ((l) < 0x80) ? 1 : ((l) < 0x100) ? 2 : \
+       ((l) < 0x10000) ? 3 : ((l) < 0x1000000) ? 4 : 5
+#if 0
 /* This is like a ber_len */
 static ber_len_t
 entry_lenlen(ber_len_t len)
@@ -456,6 +459,7 @@ entry_lenlen(ber_len_t len)
                return 4;
        return 5;
 }
+#endif
 
 static void
 entry_putlen(unsigned char **buf, ber_len_t len)
index 9312bb97e87e1d15281c62079d9f221dbd7e3230..19acd9e38dda5f906256a8a1577f33bd8e43f396 100644 (file)
@@ -426,7 +426,7 @@ get_ssa(
                /* validate/normalize using equality matching rule validator! */
                rc = asserted_value_validate_normalize(
                        ssa.sa_desc, ssa.sa_desc->ad_type->sat_equality,
-                       usage, &value, &nvalue, text );
+                       usage, &value, &nvalue, text, op->o_tmpmemctx );
 
                if( rc != LDAP_SUCCESS ) {
                        goto return_error;
@@ -448,7 +448,7 @@ get_ssa(
                                || ssa.sa_any != NULL 
                                || ssa.sa_final.bv_val != NULL )
                        {
-                               free( nvalue.bv_val );
+                               sl_free( nvalue.bv_val, op->o_tmpmemctx );
                                goto return_error;
                        }
 
@@ -465,15 +465,11 @@ get_ssa(
 #endif
 
                        if ( ssa.sa_final.bv_val != NULL ) {
-                               free( nvalue.bv_val );
+                               sl_free( nvalue.bv_val, op->o_tmpmemctx );
                                goto return_error;
                        }
 
-#ifdef notyet
                        ber_bvarray_add_x( &ssa.sa_any, &nvalue, op->o_tmpmemctx );
-#else
-                       ber_bvarray_add( &ssa.sa_any, &nvalue );
-#endif
                        break;
 
                case LDAP_SUBSTRING_FINAL:
@@ -486,7 +482,7 @@ get_ssa(
 #endif
 
                        if ( ssa.sa_final.bv_val != NULL ) {
-                               free( nvalue.bv_val );
+                               sl_free( nvalue.bv_val, op->o_tmpmemctx );
                                goto return_error;
                        }
 
@@ -505,7 +501,7 @@ get_ssa(
 #endif
 
                        assert( 0 );
-                       free( nvalue.bv_val );
+                       sl_free( nvalue.bv_val, op->o_tmpmemctx );
 
 return_error:
 #ifdef NEW_LOGGING
@@ -516,9 +512,9 @@ return_error:
                        Debug( LDAP_DEBUG_FILTER, "  error=%ld\n",
                                (long) rc, 0, 0 );
 #endif
-                       free( ssa.sa_initial.bv_val );
-                       ber_bvarray_free( ssa.sa_any );
-                       free( ssa.sa_final.bv_val );
+                       sl_free( ssa.sa_initial.bv_val, op->o_tmpmemctx );
+                       ber_bvarray_free_x( ssa.sa_any, op->o_tmpmemctx );
+                       sl_free( ssa.sa_final.bv_val, op->o_tmpmemctx );
                        return rc;
                }
 
@@ -562,19 +558,11 @@ filter_free_x( Operation *op, Filter *f )
 
        case LDAP_FILTER_SUBSTRINGS:
                if ( f->f_sub_initial.bv_val != NULL ) {
-#ifdef notyet
                        op->o_tmpfree( f->f_sub_initial.bv_val, op->o_tmpmemctx );
-#else
-                       ch_free( f->f_sub_initial.bv_val );
-#endif
                }
-               ber_bvarray_free( f->f_sub_any );
+               ber_bvarray_free_x( f->f_sub_any, op->o_tmpmemctx );
                if ( f->f_sub_final.bv_val != NULL ) {
-#ifdef notyet
                        op->o_tmpfree( f->f_sub_final.bv_val, op->o_tmpmemctx );
-#else
-                       ch_free( f->f_sub_final.bv_val );
-#endif
                }
                op->o_tmpfree( f->f_sub, op->o_tmpmemctx );
                break;
@@ -1150,19 +1138,11 @@ vrFilter_free( Operation *op, ValuesReturnFilter *vrf )
 
                case LDAP_FILTER_SUBSTRINGS:
                        if ( vrf->vrf_sub_initial.bv_val != NULL ) {
-#ifdef notyet
                                op->o_tmpfree( vrf->vrf_sub_initial.bv_val, op->o_tmpmemctx );
-#else
-                               ch_free( vrf->vrf_sub_initial.bv_val );
-#endif
                        }
                        ber_bvarray_free_x( vrf->vrf_sub_any, op->o_tmpmemctx );
                        if ( vrf->vrf_sub_final.bv_val != NULL ) {
-#ifdef notyet
                                op->o_tmpfree( vrf->vrf_sub_final.bv_val, op->o_tmpmemctx );
-#else
-                               ch_free( vrf->vrf_sub_final.bv_val );
-#endif
                        }
                        op->o_tmpfree( vrf->vrf_sub, op->o_tmpmemctx );
                        break;
index 13cae45d14811135663d7fdfbd36044f8167d982..386ea48a15c8155f768beead60fa3606237dd545 100644 (file)
@@ -257,7 +257,7 @@ static int test_mra_filter(
                        /* normalize for equality */
                        rc = asserted_value_validate_normalize( a->a_desc, mra->ma_rule,
                                SLAP_MR_EXT|SLAP_MR_VALUE_OF_ASSERTION_SYNTAX,
-                               &mra->ma_value, &value, &text );
+                               &mra->ma_value, &value, &text, op->o_tmpmemctx );
                        if ( rc != LDAP_SUCCESS ) {
                                continue;
                        }
@@ -294,22 +294,22 @@ static int test_mra_filter(
 
        /* check attrs in DN AVAs if required */
        if ( mra->ma_dnattrs ) {
-               LDAPDN          *dn = NULL;
+               LDAPDN          dn = NULL;
                int             iRDN, iAVA;
                int             rc;
 
                /* parse and pretty the dn */
-               rc = dnPrettyDN( NULL, &e->e_name, &dn );
+               rc = dnPrettyDN( NULL, &e->e_name, &dn, op->o_tmpmemctx );
                if ( rc != LDAP_SUCCESS ) {
                        return LDAP_INVALID_SYNTAX;
                }
 
                /* for each AVA of each RDN ... */
-               for ( iRDN = 0; dn[ 0 ][ iRDN ]; iRDN++ ) {
-                       LDAPRDN         *rdn = dn[ 0 ][ iRDN ];
+               for ( iRDN = 0; dn[ iRDN ]; iRDN++ ) {
+                       LDAPRDN         rdn = dn[ iRDN ];
 
-                       for ( iAVA = 0; rdn[ 0 ][ iAVA ]; iAVA++ ) {
-                               LDAPAVA         *ava = rdn[ 0 ][ iAVA ];
+                       for ( iAVA = 0; rdn[ iAVA ]; iAVA++ ) {
+                               LDAPAVA         *ava = rdn[ iAVA ];
                                struct berval   *bv = &ava->la_value, value;
                                AttributeDescription *ad = (AttributeDescription *)ava->la_private;
                                int ret;
@@ -337,7 +337,7 @@ static int test_mra_filter(
                                        rc = asserted_value_validate_normalize( ad,
                                                mra->ma_rule,
                                                SLAP_MR_EXT|SLAP_MR_VALUE_OF_ASSERTION_SYNTAX,
-                                               &mra->ma_value, &value, &text );
+                                               &mra->ma_value, &value, &text, op->o_tmpmemctx );
                                        if ( rc != LDAP_SUCCESS ) {
                                                continue;
                                        }
@@ -354,12 +354,12 @@ static int test_mra_filter(
                                        bv, &value, &text );
 
                                if( rc != LDAP_SUCCESS ) {
-                                       ldap_dnfree( dn );
+                                       ldap_dnfree_x( dn, op->o_tmpmemctx );
                                        return rc;
                                }
 
                                if ( ret == 0 ) {
-                                       ldap_dnfree( dn );
+                                       ldap_dnfree_x( dn, op->o_tmpmemctx );
                                        return LDAP_COMPARE_TRUE;
                                }
                        }
index 7fae9b282fb226c3883a7b5e5c93394535f7fc30..5a32b6508b6f5e659cd7dac8473163e9400b1037 100644 (file)
@@ -174,7 +174,7 @@ add_limits(
                        bv.bv_val = (char *) pattern;
                        bv.bv_len = strlen( pattern );
 
-                       rc = dnNormalize2( NULL, &bv, &lm->lm_dn_pat );
+                       rc = dnNormalize2( NULL, &bv, &lm->lm_dn_pat, NULL );
                        if ( rc != LDAP_SUCCESS ) {
                                ch_free( lm );
                                return( -1 );
index e13d66129614fd5e33cdca7d7eac4774d1c779fb..39cb6426bb8efd85440900b3ca94e4f9dd117524 100644 (file)
@@ -357,7 +357,7 @@ test_mra_vrFilter(
 
                        rc = asserted_value_validate_normalize( a->a_desc, mra->ma_rule,
                                SLAP_MR_EXT|SLAP_MR_VALUE_OF_ASSERTION_SYNTAX,
-                               &mra->ma_value, &value, &text );
+                               &mra->ma_value, &value, &text, op->o_tmpmemctx );
 
                        if( rc != LDAP_SUCCESS ) continue;
                }
index 8944b2297f27f9741cf1e54d0c87fee43a7dc742..c00bb762d5e7c3ed996378b3e409befd90f97609 100644 (file)
@@ -177,7 +177,7 @@ do_modify(
                goto cleanup;
        }
 
-       rs->sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn );
+       rs->sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn, op->o_tmpmemctx );
        if( rs->sr_err != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
                LDAP_LOG( OPERATION, INFO, "do_modify: conn %d  invalid dn (%s)\n",
@@ -394,7 +394,7 @@ do_modify(
                        size_t textlen = sizeof textbuf;
 
                        rs->sr_err = slap_mods_check( modlist, update, &rs->sr_text,
-                               textbuf, textlen );
+                               textbuf, textlen, op->o_tmpmemctx );
 
                        if( rs->sr_err != LDAP_SUCCESS ) {
                                send_ldap_result( op, rs );
@@ -476,7 +476,8 @@ int slap_mods_check(
        int update,
        const char **text,
        char *textbuf,
-       size_t textlen )
+       size_t textlen,
+       void *ctx )
 {
        int rc;
 
@@ -577,7 +578,7 @@ int slap_mods_check(
                                struct berval pval;
                                if( pretty ) {
                                        rc = pretty( ad->ad_type->sat_syntax,
-                                               &ml->sml_values[nvals], &pval );
+                                               &ml->sml_values[nvals], &pval, ctx );
                                } else {
                                        rc = validate( ad->ad_type->sat_syntax,
                                                &ml->sml_values[nvals] );
@@ -592,7 +593,7 @@ int slap_mods_check(
                                }
 
                                if( pretty ) {
-                                       ber_memfree( ml->sml_values[nvals].bv_val );
+                                       ber_memfree_x( ml->sml_values[nvals].bv_val, ctx );
                                        ml->sml_values[nvals] = pval;
                                }
                        }
@@ -614,13 +615,13 @@ int slap_mods_check(
                        if( nvals && ad->ad_type->sat_equality &&
                                ad->ad_type->sat_equality->smr_normalize )
                        {
-                               ml->sml_nvalues = ch_malloc( (nvals+1)*sizeof(struct berval) );
+                               ml->sml_nvalues = ber_memalloc_x( (nvals+1)*sizeof(struct berval), ctx );
                                for( nvals = 0; ml->sml_values[nvals].bv_val; nvals++ ) {
                                        rc = ad->ad_type->sat_equality->smr_normalize(
                                                0,
                                                ad->ad_type->sat_syntax,
                                                ad->ad_type->sat_equality,
-                                               &ml->sml_values[nvals], &ml->sml_nvalues[nvals] );
+                                               &ml->sml_values[nvals], &ml->sml_nvalues[nvals], ctx );
                                        if( rc ) {
 #ifdef NEW_LOGGING
                                                LDAP_LOG( OPERATION, DETAIL1,
index 83ce08eeb8c74f8b450897c5ca73b7345d3f1225..49d6a3842a8c817ff9ab414119e39a8b99275caf 100644 (file)
@@ -173,7 +173,7 @@ do_modrdn(
                goto cleanup;
        } 
 
-       rs->sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn );
+       rs->sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn, op->o_tmpmemctx );
        if( rs->sr_err != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
                LDAP_LOG( OPERATION, INFO, 
@@ -216,7 +216,7 @@ do_modrdn(
 
        /* FIXME: should have/use rdnPretty / rdnNormalize routines */
 
-       rs->sr_err = dnPrettyNormal( NULL, &newrdn, &op->orr_newrdn, &op->orr_nnewrdn );
+       rs->sr_err = dnPrettyNormal( NULL, &newrdn, &op->orr_newrdn, &op->orr_nnewrdn, op->o_tmpmemctx );
        if( rs->sr_err != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
                LDAP_LOG( OPERATION, INFO, 
@@ -245,7 +245,7 @@ do_modrdn(
 
        if( op->orr_newSup ) {
                rs->sr_err = dnPrettyNormal( NULL, &newSuperior, &pnewSuperior,
-                       &nnewSuperior );
+                       &nnewSuperior, op->o_tmpmemctx );
                if( rs->sr_err != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
                        LDAP_LOG( OPERATION, INFO, 
@@ -407,8 +407,8 @@ slap_modrdn2mods(
        Operation       *op,
        SlapReply       *rs,
        Entry           *e,
-       LDAPRDN         *old_rdn,
-       LDAPRDN         *new_rdn,
+       LDAPRDN         old_rdn,
+       LDAPRDN         new_rdn,
        Modifications   **pmod )
 {
        Modifications   *mod = NULL;
@@ -418,40 +418,40 @@ slap_modrdn2mods(
        assert( !op->orr_deleteoldrdn || old_rdn != NULL );
 
        /* Add new attribute values to the entry */
-       for ( a_cnt = 0; new_rdn[0][a_cnt]; a_cnt++ ) {
+       for ( a_cnt = 0; new_rdn[a_cnt]; a_cnt++ ) {
                AttributeDescription    *desc = NULL;
                Modifications           *mod_tmp;
 
-               rs->sr_err = slap_bv2ad( &new_rdn[0][a_cnt]->la_attr, &desc, &rs->sr_text );
+               rs->sr_err = slap_bv2ad( &new_rdn[a_cnt]->la_attr, &desc, &rs->sr_text );
 
                if ( rs->sr_err != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
                        LDAP_LOG ( OPERATION, ERR, 
                                "slap_modrdn2modlist: %s: %s (new)\n", 
                                rs->sr_text, 
-                               new_rdn[ 0 ][ a_cnt ]->la_attr.bv_val, 0 );
+                               new_rdn[ a_cnt ]->la_attr.bv_val, 0 );
 #else
                        Debug( LDAP_DEBUG_TRACE,
                                "slap_modrdn2modlist: %s: %s (new)\n",
                                rs->sr_text, 
-                               new_rdn[ 0 ][ a_cnt ]->la_attr.bv_val, 0 );
+                               new_rdn[ a_cnt ]->la_attr.bv_val, 0 );
 #endif
                        goto done;              
                }
 
                /* ACL check of newly added attrs */
                if ( op->o_bd && !access_allowed( op, e, desc,
-                       &new_rdn[0][a_cnt]->la_value, ACL_WRITE, NULL ) ) {
+                       &new_rdn[a_cnt]->la_value, ACL_WRITE, NULL ) ) {
 #ifdef NEW_LOGGING
                        LDAP_LOG ( OPERATION, ERR, 
                                "slap_modrdn2modlist: access to attr \"%s\" "
                                "(new) not allowed\n", 
-                               new_rdn[0][a_cnt]->la_attr.bv_val, 0, 0 );
+                               new_rdn[a_cnt]->la_attr.bv_val, 0, 0 );
 #else
                        Debug( LDAP_DEBUG_TRACE,
                                "slap_modrdn2modlist: access to attr \"%s\" "
                                "(new) not allowed\n", 
-                               new_rdn[0][ a_cnt ]->la_attr.bv_val, 0, 0 );
+                               new_rdn[ a_cnt ]->la_attr.bv_val, 0, 0 );
 #endif
                        rs->sr_err = LDAP_INSUFFICIENT_ACCESS;
                        goto done;
@@ -462,7 +462,7 @@ slap_modrdn2mods(
                        + 4 * sizeof( struct berval ) );
                mod_tmp->sml_desc = desc;
                mod_tmp->sml_values = ( BerVarray )( mod_tmp + 1 );
-               mod_tmp->sml_values[0] = new_rdn[0][a_cnt]->la_value;
+               mod_tmp->sml_values[0] = new_rdn[a_cnt]->la_value;
                mod_tmp->sml_values[1].bv_val = NULL;
                if( desc->ad_type->sat_equality->smr_normalize) {
                        mod_tmp->sml_nvalues = &mod_tmp->sml_values[2];
@@ -471,7 +471,7 @@ slap_modrdn2mods(
                                desc->ad_type->sat_syntax,
                                desc->ad_type->sat_equality,
                                &mod_tmp->sml_values[0],
-                               &mod_tmp->sml_nvalues[0] );
+                               &mod_tmp->sml_nvalues[0], op->o_tmpmemctx );
                        mod_tmp->sml_nvalues[1].bv_val = NULL;
                } else {
                        mod_tmp->sml_nvalues = NULL;
@@ -483,23 +483,23 @@ slap_modrdn2mods(
 
        /* Remove old rdn value if required */
        if ( op->orr_deleteoldrdn ) {
-               for ( d_cnt = 0; old_rdn[0][d_cnt]; d_cnt++ ) {
+               for ( d_cnt = 0; old_rdn[d_cnt]; d_cnt++ ) {
                        AttributeDescription    *desc = NULL;
                        Modifications           *mod_tmp;
 
-                       rs->sr_err = slap_bv2ad( &old_rdn[0][d_cnt]->la_attr, &desc, &rs->sr_text );
+                       rs->sr_err = slap_bv2ad( &old_rdn[d_cnt]->la_attr, &desc, &rs->sr_text );
                        if ( rs->sr_err != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
                                LDAP_LOG ( OPERATION, ERR, 
                                        "slap_modrdn2modlist: %s: %s (old)\n", 
                                        rs->sr_text, 
-                                       old_rdn[0][d_cnt]->la_attr.bv_val, 
+                                       old_rdn[d_cnt]->la_attr.bv_val, 
                                        0 );
 #else
                                Debug( LDAP_DEBUG_TRACE,
                                        "slap_modrdn2modlist: %s: %s (old)\n",
                                        rs->sr_text, 
-                                       old_rdn[0][d_cnt]->la_attr.bv_val, 
+                                       old_rdn[d_cnt]->la_attr.bv_val, 
                                        0 );
 #endif
                                goto done;              
@@ -507,19 +507,19 @@ slap_modrdn2mods(
 
                        /* ACL check of newly added attrs */
                        if ( op->o_bd && !access_allowed( op, e, desc,
-                               &old_rdn[0][d_cnt]->la_value, ACL_WRITE, 
+                               &old_rdn[d_cnt]->la_value, ACL_WRITE, 
                                NULL ) ) {
 #ifdef NEW_LOGGING
                                LDAP_LOG ( OPERATION, ERR, 
                                        "slap_modrdn2modlist: access "
                                        "to attr \"%s\" (old) not allowed\n", 
-                                       old_rdn[ 0 ][ d_cnt ]->la_attr.bv_val, 
+                                       old_rdn[ d_cnt ]->la_attr.bv_val, 
                                        0, 0 );
 #else
                                Debug( LDAP_DEBUG_TRACE,
                                        "slap_modrdn2modlist: access "
                                        "to attr \"%s\" (old) not allowed\n", 
-                                       old_rdn[ 0 ][ d_cnt ]->la_attr.bv_val,
+                                       old_rdn[ d_cnt ]->la_attr.bv_val,
                                        0, 0 );
 #endif
                                rs->sr_err = LDAP_INSUFFICIENT_ACCESS;
@@ -531,7 +531,7 @@ slap_modrdn2mods(
                                + 4 * sizeof ( struct berval ) );
                        mod_tmp->sml_desc = desc;
                        mod_tmp->sml_values = ( BerVarray )(mod_tmp+1);
-                       mod_tmp->sml_values[0] = old_rdn[0][d_cnt]->la_value;
+                       mod_tmp->sml_values[0] = old_rdn[d_cnt]->la_value;
                        mod_tmp->sml_values[1].bv_val = NULL;
                        if( desc->ad_type->sat_equality->smr_normalize) {
                                mod_tmp->sml_nvalues = &mod_tmp->sml_values[2];
@@ -540,7 +540,7 @@ slap_modrdn2mods(
                                        desc->ad_type->sat_syntax,
                                        desc->ad_type->sat_equality,
                                        &mod_tmp->sml_values[0],
-                                       &mod_tmp->sml_nvalues[0] );
+                                       &mod_tmp->sml_nvalues[0], op->o_tmpmemctx );
                                mod_tmp->sml_nvalues[1].bv_val = NULL;
                        } else {
                                mod_tmp->sml_nvalues = NULL;
index 7e3a179030db1086830bb2f3ef22e78e7a31f1d9..ce4a86def0bee0321f33e761f105771f047fa03b 100644 (file)
@@ -212,7 +212,7 @@ get_mra(
        rc = asserted_value_validate_normalize( ma.ma_desc,
                ma.ma_rule,
                SLAP_MR_EXT|SLAP_MR_VALUE_OF_ASSERTION_SYNTAX,
-               &value, &ma.ma_value, text );
+               &value, &ma.ma_value, text, op->o_tmpmemctx );
 
        if( rc != LDAP_SUCCESS ) {
                return rc;
index 235d0a447e13f4375d986ac4ac04a644e042a2da..0ea64da22542303c987352d55a778d2f615d20c8 100644 (file)
@@ -148,10 +148,10 @@ LDAP_SLAPD_F (int) attr_merge_one LDAP_P(( Entry *e,
        struct berval *nval ));
 LDAP_SLAPD_F (int) attr_merge_normalize LDAP_P(( Entry *e,
        AttributeDescription *desc,
-       BerVarray vals ));
+       BerVarray vals, void *memctx ));
 LDAP_SLAPD_F (int) attr_merge_normalize_one LDAP_P(( Entry *e,
        AttributeDescription *desc,
-       struct berval *val ));
+       struct berval *val, void *memctx ));
 LDAP_SLAPD_F (Attribute *) attrs_find LDAP_P((
        Attribute *a, AttributeDescription *desc ));
 LDAP_SLAPD_F (Attribute *) attr_find LDAP_P((
@@ -370,29 +370,22 @@ LDAP_SLAPD_F (int) dnValidate LDAP_P((
        Syntax *syntax, 
        struct berval *val ));
 
-LDAP_SLAPD_F (int) dnNormalize LDAP_P((
-       slap_mask_t use,
-       Syntax *syntax, 
-       MatchingRule *mr,
-       struct berval *val, 
-       struct berval *normalized ));
-#define dnNormalize2(s,v,n)            dnNormalize(0,(s),NULL,(v),(n))
+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 (int) dnPretty2 LDAP_P(( 
-       Syntax *syntax, 
-       struct berval *val, 
-       struct berval *pretty ));
+LDAP_SLAPD_F (slap_syntax_transform_func) dnPretty2;
 
 LDAP_SLAPD_F (int) dnPrettyNormal LDAP_P(( 
        Syntax *syntax, 
        struct berval *val, 
        struct berval *pretty,
-       struct berval *normal ));
+       struct berval *normal,
+       void *ctx ));
 
 LDAP_SLAPD_F (int) dnMatch LDAP_P(( 
        int *matchp, 
@@ -406,7 +399,7 @@ LDAP_SLAPD_F (int) dnIsSuffix LDAP_P((
        const struct berval *dn, const struct berval *suffix ));
 
 LDAP_SLAPD_F (int) dnExtractRdn LDAP_P((
-       struct berval *dn, struct berval *rdn ));
+       struct berval *dn, struct berval *rdn, void *ctx ));
 
 LDAP_SLAPD_F (int) rdnValidate LDAP_P(( struct berval * rdn ));
 
@@ -423,11 +416,11 @@ LDAP_SLAPD_F (int) dnX509normalize LDAP_P(( void *x509_name, struct berval *out
 
 LDAP_SLAPD_F (int) dnX509peerNormalize LDAP_P(( void *ssl, struct berval *dn ));
 
-LDAP_SLAPD_F (int) dnPrettyNormalDN LDAP_P(( Syntax *syntax, struct berval *val, LDAPDN **dn, int flags ));
-#define dnPrettyDN(syntax, val, dn) \
-       dnPrettyNormalDN((syntax),(val),(dn), SLAP_LDAPDN_PRETTY)
-#define dnNormalDN(syntax, val, dn) \
-       dnPrettyNormalDN((syntax),(val),(dn), 0)
+LDAP_SLAPD_F (int) dnPrettyNormalDN LDAP_P(( Syntax *syntax, struct berval *val, LDAPDN *dn, int flags, void *ctx ));
+#define dnPrettyDN(syntax, val, dn, ctx) \
+       dnPrettyNormalDN((syntax),(val),(dn), SLAP_LDAPDN_PRETTY, ctx)
+#define dnNormalDN(syntax, val, dn, ctx) \
+       dnPrettyNormalDN((syntax),(val),(dn), 0, ctx)
 
 
 /*
@@ -575,8 +568,8 @@ LDAP_SLAPD_F (int) slap_modrdn2mods(
        Operation       *op,
        SlapReply       *rs,
        Entry           *e,
-       LDAPRDN         *oldrdn,
-       LDAPRDN         *newrdn,
+       LDAPRDN         oldrdn,
+       LDAPRDN         newrdn,
        Modifications   **pmod );
 
 /*
@@ -586,7 +579,7 @@ LDAP_SLAPD_F( int ) slap_mods_check(
        Modifications *ml,
        int update,
        const char **text,
-       char *textbuf, size_t textlen );
+       char *textbuf, size_t textlen, void *ctx );
 
 LDAP_SLAPD_F( int ) slap_mods_opattrs(
        Operation *op,
@@ -921,23 +914,9 @@ LDAP_SLAPD_V( int ) schema_init_done;
 LDAP_SLAPD_F (int) slap_schema_init LDAP_P((void));
 LDAP_SLAPD_F (void) schema_destroy LDAP_P(( void ));
 
-LDAP_SLAPD_F( int ) octetStringIndexer(
-       slap_mask_t use,
-       slap_mask_t flags,
-       Syntax *syntax,
-       MatchingRule *mr,
-       struct berval *prefix,
-       BerVarray values,
-       BerVarray *keysp );
+LDAP_SLAPD_F( slap_mr_indexer_func ) octetStringIndexer;
 
-LDAP_SLAPD_F( int ) octetStringFilter(
-       slap_mask_t use,
-       slap_mask_t flags,
-       Syntax *syntax,
-       MatchingRule *mr,
-       struct berval *prefix,
-       void * assertValue,
-       BerVarray *keysp );
+LDAP_SLAPD_F( slap_mr_filter_func ) octetStringFilter;
 
 /*
  * schema_prep.c
@@ -1016,7 +995,8 @@ LDAP_SLAPD_F (int) asserted_value_validate_normalize LDAP_P((
        unsigned usage,
        struct berval *in,
        struct berval *out,
-       const char ** text ));
+       const char ** text,
+       void *ctx ));
 
 LDAP_SLAPD_F (int) value_match LDAP_P((
        int *match,
@@ -1030,7 +1010,8 @@ LDAP_SLAPD_F (int) value_find_ex LDAP_P((
        AttributeDescription *ad,
        unsigned flags,
        BerVarray values,
-       struct berval *value ));
+       struct berval *value,
+       void *ctx ));
 
 LDAP_SLAPD_F (int) value_add LDAP_P((
        BerVarray *vals,
index 4e596ef2871ec5cdc237240e4a5ee05d7f424bc7..503e1f4558b9237bc5cbd7c831caafe7f8795240 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 );
+               rc = dnPretty2( 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 );
+       rc = dnPretty2( 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 );
+               rc = dnPretty2( NULL, baseDN, &nbaseDN, NULL );
                if( rc != LDAP_SUCCESS ) {
                        /* Invalid baseDN */
                        ch_free( nrefDN.bv_val );
index f37ba4c8ca70335a5616125d89270fd837daaf03..8424e73c9c05aa096a3913b4d0299c943f817a97 100644 (file)
@@ -61,7 +61,7 @@ add_replica_suffix(
        dn.bv_val = (char *) suffix;
        dn.bv_len = strlen( dn.bv_val );
 
-       rc = dnNormalize2( NULL, &dn, &ndn );
+       rc = dnNormalize2( NULL, &dn, &ndn, NULL );
        if( rc != LDAP_SUCCESS ) {
                return 2;
        }
index 0b1e1285db6d2d4228eaa4d5bc1eeee78665661f..6f95c5edfb0a3af8e9ff1b738bf1f922ad095002 100644 (file)
@@ -1532,6 +1532,10 @@ int slap_sasl_getdn( Connection *conn, Operation *op, char *id, int len,
                id ? ( *id ? id : "<empty>" ) : "NULL", len, 0 );
 #endif
 
+       if ( !op ) {
+               op = conn->c_sasl_bindop;
+       }
+
        dn->bv_val = NULL;
        dn->bv_len = 0;
 
@@ -1606,7 +1610,7 @@ int slap_sasl_getdn( Connection *conn, Operation *op, char *id, int len,
 
                /* Build the new dn */
                c1 = dn->bv_val;
-               dn->bv_val = SLAP_MALLOC( len+1 );
+               dn->bv_val = sl_malloc( len+1, op->o_tmpmemctx );
                if( dn->bv_val == NULL ) {
 #ifdef NEW_LOGGING
                        LDAP_LOG( TRANSPORT, ERR, 
@@ -1648,16 +1652,16 @@ int slap_sasl_getdn( Connection *conn, Operation *op, char *id, int len,
                /* Dup the DN in any case, so we don't risk 
                 * leaks or dangling pointers later,
                 * and the DN value is '\0' terminated */
-               ber_dupbv( &dn2, dn );
+               ber_dupbv_x( &dn2, dn, op->o_tmpmemctx );
                dn->bv_val = dn2.bv_val;
        }
 
        /* All strings are in DN form now. Normalize if needed. */
        if ( do_norm ) {
-               rc = dnNormalize2( NULL, dn, &dn2 );
+               rc = dnNormalize2( NULL, dn, &dn2, op->o_tmpmemctx );
 
                /* User DNs were constructed above and must be freed now */
-               ch_free( dn->bv_val );
+               sl_free( dn->bv_val, op->o_tmpmemctx );
 
                if ( rc != LDAP_SUCCESS ) {
                        dn->bv_val = NULL;
@@ -1667,14 +1671,10 @@ int slap_sasl_getdn( Connection *conn, Operation *op, char *id, int len,
                *dn = dn2;
        }
 
-       if ( !op ) {
-               op = conn->c_sasl_bindop;
-       }
-
        /* Run thru regexp */
        slap_sasl2dn( op, dn, &dn2 );
        if( dn2.bv_val ) {
-               ch_free( dn->bv_val );
+               sl_free( dn->bv_val, op->o_tmpmemctx );
                *dn = dn2;
 #ifdef NEW_LOGGING
                LDAP_LOG( TRANSPORT, ENTRY, 
index cea19411cecacd3ac08a88b1848f594001def927..cb89fe47912877a0eebc31cff057307224b29fa3 100644 (file)
@@ -94,7 +94,7 @@ static int slap_parseURI( Operation *op, struct berval *uri,
 
 is_dn: bv.bv_len = uri->bv_len - (bv.bv_val - uri->bv_val);
 
-               rc = dnNormalize2( NULL, &bv, searchbase );
+               rc = dnNormalize2( NULL, &bv, searchbase, op->o_tmpmemctx );
                if( rc == LDAP_SUCCESS ) {
                        *scope = LDAP_SCOPE_BASE;
                }
@@ -134,7 +134,7 @@ is_dn:      bv.bv_len = uri->bv_len - (bv.bv_val - uri->bv_val);
        /* Grab the searchbase */
        bv.bv_val = ludp->lud_dn;
        bv.bv_len = strlen( bv.bv_val );
-       rc = dnNormalize2( NULL, &bv, searchbase );
+       rc = dnNormalize2( NULL, &bv, searchbase, op->o_tmpmemctx );
 
 done:
        if( rc != LDAP_SUCCESS ) {
index 0cc09ddb0415aeaaee247e3bcd75e1a4600f79a6..db220385e11eb4a7c3e673dec9f00d165d16f679 100644 (file)
@@ -810,7 +810,7 @@ entry_naming_check(
        char *textbuf, size_t textlen )
 {
        /* naming check */
-       LDAPRDN         *rdn = NULL;
+       LDAPRDN         rdn = NULL;
        const char      *p = NULL;
        ber_len_t       cnt;
        int             rc = LDAP_SUCCESS;
@@ -827,8 +827,8 @@ entry_naming_check(
 
        /* Check that each AVA of the RDN is present in the entry */
        /* FIXME: Should also check that each AVA lists a distinct type */
-       for ( cnt = 0; rdn[0][cnt]; cnt++ ) {
-               LDAPAVA *ava = rdn[0][cnt];
+       for ( cnt = 0; rdn[cnt]; cnt++ ) {
+               LDAPAVA *ava = rdn[cnt];
                AttributeDescription *desc = NULL;
                Attribute *attr;
                const char *errtext;
@@ -859,7 +859,7 @@ entry_naming_check(
                if ( value_find_ex( desc,
                        SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH,
                        attr->a_nvals,
-                       &ava->la_value ) != 0 )
+                       &ava->la_value, NULL ) != 0 )
                {
                        snprintf( textbuf, textlen, 
                                "value of naming attribute '%s' is not present in entry",
index 4e3f60e5b8c1c3c2c9b6756b9ae6aee0c7f64cad..60c14a89a8fd64852e8a9b1fe9e1b134573b0456 100644 (file)
@@ -124,7 +124,8 @@ int octetStringIndexer(
        MatchingRule *mr,
        struct berval *prefix,
        BerVarray values,
-       BerVarray *keysp )
+       BerVarray *keysp,
+       void *ctx )
 {
        int i;
        size_t slen, mlen;
@@ -142,7 +143,7 @@ int octetStringIndexer(
        /* we should have at least one value at this point */
        assert( i > 0 );
 
-       keys = ch_malloc( sizeof( struct berval ) * (i+1) );
+       keys = sl_malloc( sizeof( struct berval ) * (i+1), ctx );
 
        slen = syntax->ssyn_oidlen;
        mlen = mr->smr_oidlen;
@@ -161,7 +162,7 @@ int octetStringIndexer(
                        values[i].bv_val, values[i].bv_len );
                HASH_Final( HASHdigest, &HASHcontext );
 
-               ber_dupbv( &keys[i], &digest );
+               ber_dupbv_x( &keys[i], &digest, ctx );
        }
 
        keys[i].bv_val = NULL;
@@ -180,7 +181,8 @@ int octetStringFilter(
        MatchingRule *mr,
        struct berval *prefix,
        void * assertedValue,
-       BerVarray *keysp )
+       BerVarray *keysp,
+       void *ctx )
 {
        size_t slen, mlen;
        BerVarray keys;
@@ -194,7 +196,7 @@ int octetStringFilter(
        slen = syntax->ssyn_oidlen;
        mlen = mr->smr_oidlen;
 
-       keys = ch_malloc( sizeof( struct berval ) * 2 );
+       keys = sl_malloc( sizeof( struct berval ) * 2, ctx );
 
        HASH_Init( &HASHcontext );
        if( prefix != NULL && prefix->bv_len > 0 ) {
@@ -209,7 +211,7 @@ int octetStringFilter(
                value->bv_val, value->bv_len );
        HASH_Final( HASHdigest, &HASHcontext );
 
-       ber_dupbv( keys, &digest );
+       ber_dupbv_x( keys, &digest, ctx );
        keys[1].bv_val = NULL;
        keys[1].bv_len = 0;
 
@@ -351,7 +353,8 @@ octetStringSubstringsIndexer(
        MatchingRule *mr,
        struct berval *prefix,
        BerVarray values,
-       BerVarray *keysp )
+       BerVarray *keysp,
+       void *ctx )
 {
        ber_len_t i, j, nkeys;
        size_t slen, mlen;
@@ -402,7 +405,7 @@ octetStringSubstringsIndexer(
                return LDAP_SUCCESS;
        }
 
-       keys = ch_malloc( sizeof( struct berval ) * (nkeys+1) );
+       keys = sl_malloc( sizeof( struct berval ) * (nkeys+1), ctx );
 
        slen = syntax->ssyn_oidlen;
        mlen = mr->smr_oidlen;
@@ -437,7 +440,7 @@ octetStringSubstringsIndexer(
                                        SLAP_INDEX_SUBSTR_MAXLEN );
                                HASH_Final( HASHdigest, &HASHcontext );
 
-                               ber_dupbv( &keys[nkeys++], &digest );
+                               ber_dupbv_x( &keys[nkeys++], &digest, ctx );
                        }
                }
 
@@ -464,7 +467,7 @@ octetStringSubstringsIndexer(
                                        values[i].bv_val, j );
                                HASH_Final( HASHdigest, &HASHcontext );
 
-                               ber_dupbv( &keys[nkeys++], &digest );
+                               ber_dupbv_x( &keys[nkeys++], &digest, ctx );
                        }
 
                        if( flags & SLAP_INDEX_SUBSTR_FINAL ) {
@@ -484,7 +487,7 @@ octetStringSubstringsIndexer(
                                        &values[i].bv_val[values[i].bv_len-j], j );
                                HASH_Final( HASHdigest, &HASHcontext );
 
-                               ber_dupbv( &keys[nkeys++], &digest );
+                               ber_dupbv_x( &keys[nkeys++], &digest, ctx );
                        }
 
                }
@@ -510,7 +513,8 @@ octetStringSubstringsFilter (
        MatchingRule *mr,
        struct berval *prefix,
        void * assertedValue,
-       BerVarray *keysp )
+       BerVarray *keysp,
+       void *ctx)
 {
        SubstringsAssertion *sa;
        char pre;
@@ -559,7 +563,7 @@ octetStringSubstringsFilter (
        slen = syntax->ssyn_oidlen;
        mlen = mr->smr_oidlen;
 
-       keys = ch_malloc( sizeof( struct berval ) * (nkeys+1) );
+       keys = sl_malloc( sizeof( struct berval ) * (nkeys+1), ctx );
        nkeys = 0;
 
        if( flags & SLAP_INDEX_SUBSTR_INITIAL && sa->sa_initial.bv_val != NULL &&
@@ -586,7 +590,7 @@ octetStringSubstringsFilter (
                        value->bv_val, klen );
                HASH_Final( HASHdigest, &HASHcontext );
 
-               ber_dupbv( &keys[nkeys++], &digest );
+               ber_dupbv_x( &keys[nkeys++], &digest, ctx );
        }
 
        if( flags & SLAP_INDEX_SUBSTR_ANY && sa->sa_any != NULL ) {
@@ -620,7 +624,7 @@ octetStringSubstringsFilter (
                                        &value->bv_val[j], klen ); 
                                HASH_Final( HASHdigest, &HASHcontext );
 
-                               ber_dupbv( &keys[nkeys++], &digest );
+                               ber_dupbv_x( &keys[nkeys++], &digest, ctx );
                        }
                }
        }
@@ -649,7 +653,7 @@ octetStringSubstringsFilter (
                        &value->bv_val[value->bv_len-klen], klen );
                HASH_Final( HASHdigest, &HASHcontext );
 
-               ber_dupbv( &keys[nkeys++], &digest );
+               ber_dupbv_x( &keys[nkeys++], &digest, ctx );
        }
 
        if( nkeys > 0 ) {
@@ -746,7 +750,8 @@ uniqueMemberNormalize(
        Syntax *syntax,
        MatchingRule *mr,
        struct berval *val,
-       struct berval *normalized )
+       struct berval *normalized,
+       void *ctx )
 {
        struct berval out;
        int rc;
@@ -773,7 +778,7 @@ uniqueMemberNormalize(
                        *(uid.bv_val++) = '\0';
                }
 
-               rc = dnNormalize2( NULL, &out, normalized );
+               rc = dnNormalize2( NULL, &out, normalized, ctx );
 
                if( rc != LDAP_SUCCESS ) {
                        free( out.bv_val );
@@ -982,7 +987,8 @@ UTF8StringNormalize(
        Syntax *syntax,
        MatchingRule *mr,
        struct berval *val,
-       struct berval *normalized )
+       struct berval *normalized,
+       void *ctx )
 {
        struct berval tmp, nvalue;
        int flags;
@@ -1393,14 +1399,15 @@ telephoneNumberNormalize(
        Syntax *syntax,
        MatchingRule *mr,
        struct berval *val,
-       struct berval *normalized )
+       struct berval *normalized,
+       void *ctx )
 {
        char *p, *q;
 
        /* validator should have refused an empty string */
        assert( val->bv_len );
 
-       q = normalized->bv_val = ch_malloc( val->bv_len + 1 );
+       q = normalized->bv_val = sl_malloc( val->bv_len + 1, ctx );
 
        for( p = val->bv_val; *p; p++ ) {
                if ( ! ( ASCII_SPACE( *p ) || *p == '-' )) {
@@ -1412,7 +1419,7 @@ telephoneNumberNormalize(
        normalized->bv_len = q - normalized->bv_val;
 
        if( normalized->bv_len == 0 ) {
-               free( normalized->bv_val );
+               sl_free( normalized->bv_val, ctx );
                return LDAP_INVALID_SYNTAX;
        }
 
@@ -1542,7 +1549,8 @@ integerNormalize(
        Syntax *syntax,
        MatchingRule *mr,
        struct berval *val,
-       struct berval *normalized )
+       struct berval *normalized,
+       void *ctx )
 {
        char *p;
        int negative=0;
@@ -1575,12 +1583,12 @@ integerNormalize(
        /* If there are no non-zero digits left, the number is zero, otherwise
           allocate space for the number and copy it into the buffer */
        if( len == 0 ) {
-               normalized->bv_val = ch_strdup("0");
+               normalized->bv_val = ber_strdup_x("0", ctx);
                normalized->bv_len = 1;
 
        } else {
                normalized->bv_len = len+negative;
-               normalized->bv_val = ch_malloc( normalized->bv_len + 1 );
+               normalized->bv_val = sl_malloc( normalized->bv_len + 1, ctx );
                if( negative ) normalized->bv_val[0] = '-';
                AC_MEMCPY( normalized->bv_val + negative, p, len );
                normalized->bv_val[len+negative] = '\0';
@@ -1680,7 +1688,8 @@ IA5StringNormalize(
        Syntax *syntax,
        MatchingRule *mr,
        struct berval *val,
-       struct berval *normalized )
+       struct berval *normalized,
+       void *ctx )
 {
        char *p, *q;
        int casefold = (mr != slap_schema.si_mr_caseExactIA5Match);
@@ -1694,7 +1703,7 @@ IA5StringNormalize(
                p++;
        }
 
-       normalized->bv_val = ch_strdup( p );
+       normalized->bv_val = ber_strdup_x( p, ctx );
        p = q = normalized->bv_val;
 
        while ( *p ) {
@@ -1734,7 +1743,7 @@ IA5StringNormalize(
        normalized->bv_len = q - normalized->bv_val;
 
        if( normalized->bv_len == 0 ) {
-               normalized->bv_val = ch_realloc( normalized->bv_val, 2 );
+               normalized->bv_val = sl_realloc( normalized->bv_val, 2, ctx );
                normalized->bv_val[0] = ' ';
                normalized->bv_val[1] = '\0';
                normalized->bv_len = 1;
@@ -1767,14 +1776,15 @@ numericStringNormalize(
        Syntax *syntax,
        MatchingRule *mr,
        struct berval *val,
-       struct berval *normalized )
+       struct berval *normalized,
+       void *ctx )
 {
        /* removal all spaces */
        char *p, *q;
 
        assert( val->bv_len );
 
-       normalized->bv_val = ch_malloc( val->bv_len + 1 );
+       normalized->bv_val = sl_malloc( val->bv_len + 1, ctx );
 
        p = val->bv_val;
        q = normalized->bv_val;
@@ -1797,7 +1807,7 @@ numericStringNormalize(
        normalized->bv_len = q - normalized->bv_val;
 
        if( normalized->bv_len == 0 ) {
-               normalized->bv_val = ch_realloc( normalized->bv_val, 2 );
+               normalized->bv_val = sl_realloc( normalized->bv_val, 2, ctx );
                normalized->bv_val[0] = ' ';
                normalized->bv_val[1] = '\0';
                normalized->bv_len = 1;
@@ -2534,7 +2544,8 @@ generalizedTimeNormalize(
        Syntax *syntax,
        MatchingRule *mr,
        struct berval *val,
-       struct berval *normalized )
+       struct berval *normalized,
+       void *ctx )
 {
        int parts[9], rc;
 
@@ -2543,7 +2554,7 @@ generalizedTimeNormalize(
                return rc;
        }
 
-       normalized->bv_val = ch_malloc( 16 );
+       normalized->bv_val = sl_malloc( 16, ctx );
        if ( normalized->bv_val == NULL ) {
                return LBER_ERROR_MEMORY;
        }
index 9a3ee2526eba440cb6387b50a25fa692ba7b8de0..086c023905343adeedac42269b9c07aa34759bab 100644 (file)
@@ -28,14 +28,15 @@ static int objectClassNormalize(
        struct slap_syntax *syntax, /* NULL if in is asserted value */
        struct slap_matching_rule *mr,
        struct berval * in,
-       struct berval * out )
+       struct berval * out,
+       void *ctx )
 {
        ObjectClass *oc = oc_bvfind( in );
 
        if( oc != NULL ) {
-               ber_dupbv( out, &oc->soc_cname );
+               ber_dupbv_x( out, &oc->soc_cname, ctx );
        } else {
-               ber_dupbv( out, in );
+               ber_dupbv_x( out, in, ctx );
        }
 
 #if OCDEBUG
@@ -118,7 +119,8 @@ static int objectSubClassIndexer(
        struct slap_matching_rule *mr,
        struct berval *prefix,
        BerVarray values,
-       BerVarray *keysp )
+       BerVarray *keysp,
+       void *ctx )
 {
        int rc, noc, i;
        BerVarray ocvalues;
@@ -128,7 +130,7 @@ static int objectSubClassIndexer(
        }
 
        /* over allocate */
-       ocvalues = ch_malloc( sizeof( struct berval ) * (noc+16) );
+       ocvalues = sl_malloc( sizeof( struct berval ) * (noc+16), ctx );
 
        /* copy listed values (and termination) */
        for( i=0; i<noc; i++ ) {
@@ -185,8 +187,8 @@ static int objectSubClassIndexer(
                        }
 
                        if( !found ) {
-                               ocvalues = ch_realloc( ocvalues,
-                                       sizeof( struct berval ) * (noc+2) );
+                               ocvalues = sl_realloc( ocvalues,
+                                       sizeof( struct berval ) * (noc+2), ctx );
 
                                assert( k == noc );
 
@@ -226,9 +228,9 @@ static int objectSubClassIndexer(
 #endif
 
        rc = octetStringIndexer( use, mask, syntax, mr,
-               prefix, ocvalues, keysp );
+               prefix, ocvalues, keysp, ctx );
 
-       ch_free( ocvalues );
+       sl_free( ocvalues, ctx );
        return rc;
 }
 
@@ -240,7 +242,8 @@ static int objectSubClassFilter(
        MatchingRule *mr,
        struct berval *prefix,
        void * assertedValue,
-       BerVarray *keysp )
+       BerVarray *keysp,
+       void *ctx )
 {
 #if OCDEBUG
        struct berval *bv = (struct berval *) assertedValue;
@@ -259,7 +262,7 @@ static int objectSubClassFilter(
 #endif
 
        return octetStringFilter( use, flags, syntax, mr,
-               prefix, assertedValue, keysp );
+               prefix, assertedValue, keysp, ctx );
 }
 
 static ObjectClassSchemaCheckFN rootDseObjectClass;
index a6ed0fe18088d11f0a3d020bd5177f86a98eee43..17096c28bf7049dab27ff6f131f9138d7b35b1fe 100644 (file)
@@ -108,7 +108,7 @@ do_search(
                goto return_results;
        }
 
-       rs->sr_err = dnPrettyNormal( NULL, &base, &op->o_req_dn, &op->o_req_ndn );
+       rs->sr_err = dnPrettyNormal( NULL, &base, &op->o_req_dn, &op->o_req_ndn, op->o_tmpmemctx );
        if( rs->sr_err != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
                LDAP_LOG( OPERATION, ERR, 
@@ -318,11 +318,11 @@ do_search(
        }
 
        if( !op->o_req_ndn.bv_len && default_search_nbase.bv_len ) {
-               ch_free( op->o_req_dn.bv_val );
-               ch_free( op->o_req_ndn.bv_val );
+               sl_free( op->o_req_dn.bv_val, op->o_tmpmemctx );
+               sl_free( op->o_req_ndn.bv_val, op->o_tmpmemctx );
 
-               ber_dupbv( &op->o_req_dn, &default_search_base );
-               ber_dupbv( &op->o_req_ndn, &default_search_nbase );
+               ber_dupbv_x( &op->o_req_dn, &default_search_base, op->o_tmpmemctx );
+               ber_dupbv_x( &op->o_req_ndn, &default_search_nbase, op->o_tmpmemctx );
        }
 
        /*
@@ -392,8 +392,8 @@ return_results:;
                return rs->sr_err;
 #endif
 
-       if( op->o_req_dn.bv_val != NULL) free( op->o_req_dn.bv_val );
-       if( op->o_req_ndn.bv_val != NULL) free( op->o_req_ndn.bv_val );
+       if( op->o_req_dn.bv_val != NULL) sl_free( op->o_req_dn.bv_val, op->o_tmpmemctx );
+       if( op->o_req_ndn.bv_val != NULL) sl_free( op->o_req_ndn.bv_val, op->o_tmpmemctx );
 
        if( op->ors_filterstr.bv_val != NULL) op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx );
        if( op->ors_filter != NULL) filter_free_x( op, op->ors_filter );
index 6d81abeab871b1e26f63a7a6a2100be628dce1d8..8e037662d7421c4e6ea7e9941646d483703cb1de 100644 (file)
@@ -129,7 +129,7 @@ sl_realloc( void *ptr, ber_len_t size, void *ctx )
        if ( ptr == NULL ) return sl_malloc( size, ctx );
 
        /* Not our memory? */
-       if ( ptr < sh->h_base || ptr >= sh->h_end ) {
+       if ( !sh || ptr < sh->h_base || ptr >= sh->h_end ) {
                return ch_realloc( ptr, size );
        }
 
@@ -154,7 +154,7 @@ sl_free( void *ptr, void *ctx )
 {
        struct slab_heap *sh = ctx;
 
-       if ( ptr < sh->h_base || ptr >= sh->h_end ) {
+       if ( !sh || ptr < sh->h_base || ptr >= sh->h_end ) {
                ch_free( ptr );
        }
 }
@@ -164,7 +164,7 @@ sl_release( void *ptr, void *ctx )
 {
        struct slab_heap *sh = ctx;
 
-       if ( ptr >= sh->h_base && ptr <= sh->h_end ) {
+       if ( sh && ptr >= sh->h_base && ptr <= sh->h_end ) {
                sh->h_last = ptr;
        }
 }
@@ -173,6 +173,9 @@ void *
 sl_mark( void *ctx )
 {
        struct slab_heap *sh = ctx;
+       void *ret = NULL;
 
-       return sh->h_last;
+       if (sh) ret = sh->h_last;
+
+       return ret;
 }
index 8ae1b3ad2c592d953bd56a72d372abb567864594..1ca24c39276c2ed3e21d23440b5cfcbb24cd02b2 100644 (file)
@@ -292,7 +292,8 @@ typedef int slap_syntax_validate_func LDAP_P((
 typedef int slap_syntax_transform_func LDAP_P((
        struct slap_syntax *syntax,
        struct berval * in,
-       struct berval * out));
+       struct berval * out,
+       void *memctx));
 
 typedef struct slap_syntax {
        LDAPSyntax                      ssyn_syn;
@@ -350,7 +351,8 @@ typedef struct slap_syntax_defs_rec {
 /* X -> Y Converter */
 typedef int slap_mr_convert_func LDAP_P((
        struct berval * in,
-       struct berval * out ));
+       struct berval * out,
+       void *memctx ));
 
 /* Normalizer */
 typedef int slap_mr_normalize_func LDAP_P((
@@ -358,7 +360,8 @@ typedef int slap_mr_normalize_func LDAP_P((
        struct slap_syntax *syntax, /* NULL if in is asserted value */
        struct slap_matching_rule *mr,
        struct berval * in,
-       struct berval * out ));
+       struct berval * out,
+       void *memctx ));
 
 /* Match (compare) function */
 typedef int slap_mr_match_func LDAP_P((
@@ -377,7 +380,8 @@ typedef int slap_mr_indexer_func LDAP_P((
        struct slap_matching_rule *mr,
        struct berval *prefix,
        BerVarray values,
-       BerVarray *keys ));
+       BerVarray *keys,
+       void *memctx ));
 
 /* Filter index function */
 typedef int slap_mr_filter_func LDAP_P((
@@ -387,7 +391,8 @@ typedef int slap_mr_filter_func LDAP_P((
        struct slap_matching_rule *mr,
        struct berval *prefix,
        void * assertValue,
-       BerVarray *keys ));
+       BerVarray *keys,
+       void *memctx ));
 
 typedef struct slap_matching_rule_use MatchingRuleUse;
 
index 5e3f4992cf1295bb672bc2521f4d739ba9a9b17c..bc1e84cea8b759fad9123c45bf1f18f3334e1a99 100644 (file)
@@ -351,7 +351,7 @@ LDAPModToEntry(
        dn.bv_val = slapi_ch_strdup(ldn);
        dn.bv_len = strlen(ldn);
 
-       rc = dnPrettyNormal( NULL, &dn, &pEntry->e_name, &pEntry->e_nname );
+       rc = dnPrettyNormal( NULL, &dn, &pEntry->e_name, &pEntry->e_nname, NULL );
        if ( rc != LDAP_SUCCESS )
                goto cleanup;
 
@@ -420,7 +420,7 @@ LDAPModToEntry(
                        size_t textlen = sizeof textbuf;
 
                        rc = slap_mods_check( modlist, update, &text, 
-                                       textbuf, textlen );
+                                       textbuf, textlen, NULL );
                        if ( rc != LDAP_SUCCESS) {
                                goto cleanup;
                        }
@@ -511,7 +511,7 @@ slapi_delete_internal(
 
        dn.bv_val = slapi_ch_strdup(ldn);
        dn.bv_len = strlen(ldn);
-       rs.sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn );
+       rs.sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn, NULL );
        if ( rs.sr_err != LDAP_SUCCESS )
                goto cleanup;
 
@@ -751,7 +751,7 @@ slapi_modrdn_internal(
        dn.bv_val = slapi_ch_strdup( olddn );
        dn.bv_len = strlen( olddn );
 
-       rs.sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn );
+       rs.sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn, NULL );
        if ( rs.sr_err != LDAP_SUCCESS ) {
                goto cleanup;
        }
@@ -764,7 +764,7 @@ slapi_modrdn_internal(
        newrdn.bv_val = slapi_ch_strdup( lnewrdn );
        newrdn.bv_len = strlen( lnewrdn );
 
-       rs.sr_err = dnPrettyNormal( NULL, &newrdn, &op->oq_modrdn.rs_newrdn, &op->oq_modrdn.rs_nnewrdn );
+       rs.sr_err = dnPrettyNormal( NULL, &newrdn, &op->oq_modrdn.rs_newrdn, &op->oq_modrdn.rs_nnewrdn, NULL );
        if ( rs.sr_err != LDAP_SUCCESS ) {
                goto cleanup;
        }
@@ -876,7 +876,7 @@ slapi_modify_internal(
 
        dn.bv_val = slapi_ch_strdup( ldn );
        dn.bv_len = strlen( ldn );
-       rs.sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn );
+       rs.sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn, NULL );
        if ( rs.sr_err != LDAP_SUCCESS ) {
                goto cleanup;
        }
@@ -979,7 +979,7 @@ slapi_modify_internal(
                        size_t textlen = sizeof( textbuf );
 
                        rs.sr_err = slap_mods_check( modlist, update,
-                                       &text, textbuf, textlen );
+                                       &text, textbuf, textlen, NULL );
                        if ( rs.sr_err != LDAP_SUCCESS ) {
                                goto cleanup;
                        }
@@ -1069,7 +1069,7 @@ slapi_search_internal_bind(
        dn.bv_val = slapi_ch_strdup(ldn);
        dn.bv_len = strlen(ldn);
 
-       rs.sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn );
+       rs.sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn, NULL );
        if ( rs.sr_err != LDAP_SUCCESS ) {
                goto cleanup;
        }
index 74812f822e4737e73f0766fb60bfba256aa468a1..9aece919aa2fefb0cc9c32c65888c908d115f919 100644 (file)
@@ -161,7 +161,7 @@ slapi_entry_set_dn(
        dn.bv_val = ldn;
        dn.bv_len = strlen( ldn );
 
-       dnPrettyNormal( NULL, &dn, &e->e_name, &e->e_nname );
+       dnPrettyNormal( NULL, &dn, &e->e_name, &e->e_nname, NULL );
 #endif /* LDAP_SLAPI */
 }
 
@@ -857,7 +857,7 @@ slapi_dn_normalize( char *dn )
        bdn.bv_val = dn;
        bdn.bv_len = strlen( dn );
 
-       dnNormalize2( NULL, &bdn, &ndn );
+       dnNormalize2( NULL, &bdn, &ndn, NULL );
 
        /*
         * FIXME: ain't it safe to set dn = ndn.bv_val ?
@@ -909,11 +909,11 @@ slapi_dn_issuffix(
        bsuffix.bv_val = suffix;
        bsuffix.bv_len = strlen( suffix );
 
-       if ( dnNormalize2( NULL, &bdn, &ndn ) != LDAP_SUCCESS ) {
+       if ( dnNormalize2( NULL, &bdn, &ndn, NULL ) != LDAP_SUCCESS ) {
                return 0;
        }
 
-       if ( dnNormalize2( NULL, &bsuffix, &nsuffix ) != LDAP_SUCCESS ) {
+       if ( dnNormalize2( NULL, &bsuffix, &nsuffix, NULL ) != LDAP_SUCCESS ) {
                slapi_ch_free( (void **)&ndn.bv_val );
                return 0;
        }
index 534c80094f5ab21ec823d6d1b964b77431154cf0..63635c819fd7424a5cbd43f51160ce8487cbad49 100644 (file)
@@ -46,7 +46,7 @@ SLAPD_OBJS = ../globals.o ../config.o ../ch_malloc.o ../cr.o ../backend.o \
                ../init.o ../controls.o ../kerberos.o ../passwd.o \
                ../index.o ../extended.o ../starttls.o ../sets.o ../mra.o \
                ../referral.o ../backglue.o ../oidm.o ../mods.o ../operation.o \
-               ../cancel.o
+               ../cancel.o ../sl_malloc.o
 
 SLAPOBJS = $(SLAPD_OBJS) slapcommon.o mimic.o
 
index c05600417b8e8f9dbd2ffb8d31e546a8a2974495..e319fa3a12457a549ad34fc5fa2a799eb3787bc4 100644 (file)
@@ -199,8 +199,8 @@ int
 slap_modrdn2mods(
        Operation       *op, SlapReply *rs,
        Entry           *e,
-       LDAPRDN         *oldrdn,
-       LDAPRDN         *newrdn,
+       LDAPRDN         oldrdn,
+       LDAPRDN         newrdn,
        Modifications   **pmod )
 {
        return 0;
@@ -217,7 +217,7 @@ slap_mods2entry(
        return 0;
 }
 
-int slap_sasl_getdn( Connection *conn, char *id, int len,
+int slap_sasl_getdn( Connection *conn, Operation *op, char *id, int len,
        char *user_realm, struct berval *dn, int flags )
 {
        return -1;
index d78f3bc0c218d4873e25152decc6a0006dd2c1fe..2f1255d8f66d0c6e37492a461053e7af467e547a 100644 (file)
@@ -232,7 +232,7 @@ slap_tool_init(
        if( base.bv_val != NULL ) {
                struct berval nbase;
 
-               rc = dnNormalize2( NULL, &base, &nbase );
+               rc = dnNormalize2( NULL, &base, &nbase, NULL );
                if( rc != LDAP_SUCCESS ) {
                        fprintf( stderr, "%s: slap_init invalid suffix (\"%s\")\n",
                                progname, base.bv_val );
index 0d70a7c611b2e538e0ac78d1cb073072528081e7..f7cd45c014ecfa9806899498f2d22b19d4380222 100644 (file)
@@ -129,7 +129,8 @@ int asserted_value_validate_normalize(
        unsigned usage,
        struct berval *in,
        struct berval *out,
-       const char ** text )
+       const char ** text,
+       void *ctx )
 {
        int rc;
 
@@ -156,7 +157,7 @@ int asserted_value_validate_normalize(
        if( mr->smr_normalize ) {
                rc = (mr->smr_normalize)( usage,
                        ad ? ad->ad_type->sat_syntax : NULL,
-                       mr, in, out );
+                       mr, in, out, ctx );
 
                if( rc != LDAP_SUCCESS ) {
                        *text = "unable to normalize value for matching";
@@ -164,7 +165,7 @@ int asserted_value_validate_normalize(
                }
 
        } else {
-               ber_dupbv( out, in );
+               ber_dupbv_x( out, in, ctx );
        }
 
        return LDAP_SUCCESS;
@@ -207,7 +208,8 @@ int value_find_ex(
        AttributeDescription *ad,
        unsigned flags,
        BerVarray vals,
-       struct berval *val )
+       struct berval *val,
+       void *ctx )
 {
        int     i;
        int rc;
@@ -226,7 +228,7 @@ int value_find_ex(
                rc = (mr->smr_normalize)(
                        flags & SLAP_MR_TYPE_MASK|SLAP_MR_SUBTYPE_MASK,
                        ad ? ad->ad_type->sat_syntax : NULL,
-                       mr, val, &nval );
+                       mr, val, &nval, ctx );
 
                if( rc != LDAP_SUCCESS ) {
                        return LDAP_INVALID_SYNTAX;
@@ -246,6 +248,6 @@ int value_find_ex(
                }
        }
 
-       free( nval.bv_val );
+       ber_memfree_x( nval.bv_val, ctx );
        return LDAP_NO_SUCH_ATTRIBUTE;
 }