Entry *ctxcsn_e;
int ctxcsn_added = 0;
+ LDAPControl **postread_ctrl = NULL;
LDAPControl *ctrls[SLAP_MAX_RESPONSE_CONTROLS];
int num_ctrls = 0;
op->oq_add.rs_e->e_name.bv_val, 0, 0);
#endif
+ ctrls[num_ctrls] = 0;
+
/* check entry's schema */
rs->sr_err = entry_schema_check( op->o_bd, op->oq_add.rs_e,
NULL, &rs->sr_text, textbuf, textlen );
/* post-read */
if( op->o_postread ) {
+ if( postread_ctrl == NULL ) {
+ postread_ctrl = &ctrls[num_ctrls++];
+ ctrls[num_ctrls] = NULL;
+ }
if ( slap_read_controls( op, rs, op->oq_add.rs_e,
- &slap_post_read_bv, &ctrls[num_ctrls] ) )
+ &slap_post_read_bv, postread_ctrl ) )
{
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, DETAIL1,
#endif
goto return_results;
}
- ctrls[++num_ctrls] = NULL;
- op->o_postread = 0; /* prevent redo on retry */
- /* FIXME: should read entry on the last retry */
}
if ( op->o_noop ) {
op->o_private = NULL;
}
+ if( postread_ctrl != NULL ) {
+ slap_sl_free( (*postread_ctrl)->ldctl_value.bv_val, &op->o_tmpmemctx );
+ slap_sl_free( *postread_ctrl, &op->o_tmpmemctx );
+ }
return rs->sr_err;
}
Entry *ctxcsn_e;
int ctxcsn_added = 0;
+ LDAPControl **preread_ctrl = NULL;
LDAPControl *ctrls[SLAP_MAX_RESPONSE_CONTROLS];
int num_ctrls = 0;
int parent_is_glue = 0;
int parent_is_leaf = 0;
+ ctrls[num_ctrls] = 0;
+
#ifdef NEW_LOGGING
- LDAP_LOG ( OPERATION, ARGS, "==> bdb_delete: %s\n", op->o_req_dn.bv_val, 0, 0 );
+ LDAP_LOG ( OPERATION, ARGS, "==> bdb_delete: %s\n",
+ op->o_req_dn.bv_val, 0, 0 );
#else
Debug( LDAP_DEBUG_ARGS, "==> bdb_delete: %s\n",
op->o_req_dn.bv_val, 0, 0 );
/* pre-read */
if( op->o_preread ) {
+ if( preread_ctrl == NULL ) {
+ preread_ctrl = &ctrls[num_ctrls++];
+ ctrls[num_ctrls] = NULL;
+ }
if( slap_read_controls( op, rs, e,
- &slap_pre_read_bv, &ctrls[num_ctrls] ) )
+ &slap_pre_read_bv, preread_ctrl ) )
{
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, DETAIL1,
#endif
goto return_results;
}
- ctrls[++num_ctrls] = NULL;
- op->o_preread = 0; /* prevent redo on retry */
- /* FIXME: should read entry on the last retry */
}
/* nested transaction */
op->o_private = NULL;
}
+ if( preread_ctrl != NULL ) {
+ slap_sl_free( (*preread_ctrl)->ldctl_value.bv_val, &op->o_tmpmemctx );
+ slap_sl_free( *preread_ctrl, &op->o_tmpmemctx );
+ }
return rs->sr_err;
}
int num_retries = 0;
+ LDAPControl **preread_ctrl = NULL;
+ LDAPControl **postread_ctrl = NULL;
LDAPControl *ctrls[SLAP_MAX_RESPONSE_CONTROLS];
int num_ctrls = 0;
int ctxcsn_added = 0;
#ifdef NEW_LOGGING
- LDAP_LOG ( OPERATION, ENTRY, "bdb_modify: %s\n", op->o_req_dn.bv_val, 0, 0 );
+ LDAP_LOG ( OPERATION, ENTRY, "bdb_modify: %s\n",
+ op->o_req_dn.bv_val, 0, 0 );
#else
- Debug( LDAP_DEBUG_ARGS, "bdb_modify: %s\n", op->o_req_dn.bv_val, 0, 0 );
+ Debug( LDAP_DEBUG_ARGS, "bdb_modify: %s\n",
+ op->o_req_dn.bv_val, 0, 0 );
#endif
+ ctrls[num_ctrls] = NULL;
+
if( 0 ) {
retry: /* transaction retry */
if( e != NULL ) {
e = ei->bei_e;
/* acquire and lock entry */
/* FIXME: dn2entry() should return non-glue entry */
- if (( rs->sr_err == DB_NOTFOUND ) || ( !manageDSAit && e && is_entry_glue( e ))) {
+ if (( rs->sr_err == DB_NOTFOUND ) ||
+ ( !manageDSAit && e && is_entry_glue( e )))
+ {
if ( e != NULL ) {
rs->sr_matched = ch_strdup( e->e_dn );
rs->sr_ref = is_entry_referral( e )
rs->sr_ref = get_entry_referrals( op, e );
#ifdef NEW_LOGGING
- LDAP_LOG ( OPERATION, DETAIL1, "bdb_modify: entry is referral\n", 0, 0, 0 );
+ LDAP_LOG ( OPERATION, DETAIL1,
+ "bdb_modify: entry is referral\n",
+ 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_modify: entry is referral\n",
}
if( op->o_preread ) {
+ if( preread_ctrl == NULL ) {
+ preread_ctrl = &ctrls[num_ctrls++];
+ ctrls[num_ctrls] = NULL;
+ }
if ( slap_read_controls( op, rs, e,
- &slap_pre_read_bv, &ctrls[num_ctrls] ) )
+ &slap_pre_read_bv, preread_ctrl ) )
{
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, DETAIL1,
#endif
goto return_results;
}
- ctrls[++num_ctrls] = NULL;
- op->o_preread = 0; /* prevent redo on retry */
- /* FIXME: should read entry on the last retry */
}
/* nested transaction */
if( rs->sr_err != 0 ) {
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ERR,
- "bdb_modify: txn_begin(2) failed: %s (%d)\n", db_strerror(rs->sr_err), rs->sr_err, 0 );
+ "bdb_modify: txn_begin(2) failed: %s (%d)\n",
+ db_strerror(rs->sr_err), rs->sr_err, 0 );
#else
Debug( LDAP_DEBUG_TRACE,
"bdb_modify: txn_begin(2) failed: %s (%d)\n",
}
if( op->o_postread ) {
+ if( postread_ctrl == NULL ) {
+ postread_ctrl = &ctrls[num_ctrls++];
+ ctrls[num_ctrls] = NULL;
+ }
if( slap_read_controls( op, rs, e,
- &slap_post_read_bv, &ctrls[num_ctrls] ) )
+ &slap_post_read_bv, postread_ctrl ) )
{
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, DETAIL1,
#endif
goto return_results;
}
- ctrls[++num_ctrls] = NULL;
- op->o_postread = 0; /* prevent redo on retry */
- /* FIXME: should read entry on the last retry */
}
if( op->o_noop ) {
if( e != NULL ) {
bdb_unlocked_cache_return_entry_w (&bdb->bi_cache, e);
}
+
+ if( preread_ctrl != NULL ) {
+ slap_sl_free( (*preread_ctrl)->ldctl_value.bv_val, &op->o_tmpmemctx );
+ slap_sl_free( *preread_ctrl, &op->o_tmpmemctx );
+ }
+ if( postread_ctrl != NULL ) {
+ slap_sl_free( (*postread_ctrl)->ldctl_value.bv_val, &op->o_tmpmemctx );
+ slap_sl_free( *postread_ctrl, &op->o_tmpmemctx );
+ }
return rs->sr_err;
}
int num_retries = 0;
+ LDAPControl **preread_ctrl = NULL;
+ LDAPControl **postread_ctrl = NULL;
LDAPControl *ctrls[SLAP_MAX_RESPONSE_CONTROLS];
int num_ctrls = 0;
int parent_is_glue = 0;
int parent_is_leaf = 0;
+ ctrls[num_ctrls] = NULL;
+
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ENTRY, "==>bdb_modrdn(%s,%s,%s)\n",
op->o_req_dn.bv_val,op->oq_modrdn.rs_newrdn.bv_val,
}
if( op->o_preread ) {
+ if( preread_ctrl == NULL ) {
+ preread_ctrl = &ctrls[num_ctrls++];
+ ctrls[num_ctrls] = NULL;
+ }
if( slap_read_controls( op, rs, e,
- &slap_pre_read_bv, &ctrls[num_ctrls] ) )
+ &slap_pre_read_bv, preread_ctrl ) )
{
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, DETAIL1,
#endif
goto return_results;
}
- ctrls[++num_ctrls] = NULL;
- op->o_preread = 0; /* prevent redo on retry */
- /* FIXME: should read entry on the last retry */
}
/* nested transaction */
}
if( op->o_postread ) {
+ if( postread_ctrl == NULL ) {
+ postread_ctrl = &ctrls[num_ctrls++];
+ ctrls[num_ctrls] = NULL;
+ }
if( slap_read_controls( op, rs, e,
- &slap_post_read_bv, &ctrls[num_ctrls] ) )
+ &slap_post_read_bv, postread_ctrl ) )
{
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, DETAIL1,
#endif
goto return_results;
}
- ctrls[++num_ctrls] = NULL;
- op->o_postread = 0; /* prevent redo on retry */
- /* FIXME: should read entry on the last retry */
}
if( op->o_noop ) {
op->o_private = NULL;
}
+ if( preread_ctrl != NULL ) {
+ slap_sl_free( (*preread_ctrl)->ldctl_value.bv_val, &op->o_tmpmemctx );
+ slap_sl_free( *preread_ctrl, &op->o_tmpmemctx );
+ }
+ if( postread_ctrl != NULL ) {
+ slap_sl_free( (*postread_ctrl)->ldctl_value.bv_val, &op->o_tmpmemctx );
+ slap_sl_free( *postread_ctrl, &op->o_tmpmemctx );
+ }
return rs->sr_err;
}
c.ldctl_oid = oid->bv_val;
c.ldctl_iscritical = 0;
- *ctrl = slap_sl_calloc( 1, sizeof(LDAPControl), NULL );
+ if ( ctrl == NULL ) {
+ /* first try */
+ *ctrl = (LDAPControl *) slap_sl_calloc( 1, sizeof(LDAPControl), NULL );
+ } else {
+ /* retry: free previous try */
+ slap_sl_free( (*ctrl)->ldctl_value.bv_val, &op->o_tmpmemctx );
+ }
+
**ctrl = c;
return LDAP_SUCCESS;
}