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;
}
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;
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;
}
* 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) {
* 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,
{
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",
}
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",
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",
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
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 );
attr_merge_normalize(
Entry *e,
AttributeDescription *desc,
- BerVarray vals
+ BerVarray vals,
+ void *memctx
) {
BerVarray nvals = NULL;
int rc;
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;
attr_merge_normalize_one(
Entry *e,
AttributeDescription *desc,
- struct berval *val
+ struct berval *val,
+ void *memctx
) {
struct berval nval;
int rc;
0,
desc->ad_type->sat_syntax,
desc->ad_type->sat_equality,
- val, &nval );
+ val, &nval, memctx );
if ( rc != LDAP_SUCCESS ) {
return rc;
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 );
}
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 );
}
/* 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,
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;
}
/* 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:
#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,
int
bdb_filter_candidates(
- Backend *be,
+ Operation *op,
Filter *f,
ID *ids,
ID *tmp,
#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;
#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:
#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:
#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:
#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:
#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:
#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:
#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:
#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;
#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;
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;
}
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 ) {
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;
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 ) {
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 );
static int
equality_candidates(
- Backend *be,
+ Operation *op,
AttributeAssertion *ava,
ID *ids,
ID *tmp )
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 ) {
mr,
&prefix,
&ava->aa_value,
- &keys );
+ &keys, op->o_tmpmemctx );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
}
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 );
break;
}
- ber_bvarray_free( keys );
+ ber_bvarray_free_x( keys, op->o_tmpmemctx );
#ifdef NEW_LOGGING
LDAP_LOG ( INDEX, RESULTS,
static int
approx_candidates(
- Backend *be,
+ Operation *op,
AttributeAssertion *ava,
ID *ids,
ID *tmp )
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 ) {
mr,
&prefix,
&ava->aa_value,
- &keys );
+ &keys, op->o_tmpmemctx );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
}
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 );
break;
}
- ber_bvarray_free( keys );
+ ber_bvarray_free_x( keys, op->o_tmpmemctx );
#ifdef NEW_LOGGING
LDAP_LOG ( INDEX, RESULTS,
static int
substring_candidates(
- Backend *be,
+ Operation *op,
SubstringsAssertion *sub,
ID *ids,
ID *tmp )
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 ) {
mr,
&prefix,
sub,
- &keys );
+ &keys, op->o_tmpmemctx );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
}
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 );
break;
}
- ber_bvarray_free( keys );
+ ber_bvarray_free_x( keys, op->o_tmpmemctx );
#ifdef NEW_LOGGING
LDAP_LOG ( INDEX, RESULTS,
}
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;
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
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;
}
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;
}
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;
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;
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 ) {
}
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;
#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
#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;
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
/* 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 ) {
/* 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 ) {
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;
/* 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,
/* 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,
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,
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;
* filterentry.c
*/
int bdb_filter_candidates(
- Backend *be,
+ Operation *op,
Filter *f,
ID *ids,
ID *tmp,
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))
/* 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;
* 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 {
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 );
}
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 );
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)",
Entry *e;
DB_TXN *tid = NULL;
struct berval pdn;
+ Operation op = {0};
#ifdef NEW_LOGGING
LDAP_LOG ( TOOLS, ARGS,
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 ) {
#include "external.h"
+#undef ENABLE_REWRITE
+
/* String rewrite library */
#ifdef ENABLE_REWRITE
#include "rewrite.h"
}
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 );
}
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 );
*
* 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;
}
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;
/* 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;
}
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 );
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;
}
/* 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 );
#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
)
{
#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;
#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;
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:
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:
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:
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:
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:
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:
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:
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:
* 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
/* 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;
}
static ID_BLOCK *
presence_candidates(
- Backend *be,
+ Operation *op,
AttributeDescription *desc
)
{
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 ) {
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
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
}
}
- ldbm_cache_close( be, db );
+ ldbm_cache_close( op->o_bd, db );
#ifdef NEW_LOGGING
LDAP_LOG( FILTER, ENTRY,
static ID_BLOCK *
equality_candidates(
- Backend *be,
+ Operation *op,
AttributeAssertion *ava
)
{
#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 ) {
mr,
&prefix,
&ava->aa_value,
- &keys );
+ &keys, op->o_tmpmemctx );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
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
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 );
}
save = idl;
- idl = idl_intersection( be, idl, tmp );
+ idl = idl_intersection( op->o_bd, idl, tmp );
idl_free( save );
idl_free( tmp );
ber_bvarray_free( keys );
- ldbm_cache_close( be, db );
+ ldbm_cache_close( op->o_bd, db );
#ifdef NEW_LOGGING
static ID_BLOCK *
approx_candidates(
- Backend *be,
+ Operation *op,
AttributeAssertion *ava
)
{
#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 ) {
mr,
&prefix,
&ava->aa_value,
- &keys );
+ &keys, op->o_tmpmemctx );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
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
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 );
}
save = idl;
- idl = idl_intersection( be, idl, tmp );
+ idl = idl_intersection( op->o_bd, idl, tmp );
idl_free( save );
idl_free( tmp );
ber_bvarray_free( keys );
- ldbm_cache_close( be, db );
+ ldbm_cache_close( op->o_bd, db );
#ifdef NEW_LOGGING
LDAP_LOG( FILTER, ENTRY,
static ID_BLOCK *
list_candidates(
- Backend *be,
+ Operation *op,
Filter *flist,
int ftype
)
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 );
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 );
}
static ID_BLOCK *
substring_candidates(
- Backend *be,
+ Operation *op,
SubstringsAssertion *sub
)
{
#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 ) {
mr,
&prefix,
sub,
- &keys );
+ &keys, op->o_tmpmemctx );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
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
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 );
}
save = idl;
- idl = idl_intersection( be, idl, tmp );
+ idl = idl_intersection( op->o_bd, idl, tmp );
idl_free( save );
idl_free( tmp );
ber_bvarray_free( keys );
- ldbm_cache_close( be, db );
+ ldbm_cache_close( op->o_bd, db );
#ifdef NEW_LOGGING
LDAP_LOG( FILTER, ENTRY,
}
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;
DBCache *db;
AttributeDescription *ad = NULL;
struct berval *keys;
+ void *mark;
assert( mask );
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
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 ) ) {
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 );
}
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 );
}
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 );
}
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 );
}
}
}
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
/* 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 ) {
/* 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 ) {
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
/* 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",
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 ) {
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;
* filterindex.c
*/
-ID_BLOCK * filter_candidates LDAP_P(( Backend *be, Filter *f ));
+ID_BLOCK * filter_candidates LDAP_P(( Operation *op, Filter *f ));
/*
* id2children.c
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))
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 );
}
#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) );
} 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 );
}
static ID_BLOCK *
search_candidates(
- Backend *be,
+ Operation *op,
Entry *e,
Filter *filter,
int scope,
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 );
}
Datum key, data;
int rc, len;
ID id;
+ Operation op = {0};
assert( slapMode & SLAP_TOOL_MODE );
assert( id2entry != NULL );
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;
{
int rc;
Entry *e;
+ Operation op = {0};
#ifdef NEW_LOGGING
LDAP_LOG( BACK_LDBM, ENTRY, "ldbm_tool_entry_reindex: ID=%ld\n",
#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 );
*ep = e;
} else {
- LDAPRDN *values = NULL;
+ LDAPRDN values = NULL;
const char *text = NULL;
unsigned long connid;
}
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 );
char *s;
time_t stoptime;
- LDAPRDN *rdn = NULL;
+ LDAPRDN rdn = NULL;
struct berval parent = { 0, NULL };
AttributeDescription *ad_objectClass = slap_schema.si_ad_objectClass;
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);
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 );
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;
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 ) {
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;
}
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,
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;
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;
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;
}
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,
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;
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;
rc = dnPrettyNormal( NULL, &dn,
&default_search_base,
- &default_search_nbase );
+ &default_search_nbase, NULL );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
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
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,
rc = dnPrettyNormal( NULL, &dn,
&be->be_rootdn,
- &be->be_rootndn );
+ &be->be_rootndn, NULL );
if( rc != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
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,
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;
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;
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,
* 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;
struct berval *in )
{
int rc;
- LDAPDN *dn = NULL;
+ LDAPDN dn = NULL;
assert( in );
* 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 );
return;
}
- ava = rdn[ 0 ][ i ];
+ ava = rdn[ i ];
a = strcmp( ava_in->la_attr.bv_val,
ava->la_attr.bv_val );
}
* 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;
}
* 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;
ava->la_value.bv_len
? &ava->la_value
: (struct berval *) &slap_empty_bv,
- &bv );
+ &bv, ctx );
if ( rc != LDAP_SUCCESS ) {
return LDAP_INVALID_SYNTAX;
ava->la_value.bv_len
? &ava->la_value
: (struct berval *) &slap_empty_bv,
- &bv );
+ &bv, ctx );
if ( rc != LDAP_SUCCESS ) {
return LDAP_INVALID_SYNTAX;
if( bv.bv_val ) {
- free( ava->la_value.bv_val );
+ ber_memfree_x( ava->la_value.bv_val, ctx );
ava->la_value = bv;
}
Syntax *syntax,
MatchingRule *mr,
struct berval *val,
- struct berval *out )
+ struct berval *out,
+ void *ctx)
{
assert( val );
assert( out );
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;
}
/*
* 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;
}
/*
* 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 );
dnPretty2(
Syntax *syntax,
struct berval *val,
- struct berval *out)
+ struct berval *out,
+ void *ctx)
{
assert( val );
assert( out );
#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;
}
/*
* 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;
}
/* 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;
dnPrettyNormalDN(
Syntax *syntax,
struct berval *val,
- LDAPDN **dn,
- int flags )
+ LDAPDN *dn,
+ int flags,
+ void *ctx )
{
assert( val );
assert( dn );
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;
}
/*
* 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;
}
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 );
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;
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;
}
/*
* 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;
int
dnExtractRdn(
struct berval *dn,
- struct berval *rdn )
+ struct berval *rdn,
+ void *ctx )
{
- LDAPRDN *tmpRDN;
+ LDAPRDN tmpRDN;
const char *p;
int rc;
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;
}
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,
if( pretty ) {
rc = pretty( ad->ad_type->sat_syntax,
- &vals[0], &pval );
+ &vals[0], &pval, NULL );
} else if( validate ) {
/*
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
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)
return 4;
return 5;
}
+#endif
static void
entry_putlen(unsigned char **buf, ber_len_t len)
/* 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;
|| 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;
}
#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:
#endif
if ( ssa.sa_final.bv_val != NULL ) {
- free( nvalue.bv_val );
+ sl_free( nvalue.bv_val, op->o_tmpmemctx );
goto return_error;
}
#endif
assert( 0 );
- free( nvalue.bv_val );
+ sl_free( nvalue.bv_val, op->o_tmpmemctx );
return_error:
#ifdef NEW_LOGGING
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;
}
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;
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;
/* 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;
}
/* 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;
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;
}
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;
}
}
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 );
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;
}
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",
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 );
int update,
const char **text,
char *textbuf,
- size_t textlen )
+ size_t textlen,
+ void *ctx )
{
int rc;
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] );
}
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;
}
}
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,
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,
/* 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,
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,
Operation *op,
SlapReply *rs,
Entry *e,
- LDAPRDN *old_rdn,
- LDAPRDN *new_rdn,
+ LDAPRDN old_rdn,
+ LDAPRDN new_rdn,
Modifications **pmod )
{
Modifications *mod = NULL;
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;
+ 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];
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;
/* 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;
/* 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;
+ 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];
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;
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;
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((
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,
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 ));
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)
/*
Operation *op,
SlapReply *rs,
Entry *e,
- LDAPRDN *oldrdn,
- LDAPRDN *newrdn,
+ LDAPRDN oldrdn,
+ LDAPRDN newrdn,
Modifications **pmod );
/*
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,
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
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,
AttributeDescription *ad,
unsigned flags,
BerVarray values,
- struct berval *value ));
+ struct berval *value,
+ void *ctx ));
LDAP_SLAPD_F (int) value_add LDAP_P((
BerVarray *vals,
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;
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 );
}
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 );
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;
}
id ? ( *id ? id : "<empty>" ) : "NULL", len, 0 );
#endif
+ if ( !op ) {
+ op = conn->c_sasl_bindop;
+ }
+
dn->bv_val = NULL;
dn->bv_len = 0;
/* 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,
/* 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;
*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,
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;
}
/* 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 ) {
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;
/* 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;
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",
MatchingRule *mr,
struct berval *prefix,
BerVarray values,
- BerVarray *keysp )
+ BerVarray *keysp,
+ void *ctx )
{
int i;
size_t slen, mlen;
/* 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;
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;
MatchingRule *mr,
struct berval *prefix,
void * assertedValue,
- BerVarray *keysp )
+ BerVarray *keysp,
+ void *ctx )
{
size_t slen, mlen;
BerVarray keys;
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 ) {
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;
MatchingRule *mr,
struct berval *prefix,
BerVarray values,
- BerVarray *keysp )
+ BerVarray *keysp,
+ void *ctx )
{
ber_len_t i, j, nkeys;
size_t slen, mlen;
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;
SLAP_INDEX_SUBSTR_MAXLEN );
HASH_Final( HASHdigest, &HASHcontext );
- ber_dupbv( &keys[nkeys++], &digest );
+ ber_dupbv_x( &keys[nkeys++], &digest, ctx );
}
}
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 ) {
&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 );
}
}
MatchingRule *mr,
struct berval *prefix,
void * assertedValue,
- BerVarray *keysp )
+ BerVarray *keysp,
+ void *ctx)
{
SubstringsAssertion *sa;
char pre;
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 &&
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 ) {
&value->bv_val[j], klen );
HASH_Final( HASHdigest, &HASHcontext );
- ber_dupbv( &keys[nkeys++], &digest );
+ ber_dupbv_x( &keys[nkeys++], &digest, ctx );
}
}
}
&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 ) {
Syntax *syntax,
MatchingRule *mr,
struct berval *val,
- struct berval *normalized )
+ struct berval *normalized,
+ void *ctx )
{
struct berval out;
int rc;
*(uid.bv_val++) = '\0';
}
- rc = dnNormalize2( NULL, &out, normalized );
+ rc = dnNormalize2( NULL, &out, normalized, ctx );
if( rc != LDAP_SUCCESS ) {
free( out.bv_val );
Syntax *syntax,
MatchingRule *mr,
struct berval *val,
- struct berval *normalized )
+ struct berval *normalized,
+ void *ctx )
{
struct berval tmp, nvalue;
int flags;
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 == '-' )) {
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;
}
Syntax *syntax,
MatchingRule *mr,
struct berval *val,
- struct berval *normalized )
+ struct berval *normalized,
+ void *ctx )
{
char *p;
int negative=0;
/* 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';
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);
p++;
}
- normalized->bv_val = ch_strdup( p );
+ normalized->bv_val = ber_strdup_x( p, ctx );
p = q = normalized->bv_val;
while ( *p ) {
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;
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;
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;
Syntax *syntax,
MatchingRule *mr,
struct berval *val,
- struct berval *normalized )
+ struct berval *normalized,
+ void *ctx )
{
int parts[9], rc;
return rc;
}
- normalized->bv_val = ch_malloc( 16 );
+ normalized->bv_val = sl_malloc( 16, ctx );
if ( normalized->bv_val == NULL ) {
return LBER_ERROR_MEMORY;
}
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
struct slap_matching_rule *mr,
struct berval *prefix,
BerVarray values,
- BerVarray *keysp )
+ BerVarray *keysp,
+ void *ctx )
{
int rc, noc, i;
BerVarray ocvalues;
}
/* 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++ ) {
}
if( !found ) {
- ocvalues = ch_realloc( ocvalues,
- sizeof( struct berval ) * (noc+2) );
+ ocvalues = sl_realloc( ocvalues,
+ sizeof( struct berval ) * (noc+2), ctx );
assert( k == noc );
#endif
rc = octetStringIndexer( use, mask, syntax, mr,
- prefix, ocvalues, keysp );
+ prefix, ocvalues, keysp, ctx );
- ch_free( ocvalues );
+ sl_free( ocvalues, ctx );
return rc;
}
MatchingRule *mr,
struct berval *prefix,
void * assertedValue,
- BerVarray *keysp )
+ BerVarray *keysp,
+ void *ctx )
{
#if OCDEBUG
struct berval *bv = (struct berval *) assertedValue;
#endif
return octetStringFilter( use, flags, syntax, mr,
- prefix, assertedValue, keysp );
+ prefix, assertedValue, keysp, ctx );
}
static ObjectClassSchemaCheckFN rootDseObjectClass;
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,
}
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 );
}
/*
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 );
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 );
}
{
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 );
}
}
{
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;
}
}
sl_mark( void *ctx )
{
struct slab_heap *sh = ctx;
+ void *ret = NULL;
- return sh->h_last;
+ if (sh) ret = sh->h_last;
+
+ return ret;
}
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;
/* 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((
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((
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((
struct slap_matching_rule *mr,
struct berval *prefix,
void * assertValue,
- BerVarray *keys ));
+ BerVarray *keys,
+ void *memctx ));
typedef struct slap_matching_rule_use MatchingRuleUse;
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;
size_t textlen = sizeof textbuf;
rc = slap_mods_check( modlist, update, &text,
- textbuf, textlen );
+ textbuf, textlen, NULL );
if ( rc != LDAP_SUCCESS) {
goto cleanup;
}
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;
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;
}
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;
}
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;
}
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;
}
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;
}
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 */
}
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 ?
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;
}
../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
slap_modrdn2mods(
Operation *op, SlapReply *rs,
Entry *e,
- LDAPRDN *oldrdn,
- LDAPRDN *newrdn,
+ LDAPRDN oldrdn,
+ LDAPRDN newrdn,
Modifications **pmod )
{
return 0;
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;
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 );
unsigned usage,
struct berval *in,
struct berval *out,
- const char ** text )
+ const char ** text,
+ void *ctx )
{
int rc;
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";
}
} else {
- ber_dupbv( out, in );
+ ber_dupbv_x( out, in, ctx );
}
return LDAP_SUCCESS;
AttributeDescription *ad,
unsigned flags,
BerVarray vals,
- struct berval *val )
+ struct berval *val,
+ void *ctx )
{
int i;
int rc;
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;
}
}
- free( nval.bv_val );
+ ber_memfree_x( nval.bv_val, ctx );
return LDAP_NO_SUCH_ATTRIBUTE;
}