mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
Fix op->o_abandon handling. Use fake connection to add results to the cache (ITS#5187)
This commit is contained in:
parent
6078879299
commit
488af9daa2
@ -1901,14 +1901,19 @@ cache_entries(
|
|||||||
Entry *e;
|
Entry *e;
|
||||||
struct berval crp_uuid;
|
struct berval crp_uuid;
|
||||||
char uuidbuf[ LDAP_LUTIL_UUIDSTR_BUFSIZE ];
|
char uuidbuf[ LDAP_LUTIL_UUIDSTR_BUFSIZE ];
|
||||||
Operation op_tmp = *op;
|
Operation *op_tmp;
|
||||||
|
Connection conn = {0};
|
||||||
|
OperationBuffer opbuf;
|
||||||
|
void *thrctx = ldap_pvt_thread_pool_context();
|
||||||
|
|
||||||
query_uuid->bv_len = lutil_uuidstr(uuidbuf, sizeof(uuidbuf));
|
query_uuid->bv_len = lutil_uuidstr(uuidbuf, sizeof(uuidbuf));
|
||||||
ber_str2bv(uuidbuf, query_uuid->bv_len, 1, query_uuid);
|
ber_str2bv(uuidbuf, query_uuid->bv_len, 1, query_uuid);
|
||||||
|
|
||||||
op_tmp.o_bd = &cm->db;
|
connection_fake_init2( &conn, &opbuf, thrctx, 0 );
|
||||||
op_tmp.o_dn = cm->db.be_rootdn;
|
op_tmp = &opbuf.ob_op;
|
||||||
op_tmp.o_ndn = cm->db.be_rootndn;
|
op_tmp->o_bd = &cm->db;
|
||||||
|
op_tmp->o_dn = cm->db.be_rootdn;
|
||||||
|
op_tmp->o_ndn = cm->db.be_rootndn;
|
||||||
|
|
||||||
Debug( pcache_debug, "UUID for query being added = %s\n",
|
Debug( pcache_debug, "UUID for query being added = %s\n",
|
||||||
uuidbuf, 0, 0 );
|
uuidbuf, 0, 0 );
|
||||||
@ -1918,10 +1923,10 @@ cache_entries(
|
|||||||
e->e_private = NULL;
|
e->e_private = NULL;
|
||||||
while ( cm->cur_entries > (cm->max_entries) ) {
|
while ( cm->cur_entries > (cm->max_entries) ) {
|
||||||
BER_BVZERO( &crp_uuid );
|
BER_BVZERO( &crp_uuid );
|
||||||
remove_query_and_data( &op_tmp, rs, cm, &crp_uuid );
|
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, query_uuid);
|
||||||
ldap_pvt_thread_mutex_lock(&cm->cache_mutex);
|
ldap_pvt_thread_mutex_lock(&cm->cache_mutex);
|
||||||
cm->cur_entries += return_val;
|
cm->cur_entries += return_val;
|
||||||
Debug( pcache_debug,
|
Debug( pcache_debug,
|
||||||
@ -1983,7 +1988,8 @@ pcache_op_cleanup( Operation *op, SlapReply *rs ) {
|
|||||||
rs->sr_attrs = si->save_attrs;
|
rs->sr_attrs = si->save_attrs;
|
||||||
op->ors_attrs = si->save_attrs;
|
op->ors_attrs = si->save_attrs;
|
||||||
}
|
}
|
||||||
if ( op->o_abandon || rs->sr_err == SLAPD_ABANDON ) {
|
if ( (op->o_abandon || rs->sr_err == SLAPD_ABANDON) &&
|
||||||
|
si->caching_reason == PC_IGNORE ) {
|
||||||
filter_free( si->query.filter );
|
filter_free( si->query.filter );
|
||||||
if ( si->count ) {
|
if ( si->count ) {
|
||||||
/* duplicate query, free it */
|
/* duplicate query, free it */
|
||||||
|
Loading…
Reference in New Issue
Block a user