)
{
struct bdb_info *bdb = (struct bdb_info *) op->o_bd->be_private;
+ struct berval ctxcsn_ndn = { 0, NULL };
EntryInfo *ctxcsn_ei = NULL;
DB_LOCK ctxcsn_lock;
struct berval max_committed_csn;
e = ei->bei_e;
}
- bdb_cache_find_ndn( op, tid, op->o_bd->be_nsuffix, &ctxcsn_ei );
- bdb_cache_entryinfo_unlock( ctxcsn_ei );
- rc = bdb_cache_find_ndn( op, tid, &slap_ldapsync_cn_bv, &ctxcsn_ei );
- if ( rc == 0 ) {
- rc = bdb_cache_find_id( op, tid, ctxcsn_ei->bei_id, &ctxcsn_ei, 1,
- locker, &ctxcsn_lock );
- *ctxcsn_e = ctxcsn_ei->bei_e;
- } else {
- bdb_cache_entryinfo_unlock( ctxcsn_ei );
- }
+ build_new_dn( &ctxcsn_ndn, &op->o_bd->be_nsuffix[0],
+ (struct berval *)&slap_ldapsync_cn_bv, op->o_tmpmemctx );
+
+ rc = bdb_dn2entry( op, tid, &ctxcsn_ndn, &ctxcsn_ei,
+ 1, locker, &ctxcsn_lock );
+
+ *ctxcsn_e = ctxcsn_ei->bei_e;
+
+ op->o_tmpfree( ctxcsn_ndn.bv_val, op->o_tmpmemctx );
slap_get_commit_csn( op, &max_committed_csn );
struct berval bv;
sprintf( substr, "cn=syncrepl%d", op->o_bd->syncinfo->id );
ber_str2bv( substr, 0, 0, &bv );
- build_new_dn( &ctxcsn_ndn, &op->o_bd->be_nsuffix[0], &bv );
+ build_new_dn( &ctxcsn_ndn, &op->o_bd->be_nsuffix[0], &bv, op->o_tmpmemctx );
} else {
- build_new_dn( &ctxcsn_ndn, &op->o_bd->be_nsuffix[0], (struct berval *)&slap_ldapsync_cn_bv );
+ build_new_dn( &ctxcsn_ndn, &op->o_bd->be_nsuffix[0], (struct berval *)&slap_ldapsync_cn_bv, op->o_tmpmemctx );
}
ctxcsn_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_dn.bv_val) build_new_dn( &new_dn, new_parent_dn, &op->oq_modrdn.rs_newrdn, NULL );
if (!new_ndn.bv_val) {
struct berval bv = {0, NULL};
}
/* 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 );
+ build_new_dn( &new_dn, new_parent_dn, &op->oq_modrdn.rs_newrdn, NULL );
dnNormalize( 0, NULL, NULL, &new_dn, &new_ndn, NULL );
#ifdef NEW_LOGGING
goto modrdn_return;
}
- build_new_dn( &new_dn, new_pdn, &op->oq_modrdn.rs_newrdn );
+ build_new_dn( &new_dn, new_pdn, &op->oq_modrdn.rs_newrdn, NULL );
rs->sr_err = dnNormalize( 0, NULL, NULL, &new_dn, &new_ndn,
op->o_tmpmemctx );
if ( rs->sr_err != LDAP_SUCCESS ) {
attr_merge_one( e, slap_schema.si_ad_structuralObjectClass, &ocbva[1], NULL );
- attr_merge_one( e, slap_schema.si_ad_cn, &slap_ldapsync_bv, NULL );
+ attr_merge_one( e, slap_schema.si_ad_cn, (struct berval *)&slap_ldapsync_bv, NULL );
if ( context_csn ) {
attr_merge_one( e, slap_schema.si_ad_contextCSN,
bv.bv_len = sizeof("{}")-1;
attr_merge_one( e, slap_schema.si_ad_subtreeSpecification, &bv, NULL );
- build_new_dn( &e->e_name, &be->be_nsuffix[0], &slap_ldapsync_cn_bv );
+ build_new_dn( &e->e_name, &be->be_nsuffix[0], (struct berval *)&slap_ldapsync_cn_bv, NULL );
ber_dupbv( &e->e_nname, &e->e_name );
return e;
void
build_new_dn( struct berval * new_dn,
struct berval * parent_dn,
- struct berval * newrdn )
+ struct berval * newrdn,
+ void *memctx )
{
char *ptr;
}
new_dn->bv_len = parent_dn->bv_len + newrdn->bv_len + 1;
- new_dn->bv_val = (char *) ch_malloc( new_dn->bv_len + 1 );
+ new_dn->bv_val = (char *) sl_malloc( new_dn->bv_len + 1, memctx );
ptr = lutil_strcopy( new_dn->bv_val, newrdn->bv_val );
*ptr++ = ',';
LDAP_SLAPD_F (void) build_new_dn LDAP_P((
struct berval * new_dn,
struct berval * parent_dn,
- struct berval * newrdn ));
+ struct berval * newrdn,
+ void *memctx ));
LDAP_SLAPD_F (void) dnParent LDAP_P(( struct berval *dn, struct berval *pdn ));
op.ors_tlimit = 0;
op.ors_attrsonly = 0;
op.ors_attrs = NULL;
- op.ors_filter = str2filter( def_filter_str = "(objectClass=*)" );
- ber_str2bv( def_filter_str, strlen( def_filter_str ), 1,
- &op.ors_filterstr );
+ op.ors_filter = str2filter_x( &op, def_filter_str = "(objectClass=*)" );
+ ber_str2bv( def_filter_str, 0, 0, &op.ors_filterstr );
si->conn = &conn;
conn.c_send_ldap_result = slap_send_ldap_result;
conn.c_send_search_reference = slap_send_search_reference;
/* get syncrepl cookie of shadow replica from subentry */
- ber_str2bv( si->base, strlen(si->base), 1, &base_bv );
+ ber_str2bv( si->base, 0, 0, &base_bv );
dnPrettyNormal( 0, &base_bv, &pbase, &nbase, op.o_tmpmemctx );
sprintf( substr, "cn=syncrepl%d", si->id );
- ber_str2bv( substr, strlen(substr), 1, &sub_bv );
+ ber_str2bv( substr, 0, 0, &sub_bv );
dnPrettyNormal( 0, &sub_bv, &psubrdn, &nsubrdn, op.o_tmpmemctx );
- build_new_dn( &op.o_req_dn, &pbase, &psubrdn );
- build_new_dn( &op.o_req_ndn, &nbase, &nsubrdn );
-
- ch_free( base_bv.bv_val );
- ch_free( pbase.bv_val );
- ch_free( nbase.bv_val );
- ch_free( sub_bv.bv_val );
- ch_free( psubrdn.bv_val );
- ch_free( nsubrdn.bv_val );
+ build_new_dn( &op.o_req_dn, &pbase, &psubrdn, op.o_tmpmemctx );
+ build_new_dn( &op.o_req_ndn, &nbase, &nsubrdn, op.o_tmpmemctx );
/* set callback function */
cb.sc_response = cookie_callback;
ber_dupbv( &syncCookie_req, si->syncCookie );
- ch_free( op.o_req_dn.bv_val );
- ch_free( op.o_req_ndn.bv_val );
- filter_free( op.ors_filter );
- ch_free( op.ors_filterstr.bv_val );
-
psub = be->be_nsuffix[0];
for ( n = 0; si->attrs[ n ] != NULL; n++ ) ;
e = ( Entry * ) ch_calloc( 1, sizeof( Entry ));
- build_new_dn( &sub_bv, pdn, &psubrdn );
+ build_new_dn( &sub_bv, pdn, &psubrdn, NULL );
dnPrettyNormal( NULL, &sub_bv, &e->e_name, &e->e_nname, NULL );
ch_free( sub_bv.bv_val );
ch_free( psubrdn.bv_val );
if ( SLAP_LASTMOD(be) && update_ctxcsn == SLAP_TOOL_CTXCSN_BATCH && csn.bv_len > 0 ) {
Entry *ctxcsn_e;
ID ctxcsn_id;
- struct berval ctxcsn_rdn = { 0, NULL };
struct berval ctxcsn_ndn = { 0, NULL };
int ret;
struct berval bvtext;
bvtext.bv_val = textbuf;
bvtext.bv_val[0] = '\0';
- ber_str2bv( "cn=ldapsync", strlen( "cn=ldapsync" ), 0, &ctxcsn_rdn );
- build_new_dn( &ctxcsn_ndn, &be->be_nsuffix[0], &ctxcsn_rdn );
+ build_new_dn( &ctxcsn_ndn, &be->be_nsuffix[0], (struct berval *)&slap_ldapsync_cn_bv, NULL );
ctxcsn_id = be->be_dn2id_get( be, &ctxcsn_ndn );
if ( ctxcsn_id == NOID ) {