*ret = NULL;
- attrs = ch_malloc(( set->count+1 )*sizeof(AttributeName));
+ attrs = ch_calloc( set->count + 1, sizeof(AttributeName) );
for ( i=0; i < set->count; i++ )
attrs[i] = set->attrs[i];
attr_cnt = i;
}
query.scope = lud->lud_scope;
query.filter = str2filter( lud->lud_filter );
+ if ( query.filter == NULL ) {
+ rc = -1;
+ goto error;
+ }
tempstr.bv_val = ch_malloc( strlen( lud->lud_filter ) + 1 );
tempstr.bv_len = 0;
merge_entry(
Operation *op,
Entry *e,
+ int dup,
struct berval* query_uuid )
{
int rc;
slap_callback cb = { NULL, slap_null_cb, NULL, NULL };
+ if ( dup )
+ e = entry_dup( e );
attr = e->e_attrs;
e->e_attrs = NULL;
modlist->sml_op = LDAP_MOD_ADD;
op->o_tag = LDAP_REQ_MODIFY;
op->orm_modlist = modlist;
+ op->o_managedsait = SLAP_CONTROL_CRITICAL;
op->o_bd->be_modify( op, &sreply );
slap_mods_free( modlist, 1 );
} else if ( rc == LDAP_REFERRAL ||
}
} else {
if ( op->ora_e == e )
- be_entry_release_w( op, e );
+ entry_free( e );
rc = 1;
}
remove_query_and_data( op_tmp, rs, cm, &crp_uuid );
}
- return_val = merge_entry(op_tmp, e, query_uuid);
+ return_val = merge_entry(op_tmp, e, 0, query_uuid);
ldap_pvt_thread_mutex_lock(&cm->cache_mutex);
cm->cur_entries += return_val;
Debug( pcache_debug,
} else if ( rs->sr_err == LDAP_SIZELIMIT_EXCEEDED
&& si->qtemp->limitttl )
{
+ Entry *e;
+
si->caching_reason = PC_SIZELIMIT;
+ for (;si->head; si->head=e) {
+ e = si->head->e_private;
+ si->head->e_private = NULL;
+ entry_free(si->head);
+ }
}
} else if ( si->qtemp->negttl && !si->count && !si->over &&
}
*p2 = '\0';
op->o_tmpfree( vals, op->o_tmpmemctx );
- return str2filter_x( op, fbv->bv_val );
+
+ /* FIXME: are we sure str2filter_x can't fail?
+ * caller needs to check */
+ {
+ Filter *f = str2filter_x( op, fbv->bv_val );
+ assert( f != NULL );
+ return f;
+ }
}
/* Check if the requested entry is from the cache and has a valid
/* No local entry, just add it. FIXME: we are not checking
* the cache entry limit here
*/
- merge_entry( op, rs->sr_entry, &ri->ri_q->q_uuid );
+ merge_entry( op, rs->sr_entry, 1, &ri->ri_q->q_uuid );
} else {
/* Entry exists, update it */
Entry ne;
temp->attr_set_index,
temp->bindttr,
ldap_pvt_scope2str( temp->bindscope ));
- bv.bv_len += temp->bindbase.bv_len + temp->bindftemp.bv_len + 3;
- bv.bv_val = ch_malloc( bv.bv_len+1 );
+ bv.bv_len += temp->bindbase.bv_len + temp->bindftemp.bv_len + 4;
+ bv.bv_val = ch_malloc( bv.bv_len + 1 );
ptr = bv.bv_val;
*ptr++ = '"';
ptr = lutil_strcopy( ptr, temp->bindftemp.bv_val );
cm->check_cacheability = 0;
cm->response_cb = PCACHE_RESPONSE_CB_TAIL;
cm->defer_db_open = 1;
+ cm->cache_binds = 0;
cm->cc_period = 1000;
cm->cc_paused = 0;
cm->cc_arg = NULL;
+#ifdef PCACHE_MONITOR
+ cm->monitor_cb = NULL;
+#endif /* PCACHE_MONITOR */
qm->attr_sets = NULL;
qm->templates = NULL;
AttributeAssertion ava = ATTRIBUTEASSERTION_INIT;
AttributeName attrs[ 2 ] = {{{ 0 }}};
- connection_fake_init( &conn, &opbuf, thrctx );
+ connection_fake_init2( &conn, &opbuf, thrctx, 0 );
op = &opbuf.ob_op;
op->o_bd = &cm->db;
thrctx = ldap_pvt_thread_pool_context();
- connection_fake_init( &conn, &opbuf, thrctx );
+ connection_fake_init2( &conn, &opbuf, thrctx, 0 );
op = &opbuf.ob_op;
if ( qm->templates != NULL ) {